don't use rootless docker on 'andromache', but keep it as an option
This commit is contained in:
@@ -41,6 +41,7 @@ in
|
|||||||
];
|
];
|
||||||
|
|
||||||
secrets.username = username;
|
secrets.username = username;
|
||||||
|
docker.user = username;
|
||||||
|
|
||||||
disko.devices = {
|
disko.devices = {
|
||||||
disk.data = {
|
disk.data = {
|
||||||
|
|||||||
@@ -1,4 +1,31 @@
|
|||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.docker;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
|
options.docker = {
|
||||||
|
rootless = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
user = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = lib.mkMerge [
|
||||||
|
{
|
||||||
|
warnings = lib.flatten [
|
||||||
|
(lib.optional (
|
||||||
|
cfg.rootless && cfg.user != null
|
||||||
|
) "'virtualisation.docker.user' is ignored when rootless mode is enabled")
|
||||||
|
(lib.optional (
|
||||||
|
!cfg.rootless && cfg.user == null
|
||||||
|
) "'virtualisation.docker.user' is not set (no user is added to the docker group)")
|
||||||
|
];
|
||||||
|
}
|
||||||
|
(lib.mkIf cfg.rootless {
|
||||||
virtualisation.docker = {
|
virtualisation.docker = {
|
||||||
enable = false;
|
enable = false;
|
||||||
rootless = {
|
rootless = {
|
||||||
@@ -6,4 +33,12 @@
|
|||||||
setSocketVariable = true;
|
setSocketVariable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
})
|
||||||
|
(lib.mkIf (!cfg.rootless && cfg.user != null) {
|
||||||
|
virtualisation.docker = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
users.users.${cfg.user}.extraGroups = [ "docker" ];
|
||||||
|
})
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user