dockerTools: Tidied comments

Co-authored-by: commiterate <111539270+commiterate@users.noreply.github.com>
This commit is contained in:
Joel Holdsworth
2025-10-09 11:04:41 -07:00
co-authored by commiterate
parent a352c4cb2f
commit 3c3e8772c4
+13 -8
View File
@@ -1241,7 +1241,8 @@ rec {
result
);
# This function streams a docker image that behaves like a nix-shell for a derivation
# This function streams a docker image that behaves like a nix-shell for a derivation.
#
# Docs: doc/build-helpers/images/dockertools.section.md
# Tests: nixos/tests/docker-tools-nix-shell.nix
streamNixShellImage =
@@ -1357,10 +1358,14 @@ rec {
binSh
usrBinEnv
(fakeNss.override {
# Allows programs to look up the build user's home directory
# Allows programs to look up the build user's home directory.
#
# https://github.com/NixOS/nix/blob/2.32.0/src/libstore/unix/build/linux-derivation-builder.cc#L409-L416
# Slightly differs however: We use the passed-in homeDirectory instead of sandboxBuildDir.
# We're doing this because it's arguably a bug in Nix that sandboxBuildDir is used here: https://github.com/NixOS/nix/issues/6379
#
# This slightly differs, however, since we use the passed-in `homeDirectory` instead of `sandboxBuildDir`.
# We're doing this because it is arguably a bug in Nix that `sandboxBuildDir` is used here.
#
# https://github.com/NixOS/nix/issues/6379
extraPasswdLines = [
"nixbld:x:${toString uid}:${toString gid}:Build user:${homeDirectory}:/noshell"
];
@@ -1373,12 +1378,11 @@ rec {
fakeRootCommands = ''
# Effectively a single-user installation of Nix, giving the user full
# control over the Nix store. Needed for building the derivation this
# shell is for, but also in case one wants to use Nix inside the
# image
# shell is for, but also in case one wants to use Nix inside the image.
mkdir -p ./nix/{store,var/nix} ./etc/nix
chown -R ${toString uid}:${toString gid} ./nix ./etc/nix
# Gives the user control over the build directory
# Gives the user control over the build directory.
mkdir -p .${sandboxBuildDir}
chown -R ${toString uid}:${toString gid} .${sandboxBuildDir}
'';
@@ -1403,7 +1407,8 @@ rec {
config.Env = lib.mapAttrsToList (name: value: "${name}=${value}") envVars;
};
# Wrapper around streamNixShellImage to build an image from the result
# Wrapper around `streamNixShellImage` to build an image from the result.
#
# Docs: doc/build-helpers/images/dockertools.section.md
# Tests: nixos/tests/docker-tools-nix-shell.nix
buildNixShellImage =