diff --git a/flake.lock b/flake.lock index 896b17c..cec34eb 100644 --- a/flake.lock +++ b/flake.lock @@ -215,6 +215,24 @@ "inputs": { "systems": "systems_4" }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_5": { + "inputs": { + "systems": "systems_5" + }, "locked": { "lastModified": 1705309234, "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", @@ -508,12 +526,12 @@ }, "poetry2nix_2": { "inputs": { - "flake-utils": "flake-utils_4", + "flake-utils": "flake-utils_5", "nix-github-actions": "nix-github-actions_2", "nixpkgs": [ "nixpkgs" ], - "systems": "systems_5", + "systems": "systems_6", "treefmt-nix": "treefmt-nix" }, "locked": { @@ -587,6 +605,7 @@ "root": { "inputs": { "devenv": "devenv", + "flake-utils": "flake-utils_4", "nixpkgs": "nixpkgs_3", "poetry2nix": "poetry2nix_2" } @@ -652,6 +671,21 @@ } }, "systems_5": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_6": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", diff --git a/flake.nix b/flake.nix index 403134b..7fc98b5 100644 --- a/flake.nix +++ b/flake.nix @@ -6,6 +6,7 @@ url = "github:nix-community/poetry2nix"; inputs.nixpkgs.follows = "nixpkgs"; }; + flake-utils.url = "github:numtide/flake-utils"; }; outputs = @@ -13,65 +14,60 @@ self, nixpkgs, devenv, + flake-utils, poetry2nix, }@inputs: - let - systems = [ - "aarch64-darwin" - "aarch64-linux" - "x86_64-darwin" - "x86_64-linux" - ]; - forEachSystem = nixpkgs.lib.genAttrs systems; - in - { - packages = forEachSystem (system: { - devenv-up = self.devShells.${system}.default.config.procfileScript; - }); - devShells = forEachSystem ( - system: - let - pkgs = nixpkgs.legacyPackages.${system}; - config = self.devShells.${system}.default.config; - env = mkPoetryEnv { - projectDir = ./.; - python = pkgs.python312; - }; - inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryEnv; - tests = pkgs.writeShellScriptBin "python-test" '' - trap "process-compose down &> /dev/null" EXIT - process-compose up --tui=false & - pytest --cov=src tests.py - ''; - in - { - default = devenv.lib.mkShell { - inherit inputs pkgs; - modules = [ - { - env = { - NO_SSL = "True"; - PC_PORT_NUM = "9999"; - }; - enterShell = '' - ln -sf ${config.process-managers.process-compose.configFile} ${config.env.DEVENV_ROOT}/process-compose.yml - ''; - packages = [ - env - tests - ]; - process-managers.process-compose.enable = true; - processes = { - webserver = { - process-compose.depends_on.redis.condition = "process_started"; - exec = "gunicorn src.main:app"; + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + poetry2nix = inputs.poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }; + in + { + packages = { + devenv-up = self.devShells.${system}.default.config.procfileScript; + }; + devShells = + let + config = self.devShells.${system}.default.config; + env = poetry2nix.mkPoetryEnv { + projectDir = ./.; + python = pkgs.python312; + }; + tests = pkgs.writeShellScriptBin "python-test" '' + trap "process-compose down &> /dev/null" EXIT + process-compose up --tui=false & + pytest --cov=src tests.py + ''; + in + { + default = devenv.lib.mkShell { + inherit inputs pkgs; + modules = [ + { + env = { + NO_SSL = "True"; + PC_PORT_NUM = "9999"; }; - }; - services.redis.enable = true; - } - ]; + enterShell = '' + ln -sf ${config.process-managers.process-compose.configFile} ${config.env.DEVENV_ROOT}/process-compose.yml + ''; + packages = [ + env + tests + ]; + process-managers.process-compose.enable = true; + processes = { + webserver = { + process-compose.depends_on.redis.condition = "process_started"; + exec = "gunicorn src.main:app"; + }; + }; + services.redis.enable = true; + } + ]; + }; }; - } - ); - }; + } + ); }