feat: add support for docker-rootless
This commit is contained in:
parent
8159c4faa3
commit
ecaeaf61e9
1 changed files with 19 additions and 5 deletions
|
@ -27,8 +27,8 @@ let
|
||||||
};
|
};
|
||||||
_systemd = mkOption { internal = true; };
|
_systemd = mkOption { internal = true; };
|
||||||
};
|
};
|
||||||
config = {
|
config =
|
||||||
_systemd.services."arion-${name}" = {
|
let config = {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "sockets.target" ];
|
after = [ "sockets.target" ];
|
||||||
|
|
||||||
|
@ -37,12 +37,17 @@ let
|
||||||
cfg.docker.client.package
|
cfg.docker.client.package
|
||||||
];
|
];
|
||||||
environment.ARION_PREBUILT = config.settings.out.dockerComposeYaml;
|
environment.ARION_PREBUILT = config.settings.out.dockerComposeYaml;
|
||||||
|
# environment.DOCKER_HOST = "unix://$XDG_RUNTIME_DIR/docker.sock";
|
||||||
script = ''
|
script = ''
|
||||||
echo 1>&2 "docker compose file: $ARION_PREBUILT"
|
echo 1>&2 "docker compose file: $ARION_PREBUILT"
|
||||||
arion --prebuilt-file "$ARION_PREBUILT" up
|
arion --prebuilt-file "$ARION_PREBUILT" up
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
in
|
||||||
|
if cfg.backend == "docker-rootless" then
|
||||||
|
{ _systemd.user.services."arion-${name}" = config; }
|
||||||
|
else
|
||||||
|
{ _systemd.services."arion-${name}" = config; };
|
||||||
};
|
};
|
||||||
|
|
||||||
arionSettingsType = name:
|
arionSettingsType = name:
|
||||||
|
@ -57,7 +62,7 @@ in
|
||||||
options = {
|
options = {
|
||||||
virtualisation.arion = {
|
virtualisation.arion = {
|
||||||
backend = mkOption {
|
backend = mkOption {
|
||||||
type = types.enum [ "podman-socket" "docker" ];
|
type = types.enum [ "podman-socket" "docker" "docker-rootless" ];
|
||||||
description = ''
|
description = ''
|
||||||
Which container implementation to use.
|
Which container implementation to use.
|
||||||
'';
|
'';
|
||||||
|
@ -105,6 +110,15 @@ in
|
||||||
virtualisation.docker.enable = true;
|
virtualisation.docker.enable = true;
|
||||||
virtualisation.arion.docker.client.package = pkgs.docker;
|
virtualisation.arion.docker.client.package = pkgs.docker;
|
||||||
})
|
})
|
||||||
|
(mkIf (cfg.backend == "docker-rootless") {
|
||||||
|
virtualisation = {
|
||||||
|
docker.rootless = {
|
||||||
|
enable = true;
|
||||||
|
setSocketVariable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
virtualisation.arion.docker.client.package = pkgs.docker;
|
||||||
|
})
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue