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
|
60
flake.nix
60
flake.nix
|
@ -4,53 +4,43 @@
|
||||||
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-utils.url = "github:numtide/flake-utils";
|
||||||
|
|
||||||
outputs = { self, nixpkgs, flake-utils }:
|
outputs =
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
{ self
|
||||||
|
, nixpkgs
|
||||||
|
, flake-utils
|
||||||
|
}:
|
||||||
|
flake-utils.lib.eachDefaultSystem (
|
||||||
|
system:
|
||||||
let
|
let
|
||||||
|
nixVersion = nixpkgs.lib.fileContents ./.nix-version;
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
inherit (pkgs) stdenv;
|
inherit (pkgs) stdenv;
|
||||||
drvArgs = { srcDir = self; };
|
devShell = self.devShells.${system}.default;
|
||||||
|
drvArgs = {
|
||||||
|
srcDir = self;
|
||||||
|
nix = if nixVersion == "unstable" then pkgs.nixUnstable else pkgs.nixVersions."nix_${nixVersion}";
|
||||||
|
};
|
||||||
in
|
in
|
||||||
rec {
|
{
|
||||||
packages.nix-eval-jobs = pkgs.callPackage ./default.nix drvArgs;
|
packages.nix-eval-jobs = pkgs.callPackage ./default.nix drvArgs;
|
||||||
|
|
||||||
checks =
|
checks.treefmt = stdenv.mkDerivation {
|
||||||
let
|
name = "treefmt-check";
|
||||||
mkVariant = nix: (packages.nix-eval-jobs.override {
|
src = self;
|
||||||
inherit nix;
|
nativeBuildInputs = devShell.nativeBuildInputs;
|
||||||
}).overrideAttrs (_: {
|
dontConfigure = true;
|
||||||
name = "nix-eval-jobs-${nix.version}";
|
|
||||||
inherit (nix) version;
|
|
||||||
});
|
|
||||||
in
|
|
||||||
{
|
|
||||||
|
|
||||||
treefmt =
|
inherit (devShell) NODE_PATH;
|
||||||
let
|
|
||||||
devShell = devShells.default;
|
|
||||||
in
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
name = "treefmt-check";
|
|
||||||
src = self;
|
|
||||||
nativeBuildInputs = devShell.nativeBuildInputs;
|
|
||||||
dontConfigure = true;
|
|
||||||
|
|
||||||
inherit (devShell) NODE_PATH;
|
buildPhase = ''
|
||||||
|
env HOME=$(mktemp -d) treefmt --fail-on-change
|
||||||
|
'';
|
||||||
|
|
||||||
buildPhase = ''
|
installPhase = "touch $out";
|
||||||
env HOME=$(mktemp -d) treefmt --fail-on-change
|
};
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = "touch $out";
|
|
||||||
};
|
|
||||||
|
|
||||||
build = mkVariant pkgs.nix;
|
|
||||||
build-unstable = mkVariant pkgs.nixUnstable;
|
|
||||||
};
|
|
||||||
|
|
||||||
packages.default = self.packages.${system}.nix-eval-jobs;
|
packages.default = self.packages.${system}.nix-eval-jobs;
|
||||||
devShells.default = pkgs.callPackage ./shell.nix drvArgs;
|
devShells.default = pkgs.callPackage ./shell.nix drvArgs;
|
||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,15 +11,15 @@
|
||||||
import nixpkgs { }
|
import nixpkgs { }
|
||||||
)
|
)
|
||||||
, srcDir ? null
|
, srcDir ? null
|
||||||
|
, nix
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (pkgs) lib stdenv;
|
inherit (pkgs) lib stdenv;
|
||||||
nix = pkgs.nixUnstable;
|
|
||||||
|
|
||||||
in
|
in
|
||||||
(pkgs.callPackage ./default.nix {
|
(pkgs.callPackage ./default.nix {
|
||||||
inherit nix srcDir;
|
inherit srcDir nix;
|
||||||
}).overrideAttrs (old: {
|
}).overrideAttrs (old: {
|
||||||
|
|
||||||
src = null;
|
src = null;
|
||||||
|
|
Loading…
Reference in a new issue