nixos/nh: change FLAKE variable to NH_FLAKE; improve option documentation

This commit is contained in:
NotAShelf
2025-04-24 01:33:48 +03:00
parent 71ae33edd3
commit a4df39f2b2

View File

@@ -8,7 +8,10 @@ let
cfg = config.programs.nh;
in
{
meta.maintainers = [ lib.maintainers.viperML ];
meta.maintainers = with lib.maintainers; [
NotAShelf
viperML
];
options.programs.nh = {
enable = lib.mkEnableOption "nh, yet another Nix CLI helper";
@@ -19,9 +22,18 @@ in
type = lib.types.nullOr lib.types.path;
default = null;
description = ''
The path that will be used for the `FLAKE` environment variable.
The path that will be used for the `NH_FLAKE` environment variable.
`FLAKE` is used by nh as the default flake for performing actions, like `nh os switch`.
`NH_FLAKE` is used by nh as the default flake for performing actions, such as
`nh os switch`. This behaviour can be overriden per-command with environment
variables that will take priority.
- `NH_OS_FLAKE`: will take priority for `nh os` commands.
- `NH_HOME_FLAKE`: will take priority for `nh home` commands.
- `NH_DARWIN_FLAKE`: will take priority for `nh darwin` commands.
The formerly valid `FLAKE` is now deprecated by nh, and will cause hard errors
in future releases if `NH_FLAKE` is not set.
'';
};
@@ -77,7 +89,7 @@ in
environment = lib.mkIf cfg.enable {
systemPackages = [ cfg.package ];
variables = lib.mkIf (cfg.flake != null) {
FLAKE = cfg.flake;
NH_FLAKE = cfg.flake;
};
};