mirror of
https://github.com/nix-community/home-manager
synced 2025-03-01 03:25:13 +01:00
pbgopy: add missing options
This commit is contained in:
parent
4edc2091e0
commit
4727b0543d
2 changed files with 30 additions and 2 deletions
|
@ -3,14 +3,32 @@
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
cfg = config.services.pbgopy;
|
cfg = config.services.pbgopy;
|
||||||
package = pkgs.pbgopy;
|
package = pkgs.pbgopy;
|
||||||
|
|
||||||
|
commandLine = concatStringsSep " " ([
|
||||||
|
"${package}/bin/pbgopy serve"
|
||||||
|
"--port ${toString cfg.port}"
|
||||||
|
"--ttl ${cfg.cache.ttl}"
|
||||||
|
] ++ optional (cfg.httpAuth != null)
|
||||||
|
"--basic-auth ${escapeShellArg cfg.httpAuth}");
|
||||||
|
|
||||||
in {
|
in {
|
||||||
meta.maintainers = [ maintainers.ivar ];
|
meta.maintainers = [ maintainers.ivar ];
|
||||||
|
|
||||||
options.services.pbgopy = {
|
options.services.pbgopy = {
|
||||||
enable = mkEnableOption "pbgopy";
|
enable = mkEnableOption "pbgopy";
|
||||||
|
|
||||||
|
port = mkOption {
|
||||||
|
type = types.port;
|
||||||
|
default = 9090;
|
||||||
|
example = 8080;
|
||||||
|
description = ''
|
||||||
|
The port to host the pbgopy server on.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
cache.ttl = mkOption {
|
cache.ttl = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "24h";
|
default = "24h";
|
||||||
|
@ -19,6 +37,16 @@ in {
|
||||||
The TTL for the cache. Use <literal>"0s"</literal> to disable it.
|
The TTL for the cache. Use <literal>"0s"</literal> to disable it.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
httpAuth = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
example = "user:pass";
|
||||||
|
description = ''
|
||||||
|
Basic HTTP authentication's username and password. Both the username and
|
||||||
|
password are escaped.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
@ -31,7 +59,7 @@ in {
|
||||||
PartOf = [ "graphical-session.target" ];
|
PartOf = [ "graphical-session.target" ];
|
||||||
};
|
};
|
||||||
Service = {
|
Service = {
|
||||||
ExecStart = "${package}/bin/pbgopy serve --ttl ${cfg.cache.ttl}";
|
ExecStart = commandLine;
|
||||||
Restart = "on-abort";
|
Restart = "on-abort";
|
||||||
};
|
};
|
||||||
Install = { WantedBy = [ "graphical-session.target" ]; };
|
Install = { WantedBy = [ "graphical-session.target" ]; };
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
assertFileExists $serviceFile
|
assertFileExists $serviceFile
|
||||||
|
|
||||||
assertFileContains $serviceFile \
|
assertFileContains $serviceFile \
|
||||||
'ExecStart=@pbgopy@/bin/pbgopy serve --ttl 24h'
|
'ExecStart=@pbgopy@/bin/pbgopy serve --port 9090 --ttl 24h'
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue