mirror of
https://github.com/nix-community/home-manager.git
synced 2026-01-12 01:59:37 +08:00
home-manager: Feature test for flake support (#6825)
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:
committed by
GitHub
parent
b4e98224ad
commit
c61bfe3ae6
@@ -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
|
||||
}
|
||||
|
||||
# Attempts to set the HOME_MANAGER_CONFIG global variable.
|
||||
|
||||
Reference in New Issue
Block a user