From 7203fc1ed9892276681c661f0b212f74cf2146f8 Mon Sep 17 00:00:00 2001 From: jasmine Date: Fri, 20 Sep 2024 20:24:55 +0800 Subject: [PATCH] refactor --- home-manager/sajenim/features/cli/default.nix | 6 +- home-manager/sajenim/features/cli/git.nix | 6 +- .../sajenim/features/desktop/default.nix | 14 ++-- .../features/desktop/dunst/default.nix | 31 +++++++++ .../desktop/{email.nix => email/default.nix} | 0 .../desktop/{irc.nix => irc/default.nix} | 0 .../desktop/{mpd.nix => mpd/default.nix} | 0 .../desktop/{picom.nix => picom/default.nix} | 0 .../features/desktop/wezterm/default.nix | 2 +- home-manager/sajenim/features/desktop/xinitrc | 3 + .../sajenim/features/games/default.nix | 2 +- .../{mangohud.nix => mangohud/default.nix} | 0 .../sajenim/features/printing/default.nix | 10 +-- ...68528ea2bb7263365d822efd-paperless-ngx.age | 8 +++ .../common/optional/{key.nix => yubikey.nix} | 0 nixos/fuchsia/configuration.nix | 33 +++++++-- nixos/fuchsia/programs/default.nix | 9 --- .../default.nix} | 0 nixos/fuchsia/services/default.nix | 15 ---- .../{flatpak.nix => flatpak/default.nix} | 0 .../{libinput.nix => libinput/default.nix} | 0 .../{ollama.nix => ollama/default.nix} | 0 .../{printer => printers}/default.nix | 0 .../services/{printer => printers}/lw5xl.nix | 0 .../services/{printer => printers}/lw5xl.ppd | 0 .../{printer => printers}/raster2dymolw_v2 | Bin .../services/{udev.nix => udev/default.nix} | 0 .../{xserver.nix => xserver/default.nix} | 0 nixos/viridian/configuration.nix | 64 ++++++++++++------ nixos/viridian/containers/default.nix | 15 ---- .../{jellyfin.nix => jellyfin/default.nix} | 0 .../default.nix} | 0 .../{lidarr.nix => lidarr/default.nix} | 0 .../{mealie.nix => mealie/default.nix} | 0 .../{prowlarr.nix => prowlarr/default.nix} | 0 .../default.nix} | 0 .../{radarr.nix => radarr/default.nix} | 0 .../{recyclarr.nix => recyclarr/default.nix} | 0 .../{sonarr.nix => sonarr/default.nix} | 0 nixos/viridian/programs/default.nix | 5 -- .../default.nix} | 0 nixos/viridian/services/default.nix | 15 ---- .../{forgejo.nix => forgejo/default.nix} | 0 .../{grafana.nix => grafana/default.nix} | 0 .../{lighttpd.nix => lighttpd/default.nix} | 0 .../services/{mpd.nix => mpd/default.nix} | 0 .../services/{mysql.nix => mysql/default.nix} | 0 .../services/paperless-ngx/default.nix | 37 ++++++++++ .../services/paperless-ngx/password.age | 8 +++ .../default.nix} | 0 .../services/{samba.nix => samba/default.nix} | 0 51 files changed, 175 insertions(+), 108 deletions(-) create mode 100644 home-manager/sajenim/features/desktop/dunst/default.nix rename home-manager/sajenim/features/desktop/{email.nix => email/default.nix} (100%) rename home-manager/sajenim/features/desktop/{irc.nix => irc/default.nix} (100%) rename home-manager/sajenim/features/desktop/{mpd.nix => mpd/default.nix} (100%) rename home-manager/sajenim/features/desktop/{picom.nix => picom/default.nix} (100%) rename home-manager/sajenim/features/games/{mangohud.nix => mangohud/default.nix} (100%) create mode 100644 nixos/common/global/secrets/rekeyed/viridian/6a42b0ee68528ea2bb7263365d822efd-paperless-ngx.age rename nixos/common/optional/{key.nix => yubikey.nix} (100%) delete mode 100644 nixos/fuchsia/programs/default.nix rename nixos/fuchsia/services/{amdgpu-clocks.nix => amdgpu-clocks/default.nix} (100%) delete mode 100644 nixos/fuchsia/services/default.nix rename nixos/fuchsia/services/{flatpak.nix => flatpak/default.nix} (100%) rename nixos/fuchsia/services/{libinput.nix => libinput/default.nix} (100%) rename nixos/fuchsia/services/{ollama.nix => ollama/default.nix} (100%) rename nixos/fuchsia/services/{printer => printers}/default.nix (100%) rename nixos/fuchsia/services/{printer => printers}/lw5xl.nix (100%) rename nixos/fuchsia/services/{printer => printers}/lw5xl.ppd (100%) rename nixos/fuchsia/services/{printer => printers}/raster2dymolw_v2 (100%) rename nixos/fuchsia/services/{udev.nix => udev/default.nix} (100%) rename nixos/fuchsia/services/{xserver.nix => xserver/default.nix} (100%) delete mode 100644 nixos/viridian/containers/default.nix rename nixos/viridian/containers/{jellyfin.nix => jellyfin/default.nix} (100%) rename nixos/viridian/containers/{jellyseerr.nix => jellyseerr/default.nix} (100%) rename nixos/viridian/containers/{lidarr.nix => lidarr/default.nix} (100%) rename nixos/viridian/containers/{mealie.nix => mealie/default.nix} (100%) rename nixos/viridian/containers/{prowlarr.nix => prowlarr/default.nix} (100%) rename nixos/viridian/containers/{qbittorrent.nix => qbittorrent/default.nix} (100%) rename nixos/viridian/containers/{radarr.nix => radarr/default.nix} (100%) rename nixos/viridian/containers/{recyclarr.nix => recyclarr/default.nix} (100%) rename nixos/viridian/containers/{sonarr.nix => sonarr/default.nix} (100%) delete mode 100644 nixos/viridian/programs/default.nix rename nixos/viridian/services/{borgbackup.nix => borgbackup/default.nix} (100%) delete mode 100644 nixos/viridian/services/default.nix rename nixos/viridian/services/{forgejo.nix => forgejo/default.nix} (100%) rename nixos/viridian/services/{grafana.nix => grafana/default.nix} (100%) rename nixos/viridian/services/{lighttpd.nix => lighttpd/default.nix} (100%) rename nixos/viridian/services/{mpd.nix => mpd/default.nix} (100%) rename nixos/viridian/services/{mysql.nix => mysql/default.nix} (100%) create mode 100644 nixos/viridian/services/paperless-ngx/default.nix create mode 100644 nixos/viridian/services/paperless-ngx/password.age rename nixos/viridian/services/{prometheus.nix => prometheus/default.nix} (100%) rename nixos/viridian/services/{samba.nix => samba/default.nix} (100%) diff --git a/home-manager/sajenim/features/cli/default.nix b/home-manager/sajenim/features/cli/default.nix index 16f4aff..555d138 100644 --- a/home-manager/sajenim/features/cli/default.nix +++ b/home-manager/sajenim/features/cli/default.nix @@ -1,14 +1,10 @@ -{pkgs, ...}: { +{...}: { imports = [ ./git.nix ./nvim.nix ./zsh.nix ]; - home.packages = with pkgs; [ - lazygit - ]; - programs.ssh = { enable = true; matchBlocks."viridian" = { diff --git a/home-manager/sajenim/features/cli/git.nix b/home-manager/sajenim/features/cli/git.nix index 705c89c..202344e 100644 --- a/home-manager/sajenim/features/cli/git.nix +++ b/home-manager/sajenim/features/cli/git.nix @@ -1,8 +1,4 @@ -{pkgs, ...}: { - home.packages = with pkgs; [ - lazygit - ]; - +{...}: { programs.git = { enable = true; userName = "jasmine"; diff --git a/home-manager/sajenim/features/desktop/default.nix b/home-manager/sajenim/features/desktop/default.nix index adbbfa0..6cd0a7a 100644 --- a/home-manager/sajenim/features/desktop/default.nix +++ b/home-manager/sajenim/features/desktop/default.nix @@ -5,19 +5,19 @@ }: { imports = [ ./discord + ./dunst + ./email + ./irc + ./mpd + ./picom ./rofi ./wezterm - - ./email.nix - ./irc.nix - ./mpd.nix - ./picom.nix ]; home.packages = with pkgs; [ feh - xmobar - xmonad + xmobar # custom build using xmobar-config + xmonad # custom build using xmonad-config ]; home.file = { diff --git a/home-manager/sajenim/features/desktop/dunst/default.nix b/home-manager/sajenim/features/desktop/dunst/default.nix new file mode 100644 index 0000000..39fb00d --- /dev/null +++ b/home-manager/sajenim/features/desktop/dunst/default.nix @@ -0,0 +1,31 @@ +{...}: { + services.dunst = { + enable = true; + settings = { + global = { + width = 300; + height = 300; + origin = "top-right"; + offset = "20x20"; + frame_width = 5; + frame_color = "#282828"; + corner_radius = 10; + }; + + urgency_low = { + background = "#1d2021"; + foreground = "#d4be98"; + }; + + urgency_normal = { + background = "#1d2021"; + foreground = "#d4be98"; + }; + + urgency_critical = { + background = "#1d2021"; + foreground = "#d4be98"; + }; + }; + }; +} diff --git a/home-manager/sajenim/features/desktop/email.nix b/home-manager/sajenim/features/desktop/email/default.nix similarity index 100% rename from home-manager/sajenim/features/desktop/email.nix rename to home-manager/sajenim/features/desktop/email/default.nix diff --git a/home-manager/sajenim/features/desktop/irc.nix b/home-manager/sajenim/features/desktop/irc/default.nix similarity index 100% rename from home-manager/sajenim/features/desktop/irc.nix rename to home-manager/sajenim/features/desktop/irc/default.nix diff --git a/home-manager/sajenim/features/desktop/mpd.nix b/home-manager/sajenim/features/desktop/mpd/default.nix similarity index 100% rename from home-manager/sajenim/features/desktop/mpd.nix rename to home-manager/sajenim/features/desktop/mpd/default.nix diff --git a/home-manager/sajenim/features/desktop/picom.nix b/home-manager/sajenim/features/desktop/picom/default.nix similarity index 100% rename from home-manager/sajenim/features/desktop/picom.nix rename to home-manager/sajenim/features/desktop/picom/default.nix diff --git a/home-manager/sajenim/features/desktop/wezterm/default.nix b/home-manager/sajenim/features/desktop/wezterm/default.nix index 052768a..b7ff737 100644 --- a/home-manager/sajenim/features/desktop/wezterm/default.nix +++ b/home-manager/sajenim/features/desktop/wezterm/default.nix @@ -1,5 +1,5 @@ {pkgs, ...}: { - home.packages = with pkgs.unstable; [ + home.packages = with pkgs; [ wezterm ]; diff --git a/home-manager/sajenim/features/desktop/xinitrc b/home-manager/sajenim/features/desktop/xinitrc index 2ac33e2..421f92a 100644 --- a/home-manager/sajenim/features/desktop/xinitrc +++ b/home-manager/sajenim/features/desktop/xinitrc @@ -6,6 +6,9 @@ xrandr --output HDMI-A-0 --mode 1920x1080 --output DisplayPort-0 --mode 2560x144 # Apply our wallpaper feh --bg-center ~/.repositories/dotfiles.nix/assets/chinatown.png +# Start our notification daemon +dunst & + # Enable our compositor picom -b diff --git a/home-manager/sajenim/features/games/default.nix b/home-manager/sajenim/features/games/default.nix index ae96cc2..dfa126f 100644 --- a/home-manager/sajenim/features/games/default.nix +++ b/home-manager/sajenim/features/games/default.nix @@ -1,6 +1,6 @@ {pkgs, ...}: { imports = [ - ./mangohud.nix + ./mangohud ]; home = { diff --git a/home-manager/sajenim/features/games/mangohud.nix b/home-manager/sajenim/features/games/mangohud/default.nix similarity index 100% rename from home-manager/sajenim/features/games/mangohud.nix rename to home-manager/sajenim/features/games/mangohud/default.nix diff --git a/home-manager/sajenim/features/printing/default.nix b/home-manager/sajenim/features/printing/default.nix index 3b11048..ee0c100 100644 --- a/home-manager/sajenim/features/printing/default.nix +++ b/home-manager/sajenim/features/printing/default.nix @@ -1,11 +1,11 @@ {pkgs, ...}: { home = { packages = with pkgs; [ - blender - freecad - kicad - openscad - unstable.prusa-slicer + unstable.blender + freecad # https://discourse.nixos.org/t/error-hash-mismatch-in-fixed-output-derivation/52353 + unstable.kicad + unstable.openscad + prusa-slicer # Some error idk fix this later ]; }; } diff --git a/nixos/common/global/secrets/rekeyed/viridian/6a42b0ee68528ea2bb7263365d822efd-paperless-ngx.age b/nixos/common/global/secrets/rekeyed/viridian/6a42b0ee68528ea2bb7263365d822efd-paperless-ngx.age new file mode 100644 index 0000000..91b10a6 --- /dev/null +++ b/nixos/common/global/secrets/rekeyed/viridian/6a42b0ee68528ea2bb7263365d822efd-paperless-ngx.age @@ -0,0 +1,8 @@ +age-encryption.org/v1 +-> ssh-ed25519 KTkZog kwtoXue2ljAqDtAytalA3SPoVfzGmnB7dkyKOTKr1jI +NtMmHhdpuCcsfeq2IyUmMBgyKid8qn+y3DPh0ykGq0c +-> b#-grease NK 6\>t2sl 1OA +ythv/6KoFWwpe2Wpj9MKcdhtdlq43V+lEiG2QF6gE1rj+k38jev00MuQUHfTS9bw +Xc6ZydroPWPjqnQkvN4u4kzf4X8 +--- /HrB0xueHcV6Vc3dOdMaGnkMBFIwHSd7E0W2QPVTsKM +{^?{miх9Y墓HYr7T=*0w)1C+ \ No newline at end of file diff --git a/nixos/common/optional/key.nix b/nixos/common/optional/yubikey.nix similarity index 100% rename from nixos/common/optional/key.nix rename to nixos/common/optional/yubikey.nix diff --git a/nixos/fuchsia/configuration.nix b/nixos/fuchsia/configuration.nix index d0a50e9..e1d19e0 100644 --- a/nixos/fuchsia/configuration.nix +++ b/nixos/fuchsia/configuration.nix @@ -2,15 +2,23 @@ imports = [ # Global configuartion for all our systems ../common/global + # Our user configuration and optional user units ../common/users/sajenim ../common/users/sajenim/samba ../common/users/sajenim/steam + # Optional components - ../common/optional/key.nix - # Programs and services - ./programs - ./services + ../common/optional/yubikey.nix + + # Services + ./services/amdgpu-clocks + ./services/flatpak + ./services/libinput + ./services/printers + ./services/udev + ./services/xserver + # Setup our hardware ./hardware-configuration.nix ]; @@ -21,7 +29,22 @@ networkmanager.enable = true; }; - # Use docker instead of podman for our containers. + # Configure programs + programs = { + zsh.enable = true; + # Load and unload environment variables. + direnv.enable = true; + # Android debug bridge: communicate with devices. + adb.enable = true; + }; + + # Configure services + services = { + # Access smart cards using SCard API + pcscd.enable = true; + }; + + # Manage linux containers virtualisation.docker = { enable = true; liveRestore = false; diff --git a/nixos/fuchsia/programs/default.nix b/nixos/fuchsia/programs/default.nix deleted file mode 100644 index d22ced8..0000000 --- a/nixos/fuchsia/programs/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{...}: { - programs = { - zsh.enable = true; - # Load and unload environment variables. - direnv.enable = true; - # Android debug bridge: communicate with devices. - adb.enable = true; - }; -} diff --git a/nixos/fuchsia/services/amdgpu-clocks.nix b/nixos/fuchsia/services/amdgpu-clocks/default.nix similarity index 100% rename from nixos/fuchsia/services/amdgpu-clocks.nix rename to nixos/fuchsia/services/amdgpu-clocks/default.nix diff --git a/nixos/fuchsia/services/default.nix b/nixos/fuchsia/services/default.nix deleted file mode 100644 index fdf554a..0000000 --- a/nixos/fuchsia/services/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{...}: { - imports = [ - ./printer - ./amdgpu-clocks.nix - ./flatpak.nix - ./libinput.nix - ./udev.nix - ./xserver.nix - ]; - - # Enable a few extra services. - services = { - pcscd.enable = true; - }; -} diff --git a/nixos/fuchsia/services/flatpak.nix b/nixos/fuchsia/services/flatpak/default.nix similarity index 100% rename from nixos/fuchsia/services/flatpak.nix rename to nixos/fuchsia/services/flatpak/default.nix diff --git a/nixos/fuchsia/services/libinput.nix b/nixos/fuchsia/services/libinput/default.nix similarity index 100% rename from nixos/fuchsia/services/libinput.nix rename to nixos/fuchsia/services/libinput/default.nix diff --git a/nixos/fuchsia/services/ollama.nix b/nixos/fuchsia/services/ollama/default.nix similarity index 100% rename from nixos/fuchsia/services/ollama.nix rename to nixos/fuchsia/services/ollama/default.nix diff --git a/nixos/fuchsia/services/printer/default.nix b/nixos/fuchsia/services/printers/default.nix similarity index 100% rename from nixos/fuchsia/services/printer/default.nix rename to nixos/fuchsia/services/printers/default.nix diff --git a/nixos/fuchsia/services/printer/lw5xl.nix b/nixos/fuchsia/services/printers/lw5xl.nix similarity index 100% rename from nixos/fuchsia/services/printer/lw5xl.nix rename to nixos/fuchsia/services/printers/lw5xl.nix diff --git a/nixos/fuchsia/services/printer/lw5xl.ppd b/nixos/fuchsia/services/printers/lw5xl.ppd similarity index 100% rename from nixos/fuchsia/services/printer/lw5xl.ppd rename to nixos/fuchsia/services/printers/lw5xl.ppd diff --git a/nixos/fuchsia/services/printer/raster2dymolw_v2 b/nixos/fuchsia/services/printers/raster2dymolw_v2 similarity index 100% rename from nixos/fuchsia/services/printer/raster2dymolw_v2 rename to nixos/fuchsia/services/printers/raster2dymolw_v2 diff --git a/nixos/fuchsia/services/udev.nix b/nixos/fuchsia/services/udev/default.nix similarity index 100% rename from nixos/fuchsia/services/udev.nix rename to nixos/fuchsia/services/udev/default.nix diff --git a/nixos/fuchsia/services/xserver.nix b/nixos/fuchsia/services/xserver/default.nix similarity index 100% rename from nixos/fuchsia/services/xserver.nix rename to nixos/fuchsia/services/xserver/default.nix diff --git a/nixos/viridian/configuration.nix b/nixos/viridian/configuration.nix index ecf2ffb..8690b8a 100644 --- a/nixos/viridian/configuration.nix +++ b/nixos/viridian/configuration.nix @@ -2,13 +2,37 @@ imports = [ # Global configuration for all our systems ../common/global + # Our user configuration and optional user units ../common/users/sajenim ../common/users/spectre - # Programs and services - ./programs - ./services - ./containers + + # Containers + ./containers/jellyfin + ./containers/jellyseerr + ./containers/lidarr + ./containers/mealie + ./containers/microbin + ./containers/prowlarr + ./containers/qbittorrent + ./containers/radarr + ./containers/recyclarr + ./containers/sonarr + + # Services + ./services/borgbackup + ./services/crowdsec + ./services/forgejo + ./services/grafana + ./services/lighttpd + ./services/minecraft + ./services/mpd + ./services/mysql + ./services/paperless-ngx + ./services/prometheus + ./services/samba + ./services/traefik + # Setup our hardware ./hardware-configuration.nix ]; @@ -21,26 +45,26 @@ enable = true; allowPing = true; allowedTCPPorts = [ - 53 # adguardhome (DNS) - 80 # traefik (HTTP) - 443 # traefik (HTTPS) - 32372 # qbittorrent - 6600 # mpd - ]; - allowedUDPPorts = [ - 53 # adguardhome (DNS) - 80 # traefik (HTTP) - 443 # traefik (HTTPS) - 32372 # qbittorrent - 6600 # mpd + 80 + 443 + 6600 ]; }; }; - # Use docker instead of podman for our containers. - virtualisation.docker = { - enable = true; - liveRestore = false; + # Configure programs + programs = { + zsh.enable = true; + }; + + # Manage linux containers + virtualisation = { + docker = { + enable = true; + liveRestore = false; + }; + # Implementation to use for containers + oci-containers.backend = "docker"; }; # Required for smooth remote deployments diff --git a/nixos/viridian/containers/default.nix b/nixos/viridian/containers/default.nix deleted file mode 100644 index 433c9ba..0000000 --- a/nixos/viridian/containers/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{...}: { - imports = [ - ./jellyfin.nix - ./jellyseerr.nix - ./lidarr.nix - ./prowlarr.nix - ./qbittorrent.nix - ./radarr.nix - ./recyclarr.nix - ./sonarr.nix - ./mealie.nix - ./microbin - ]; - virtualisation.oci-containers.backend = "docker"; -} diff --git a/nixos/viridian/containers/jellyfin.nix b/nixos/viridian/containers/jellyfin/default.nix similarity index 100% rename from nixos/viridian/containers/jellyfin.nix rename to nixos/viridian/containers/jellyfin/default.nix diff --git a/nixos/viridian/containers/jellyseerr.nix b/nixos/viridian/containers/jellyseerr/default.nix similarity index 100% rename from nixos/viridian/containers/jellyseerr.nix rename to nixos/viridian/containers/jellyseerr/default.nix diff --git a/nixos/viridian/containers/lidarr.nix b/nixos/viridian/containers/lidarr/default.nix similarity index 100% rename from nixos/viridian/containers/lidarr.nix rename to nixos/viridian/containers/lidarr/default.nix diff --git a/nixos/viridian/containers/mealie.nix b/nixos/viridian/containers/mealie/default.nix similarity index 100% rename from nixos/viridian/containers/mealie.nix rename to nixos/viridian/containers/mealie/default.nix diff --git a/nixos/viridian/containers/prowlarr.nix b/nixos/viridian/containers/prowlarr/default.nix similarity index 100% rename from nixos/viridian/containers/prowlarr.nix rename to nixos/viridian/containers/prowlarr/default.nix diff --git a/nixos/viridian/containers/qbittorrent.nix b/nixos/viridian/containers/qbittorrent/default.nix similarity index 100% rename from nixos/viridian/containers/qbittorrent.nix rename to nixos/viridian/containers/qbittorrent/default.nix diff --git a/nixos/viridian/containers/radarr.nix b/nixos/viridian/containers/radarr/default.nix similarity index 100% rename from nixos/viridian/containers/radarr.nix rename to nixos/viridian/containers/radarr/default.nix diff --git a/nixos/viridian/containers/recyclarr.nix b/nixos/viridian/containers/recyclarr/default.nix similarity index 100% rename from nixos/viridian/containers/recyclarr.nix rename to nixos/viridian/containers/recyclarr/default.nix diff --git a/nixos/viridian/containers/sonarr.nix b/nixos/viridian/containers/sonarr/default.nix similarity index 100% rename from nixos/viridian/containers/sonarr.nix rename to nixos/viridian/containers/sonarr/default.nix diff --git a/nixos/viridian/programs/default.nix b/nixos/viridian/programs/default.nix deleted file mode 100644 index 6521102..0000000 --- a/nixos/viridian/programs/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -{...}: { - programs = { - zsh.enable = true; - }; -} diff --git a/nixos/viridian/services/borgbackup.nix b/nixos/viridian/services/borgbackup/default.nix similarity index 100% rename from nixos/viridian/services/borgbackup.nix rename to nixos/viridian/services/borgbackup/default.nix diff --git a/nixos/viridian/services/default.nix b/nixos/viridian/services/default.nix deleted file mode 100644 index 148afef..0000000 --- a/nixos/viridian/services/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{...}: { - imports = [ - ./traefik - ./crowdsec - ./minecraft - ./borgbackup.nix - ./forgejo.nix - ./lighttpd.nix - ./mpd.nix - ./samba.nix - ./grafana.nix - ./mysql.nix - ./prometheus.nix - ]; -} diff --git a/nixos/viridian/services/forgejo.nix b/nixos/viridian/services/forgejo/default.nix similarity index 100% rename from nixos/viridian/services/forgejo.nix rename to nixos/viridian/services/forgejo/default.nix diff --git a/nixos/viridian/services/grafana.nix b/nixos/viridian/services/grafana/default.nix similarity index 100% rename from nixos/viridian/services/grafana.nix rename to nixos/viridian/services/grafana/default.nix diff --git a/nixos/viridian/services/lighttpd.nix b/nixos/viridian/services/lighttpd/default.nix similarity index 100% rename from nixos/viridian/services/lighttpd.nix rename to nixos/viridian/services/lighttpd/default.nix diff --git a/nixos/viridian/services/mpd.nix b/nixos/viridian/services/mpd/default.nix similarity index 100% rename from nixos/viridian/services/mpd.nix rename to nixos/viridian/services/mpd/default.nix diff --git a/nixos/viridian/services/mysql.nix b/nixos/viridian/services/mysql/default.nix similarity index 100% rename from nixos/viridian/services/mysql.nix rename to nixos/viridian/services/mysql/default.nix diff --git a/nixos/viridian/services/paperless-ngx/default.nix b/nixos/viridian/services/paperless-ngx/default.nix new file mode 100644 index 0000000..9a3826a --- /dev/null +++ b/nixos/viridian/services/paperless-ngx/default.nix @@ -0,0 +1,37 @@ +{config, ...}: let + dir = "/srv/services/paperless-ngx"; +in { + age.secrets.paperless-ngx = { + rekeyFile = ./password.age; + }; + + services.paperless = { + enable = true; + port = 28981; + dataDir = "${dir}"; + mediaDir = "${dir}/media"; + settings = { + PAPERLESS_ADMIN_USER = "sajenim"; + }; + passwordFile = config.age.secrets.paperless-ngx.path; + }; + + services.traefik.dynamicConfigOptions.http.routers = { + paperless-ngx = { + rule = "Host(`docs.kanto.dev`)"; + entryPoints = [ + "websecure" + ]; + middlewares = [ + "internal" + ]; + service = "paperless-ngx"; + }; + }; + + services.traefik.dynamicConfigOptions.http.services = { + paperless-ngx.loadBalancer.servers = [ + {url = "http://127.0.0.1:${toString config.services.paperless.port}";} + ]; + }; +} diff --git a/nixos/viridian/services/paperless-ngx/password.age b/nixos/viridian/services/paperless-ngx/password.age new file mode 100644 index 0000000..3d85b8d --- /dev/null +++ b/nixos/viridian/services/paperless-ngx/password.age @@ -0,0 +1,8 @@ +age-encryption.org/v1 +-> piv-p256 hdSnGw A4P0oT5qK/bG8ieEixFW/SCouhantxg3dSjiGG1MEuns +cDorIZ44RmsUsiiybnr1y8WZtv/3kFPi86QkpGURqTY +-> FNP4c-grease +LThbpY1sc7XzQgputWt3ULuLwemBilYrOEZMTAj+/xkxyQg5HwSIhBS1XYzvMc2K +ld/o3JfDaXVLEz0Vk59TClXeOGITp7Ki +--- 572BrDug9qmAG7G0mC5bOZ/h1UD4y2m1ceDhy1qQh3U +/vؑk)hx^QyAeK}lg~k> l*p \ No newline at end of file diff --git a/nixos/viridian/services/prometheus.nix b/nixos/viridian/services/prometheus/default.nix similarity index 100% rename from nixos/viridian/services/prometheus.nix rename to nixos/viridian/services/prometheus/default.nix diff --git a/nixos/viridian/services/samba.nix b/nixos/viridian/services/samba/default.nix similarity index 100% rename from nixos/viridian/services/samba.nix rename to nixos/viridian/services/samba/default.nix