trofi / nix-guix-gentoo

Gentoo overlay for nix and guix functional package managers.
102 stars 9 forks source link

Add use flag for not installing user accounts for use with auto-allocate-uids = true #50

Open 2xsaiko opened 1 week ago

2xsaiko commented 1 week ago

With the experimental auto-allocate-uids setting, nix will work without explicitly created build users. Would be cool to have a use flag for that.

EDIT: tbh I can just use package.provided, although it's not nice since I have to list every single user account package. So if you don't want to provide flags for experimental features, that's fine.

trofi commented 6 days ago

That's a good idea. We can even try no enable it by default as user namespaces are required by the ebuild anyways. Not sure if auto-allocation interferes with things like kvm group presence for builder users (might be an issue for nixos VM tests).

trofi commented 6 days ago

Added it this way, did not test much:

--- nix-2.24.9.ebuild   2024-09-28 18:38:08.263409578 +0100
+++ nix-2.24.9-r1.ebuild        2024-10-05 07:48:31.070140625 +0100
@@ -12,7 +12,7 @@
 LICENSE="LGPL-2.1"
 SLOT="0"
 KEYWORDS="~amd64"
-IUSE="+etc-profile +gc doc +sodium"
+IUSE="+allocate-build-users +etc-profile +gc doc +sodium"

 BDEPEND="
        doc? ( app-text/mdbook
@@ -47,12 +47,16 @@
 # add users and groups
 RDEPEND+="
        acct-group/nixbld
+       allocate-build-users? (
 "
 for i in {1..64}; do
        RDEPEND+="
                >=acct-user/nixbld${i}-1
        "
 done
+RDEPEND+="
+       )
+"
 DEPEND="${RDEPEND}
        dev-cpp/nlohmann_json
        dev-cpp/toml11
2xsaiko commented 6 days ago

Works for me!