nix: patch nix directly for experimental features

The bash wrapper was causing issues with deploy-rs and the
experimental-features option in the config was causing hercules-ci to
spit out a bunch of junk in the logs. Patching nix with the default
values required for flakes fixes both of these issues.
This commit is contained in:
Timothy DeHerrera 2021-02-17 12:54:41 -07:00
parent b41c738f39
commit 4f44e0dd13
No known key found for this signature in database
GPG key ID: 8985725DB5B0C122
5 changed files with 48 additions and 11 deletions

8
overlays/nixFlakes.nix Normal file
View file

@ -0,0 +1,8 @@
final: prev: {
nixFlakes = prev.nixFlakes.overrideAttrs
(self: {
patches = [
../pkgs/tools/package-management/nix/0001-nix-command-and-flakes-by-default.patch
];
});
}

View file

@ -0,0 +1,28 @@
From a47bbae869ff35095eb2fe4d4d5145054ea81049 Mon Sep 17 00:00:00 2001
From: Timothy DeHerrera <tim.deh@pm.me>
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<Strings> experimentalFeatures{this, {}, "experimental-features",
+ Setting<Strings> experimentalFeatures{
+ this,
+ {"nix-command", "flakes", "ca-references"},
+ "experimental-features",
"Experimental Nix features to enable."};
bool isExperimentalFeatureEnabled(const std::string & name);
--
2.28.0

View file

@ -138,10 +138,10 @@ in
trustedUsers = [ "root" "@wheel" ];
extraOptions = ''
experimental-features = nix-command flakes ca-references
min-free = 536870912
keep-outputs = true
keep-derivations = true
fallback = true
'';
};

View file

@ -22,7 +22,7 @@ pkgs.devshell.mkShell
nixos-install
nixos-generate-config
nixos-enter
] ++ lib.optional (system == "x86_64-linux") pkgs.deploy-rs;
];
git.hooks = {
pre-commit.text = lib.fileContents ./pre-commit.sh;
@ -32,13 +32,11 @@ pkgs.devshell.mkShell
{
package = flk;
}
{
name = "nix";
help = nixFlakes.meta.description;
command = ''
${nixFlakes}/bin/nix --option experimental-features \
"nix-command flakes ca-references" "$@"
'';
}
] ++ lib.optional (system != "i686-linux") { package = cachix; };
]
++ lib.optional (system != "i686-linux") { package = cachix; }
++ lib.optional (system == "x86_64-linux") {
name = "deploy";
package = deploy-rs;
help = "A simple multi-profile Nix-flake deploy tool.";
};
}

View file

@ -25,5 +25,8 @@ category = "documentation"
package = "mdbook"
category = "documentation"
[[commands]]
package = "nixFlakes"
[git.hooks]
enable = true