nixos/nh: change FLAKE variable to NH_FLAKE; improve option docs (#401255)

This commit is contained in:
Niklas Korz 2025-04-24 23:45:44 +02:00 committed by GitHub
commit f0f33d852d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,7 +8,10 @@ let
cfg = config.programs.nh; cfg = config.programs.nh;
in in
{ {
meta.maintainers = [ lib.maintainers.viperML ]; meta.maintainers = with lib.maintainers; [
NotAShelf
viperML
];
options.programs.nh = { options.programs.nh = {
enable = lib.mkEnableOption "nh, yet another Nix CLI helper"; enable = lib.mkEnableOption "nh, yet another Nix CLI helper";
@ -19,9 +22,18 @@ in
type = lib.types.nullOr lib.types.path; type = lib.types.nullOr lib.types.path;
default = null; default = null;
description = '' 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 { environment = lib.mkIf cfg.enable {
systemPackages = [ cfg.package ]; systemPackages = [ cfg.package ];
variables = lib.mkIf (cfg.flake != null) { variables = lib.mkIf (cfg.flake != null) {
FLAKE = cfg.flake; NH_FLAKE = cfg.flake;
}; };
}; };