home-manager: Feature test for flake support (#6824)
Feature testing flakes / nix-command is more robust over configuration sniffing. Ultimately, the deciding factor should be if flakes work -- not if the config looks like they will / won't work. This alternative test both asserts that the `nix` command is enabled, and that flakes are enabled, without depending on whether or not flakes are emitted as an experimental feature. This is both repairing support for Determinate Nix 3, and prepares for a potential future where Nix itself considers Flakes stable. Closes #6702
This commit is contained in:
parent
d5cdf55bd9
commit
85c513aa86
1 changed files with 2 additions and 6 deletions
|
|
@ -43,13 +43,9 @@ function setWorkDir() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Checks whether the 'flakes' and 'nix-command' Nix options are enabled.
|
||||
# Check to see if flakes are functionally available.
|
||||
function hasFlakeSupport() {
|
||||
type -p nix > /dev/null \
|
||||
&& nix show-config 2> /dev/null \
|
||||
| grep experimental-features \
|
||||
| grep flakes \
|
||||
| grep -q nix-command
|
||||
nix eval --expr 'builtins.getFlake' > /dev/null 2>&1
|
||||
}
|
||||
|
||||
# Escape string for use in Nix files.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue