diff --git a/drupal-cms/flake.lock b/drupal-cms/flake.lock index e94c767..8b20fa7 100644 --- a/drupal-cms/flake.lock +++ b/drupal-cms/flake.lock @@ -1,24 +1,106 @@ { "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1759362264, + "narHash": "sha256-wfG0S7pltlYyZTM+qqlhJ7GMw2fTF4mLKCIVhLii/4M=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "758cf7296bee11f1706a574c77d072b8a7baa881", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1758198701, - "narHash": "sha256-7To75JlpekfUmdkUZewnT6MoBANS0XVypW6kjUOXQwc=", + "lastModified": 1759632233, + "narHash": "sha256-krgZxGAIIIKFJS+UB0l8do3sYUDWJc75M72tepmVMzE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "0147c2f1d54b30b5dd6d4a8c8542e8d7edf93b5d", + "rev": "d7f52a7a640bc54c7bb414cca603835bf8dd4b10", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-unstable", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1754788789, + "narHash": "sha256-x2rJ+Ovzq0sCMpgfgGaaqgBSwY+LST+WbZ6TytnT9Rk=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "a73b9c743612e4244d865a2fdee11865283c04e6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "process-compose": { + "locked": { + "lastModified": 1758658658, + "narHash": "sha256-y5GSCqlGe/uZzlocCPZcjc7Gj+mTq7m0P6xPGx88+No=", + "owner": "Platonic-Systems", + "repo": "process-compose-flake", + "rev": "e968a94633788f5d9595d727f41c2baf0714be7b", + "type": "github" + }, + "original": { + "owner": "Platonic-Systems", + "repo": "process-compose-flake", + "type": "github" + } + }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "process-compose": "process-compose", + "services": "services", + "systems": "systems" + } + }, + "services": { + "locked": { + "lastModified": 1759624902, + "narHash": "sha256-WLbsTVyf7o2hwvSPo6S4pIE+t8BM0trYl9RogukveWc=", + "owner": "juspay", + "repo": "services-flake", + "rev": "e234166b0bfe94f8d7be7ce94a763aa0b736ae1f", + "type": "github" + }, + "original": { + "owner": "juspay", + "repo": "services-flake", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" } } }, diff --git a/drupal-cms/flake.nix b/drupal-cms/flake.nix index a336345..93a16ee 100644 --- a/drupal-cms/flake.nix +++ b/drupal-cms/flake.nix @@ -1,26 +1,79 @@ { inputs = { - nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + process-compose.url = "github:Platonic-Systems/process-compose-flake"; + services.url = "github:juspay/services-flake"; + systems.url = "github:nix-systems/default"; }; outputs = inputs: - let - system = "x86_64-linux"; - pkgs = import inputs.nixpkgs { inherit system; }; - in - { - devShells.${system}.default = pkgs.mkShell { - packages = with pkgs; [ - (php.buildEnv { - extraConfig = '' - memory_limit = 512M - ''; - }) - phpPackages.composer + inputs.flake-parts.lib.mkFlake { inherit inputs; } { + systems = import inputs.systems; - sqlite - ]; - }; + imports = [ + inputs.process-compose.flakeModule + ]; + + perSystem = + { + config, + lib, + pkgs, + ... + }: + + let + php = pkgs.php; + phpPackages = pkgs.phpPackages; + + databasePort = 3306; + webPort = 8000; + in + with lib; + { + + process-compose."default" = { + imports = [ + inputs.services.processComposeModules.default + ]; + + services = { + mysql."mysql1" = { + enable = true; + + initialDatabases = [ + { name = "drupal_cms"; } + ]; + + settings.mysqld.port = toString databasePort; + }; + }; + + settings.processes = { + php = { + command = pkgs.writeShellApplication { + name = "php-local-server"; + + text = "${getExe php} -S 127.0.0.1:${toString webPort} -t web"; + }; + + depends_on."mysql1".condition = "process_healthy"; + }; + }; + }; + + devShells.default = pkgs.mkShell { + inputsFrom = [ + config.process-compose."default".services.outputs.devShell + ]; + + nativeBuildInputs = [ + php + phpPackages.composer + ]; + }; + }; }; } diff --git a/drupal-nix-flake/flake.nix b/drupal-nix-flake/flake.nix index 448b047..b1b4efe 100644 --- a/drupal-nix-flake/flake.nix +++ b/drupal-nix-flake/flake.nix @@ -74,8 +74,6 @@ phpPackages.composer ]; }; - - formatter = pkgs.nixfmt-rfc-style; }; }; } diff --git a/symfony/flake.lock b/symfony/flake.lock index 7dac337..b8a8226 100644 --- a/symfony/flake.lock +++ b/symfony/flake.lock @@ -1,6 +1,73 @@ { "nodes": { + "devshell": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1741473158, + "narHash": "sha256-kWNaq6wQUbUMlPgw8Y+9/9wP0F8SHkjy24/mN3UAppg=", + "owner": "numtide", + "repo": "devshell", + "rev": "7c9e793ebe66bcba8292989a68c0419b737a22a0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1759362264, + "narHash": "sha256-wfG0S7pltlYyZTM+qqlhJ7GMw2fTF4mLKCIVhLii/4M=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "758cf7296bee11f1706a574c77d072b8a7baa881", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "nixpkgs": { + "locked": { + "lastModified": 1722073938, + "narHash": "sha256-OpX0StkL8vpXyWOGUD6G+MA26wAXK6SpT94kLJXo6B4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e36e9f57337d0ff0cf77aceb58af4c805472bfae", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1754788789, + "narHash": "sha256-x2rJ+Ovzq0sCMpgfgGaaqgBSwY+LST+WbZ6TytnT9Rk=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "a73b9c743612e4244d865a2fdee11865283c04e6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1759733170, "narHash": "sha256-TXnlsVb5Z8HXZ6mZoeOAIwxmvGHp1g4Dw89eLvIwKVI=", @@ -18,7 +85,9 @@ }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "devshell": "devshell", + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs_2" } } }, diff --git a/symfony/flake.nix b/symfony/flake.nix index 83289ab..e04973d 100644 --- a/symfony/flake.nix +++ b/symfony/flake.nix @@ -1,20 +1,27 @@ { - inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + inputs = { + devshell.url = "github:numtide/devshell"; + flake-parts.url = "github:hercules-ci/flake-parts"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + }; - outputs = inputs: - let - system = "x86_64-linux"; - pkgs = import inputs.nixpkgs { inherit system; }; - in - { - devShells.${system}.default = - with pkgs; - mkShell { - buildInputs = [ - php - phpPackages.composer - symfony-cli - ]; + outputs = + inputs: + inputs.flake-parts.lib.mkFlake { inherit inputs; } { + imports = [ inputs.devshell.flakeModule ]; + + systems = [ "x86_64-linux" ]; + + perSystem = + { pkgs, ... }: + { + devshells.default = { + packages = with pkgs; [ + php + phpPackages.composer + symfony-cli + ]; + }; }; }; }