dockerTools.buildNixShellImage: Chown nix directories
To the user running the docker image. If a Nix binary is available in the resulting derivation, this then behaves like a single-user Nix installation, except that already-written /nix/store paths can't be changed. Most notably it makes Nix work not have to rely on a chroot store in the image
This commit is contained in:
parent
c36f929dee
commit
a1cf249394
1 changed files with 6 additions and 3 deletions
|
@ -1178,9 +1178,12 @@ rec {
|
||||||
];
|
];
|
||||||
|
|
||||||
fakeRootCommands = ''
|
fakeRootCommands = ''
|
||||||
# Allows any user to create new directories in the Nix store (for the build result)
|
# Effectively a single-user installation of Nix, giving the user full
|
||||||
mkdir -p .${storeDir}
|
# control over the Nix store. Needed for building the derivation this
|
||||||
chmod a+w+t .${storeDir}
|
# 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}
|
mkdir -p .${sandboxBuildDir}
|
||||||
|
|
Loading…
Reference in a new issue