only target single nix version in repo
This commit is contained in:
parent
c58f394e4a
commit
5088049295
1
.nix-version
Normal file
1
.nix-version
Normal file
|
@ -0,0 +1 @@
|
|||
unstable
|
40
flake.nix
40
flake.nix
|
@ -4,32 +4,27 @@
|
|||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
outputs =
|
||||
{ self
|
||||
, nixpkgs
|
||||
, flake-utils
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
nixVersion = nixpkgs.lib.fileContents ./.nix-version;
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
inherit (pkgs) stdenv;
|
||||
drvArgs = { srcDir = self; };
|
||||
in
|
||||
rec {
|
||||
packages.nix-eval-jobs = pkgs.callPackage ./default.nix drvArgs;
|
||||
|
||||
checks =
|
||||
let
|
||||
mkVariant = nix: (packages.nix-eval-jobs.override {
|
||||
inherit nix;
|
||||
}).overrideAttrs (_: {
|
||||
name = "nix-eval-jobs-${nix.version}";
|
||||
inherit (nix) version;
|
||||
});
|
||||
devShell = self.devShells.${system}.default;
|
||||
drvArgs = {
|
||||
srcDir = self;
|
||||
nix = if nixVersion == "unstable" then pkgs.nixUnstable else pkgs.nixVersions."nix_${nixVersion}";
|
||||
};
|
||||
in
|
||||
{
|
||||
packages.nix-eval-jobs = pkgs.callPackage ./default.nix drvArgs;
|
||||
|
||||
treefmt =
|
||||
let
|
||||
devShell = devShells.default;
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
checks.treefmt = stdenv.mkDerivation {
|
||||
name = "treefmt-check";
|
||||
src = self;
|
||||
nativeBuildInputs = devShell.nativeBuildInputs;
|
||||
|
@ -44,13 +39,8 @@
|
|||
installPhase = "touch $out";
|
||||
};
|
||||
|
||||
build = mkVariant pkgs.nix;
|
||||
build-unstable = mkVariant pkgs.nixUnstable;
|
||||
};
|
||||
|
||||
packages.default = self.packages.${system}.nix-eval-jobs;
|
||||
devShells.default = pkgs.callPackage ./shell.nix drvArgs;
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue