Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/nix/modules/service/image.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let
{
name = null; tag = null; contents = null; config = null;
created = null; extraCommands = null; maxLayers = null;
fakeRootCommands = null;
fakeRootCommands = null; enableFakechroot = null;
}
args;
acceptedArgs = functionArgs dockerTools.streamLayeredImage;
Expand All @@ -50,6 +50,8 @@ let
name
contents
includeStorePaths
fakeRootCommands
enableFakechroot
;
config = config.image.rawConfig;
maxLayers = 100;
Expand All @@ -68,8 +70,6 @@ let
ln -s $i nix/var/nix/gcroots/docker/$(basename $i)
done;
'';

fakeRootCommands = config.image.fakeRootCommands;
};

priorityIsDefault = option: option.highestPrio >= (lib.mkDefault true).priority;
Expand Down Expand Up @@ -132,6 +132,15 @@ in
See [`dockerTools.buildLayeredImage`](https://nixos.org/manual/nixpkgs/stable/#ssec-pkgs-dockerTools-buildLayeredImage).
'';
};
image.enableFakechroot = mkOption {
type = bool;
default = false;
description = ''
Runs the commands from `image.fakeRootCommands` in a complete fakechroot environment instead of fakeroot. This allows installation in `/` to work as expected, similar to the instruction [`RUN`](https://docs.docker.com/reference/dockerfile/#run).

See [`dockerTools.buildLayeredImage`](https://nixos.org/manual/nixpkgs/stable/#ssec-pkgs-dockerTools-buildLayeredImage).
'';
};
image.includeStorePaths = mkOption {
type = bool;
default = true;
Expand Down