Skip to content

Commit

Permalink
restore old var for compat with 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ToyVo committed Dec 19, 2024
1 parent efd625b commit 5549630
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion darwin-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ in
default = self.packages.${pkgs.stdenv.hostPlatform.system}.default;
};

flake = lib.mkOption {
type = lib.types.nullOr lib.types.path;
default = null;
description = ''
The path that will be used for the `NH_FLAKE` environment variable.
`NH_FLAKE` is used by nh as the default flake for performing actions on NixOS/nix-darwin, like `nh os switch`.
'';
};
os.flake = lib.mkOption {
type = lib.types.nullOr lib.types.path;
default = null;
Expand Down Expand Up @@ -88,7 +97,10 @@ in
assertion = cfg.clean.enable -> cfg.enable;
message = "programs.nh.clean.enable requires programs.nh.enable";
}

{
assertion = (cfg.flake != null) -> !(lib.hasSuffix ".nix" cfg.flake);
message = "nh.flake must be a directory, not a nix file";
}
{
assertion = (cfg.os.flake != null) -> !(lib.hasSuffix ".nix" cfg.os.flake);
message = "nh.os.flake must be a directory, not a nix file";
Expand All @@ -104,6 +116,7 @@ in
environment = lib.mkIf cfg.enable {
systemPackages = [ cfg.package ];
variables = lib.mkMerge [
(lib.mkIf (cfg.flake != null) { NH_FLAKE = cfg.flake; })
(lib.mkIf (cfg.os.flake != null) { NH_OS_FLAKE = cfg.os.flake; })
(lib.mkIf (cfg.home.flake != null) { NH_HOME_FLAKE = cfg.home.flake; })
];
Expand Down

0 comments on commit 5549630

Please sign in to comment.