switch to flake-parts from flake-utils

This commit is contained in:
Jörg Thalheim 2023-01-02 11:19:32 +01:00
parent 53c5b9bb33
commit 9d1abc0bc8
2 changed files with 49 additions and 43 deletions

View file

@ -1,17 +1,22 @@
{ {
"nodes": { "nodes": {
"flake-utils": { "flake-parts": {
"inputs": {
"nixpkgs-lib": [
"nixpkgs"
]
},
"locked": { "locked": {
"lastModified": 1667395993, "lastModified": 1672616755,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "narHash": "sha256-dvwU2ORLpiP6ZMXL3CJ/qrqmtLBLF6VAc+Fois7Qfew=",
"owner": "numtide", "owner": "hercules-ci",
"repo": "flake-utils", "repo": "flake-parts",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "rev": "87673d7c13a799d95ce25ff5dc7b9e15f01af2ea",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "numtide", "owner": "hercules-ci",
"repo": "flake-utils", "repo": "flake-parts",
"type": "github" "type": "github"
} }
}, },
@ -33,7 +38,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-parts": "flake-parts",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
} }

View file

@ -2,20 +2,21 @@
description = "Hydra's builtin hydra-eval-jobs as a standalone"; description = "Hydra's builtin hydra-eval-jobs as a standalone";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils"; inputs.flake-parts.url = "github:hercules-ci/flake-parts";
inputs.flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
outputs = outputs = inputs @ { flake-parts, ... }:
{ self
, nixpkgs
, flake-utils
}:
flake-utils.lib.eachDefaultSystem (
system:
let let
nixVersion = nixpkgs.lib.fileContents ./.nix-version; inherit (inputs.nixpkgs) lib;
pkgs = nixpkgs.legacyPackages.${system}; inherit (inputs) self;
inherit (pkgs) stdenv; nixVersion = lib.fileContents ./.nix-version;
devShell = self.devShells.${system}.default; in
flake-parts.lib.mkFlake { inherit inputs; }
{
systems = inputs.nixpkgs.lib.systems.flakeExposed;
perSystem = { pkgs, self', ... }:
let
devShell = self'.devShells.default;
drvArgs = { drvArgs = {
srcDir = self; srcDir = self;
nix = if nixVersion == "unstable" then pkgs.nixUnstable else pkgs.nixVersions."nix_${nixVersion}"; nix = if nixVersion == "unstable" then pkgs.nixUnstable else pkgs.nixVersions."nix_${nixVersion}";
@ -24,7 +25,7 @@
{ {
packages.nix-eval-jobs = pkgs.callPackage ./default.nix drvArgs; packages.nix-eval-jobs = pkgs.callPackage ./default.nix drvArgs;
checks.treefmt = stdenv.mkDerivation { checks.treefmt = pkgs.stdenv.mkDerivation {
name = "treefmt-check"; name = "treefmt-check";
src = self; src = self;
nativeBuildInputs = devShell.nativeBuildInputs; nativeBuildInputs = devShell.nativeBuildInputs;
@ -39,8 +40,8 @@
installPhase = "touch $out"; installPhase = "touch $out";
}; };
packages.default = self.packages.${system}.nix-eval-jobs; packages.default = self'.packages.nix-eval-jobs;
devShells.default = pkgs.callPackage ./shell.nix drvArgs; devShells.default = pkgs.callPackage ./shell.nix drvArgs;
} };
); };
} }