diff --git a/lib/modules/programs.nix b/lib/modules/programs.nix index 1c3cc67f..cf1a76c1 100644 --- a/lib/modules/programs.nix +++ b/lib/modules/programs.nix @@ -30,7 +30,6 @@ let ["aliae" "aliae"] ["brave" "Brave Browser"] ["discord" "Discord"] - ["docker" "docker"] ["firefox" "Firefox Web Browser"] ["openssh" "OpenSSH"] ["osu!lazer" "osu!lazer"] @@ -51,6 +50,7 @@ let ["logo-ls" "logo-ls"] ["lutris" "Lutris"] ["minegrub-theme" "Minegrub Theme"] + ["nginx" "nginx"] ["nodejs-n" "n"] ["nuke-usb" "nuke-usb"] ["nvidia-dkms" "Nvidia Drivers"] @@ -83,6 +83,7 @@ let ]; in { imports = [ + ./programs/docker.nix ./programs/git.nix ./programs/nextcloud.nix ./programs/oh-my-posh.nix diff --git a/lib/modules/programs/docker.nix b/lib/modules/programs/docker.nix new file mode 100644 index 00000000..4e19026e --- /dev/null +++ b/lib/modules/programs/docker.nix @@ -0,0 +1,41 @@ +{ lib, ... }: +let + inherit (lib) mkEnableOption mkOption types; + + commonOptions = { + enable = mkEnableOption "docker"; + }; +in { + options = { + valhalla = { + programs.docker = commonOptions; + + users = mkOption { + type = types.attrsOf (types.submodule ( + { ... }: { + options = { + programs.docker = commonOptions; + }; + })); + }; + + linux = { + programs = { + docker = { + services = { + anki-sync.enable = mkEnableOption "Anki Sync server"; + drone.enable = mkEnableOption "drone server"; + forgejo.enable = mkEnableOption "Forgejo server"; + minecraft.enable = mkEnableOption "Minecraft server"; + nextcloud.enable = mkEnableOption "Nextcloud server"; + teamspeak.enable = mkEnableOption "TeamSpeak server"; + trackmania.enable = mkEnableOption "TrackMania server"; + vaultwarden.enable = mkEnableOption "Vaultwarden server"; + woodpecker.enable = mkEnableOption "Woodpecker CI server"; + }; + }; + }; + }; + }; + }; +} diff --git a/scripts/Arch/Software/docker/main.fish b/scripts/Arch/Software/docker/main.fish index 4cdaee8a..dfdca988 100755 --- a/scripts/Arch/Software/docker/main.fish +++ b/scripts/Arch/Software/docker/main.fish @@ -10,6 +10,8 @@ begin docker-compose \ docker-buildx \ docker-scan + + installSWBase $argv end runInstaller $argv diff --git a/scripts/Common/Software/docker/main.fish b/scripts/Common/Software/docker/main.fish index ed6b4fa6..3dcf5e57 100755 --- a/scripts/Common/Software/docker/main.fish +++ b/scripts/Common/Software/docker/main.fish @@ -12,5 +12,20 @@ begin sudo usermod -aG docker "$_flag_user" end + function installSWDependencies -V dir -V args + source "$dir/../../../lib/settings.fish" + set -la argv $args + echo "args: $argv" + argparse -i "name=" "user=" -- $argv + set -l services (getProgramConfig --name "$_flag_name" --user "$_flag_user" --json | jq '.services') + + for service in (echo "$services" | jq '. | keys[]' --raw-output0 | string split0) + + if echo "$services" | SERVICE=$service jq --exit-status ".[env.SERVICE].enable" >/dev/null + fish "$dir/services/$service/main.fish" $argv + end + end + end + runInstaller $argv end