From 85c513aa862228d5b51295b20ccbdcc5fdf086bc Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Tue, 15 Apr 2025 12:48:20 -0400 Subject: [PATCH] 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 --- home-manager/home-manager | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/home-manager/home-manager b/home-manager/home-manager index ddd9879b..8f675c66 100644 --- a/home-manager/home-manager +++ b/home-manager/home-manager @@ -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.