nixos/nixseparatedebuginfod2: adapt to v1

several substituters are supported at the same time
This commit is contained in:
Guillaume Girol
2025-10-14 12:00:00 +00:00
parent b9a31d8862
commit 09ac18fbd3
2 changed files with 26 additions and 15 deletions

View File

@@ -10,6 +10,11 @@ let
url = "127.0.0.1:${toString cfg.port}";
in
{
imports = [
(lib.mkRemovedOptionModule [ "services" "nixseparatedebuginfod2" "substituter" ] ''
Instead of `services.nixseparatedebuginfod2.substituter = "foo"`, set `services.nixseparatedebuginfod2.substituters = [ "foo" ]` (possibly with mkForce to override the default value).
'')
];
options = {
services.nixseparatedebuginfod2 = {
enable = lib.mkEnableOption "nixseparatedebuginfod2, a debuginfod server providing source and debuginfo for nix packages";
@@ -19,11 +24,13 @@ in
type = lib.types.port;
};
package = lib.mkPackageOption pkgs "nixseparatedebuginfod2" { };
substituter = lib.mkOption {
description = "nix substituter to fetch debuginfo from. Either http/https substituters, or `local:` to use debuginfo present in the local store.";
default = "https://cache.nixos.org";
example = "local:";
type = lib.types.str;
substituters = lib.mkOption {
description = "nix substituter to fetch debuginfo from. Either http/https/file substituters, or `local:` to use debuginfo present in the local store.";
default = [
"local:"
"https://cache.nixos.org"
];
type = lib.types.listOf lib.types.str;
};
cacheExpirationDelay = lib.mkOption {
description = "keep unused cache entries for this long. A number followed by a unit";
@@ -38,15 +45,19 @@ in
path = [ config.nix.package ];
serviceConfig = {
ExecStart = [
(utils.escapeSystemdExecArgs [
(lib.getExe cfg.package)
"--listen-address"
url
"--substituter"
cfg.substituter
"--expiration"
cfg.cacheExpirationDelay
])
(utils.escapeSystemdExecArgs (
[
(lib.getExe cfg.package)
"--listen-address"
url
"--expiration"
cfg.cacheExpirationDelay
]
++ (lib.lists.concatMap (s: [
"--substituter"
s
]) cfg.substituters)
))
];
Restart = "on-failure";
CacheDirectory = "nixseparatedebuginfod2";