From 1d636fd90adc2c228b9ed9ee7673e0aa1560b3b0 Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Fri, 3 May 2024 17:13:57 -0700 Subject: [PATCH] Fix NixOS system building and add a flake check that it works Problem caused by: https://gerrit.lix.systems/c/lix/+/993 But this is actually nixpkgs doing extremely silly feature detection of Nix based on version which it should /absolutely not be doing/. --- flake.lock | 14 +++++++------- flake.nix | 7 +++++++ overlay.nix | 10 +++++----- test-nixos.nix | 17 +++++++++++++++++ 4 files changed, 36 insertions(+), 12 deletions(-) create mode 100644 test-nixos.nix diff --git a/flake.lock b/flake.lock index 6c991e3..852d326 100644 --- a/flake.lock +++ b/flake.lock @@ -36,11 +36,11 @@ "lix": { "flake": false, "locked": { - "lastModified": 1714353561, - "narHash": "sha256-1OKjSB5kPw0Tnm/h4j1IZe6TfdX04QNbm1kn0q58Rls=", + "lastModified": 1714774053, + "narHash": "sha256-RaiwQCGFhC1WtieS2N3FotIlKSowq+R6ETyY6nZnPh8=", "ref": "refs/heads/main", - "rev": "c0733f3cec9e5edd7fa3a4bf156b6ee065762fea", - "revCount": 15448, + "rev": "549d609a7bce2b4ac28808a76a72d7f3743b9c76", + "revCount": 15471, "type": "git", "url": "ssh://git@git.lix.systems/lix-project/lix.git" }, @@ -51,11 +51,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1714253743, - "narHash": "sha256-mdTQw2XlariysyScCv2tTE45QSU9v/ezLcHJ22f0Nxc=", + "lastModified": 1714635257, + "narHash": "sha256-4cPymbty65RvF1DWQfc+Bc8B233A1BWxJnNULJKQ1EY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "58a1abdbae3217ca6b702f03d3b35125d88a2994", + "rev": "63c3a29ca82437c87573e4c6919b09a24ea61b0f", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index c0769d9..a11df86 100644 --- a/flake.nix +++ b/flake.nix @@ -28,5 +28,12 @@ }; packages.system-profile = import ./system-profile.nix { inherit pkgs flakey-profile; }; + + nixosTests = pkgs.recurseIntoAttrs (pkgs.callPackage ./test-nixos.nix { lix-module = self.nixosModules.default; }); + + checks = { + inherit (self.nixosTests.${system}) it-builds; + inherit (self.packages.${system}) default nix-eval-jobs; + }; }); } diff --git a/overlay.nix b/overlay.nix index 930ad10..d1a3e40 100644 --- a/overlay.nix +++ b/overlay.nix @@ -15,15 +15,15 @@ let }) ); + # This is kind of scary to not override the nix version to pretend to be + # 2.18 since nixpkgs can introduce new breakage in its Nix unstable CLI + # usage. + # https://github.com/nixos/nixpkgs/blob/6afb255d976f85f3359e4929abd6f5149c323a02/nixos/modules/config/nix.nix#L121 lixPkg = (final.callPackage (lix + "/package.nix") { build-release-notes = false; versionSuffix = "-lix${versionSuffix}"; boehmgc-nix = boehmgc-patched; - }).overrideAttrs { - # Note: load-bearing version override. Nixpkgs does version detection to determine - # what commands and whatnot we support, so tell Nixpkgs that we're 2.18 (ish). - version = "2.18.3-lix${versionSuffix}"; - }; + }); inherit (prev) lib; in diff --git a/test-nixos.nix b/test-nixos.nix new file mode 100644 index 0000000..ae9f8c9 --- /dev/null +++ b/test-nixos.nix @@ -0,0 +1,17 @@ +{ nixos, lix-module }: +let + configs = { + it-builds = nixos ({ ... }: { + documentation.enable = false; + fileSystems."/".device = "ignore-root-device"; + boot.loader.grub.enable = false; + system.stateVersion = "24.05"; + }); + + }; +in +{ + inherit configs; + + it-builds = configs.it-builds.config.system.build.toplevel; +}