nixos/nix-serve: add package option

This commit is contained in:
alyaeanyx 2022-09-25 10:51:24 +02:00
parent d917c76850
commit 850053ebe7

View file

@ -26,6 +26,15 @@ in
''; '';
}; };
package = mkOption {
type = types.package;
default = pkgs.nix-serve;
defaultText = literalExpression "pkgs.nix-serve";
description = lib.mdDoc ''
nix-serve package to use.
'';
};
openFirewall = mkOption { openFirewall = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
@ -70,7 +79,7 @@ in
${lib.optionalString (cfg.secretKeyFile != null) '' ${lib.optionalString (cfg.secretKeyFile != null) ''
export NIX_SECRET_KEY_FILE="$CREDENTIALS_DIRECTORY/NIX_SECRET_KEY_FILE" export NIX_SECRET_KEY_FILE="$CREDENTIALS_DIRECTORY/NIX_SECRET_KEY_FILE"
''} ''}
exec ${pkgs.nix-serve}/bin/nix-serve --listen ${cfg.bindAddress}:${toString cfg.port} ${cfg.extraParams} exec ${cfg.package}/bin/nix-serve --listen ${cfg.bindAddress}:${toString cfg.port} ${cfg.extraParams}
''; '';
serviceConfig = { serviceConfig = {