nix: removed docker and docker services

This commit is contained in:
Tigor Hutasuhut 2024-09-18 14:38:47 +07:00
parent 41c2cddd21
commit 327ee6366d
9 changed files with 2 additions and 110 deletions

View file

@ -3,7 +3,6 @@
imports = [ imports = [
./programs.nix ./programs.nix
./hyprland.nix ./hyprland.nix
./docker.nix
./podman.nix ./podman.nix
./services.nix ./services.nix
./games.nix ./games.nix

View file

@ -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";
};
}

View file

@ -5,7 +5,6 @@ in
{ {
options.profile.podman = { options.profile.podman = {
enable = lib.mkEnableOption "podman"; enable = lib.mkEnableOption "podman";
caddy.enable = lib.mkEnableOption "caddy podman";
pihole.enable = lib.mkEnableOption "pihole podman"; pihole.enable = lib.mkEnableOption "pihole podman";
suwayomi.enable = lib.mkEnableOption "suwayomi podman"; suwayomi.enable = lib.mkEnableOption "suwayomi podman";
ytptube.enable = lib.mkEnableOption "metube podman"; ytptube.enable = lib.mkEnableOption "metube podman";

View file

@ -44,10 +44,6 @@
valheim.enable = true; valheim.enable = true;
}; };
docker = {
enable = false;
};
home.programs.zellij = { home.programs.zellij = {
enable = true; enable = true;
autoAttach = true; autoAttach = true;

View file

@ -7,7 +7,6 @@
./modules ./modules
./services ./services
./podman ./podman
./docker
./programs.nix ./programs.nix
./user.nix ./user.nix
./keyboard.nix ./keyboard.nix

View file

@ -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"
];
};
};
};
}

View file

@ -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
];
}

View file

@ -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"
];
};
};
}

View file

@ -45,7 +45,7 @@ in
''; '';
system.activationScripts."podman-${name}" = '' system.activationScripts."podman-${name}" = ''
mkdir -p ${volume} mkdir -p ${volume}
chown -R ${uid}:${gid} ${volume} chown -R ${uid}:${gid} ${volume} /etc/podman/${name}
''; '';
systemd.services."caddy".serviceConfig = { systemd.services."caddy".serviceConfig = {
@ -101,7 +101,7 @@ in
}; };
volumes = [ volumes = [
"${volume}:/downloads" "${volume}:/downloads"
"/etc/podman/${name}/ytdlp.json:/config/ytdlp.json" "/etc/podman/${name}:/config"
]; ];
extraOptions = [ extraOptions = [
"--ip=${ip}" "--ip=${ip}"