nixos/singularity: format using nixfmt (Nix RFC 166)

This commit is contained in:
Yueh-Shun Li 2024-04-25 08:20:11 +08:00
parent 7b62cf00cb
commit 54e547ff5d

View file

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
with lib;
let
@ -12,9 +17,7 @@ in
Whether to install Singularity/Apptainer with system-level overriding such as SUID support.
'';
};
package = mkPackageOption pkgs "singularity" {
example = "apptainer";
};
package = mkPackageOption pkgs "singularity" { example = "apptainer"; };
packageOverriden = mkOption {
type = types.nullOr types.package;
default = null;
@ -75,17 +78,19 @@ in
};
config = mkIf cfg.enable {
programs.singularity.packageOverriden = (cfg.package.override (
optionalAttrs cfg.enableExternalLocalStateDir {
externalLocalStateDir = "/var/lib";
} // optionalAttrs cfg.enableFakeroot {
newuidmapPath = "/run/wrappers/bin/newuidmap";
newgidmapPath = "/run/wrappers/bin/newgidmap";
} // optionalAttrs cfg.enableSuid {
enableSuid = true;
starterSuidPath = "/run/wrappers/bin/${cfg.package.projectName}-suid";
}
));
programs.singularity.packageOverriden = (
cfg.package.override (
optionalAttrs cfg.enableExternalLocalStateDir { externalLocalStateDir = "/var/lib"; }
// optionalAttrs cfg.enableFakeroot {
newuidmapPath = "/run/wrappers/bin/newuidmap";
newgidmapPath = "/run/wrappers/bin/newgidmap";
}
// optionalAttrs cfg.enableSuid {
enableSuid = true;
starterSuidPath = "/run/wrappers/bin/${cfg.package.projectName}-suid";
}
)
);
environment.systemPackages = [ cfg.packageOverriden ];
security.wrappers."${cfg.packageOverriden.projectName}-suid" = mkIf cfg.enableSuid {
setuid = true;
@ -97,5 +102,4 @@ in
"d /var/lib/${cfg.packageOverriden.projectName}/mnt/session 0770 root root -"
];
};
}