diff --git a/extern/default.nix b/extern/default.nix index ecfffcd6..8a4e36f8 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 9605a99f..f36841e1 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": { @@ -152,47 +152,28 @@ "type": "github" } }, - "nix": { - "inputs": { - "nixpkgs": [ - "nixos" - ] - }, - "locked": { - "lastModified": 1615476733, - "narHash": "sha256-iae4JMAl2KAaPhUGLMf4/DEejWjs5fWfEU1ccVF8s6Q=", - "owner": "NixOS", - "repo": "nix", - "rev": "8127094f767b6caae145bc395a504ca62f30af3e", - "type": "github" - }, - "original": { - "id": "nix", - "type": "indirect" - } - }, "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 +184,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 +198,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 +217,7 @@ ] }, "locked": { - "narHash": "sha256-sBVaeGxxs7sk7PodW1mqJbF0CqUqUar0GUdd+OPnZ8o=", + "narHash": "sha256-XG4TOZObj2Wd8KiqnHgtlWjjMbJOIJB7+DxUFzMCXw8=", "path": "./pkgs", "type": "path" }, @@ -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 130c2b13..aa89c77b 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"; @@ -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; diff --git a/hosts/default.nix b/hosts/default.nix index a4bf3f30..ba6ad91c 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 1ff88677..00000000 --- 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/flake.lock b/pkgs/flake.lock index 15754953..ef3f5a9a 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/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 e22793ac..00000000 --- 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 0d1da514..72ac09e4 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; } diff --git a/shell/flk.sh b/shell/flk.sh index 875e7559..d22b327c 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" \ diff --git a/tests/default.nix b/tests/default.nix index d1ecddd3..5764ae15 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;