From 985096e89d146e3814f5ead9e448a3a9fcfc6b1e Mon Sep 17 00:00:00 2001 From: adisbladis Date: Sat, 8 Jan 2022 08:41:07 +1300 Subject: [PATCH 1/4] Bump flake inputs --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 6063da8..3f2e2f5 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "flake-utils": { "locked": { - "lastModified": 1637014545, - "narHash": "sha256-26IZAc5yzlD9FlDT54io1oqG/bBoyka+FJk5guaX4x4=", + "lastModified": 1638122382, + "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", "owner": "numtide", "repo": "flake-utils", - "rev": "bba5dcc8e0b20ab664967ad83d24d64cb64ec4f4", + "rev": "74f7e4319258e287b0f9cb95426c9853b282730b", "type": "github" }, "original": { @@ -17,11 +17,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1639573498, - "narHash": "sha256-YAoywqjyjOJYuEZpA8sln84jk99GG9hYbPEYXwGEGGM=", + "lastModified": 1641577433, + "narHash": "sha256-T7lS8vpbC3dgtrkb2ueC9HWaX4RYUwdP7IEttnvKQ8Y=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "aef12c8678fd5e927edba764bd04f3ba2930ae15", + "rev": "568e0bc498ee51fdd88e1e94089de05f2fdbd18b", "type": "github" }, "original": { From 44655761c5e524814be760e19b6f024d379445b9 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Sat, 8 Jan 2022 08:53:26 +1300 Subject: [PATCH 2/4] Use locked nixpkgs version for nix-shell --- shell.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/shell.nix b/shell.nix index 7b97e75..1def6db 100644 --- a/shell.nix +++ b/shell.nix @@ -1,4 +1,15 @@ -{ pkgs ? import { } +{ pkgs ? ( + let + inherit (builtins) fromJSON readFile; + flakeLock = fromJSON (readFile ./flake.lock); + locked = flakeLock.nodes.nixpkgs.locked; + nixpkgs = assert locked.type == "github"; builtins.fetchTarball { + url = "https://github.com/${locked.owner}/${locked.repo}/archive/${locked.rev}.tar.gz"; + sha256 = locked.narHash; + }; + in + import nixpkgs { } + ) , srcDir ? null }: From a0bd67f9cbdd1ad0c3938b0c626bcf2994731e3a Mon Sep 17 00:00:00 2001 From: adisbladis Date: Sat, 8 Jan 2022 08:53:59 +1300 Subject: [PATCH 3/4] Use `nix` as the argument name for `nix` in default.nix And pass in `nix = nixUnstable` from the development shell. --- default.nix | 4 ++-- shell.nix | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/default.nix b/default.nix index b052317..1178d04 100644 --- a/default.nix +++ b/default.nix @@ -1,6 +1,6 @@ { stdenv , lib -, nixUnstable +, nix , meson , cmake , ninja @@ -21,7 +21,7 @@ stdenv.mkDerivation rec { src = if srcDir == null then filterMesonBuild ./. else srcDir; buildInputs = [ nlohmann_json - nixUnstable + nix boost ]; nativeBuildInputs = [ diff --git a/shell.nix b/shell.nix index 1def6db..70b4e37 100644 --- a/shell.nix +++ b/shell.nix @@ -13,7 +13,10 @@ , srcDir ? null }: -(pkgs.callPackage ./default.nix { inherit srcDir; }).overrideAttrs (old: { +(pkgs.callPackage ./default.nix { + inherit srcDir; + nix = pkgs.nixUnstable; +}).overrideAttrs (old: { nativeBuildInputs = old.nativeBuildInputs ++ [ From 9bcb1bb3fc95de1f29cba9999c284db6285f300a Mon Sep 17 00:00:00 2001 From: adisbladis Date: Sat, 8 Jan 2022 09:06:12 +1300 Subject: [PATCH 4/4] Run build against both stable nix and nixUnstable in CI --- flake.nix | 51 +++++++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/flake.nix b/flake.nix index 6e4dd50..963055a 100644 --- a/flake.nix +++ b/flake.nix @@ -13,31 +13,38 @@ rec { packages.nix-eval-jobs = pkgs.callPackage ./default.nix drvArgs; - checks = { + checks = + let + mkVariant = nix: packages.nix-eval-jobs.overrideAttrs (_: { + name = "nix-eval-jobs-${nix.version}"; + inherit (nix) version; + }); + in + { - editorconfig = pkgs.runCommand "editorconfig-check" - { - nativeBuildInputs = [ - pkgs.editorconfig-checker - ]; - } '' - editorconfig-checker ${self} - touch $out - ''; + editorconfig = pkgs.runCommand "editorconfig-check" + { + nativeBuildInputs = [ + pkgs.editorconfig-checker + ]; + } '' + editorconfig-checker ${self} + touch $out + ''; - nixpkgs-fmt = pkgs.runCommand "fmt-check" - { - nativeBuildInputs = [ - pkgs.nixpkgs-fmt - ]; - } '' - nixpkgs-fmt --check . - touch $out - ''; + nixpkgs-fmt = pkgs.runCommand "fmt-check" + { + nativeBuildInputs = [ + pkgs.nixpkgs-fmt + ]; + } '' + nixpkgs-fmt --check . + touch $out + ''; - build = packages.nix-eval-jobs; - - }; + build = mkVariant pkgs.nix; + build-unstable = mkVariant pkgs.nixUnstable; + }; defaultPackage = self.packages.${system}.nix-eval-jobs; devShell = pkgs.callPackage ./shell.nix drvArgs;