1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-06 09:01:04 +01:00

nh: support 4.0 for flake option (#6818)

Recently switched from FLAKE to NH_FLAKE in 4.0
This commit is contained in:
Austin Horstman 2025-04-13 20:22:31 -07:00 committed by GitHub
parent ac3c1f4fa4
commit e980d0e0e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -69,7 +69,13 @@ in
home = lib.mkIf cfg.enable {
packages = [ cfg.package ];
sessionVariables = lib.mkIf (cfg.flake != null) { FLAKE = cfg.flake; };
sessionVariables = lib.mkIf (cfg.flake != null) (
let
packageVersion = lib.getVersion cfg.package;
isVersion4OrHigher = lib.versionAtLeast packageVersion "4.0.0";
in
if isVersion4OrHigher then { NH_FLAKE = cfg.flake; } else { FLAKE = cfg.flake; }
);
};
systemd.user = lib.mkIf cfg.clean.enable {