2024-01-05 03:41:21 -05:00
|
|
|
{
|
|
|
|
arion,
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
2024-01-06 02:40:54 -05:00
|
|
|
} @ inputs:
|
2024-01-05 03:41:21 -05:00
|
|
|
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
|
2024-01-06 02:40:54 -05:00
|
|
|
configPath = "/var/lib/arion";
|
|
|
|
|
2024-01-05 03:41:21 -05:00
|
|
|
composeFiles =
|
|
|
|
filter (n: hasSuffix "compose.nix" (toString n))
|
|
|
|
(filesystem.listFilesRecursive ./.);
|
|
|
|
|
2024-01-06 02:40:54 -05:00
|
|
|
projects = filterAttrs (n: v: v.enabled or true) (listToAttrs (map (p: {
|
2024-01-05 03:41:21 -05:00
|
|
|
name = elemAt (match ".*\/(.*)\/compose\.nix" (toString p)) 0;
|
2024-01-06 02:40:54 -05:00
|
|
|
|
|
|
|
value = import p (inputs
|
|
|
|
// {
|
|
|
|
rwPath = configPath + "/" + elemAt (match "[^-]*-(.*)" "${dirOf p}") 0;
|
|
|
|
});
|
2024-01-05 03:41:21 -05:00
|
|
|
})
|
2024-01-06 02:40:54 -05:00
|
|
|
composeFiles));
|
2024-01-05 03:41:21 -05:00
|
|
|
in
|
|
|
|
mapAttrs (n: v: {
|
|
|
|
# https://docs.hercules-ci.com/arion/options
|
|
|
|
settings = {
|
|
|
|
enableDefaultNetwork = v.enableDefaultNetwork or true;
|
|
|
|
networks = optionalAttrs (hasAttr "networks" v) v.networks;
|
|
|
|
|
2024-01-06 02:40:54 -05:00
|
|
|
services =
|
|
|
|
mapAttrs (n': v': {
|
|
|
|
image = optionalAttrs (hasAttr "customImage" v') v'.customImage;
|
|
|
|
service = filterAttrs (n: v: n != "customImage") v';
|
|
|
|
})
|
|
|
|
v.services;
|
2024-01-05 03:41:21 -05:00
|
|
|
};
|
|
|
|
})
|
|
|
|
projects;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|