Merge pull request #68 from nix-community/ci

only target single nix version in repo
This commit is contained in:
adisbladis 2022-05-09 14:34:02 +07:00 committed by GitHub
commit 8a7c154a70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 37 deletions

1
.nix-version Normal file
View file

@ -0,0 +1 @@
unstable

View file

@ -4,32 +4,27 @@
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;
in drvArgs = {
rec { srcDir = self;
packages.nix-eval-jobs = pkgs.callPackage ./default.nix drvArgs; nix = if nixVersion == "unstable" then pkgs.nixUnstable else pkgs.nixVersions."nix_${nixVersion}";
};
checks =
let
mkVariant = nix: (packages.nix-eval-jobs.override {
inherit nix;
}).overrideAttrs (_: {
name = "nix-eval-jobs-${nix.version}";
inherit (nix) version;
});
in in
{ {
packages.nix-eval-jobs = pkgs.callPackage ./default.nix drvArgs;
treefmt = checks.treefmt = stdenv.mkDerivation {
let
devShell = devShells.default;
in
stdenv.mkDerivation {
name = "treefmt-check"; name = "treefmt-check";
src = self; src = self;
nativeBuildInputs = devShell.nativeBuildInputs; nativeBuildInputs = devShell.nativeBuildInputs;
@ -44,13 +39,8 @@
installPhase = "touch $out"; 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;
} }
); );
} }

View file

@ -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;