Skip to content

Commit 3f555f9

Browse files
authored
nix: allow unfree and insecure in cache upload (#2078)
Add the `NIXPKGS_ALLOW_UNFREE` and `NIXPKGS_ALLOW_INSECURE` environment variables to `nix copy` commands so that those packages can be uploaded by default. This also requires the `--impure` flag so that Nix respects the environment variables.
1 parent 893e550 commit 3f555f9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

internal/nix/cache.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ func CopyInstallableToCache(
2121
cmd := commandContext(
2222
ctx,
2323
"copy", "--to", to,
24+
// --impure makes NIXPKGS_ALLOW_* environment variables work.
25+
"--impure",
2426
// --refresh checks the cache to ensure it is up to date. Otherwise if
2527
// anything has was copied previously from this machine and then purged
2628
// it may not be copied again. It's fairly fast, but not instant.
@@ -31,7 +33,7 @@ func CopyInstallableToCache(
3133
cmd.Stdin = os.Stdin
3234
cmd.Stdout = out
3335
cmd.Stderr = out
34-
cmd.Env = append(os.Environ(), env...)
36+
cmd.Env = append(allowUnfreeEnv(allowInsecureEnv(os.Environ())), env...)
3537

3638
return cmd.Run()
3739
}

0 commit comments

Comments
 (0)