From 327ee6366d48fede88eb4199b7896c794308f996 Mon Sep 17 00:00:00 2001 From: Tigor Hutasuhut Date: Wed, 18 Sep 2024 14:38:47 +0700 Subject: [PATCH] nix: removed docker and docker services --- options/default.nix | 1 - options/docker.nix | 11 ----------- options/podman.nix | 1 - profiles/homeserver.nix | 4 ---- system/default.nix | 1 - system/docker/caddy.nix | 40 --------------------------------------- system/docker/default.nix | 18 ------------------ system/docker/kavita.nix | 32 ------------------------------- system/podman/ytptube.nix | 4 ++-- 9 files changed, 2 insertions(+), 110 deletions(-) delete mode 100644 options/docker.nix delete mode 100644 system/docker/caddy.nix delete mode 100644 system/docker/default.nix delete mode 100644 system/docker/kavita.nix diff --git a/options/default.nix b/options/default.nix index 1b01a76..b0167fc 100644 --- a/options/default.nix +++ b/options/default.nix @@ -3,7 +3,6 @@ imports = [ ./programs.nix ./hyprland.nix - ./docker.nix ./podman.nix ./services.nix ./games.nix diff --git a/options/docker.nix b/options/docker.nix deleted file mode 100644 index 3960969..0000000 --- a/options/docker.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ lib, ... }: -let - inherit (lib) mkEnableOption; -in -{ - options.profile.docker = { - enable = lib.mkEnableOption "docker"; - caddy.enable = mkEnableOption "caddy docker"; - kavita.enable = lib.mkEnableOption "kavita docker"; - }; -} diff --git a/options/podman.nix b/options/podman.nix index 3459a92..74d6238 100644 --- a/options/podman.nix +++ b/options/podman.nix @@ -5,7 +5,6 @@ in { options.profile.podman = { enable = lib.mkEnableOption "podman"; - caddy.enable = lib.mkEnableOption "caddy podman"; pihole.enable = lib.mkEnableOption "pihole podman"; suwayomi.enable = lib.mkEnableOption "suwayomi podman"; ytptube.enable = lib.mkEnableOption "metube podman"; diff --git a/profiles/homeserver.nix b/profiles/homeserver.nix index 63e0a48..d90362c 100644 --- a/profiles/homeserver.nix +++ b/profiles/homeserver.nix @@ -44,10 +44,6 @@ valheim.enable = true; }; - docker = { - enable = false; - }; - home.programs.zellij = { enable = true; autoAttach = true; diff --git a/system/default.nix b/system/default.nix index dbd9004..c3219e2 100644 --- a/system/default.nix +++ b/system/default.nix @@ -7,7 +7,6 @@ ./modules ./services ./podman - ./docker ./programs.nix ./user.nix ./keyboard.nix diff --git a/system/docker/caddy.nix b/system/docker/caddy.nix deleted file mode 100644 index a095205..0000000 --- a/system/docker/caddy.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ config, lib, pkgs, ... }: -let - user = config.profile.user; - docker = config.profile.docker; - cache = "/home/${user.name}/.cache/docker/caddy"; - image = "lucaslorentz/caddy-docker-proxy:ci-alpine"; -in -{ - config = lib.mkIf (docker.enable && docker.caddy.enable) { - system.activationScripts.docker-caddy = '' - mkdir -p ${cache} - chown -R ${config.profile.user.name} ${cache} - ''; - systemd.services.create-caddy-network = with config.virtualisation.oci-containers; { - serviceConfig = { - Type = "oneshot"; - # ExecStop = "${pkgs.docker}/bin/docker network rm -f caddy"; - }; - wantedBy = [ "${backend}-caddy.service" ]; - script = ''${pkgs.docker}/bin/docker network inspect caddy || ${pkgs.docker}/bin/docker network create caddy''; - }; - virtualisation.oci-containers.containers = { - caddy = { - inherit image; - environment = { - TZ = "Asia/Jakarta"; - }; - ports = [ "80:80" "443:443" ]; - autoStart = true; - volumes = [ - "/var/run/docker.sock:/var/run/docker.sock:z" - "${cache}:/data" - ]; - extraOptions = [ - "--network=caddy" - ]; - }; - }; - }; -} diff --git a/system/docker/default.nix b/system/docker/default.nix deleted file mode 100644 index a159712..0000000 --- a/system/docker/default.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ config, lib, ... }: -let - cfg = config.profile.docker; - username = config.profile.user.name; -in -{ - config = lib.mkIf cfg.enable { - users.users.${username}.extraGroups = [ "docker" ]; - virtualisation.docker.enable = true; - virtualisation.docker.autoPrune.enable = true; - virtualisation.oci-containers.backend = "docker"; - }; - - imports = [ - ./caddy.nix - ./kavita.nix - ]; -} diff --git a/system/docker/kavita.nix b/system/docker/kavita.nix deleted file mode 100644 index 3f6eb9a..0000000 --- a/system/docker/kavita.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ config, lib, ... }: -let - user = config.profile.user; - docker = config.profile.docker; - volume = "/nas/kavita"; - image = "lscr.io/linuxserver/kavita:latest"; - gid = toString user.gid; - uid = toString user.uid; -in -{ - config = lib.mkIf (docker.enable && docker.kavita.enable) { - system.activationScripts.docker-kavita = '' - mkdir -p ${volume} - chown -R ${user.name}:${gid} ${volume} - ''; - - virtualisation.oci-containers.containers.kavita = { - inherit image; - environment = { - PUID = uid; - PGID = gid; - TZ = "Asia/Jakarta"; - }; - ports = [ "5000:5000" ]; - autoStart = true; - volumes = [ - "${volume}/config:/config" - "${volume}/library:/library" - ]; - }; - }; -} diff --git a/system/podman/ytptube.nix b/system/podman/ytptube.nix index 97f9290..8c6e1d4 100644 --- a/system/podman/ytptube.nix +++ b/system/podman/ytptube.nix @@ -45,7 +45,7 @@ in ''; system.activationScripts."podman-${name}" = '' mkdir -p ${volume} - chown -R ${uid}:${gid} ${volume} + chown -R ${uid}:${gid} ${volume} /etc/podman/${name} ''; systemd.services."caddy".serviceConfig = { @@ -101,7 +101,7 @@ in }; volumes = [ "${volume}:/downloads" - "/etc/podman/${name}/ytdlp.json:/config/ytdlp.json" + "/etc/podman/${name}:/config" ]; extraOptions = [ "--ip=${ip}"