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

View File

@@ -32,7 +32,7 @@
nodes.machine = { nodes.machine = {
services.nixseparatedebuginfod2 = { services.nixseparatedebuginfod2 = {
enable = true; enable = true;
substituter = "http://cache"; substituters = [ "http://cache" ];
}; };
environment.systemPackages = [ environment.systemPackages = [
pkgs.valgrind pkgs.valgrind