From 9537daee32e33a0ad133206a23e91ed7cf746acb Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Tue, 16 Mar 2021 15:43:55 -0600 Subject: [PATCH 1/4] flake: nixos -> nixos-unstable 20.09 is getting stale as we move toward a new release so track unstable for now. --- flake.lock | 46 +++++++++++++++++++++++----------------------- flake.nix | 2 +- pkgs/flake.lock | 6 +++--- shell/flk.sh | 2 +- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/flake.lock b/flake.lock index 9605a99..2d3c131 100644 --- a/flake.lock +++ b/flake.lock @@ -17,11 +17,11 @@ "pre-commit-hooks-nix": "pre-commit-hooks-nix" }, "locked": { - "lastModified": 1614270488, - "narHash": "sha256-WC7qF0BYB7RdfnEPk9du029bkxhbNTw4MAOpYDm1KNI=", + "lastModified": 1615131736, + "narHash": "sha256-z4Er9Cj3WpBDO/saLxqb7IypEvVP0/1AnO6rY5NB03Y=", "owner": "hercules-ci", "repo": "hercules-ci-agent", - "rev": "6adf883b66f9dcfe8b9a44e689b1ac7819077bde", + "rev": "a1513a51e8efb96e990a562e6e724e17f2789978", "type": "github" }, "original": { @@ -139,11 +139,11 @@ ] }, "locked": { - "lastModified": 1614333665, - "narHash": "sha256-6y22hmT4iWY1v5uggGhrH22QDZxBnsfO5+83s9mb1Js=", + "lastModified": 1614785451, + "narHash": "sha256-TPw8kQvr2UNCuvndtY+EjyXp6Q5GEW2l9UafXXh1XmI=", "owner": "nmattia", "repo": "naersk", - "rev": "a2a4b60a9ed541794906977be771b9cfe325d57a", + "rev": "e0fe990b478a66178a58c69cf53daec0478ca6f9", "type": "github" }, "original": { @@ -159,11 +159,11 @@ ] }, "locked": { - "lastModified": 1615476733, - "narHash": "sha256-iae4JMAl2KAaPhUGLMf4/DEejWjs5fWfEU1ccVF8s6Q=", + "lastModified": 1615911544, + "narHash": "sha256-2V0qJ9EaPjOetEzEx0vxP+dxKOX8ZXJi7PIlLjkxymA=", "owner": "NixOS", "repo": "nix", - "rev": "8127094f767b6caae145bc395a504ca62f30af3e", + "rev": "66fa1c7375e4b3073a16df4678cf1d37446ed20b", "type": "github" }, "original": { @@ -173,26 +173,26 @@ }, "nixos": { "locked": { - "lastModified": 1614531331, - "narHash": "sha256-/69RG5ZI84MMN+ZD99A+MtPzyNDtwfcEFIUsuijwQPw=", + "lastModified": 1615797423, + "narHash": "sha256-5NGDZXPQzuoxf/42NiyC9YwwhwzfMfIRrz3aT0XHzSc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "df8e3bd110921621d175fad88c9e67909b7cb3d3", + "rev": "266dc8c3d052f549826ba246d06787a219533b8f", "type": "github" }, "original": { "id": "nixpkgs", - "ref": "release-20.09", + "ref": "nixos-unstable", "type": "indirect" } }, "nixos-hardware": { "locked": { - "lastModified": 1614460257, - "narHash": "sha256-hFR865O5gIuFNiwFyx/K2g8AeLvGy/f3/SHalF85zuM=", + "lastModified": 1615652054, + "narHash": "sha256-jqXKU8Ovpi7MmPRqGf2FB3QOPcZtGwO2MFc0AYiOPjg=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "c9b965a43e582765f797f8b75d50cb2874b30f30", + "rev": "31f61b90ddb9257b94888ee17ccf96236e180c76", "type": "github" }, "original": { @@ -203,11 +203,11 @@ }, "nur": { "locked": { - "lastModified": 1614639970, - "narHash": "sha256-RM2s9f7UPCzTHm1J5q1iI1RGytw5CwLOj4cnEGwYWos=", + "lastModified": 1615921934, + "narHash": "sha256-nURGM869KKA1+c1SHHsXKYcPXhHIuxWBjNXjJ90OzRQ=", "owner": "nix-community", "repo": "NUR", - "rev": "f5f8df943c5e9cb722fc56ea79f1c688de7d26bd", + "rev": "faf862e8cf009edfa38ecc61188f7a6ace293552", "type": "github" }, "original": { @@ -217,11 +217,11 @@ }, "override": { "locked": { - "lastModified": 1614652644, - "narHash": "sha256-/XTMCbKcbTHf96KL+eAal6FrnLAtUAuJPPrDU9Ze9J0=", + "lastModified": 1615926763, + "narHash": "sha256-yeq8A3EPNuQVlsxlEQrIRsklfJwJK0Us6jtcG/u8wNs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "66d7cb4fa8b583f120e25bc86a2f5f2345f3b976", + "rev": "b702a56d417647de4090ac56c0f18bdc7e646610", "type": "github" }, "original": { @@ -236,7 +236,7 @@ ] }, "locked": { - "narHash": "sha256-sBVaeGxxs7sk7PodW1mqJbF0CqUqUar0GUdd+OPnZ8o=", + "narHash": "sha256-XG4TOZObj2Wd8KiqnHgtlWjjMbJOIJB7+DxUFzMCXw8=", "path": "./pkgs", "type": "path" }, diff --git a/flake.nix b/flake.nix index 130c2b1..9bb833d 100644 --- a/flake.nix +++ b/flake.nix @@ -3,7 +3,7 @@ inputs = { - nixos.url = "nixpkgs/release-20.09"; + nixos.url = "nixpkgs/nixos-unstable"; override.url = "nixpkgs"; ci-agent = { url = "github:hercules-ci/hercules-ci-agent"; diff --git a/pkgs/flake.lock b/pkgs/flake.lock index 1575495..ef3f5a9 100644 --- a/pkgs/flake.lock +++ b/pkgs/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1615769536, - "narHash": "sha256-oah5pb8kXyFa6ZcccvfREuY9VXHkUTNaoClXW7H1XUw=", + "lastModified": 1615926763, + "narHash": "sha256-yeq8A3EPNuQVlsxlEQrIRsklfJwJK0Us6jtcG/u8wNs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "63a9f162355ec84c423690869a97848d73409fb8", + "rev": "b702a56d417647de4090ac56c0f18bdc7e646610", "type": "github" }, "original": { diff --git a/shell/flk.sh b/shell/flk.sh index 875e755..d22b327 100755 --- a/shell/flk.sh +++ b/shell/flk.sh @@ -17,7 +17,7 @@ usage () { printf " %-30s %s\n\n" \ "up" "Generate $DEVSHELL_ROOT/hosts/up-$HOSTNAME.nix" \ - "update [INPUT]" "Update and commit the lock file" \ + "update [INPUT]" "Update and commit the lock file, or specific input" \ "get (core|community) [DEST]" "Copy the desired template to DEST" \ "iso HOST" "Generate an ISO image of HOST" \ "install HOST [ARGS]" "Shortcut for nixos-install" \ From 436fbb08e8c70dec921953ba15c340680a314a62 Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Tue, 16 Mar 2021 15:49:33 -0600 Subject: [PATCH 2/4] tests: patched nixpkgs no longer needed --- tests/default.nix | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/tests/default.nix b/tests/default.nix index d1ecddd..5764ae1 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -3,40 +3,10 @@ let inherit (self.inputs) nixos; inherit (self.nixosConfigurations.NixOS.config.lib) testModule specialArgs; - # current release 20.09 does not support the specialArgs required for us - # to use tests as we would normally use hosts. Using the "testing-python.nix" - # from the override flake would build the test-vm from an unstable os - # different than the one our systems are running. Instead simply patch nixpkgs - # to include the updated version. This can be removed in the next release - patchedNixpkgs = - pkgs.stdenv.mkDerivation { - name = "nixpkgs-patched"; - - src = nixos; - patches = [ ./0004-nixos-testing-Add-support-for-specialArgs.patch ]; - - dontBuild = true; - dontFixup = true; - - versionSuffix = "pre${ - if nixos ? lastModified - then builtins.substring 0 8 (nixos.lastModifiedDate or nixos.lastModified) - else toString nixos.revCount}.${nixos.shortRev or "dirty"}"; - - configurePhase = '' - echo -n $VERSION_SUFFIX > .version-suffix - echo -n ${nixos.rev or nixos.shortRev or "dirty"} > .git-revision - ''; - - installPhase = '' - cp -r $PWD $out - ''; - }; - mkTest = let nixosTesting = - (import "${patchedNixpkgs}/nixos/lib/testing-python.nix" { + (import "${nixos}/nixos/lib/testing-python.nix" { inherit (pkgs.stdenv.hostPlatform) system; inherit specialArgs; inherit pkgs; From 9ba1e7f9bc321f0aa009186cc21c2aee9e77dacf Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Tue, 16 Mar 2021 22:11:56 -0600 Subject: [PATCH 3/4] nix: remove patch for default unstable features --- hosts/default.nix | 13 +++++++++ overlays/nixFlakes.nix | 12 -------- ...01-nix-command-and-flakes-by-default.patch | 28 ------------------- shell/default.nix | 8 ++++-- 4 files changed, 19 insertions(+), 42 deletions(-) delete mode 100644 overlays/nixFlakes.nix delete mode 100644 pkgs/tools/package-management/nix/0001-nix-command-and-flakes-by-default.patch diff --git a/hosts/default.nix b/hosts/default.nix index a4bf3f3..ba6ad91 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -13,6 +13,13 @@ let suites = import ../suites { inherit lib; }; + experimentalFeatures = [ + "flakes" + "nix-command" + "ca-references" + "ca-derivations" + ]; + modules = { core = ../profiles/core; modOverrides = { config, overrideModulesPath, ... }: @@ -47,6 +54,12 @@ let override.flake = override; }; + nix.extraOptions = '' + experimental-features = ${lib.concatStringsSep " " + experimentalFeatures + } + ''; + system.configurationRevision = lib.mkIf (self ? rev) self.rev; }; diff --git a/overlays/nixFlakes.nix b/overlays/nixFlakes.nix deleted file mode 100644 index 1ff8867..0000000 --- a/overlays/nixFlakes.nix +++ /dev/null @@ -1,12 +0,0 @@ -final: prev: { - nixFlakes = final.nix.overrideAttrs - (self: - let - oldPatches = self.patches or [ ]; - in - { - patches = oldPatches ++ [ - ../pkgs/tools/package-management/nix/0001-nix-command-and-flakes-by-default.patch - ]; - }); -} diff --git a/pkgs/tools/package-management/nix/0001-nix-command-and-flakes-by-default.patch b/pkgs/tools/package-management/nix/0001-nix-command-and-flakes-by-default.patch deleted file mode 100644 index e22793a..0000000 --- a/pkgs/tools/package-management/nix/0001-nix-command-and-flakes-by-default.patch +++ /dev/null @@ -1,28 +0,0 @@ -From a47bbae869ff35095eb2fe4d4d5145054ea81049 Mon Sep 17 00:00:00 2001 -From: Timothy DeHerrera -Date: Wed, 17 Feb 2021 12:26:48 -0700 -Subject: [PATCH] nix-command and flakes by default - ---- - src/libstore/globals.hh | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh -index eabd83e3f..e851e2a79 100644 ---- a/src/libstore/globals.hh -+++ b/src/libstore/globals.hh -@@ -889,7 +889,10 @@ public: - value. - )"}; - -- Setting experimentalFeatures{this, {}, "experimental-features", -+ Setting experimentalFeatures{ -+ this, -+ {"nix-command", "flakes", "ca-references"}, -+ "experimental-features", - "Experimental Nix features to enable."}; - - bool isExperimentalFeatureEnabled(const std::string & name); --- -2.28.0 - diff --git a/shell/default.nix b/shell/default.nix index 0d1da51..72ac09e 100644 --- a/shell/default.nix +++ b/shell/default.nix @@ -22,7 +22,6 @@ pkgs.devshell.mkShell nixos-install nixos-generate-config nixos-enter - pkgs.nixFlakes ]; git.hooks = { @@ -30,8 +29,13 @@ pkgs.devshell.mkShell }; commands = with pkgs; [ + { package = flk; } { - package = flk; + name = "nix"; + help = pkgs.nixFlakes.meta.description; + command = '' + ${pkgs.nixFlakes}/bin/nix --experimental-features "nix-command flakes ca-references" "${"\${@}"}" + ''; } ] ++ lib.optional (system != "i686-linux") { package = cachix; } From 44623b5979f375dc565134a0f7b2a47440517b13 Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Tue, 16 Mar 2021 22:52:28 -0600 Subject: [PATCH 4/4] nix: don't use nix flake I originally wanted to use the nix flake to allow users to take advantage of the latest changes. Just so happened that nixpkgs was recently updated with a new version around the same time, and this just adds complexity for no real gain. --- extern/default.nix | 1 - flake.lock | 20 -------------------- flake.nix | 3 +-- 3 files changed, 1 insertion(+), 23 deletions(-) diff --git a/extern/default.nix b/extern/default.nix index ecfffcd..8a4e36f 100644 --- a/extern/default.nix +++ b/extern/default.nix @@ -9,7 +9,6 @@ in ]; overlays = [ - nix.overlay nur.overlay devshell.overlay (final: prev: { diff --git a/flake.lock b/flake.lock index 2d3c131..f36841e 100644 --- a/flake.lock +++ b/flake.lock @@ -152,25 +152,6 @@ "type": "github" } }, - "nix": { - "inputs": { - "nixpkgs": [ - "nixos" - ] - }, - "locked": { - "lastModified": 1615911544, - "narHash": "sha256-2V0qJ9EaPjOetEzEx0vxP+dxKOX8ZXJi7PIlLjkxymA=", - "owner": "NixOS", - "repo": "nix", - "rev": "66fa1c7375e4b3073a16df4678cf1d37446ed20b", - "type": "github" - }, - "original": { - "id": "nix", - "type": "indirect" - } - }, "nixos": { "locked": { "lastModified": 1615797423, @@ -270,7 +251,6 @@ "flake-compat": "flake-compat", "home": "home", "naersk": "naersk", - "nix": "nix", "nixos": "nixos", "nixos-hardware": "nixos-hardware", "nur": "nur", diff --git a/flake.nix b/flake.nix index 9bb833d..aa89c77 100644 --- a/flake.nix +++ b/flake.nix @@ -22,14 +22,13 @@ home.inputs.nixpkgs.follows = "nixos"; naersk.url = "github:nmattia/naersk"; naersk.inputs.nixpkgs.follows = "override"; - nix.inputs.nixpkgs.follows = "nixos"; nixos-hardware.url = "github:nixos/nixos-hardware"; utils.url = "github:numtide/flake-utils/flatten-tree-system"; pkgs.url = "path:./pkgs"; pkgs.inputs.nixpkgs.follows = "nixos"; }; - outputs = inputs@{ deploy, nixos, nur, nix, self, utils, ... }: + outputs = inputs@{ deploy, nixos, nur, self, utils, ... }: let inherit (self) lib; inherit (lib) os;