Compare commits
10 Commits
0652389078
...
6b6556cd80
| Author | SHA1 | Date | |
|---|---|---|---|
| 6b6556cd80 | |||
| 2e9c500892 | |||
| 4cabbcca5d | |||
| 1f326544d6 | |||
| 69599c8e3d | |||
| 7f3a7c5543 | |||
| 9d095ffb7e | |||
| 9c1d77eb47 | |||
| baafd655ca | |||
| 022e5b17a0 |
@@ -40,7 +40,6 @@ in
|
|||||||
];
|
];
|
||||||
|
|
||||||
secrets.username = username;
|
secrets.username = username;
|
||||||
docker.user = username;
|
|
||||||
|
|
||||||
disko.devices = {
|
disko.devices = {
|
||||||
disk.data = {
|
disk.data = {
|
||||||
|
|||||||
@@ -1,44 +1,9 @@
|
|||||||
{ config, lib, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
cfg = config.docker;
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
options.docker = {
|
virtualisation.docker = {
|
||||||
rootless = lib.mkOption {
|
enable = false;
|
||||||
type = lib.types.bool;
|
rootless = {
|
||||||
default = false;
|
enable = true;
|
||||||
};
|
setSocketVariable = true;
|
||||||
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 = {
|
|
||||||
enable = false;
|
|
||||||
rootless = {
|
|
||||||
enable = 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