Rewrite to flake-utils

This commit is contained in:
Andreas Zweili 2024-04-04 00:22:21 +02:00
parent 5b094459a1
commit 9c45c7f21a
2 changed files with 89 additions and 59 deletions

View File

@ -215,6 +215,24 @@
"inputs": { "inputs": {
"systems": "systems_4" "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": { "locked": {
"lastModified": 1705309234, "lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
@ -508,12 +526,12 @@
}, },
"poetry2nix_2": { "poetry2nix_2": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_4", "flake-utils": "flake-utils_5",
"nix-github-actions": "nix-github-actions_2", "nix-github-actions": "nix-github-actions_2",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"systems": "systems_5", "systems": "systems_6",
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
@ -587,6 +605,7 @@
"root": { "root": {
"inputs": { "inputs": {
"devenv": "devenv", "devenv": "devenv",
"flake-utils": "flake-utils_4",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_3",
"poetry2nix": "poetry2nix_2" "poetry2nix": "poetry2nix_2"
} }
@ -652,6 +671,21 @@
} }
}, },
"systems_5": { "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": { "locked": {
"lastModified": 1681028828, "lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",

View File

@ -6,6 +6,7 @@
url = "github:nix-community/poetry2nix"; url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = outputs =
@ -13,31 +14,26 @@
self, self,
nixpkgs, nixpkgs,
devenv, devenv,
flake-utils,
poetry2nix, poetry2nix,
}@inputs: }@inputs:
let flake-utils.lib.eachDefaultSystem (
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: system:
let let
pkgs = nixpkgs.legacyPackages.${system}; 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; config = self.devShells.${system}.default.config;
env = mkPoetryEnv { env = poetry2nix.mkPoetryEnv {
projectDir = ./.; projectDir = ./.;
python = pkgs.python312; python = pkgs.python312;
}; };
inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryEnv;
tests = pkgs.writeShellScriptBin "python-test" '' tests = pkgs.writeShellScriptBin "python-test" ''
trap "process-compose down &> /dev/null" EXIT trap "process-compose down &> /dev/null" EXIT
process-compose up --tui=false & process-compose up --tui=false &
@ -71,7 +67,7 @@
} }
]; ];
}; };
};
} }
); );
};
} }