feat(servers): setup docker-compose backend with arion
All checks were successful
Discord / discord commits (push) Successful in 1m14s
All checks were successful
Discord / discord commits (push) Successful in 1m14s
This commit is contained in:
parent
128ff2d98c
commit
eb23379935
4 changed files with 55 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
|||
../../modules/sshd.nix
|
||||
../../modules/tailscale.nix
|
||||
|
||||
./modules/arion
|
||||
./modules/binary-cache.nix
|
||||
./modules/borgbackup.nix
|
||||
./modules/minecraft.nix
|
||||
|
|
54
devices/servivi/modules/arion/default.nix
Normal file
54
devices/servivi/modules/arion/default.nix
Normal file
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
arion,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with builtins; let
|
||||
user = config.vars.user;
|
||||
in {
|
||||
imports = [arion.nixosModules.arion];
|
||||
|
||||
users.extraUsers.${user}.extraGroups = ["podman"];
|
||||
home-manager.users.${user}.programs.bash.shellAliases = {
|
||||
podman = "sudo podman ";
|
||||
};
|
||||
|
||||
virtualisation = {
|
||||
podman = {
|
||||
enable = true;
|
||||
dockerSocket.enable = true;
|
||||
defaultNetwork.settings.dns_enabled = true;
|
||||
};
|
||||
|
||||
arion = {
|
||||
backend = "podman-socket";
|
||||
|
||||
projects = let
|
||||
composeFiles =
|
||||
filter (n: hasSuffix "compose.nix" (toString n))
|
||||
(filesystem.listFilesRecursive ./.);
|
||||
|
||||
projects = listToAttrs (map (p: {
|
||||
name = elemAt (match ".*\/(.*)\/compose\.nix" (toString p)) 0;
|
||||
value = import p;
|
||||
})
|
||||
composeFiles);
|
||||
in
|
||||
mapAttrs (n: v: {
|
||||
# https://docs.hercules-ci.com/arion/options
|
||||
settings = {
|
||||
enableDefaultNetwork = v.enableDefaultNetwork or true;
|
||||
networks = optionalAttrs (hasAttr "networks" v) v.networks;
|
||||
|
||||
services = mapAttrs (n': v': {
|
||||
image = optionalAttrs (hasAttr "customImage" v') v'.customImage;
|
||||
service = filterAttrs (n: v: n != "customImage") v';
|
||||
}) v.services;
|
||||
};
|
||||
})
|
||||
projects;
|
||||
};
|
||||
};
|
||||
}
|
BIN
flake.lock
BIN
flake.lock
Binary file not shown.
BIN
flake.nix
BIN
flake.nix
Binary file not shown.
Loading…
Reference in a new issue