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;
|
2024-01-07 02:05:16 -05:00
|
|
|
configPath = "/var/lib/arion";
|
2024-01-05 03:41:21 -05:00
|
|
|
in {
|
|
|
|
imports = [arion.nixosModules.arion];
|
|
|
|
|
2024-01-07 04:21:44 -05:00
|
|
|
users.extraUsers.${user}.extraGroups = ["docker"];
|
2024-01-07 02:05:16 -05:00
|
|
|
|
|
|
|
services.borgbackup.configs.arion = {
|
|
|
|
paths = [configPath];
|
|
|
|
exclude = ["**/lineageos*"];
|
2024-01-05 03:41:21 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
virtualisation = {
|
2024-01-07 04:21:44 -05:00
|
|
|
docker = {
|
2024-01-05 03:41:21 -05:00
|
|
|
enable = true;
|
2024-01-07 04:21:44 -05:00
|
|
|
storageDriver = "btrfs";
|
2024-01-05 03:41:21 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
arion = {
|
2024-01-07 04:21:44 -05:00
|
|
|
backend = "docker";
|
2024-01-05 03:41:21 -05:00
|
|
|
|
|
|
|
projects = let
|
|
|
|
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
|
|
|
|
// {
|
2024-01-07 02:05:16 -05:00
|
|
|
rwPath =
|
|
|
|
configPath
|
|
|
|
+ "/"
|
|
|
|
+ elemAt (match "[^-]*-(.*)" "${dirOf p}") 0;
|
2024-01-06 02:40:54 -05:00
|
|
|
});
|
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;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|