From 35de6f1c4eb4e983fe39a5407db7c831fea675f7 Mon Sep 17 00:00:00 2001 From: Someone Serge Date: Wed, 3 Jan 2024 22:28:57 +0000 Subject: [PATCH] nixos/singularity: disable setuid for apptainer (cherry picked from commit 5f4b6ea5dde8b0153f416c78519d877ab1224f91) --- nixos/modules/programs/singularity.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nixos/modules/programs/singularity.nix b/nixos/modules/programs/singularity.nix index 9fd37e1793a7..7f285ab05537 100644 --- a/nixos/modules/programs/singularity.nix +++ b/nixos/modules/programs/singularity.nix @@ -61,7 +61,12 @@ in }; enableSuid = mkOption { type = types.bool; - default = true; + # SingularityCE requires SETUID for most things. Apptainer prefers user + # namespaces, e.g. `apptainer exec --nv` would fail if built + # `--with-suid`: + # > `FATAL: nvidia-container-cli not allowed in setuid mode` + default = cfg.package.projectName != "apptainer"; + defaultText = literalExpression ''config.services.singularity.package.projectName != "apptainer"''; example = false; description = mdDoc '' Whether to enable the SUID support of Singularity/Apptainer.