diff --git a/bootable/common.nix b/bootable/common.nix index ea11b34..6d87d98 100644 --- a/bootable/common.nix +++ b/bootable/common.nix @@ -4,6 +4,7 @@ loader.timeout = 0; }; environment.systemPackages = with pkgs; [ + cryptsetup ddrescue efibootmgr hdparm diff --git a/common.nix b/common.nix index 7a13d71..a0bc031 100644 --- a/common.nix +++ b/common.nix @@ -22,7 +22,6 @@ }; environment.systemPackages = with pkgs; [ _7zz - cryptsetup file gptfdisk jq diff --git a/desktop/configuration.nix b/desktop/configuration.nix index 7cc6e6d..57fd4e2 100644 --- a/desktop/configuration.nix +++ b/desktop/configuration.nix @@ -11,7 +11,6 @@ binutils binwalk exfat - nixfmt-tree qemu qrencode ]; @@ -67,12 +66,7 @@ pulse.enable = true; }; tuned.enable = true; - upower = { - allowRiskyCriticalPowerAction = true; - criticalPowerAction = "Suspend"; - enable = true; - percentageCritical = 10; - }; + upower.enable = true; }; sops = { secrets = { diff --git a/desktop/hardware.nix b/desktop/hardware.nix index 55b58f6..6a334d5 100644 --- a/desktop/hardware.nix +++ b/desktop/hardware.nix @@ -14,11 +14,10 @@ kernelParams = [ "ttm.pages_limit=3014656" ]; }; fileSystems."/boot".device = "/dev/disk/by-uuid/2610-A769"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; swapDevices = [ { device = "/var/lib/swapfile"; - size = 15 * 1024; + size = 15360; } ]; } diff --git a/desktop/mods/pxeboot.nix b/desktop/mods/pxeboot.nix index 317f751..22cb44e 100644 --- a/desktop/mods/pxeboot.nix +++ b/desktop/mods/pxeboot.nix @@ -94,8 +94,7 @@ cd ${config.boot.kernelPackages.kernel.modules}/lib/modules/*/kernel/drivers/net/ethernet find -type f | sed 's/^.*\/\([^.]*\).*$/ "\1"/' | sort printf ' ];\n}\n') > /etc/nixos/bootable/ethernet.nix - nixos-install --flake "/etc/nixos#nixos-bootpxe" \ - --no-channel-copy --no-root-passwd --root /srv/pxe/nixos + nixos-install --flake "/etc/nixos#nixos-bootpxe" --no-root-passwd --root /srv/pxe/nixos ''; }; }; diff --git a/flake.nix b/flake.nix index 3a00ff4..55a6ce2 100644 --- a/flake.nix +++ b/flake.nix @@ -19,12 +19,9 @@ }: { formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-tree; - nixosConfigurations = { - nixos-bootdrive = nixpkgs.lib.nixosSystem { modules = [ ./bootable/drive.nix ]; }; - nixos-bootpxe = nixpkgs.lib.nixosSystem { modules = [ ./bootable/pxe.nix ]; }; - nixos-desktop = nixpkgs.lib.nixosSystem { - modules = [ - ./desktop/configuration.nix + nixosConfigurations = + let + hostMods = users: [ home-manager.nixosModules.home-manager { home-manager = { @@ -32,29 +29,22 @@ useGlobalPkgs = true; useUserPackages = true; users = { - bogale = ./home/bogale.nix; root = ./home/root.nix; - }; + } + // users; }; } sops-nix.nixosModules.sops ]; + makeSystem = modules: nixpkgs.lib.nixosSystem { inherit modules; }; + in + { + nixos-bootdrive = makeSystem [ ./bootable/drive.nix ]; + nixos-bootpxe = makeSystem [ ./bootable/pxe.nix ]; + nixos-desktop = makeSystem ( + [ ./desktop/configuration.nix ] ++ hostMods { bogale = ./home/bogale.nix; } + ); + nixos-server = makeSystem ([ ./server/configuration.nix ] ++ hostMods { }); }; - nixos-server = nixpkgs.lib.nixosSystem { - modules = [ - ./server/configuration.nix - home-manager.nixosModules.home-manager - { - home-manager = { - extraSpecialArgs = { inherit inputs; }; - useGlobalPkgs = true; - useUserPackages = true; - users.root = ./home/root.nix; - }; - } - sops-nix.nixosModules.sops - ]; - }; - }; }; } diff --git a/home/bogale.nix b/home/bogale.nix index 1906800..15a8822 100644 --- a/home/bogale.nix +++ b/home/bogale.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: { +{ pkgs, ... }: { dconf.settings."org/gnome/desktop/interface".gtk-enable-primary-paste = true; gtk = { colorScheme = "dark"; @@ -8,7 +8,6 @@ homeDirectory = "/home/bogale"; packages = with pkgs; [ alacritty - bibata-cursors bluez ffmpeg-headless heroic @@ -38,14 +37,11 @@ }; imports = [ ./common.nix ]; programs = { - bash = { - initExtra = '' - session() { - sudo machinectl shell root@ - } - ''; - sessionVariables.TTS_MODEL = "ggml-org/Qwen3-TTS-12Hz-1.7B-Base-GGUF"; - }; + bash.initExtra = '' + session() { + sudo machinectl shell root@ + } + ''; noctalia = { enable = true; settings = ./mods/noctalia.toml; diff --git a/home/common.nix b/home/common.nix index 7002c4d..9590f0c 100644 --- a/home/common.nix +++ b/home/common.nix @@ -1,8 +1,8 @@ -{ config, pkgs, ... }: { +{ pkgs, ... }: { home = { - packages = [ - pkgs.ncdu - pkgs.yt-dlp + packages = with pkgs; [ + ncdu + yt-dlp ]; stateVersion = "26.11"; }; diff --git a/home/mods/niri.kdl b/home/mods/niri.kdl index f019a95..fa48f89 100644 --- a/home/mods/niri.kdl +++ b/home/mods/niri.kdl @@ -1,74 +1,74 @@ binds { - Alt+Print { screenshot-window; }; - Ctrl+Print { screenshot-screen; }; - Mod+Ctrl+H { focus-monitor-left; }; - Mod+Ctrl+J { focus-monitor-down; }; - Mod+Ctrl+K { focus-monitor-up; }; - Mod+Ctrl+L { focus-monitor-right; }; - Mod+Ctrl+Shift+H { move-column-to-monitor-left; }; - Mod+Ctrl+Shift+J { move-column-to-monitor-down; }; - Mod+Ctrl+Shift+K { move-column-to-monitor-up; }; - Mod+Ctrl+Shift+L { move-column-to-monitor-right; }; - Mod+D { spawn-sh "noctalia msg panel-toggle launcher"; }; - Mod+E { spawn-sh "noctalia msg panel-toggle session"; }; - Mod+F { maximize-column; }; - Mod+H { focus-column-left; }; - Mod+J { focus-window-or-workspace-down; }; - Mod+K { focus-window-or-workspace-up; }; - Mod+L { focus-column-right; }; - Mod+O { toggle-overview; }; - Mod+Q { close-window; }; - Mod+S { spawn-sh "noctalia msg panel-toggle control-center"; }; - Mod+Shift+F { fullscreen-window; }; - Mod+Shift+H { move-column-left; }; - Mod+Shift+J { move-window-down-or-to-workspace-down; }; - Mod+Shift+K { move-window-up-or-to-workspace-up; }; - Mod+Shift+L { move-column-right; }; - Mod+Shift+P { power-off-monitors; }; - Mod+Shift+S { spawn-sh "noctalia msg settings-open"; }; - Mod+T { spawn "alacritty"; }; - Print { screenshot; }; - Shift+XF86AudioLowerVolume { spawn-sh "noctalia msg mic-volume-down"; }; - Shift+XF86AudioMute { spawn-sh "noctalia msg mic-mute"; }; - Shift+XF86AudioRaiseVolume { spawn-sh "noctalia msg mic-volume-up"; }; - XF86AudioLowerVolume { spawn-sh "noctalia msg volume-down"; }; - XF86AudioMute { spawn-sh "noctalia msg volume-mute"; }; - XF86AudioRaiseVolume { spawn-sh "noctalia msg volume-up"; }; - XF86MonBrightnessDown { spawn-sh "noctalia msg brightness-down"; }; - XF86MonBrightnessUp { spawn-sh "noctalia msg brightness-up"; }; + Alt+Print { screenshot-window; }; + Ctrl+Print { screenshot-screen; }; + Mod+Ctrl+H { focus-monitor-left; }; + Mod+Ctrl+J { focus-monitor-down; }; + Mod+Ctrl+K { focus-monitor-up; }; + Mod+Ctrl+L { focus-monitor-right; }; + Mod+Ctrl+Shift+H { move-column-to-monitor-left; }; + Mod+Ctrl+Shift+J { move-column-to-monitor-down; }; + Mod+Ctrl+Shift+K { move-column-to-monitor-up; }; + Mod+Ctrl+Shift+L { move-column-to-monitor-right; }; + Mod+D { spawn-sh "noctalia msg panel-toggle launcher"; }; + Mod+E { spawn-sh "noctalia msg panel-toggle session"; }; + Mod+F { maximize-column; }; + Mod+H { focus-column-left; }; + Mod+J { focus-window-or-workspace-down; }; + Mod+K { focus-window-or-workspace-up; }; + Mod+L { focus-column-right; }; + Mod+O { toggle-overview; }; + Mod+Q { close-window; }; + Mod+S { spawn-sh "noctalia msg panel-toggle control-center"; }; + Mod+Shift+F { fullscreen-window; }; + Mod+Shift+H { move-column-left; }; + Mod+Shift+J { move-window-down-or-to-workspace-down; }; + Mod+Shift+K { move-window-up-or-to-workspace-up; }; + Mod+Shift+L { move-column-right; }; + Mod+Shift+S { spawn-sh "noctalia msg settings-open"; }; + Mod+T { spawn "alacritty"; }; + Print { screenshot; }; + Shift+XF86AudioLowerVolume { spawn-sh "noctalia msg mic-volume-down"; }; + Shift+XF86AudioMute { spawn-sh "noctalia msg mic-mute"; }; + Shift+XF86AudioRaiseVolume { spawn-sh "noctalia msg mic-volume-up"; }; + XF86AudioLowerVolume { spawn-sh "noctalia msg volume-down"; }; + XF86AudioMute { spawn-sh "noctalia msg volume-mute"; }; + XF86AudioRaiseVolume { spawn-sh "noctalia msg volume-up"; }; + XF86MonBrightnessDown { spawn-sh "noctalia msg brightness-down"; }; + XF86MonBrightnessUp { spawn-sh "noctalia msg brightness-up"; }; }; cursor { - xcursor-size 24; - xcursor-theme "Bibata-Modern-Amber"; + xcursor-size 24; + xcursor-theme "Bibata-Modern-Amber"; }; gestures { hot-corners { off; }; }; hotkey-overlay { skip-at-startup; }; include "./noctalia.kdl"; input { - keyboard { - numlock; - xkb { - layout "us,ru"; - options "grp:alt_shift_toggle"; - }; - }; - touchpad { - dwt; - natural-scroll; - tap; + keyboard { + numlock; + xkb { + layout "us,ru"; + options "grp:alt_shift_toggle"; }; + }; + touchpad { + dwt; + natural-scroll; + tap; + }; }; layout { - center-focused-column "always"; - default-column-width { proportion 0.8; }; + center-focused-column "always"; + default-column-width { proportion 0.8; }; }; screenshot-path "~/Multimedia/Screenshots/%Y-%m-%d_%H-%M-%S.png"; window-rule { - clip-to-geometry true; - geometry-corner-radius 8; - open-floating false; + clip-to-geometry true; + geometry-corner-radius 8; + open-floating false; }; window-rule { - match app-id="mpv"; - open-fullscreen true; + match app-id="Waydroid"; + match app-id="mpv"; + open-fullscreen true; }; diff --git a/home/mods/noctalia.toml b/home/mods/noctalia.toml index 51a1ef5..b035a33 100644 --- a/home/mods/noctalia.toml +++ b/home/mods/noctalia.toml @@ -1,14 +1,14 @@ [bar] order = [ "default" ] - [bar.default] - center = [ "workspaces" ] - enabled = true - end = [ "tray", "keyboard_layout", "battery", "notifications" ] - margin_ends = 0 - start = [ "date", "clock", "sysmon" ] - widget_spacing = 12 - [bar.default.dead_zone.actions] - right = "none" + [bar.default] + center = [ "workspaces" ] + enabled = true + end = [ "tray", "keyboard_layout", "battery", "notifications" ] + margin_ends = 0 + start = [ "date", "clock", "sysmon" ] + widget_spacing = 12 + [bar.default.dead_zone.actions] + right = "none" [[control_center.shortcuts]] type = "wifi" [[control_center.shortcuts]] @@ -16,21 +16,21 @@ type = "bluetooth" [[control_center.shortcuts]] type = "caffeine" [[control_center.shortcuts]] -type = "notification" +type = "system" [[control_center.shortcuts]] type = "power_profile" [[control_center.shortcuts]] -type = "weather" +type = "screen_time" [idle] behavior_order = [ "screen-off", "lock" ] - [idle.behavior.screen-off] - action = "screen_off" - enabled = true - timeout = 300.0 - [idle.behavior.lock] - action = "lock" - enabled = true - timeout = 450.0 + [idle.behavior.screen-off] + action = "screen_off" + enabled = true + timeout = 300.0 + [idle.behavior.lock] + action = "lock" + enabled = true + timeout = 450.0 [location] address = "Chita" [notification] @@ -50,45 +50,45 @@ wifi = false clipboard_enabled = false launch_apps_as_systemd_services = true screen_time_enabled = true - [shell.greeter_sync] - auto_sync = true - [shell.screen_corners] - enabled = true - [[shell.session.actions]] - action = "lock" - countdown_seconds = 0.0 - enabled = true - shortcut = "1" - variant = "default" - [[shell.session.actions]] - action = "command" - command = "systemctl suspend-then-hibernate" - countdown_seconds = 0.0 - enabled = true - glyph = "suspend" - label = "Сон" - shortcut = "2" - variant = "default" - [[shell.session.actions]] - action = "reboot" - countdown_seconds = 0.0 - enabled = true - shortcut = "3" - variant = "default" - [[shell.session.actions]] - action = "shutdown" - countdown_seconds = 0.0 - enabled = true - shortcut = "4" - variant = "default" + [shell.greeter_sync] + auto_sync = true + [shell.screen_corners] + enabled = true + [[shell.session.actions]] + action = "lock" + countdown_seconds = 0.0 + enabled = true + shortcut = "1" + variant = "default" + [[shell.session.actions]] + action = "command" + command = "systemctl suspend-then-hibernate" + countdown_seconds = 0.0 + enabled = true + glyph = "suspend" + label = "Сон" + shortcut = "2" + variant = "default" + [[shell.session.actions]] + action = "reboot" + countdown_seconds = 0.0 + enabled = true + shortcut = "3" + variant = "default" + [[shell.session.actions]] + action = "shutdown" + countdown_seconds = 0.0 + enabled = true + shortcut = "4" + variant = "default" [theme] builtin = "Tokyo-Night" - [theme.templates] - builtin_ids = [ "alacritty", "gtk3", "gtk4", "niri" ] + [theme.templates] + builtin_ids = [ "alacritty", "gtk3", "gtk4", "niri" ] [wallpaper] directory = "/home/bogale/Multimedia/Wallpapers" transition_on_startup = true - [wallpaper.default] - path = "/home/bogale/Multimedia/Wallpapers/main.jpg" + [wallpaper.default] + path = "/home/bogale/Multimedia/Wallpapers/main.jpg" [weather] refresh_minutes = 10 diff --git a/home/root.nix b/home/root.nix index 80e427f..7bb2192 100644 --- a/home/root.nix +++ b/home/root.nix @@ -9,9 +9,9 @@ initExtra = '' awg-gen() { PRIVATE=$(awg genkey) - echo "private: $PRIVATE" printf "public: " echo $PRIVATE | awg pubkey + echo "private: $PRIVATE" printf "preshared: " awg genpsk } diff --git a/mods/host.nix b/mods/host.nix index 65a36d4..d275231 100644 --- a/mods/host.nix +++ b/mods/host.nix @@ -1,4 +1,10 @@ -{ config, pkgs, ... }: { +{ + config, + lib, + pkgs, + ... +}: +{ boot = { extraModulePackages = [ config.boot.kernelPackages.amneziawg ]; kernelModules = [ "amneziawg" ]; @@ -10,6 +16,7 @@ sops ]; fileSystems."/".device = "/dev/mapper/root"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; imports = [ ../common.nix ./fs.nix diff --git a/server/configuration.nix b/server/configuration.nix index 455b061..ffe80da 100644 --- a/server/configuration.nix +++ b/server/configuration.nix @@ -4,6 +4,7 @@ ../mods/host.nix ./hardware.nix ./mods/mail.nix + ./mods/services.nix ./mods/system.nix ./mods/web.nix ]; diff --git a/server/hardware.nix b/server/hardware.nix index fdda095..111fb92 100644 --- a/server/hardware.nix +++ b/server/hardware.nix @@ -16,5 +16,4 @@ ]; }; fileSystems."/boot".device = "/dev/disk/by-uuid/86F4-A8F1"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/server/mods/services.nix b/server/mods/services.nix new file mode 100644 index 0000000..f94cd61 --- /dev/null +++ b/server/mods/services.nix @@ -0,0 +1,94 @@ +{ config, pkgs, ... }: { + services = + let + phpConfig = { + "listen.group" = "nginx"; + "listen.owner" = "nginx"; + "pm" = "ondemand"; + "pm.max_children" = 4; + }; + in + { + forgejo = { + database.type = "postgres"; + enable = true; + settings = { + mailer = { + ENABLED = true; + FROM = "Forgejo "; + SMTP_ADDR = "localhost"; + SMTP_PORT = 25; + }; + server = { + HTTP_ADDR = "/run/forgejo/forgejo.sock"; + PROTOCOL = "http+unix"; + ROOT_URL = "https://bogaledev.ru/git/"; + SSH_PORT = 32831; + }; + service = { + ENABLE_CAPTCHA = true; + REGISTER_EMAIL_CONFIRM = true; + }; + }; + }; + grafana = { + enable = true; + settings = { + database = { + host = "/run/postgresql"; + type = "postgres"; + user = "grafana"; + }; + security.secret_key = "$__file{${config.sops.secrets.grafana-key.path}}"; + server = { + enable_gzip = true; + protocol = "socket"; + root_url = "https://bogaledev.ru/grafana"; + }; + }; + }; + nextcloud = { + config.dbtype = "pgsql"; + database.createLocally = true; + enable = true; + hostName = "nextcloud-local"; + maxUploadSize = "4G"; + poolSettings = phpConfig; + settings = { + overwritewebroot = "/nextcloud"; + trusted_domains = [ + "bogaledev.ru" + "wl.bogaledev.ru" + ]; + }; + }; + phpfpm.pools.php = { + group = "php"; + settings = phpConfig; + user = "php"; + }; + vaultwarden = { + config = { + DOMAIN = "https://bogaledev.ru/vaultwarden/"; + EMERGENCY_ACCESS_ALLOWED = false; + PASSWORD_HINTS_ALLOWED = false; + ROCKET_PORT = 46151; + SIGNUPS_ALLOWED = false; + TRASH_AUTO_DELETE_DAYS = 90; + }; + configurePostgres = true; + dbBackend = "postgresql"; + enable = true; + environmentFile = config.sops.secrets.vaultwarden-env.path; + package = pkgs.vaultwarden-postgresql; + }; + }; + sops.secrets = { + grafana-key = { + group = "grafana"; + mode = "0440"; + restartUnits = [ "grafana.service" ]; + }; + vaultwarden-env.restartUnits = [ "vaultwarden.service" ]; + }; +} diff --git a/server/mods/web.nix b/server/mods/web.nix index e46b755..b45dd2d 100644 --- a/server/mods/web.nix +++ b/server/mods/web.nix @@ -1,179 +1,88 @@ { config, pkgs, ... }: { - services = - let - phpSettings = { - "listen.group" = "nginx"; - "listen.owner" = "nginx"; - "pm" = "ondemand"; - "pm.max_children" = 4; - }; - sslCertDir = config.security.acme.certs."bogaledev.ru".directory; - in - { - forgejo = { - database.type = "postgres"; - enable = true; - settings = { - mailer = { - ENABLED = true; - FROM = "Forgejo "; - SMTP_ADDR = "localhost"; - SMTP_PORT = 25; - }; - server = { - HTTP_ADDR = "/run/forgejo/forgejo.sock"; - PROTOCOL = "http+unix"; - ROOT_URL = "https://bogaledev.ru/git/"; - SSH_PORT = 32831; - }; - service = { - ENABLE_CAPTCHA = true; - REGISTER_EMAIL_CONFIRM = true; - }; - }; - }; - grafana = { - enable = true; - settings = { - database = { - host = "/run/postgresql"; - type = "postgres"; - user = "grafana"; - }; - security.secret_key = "$__file{${config.sops.secrets.grafana-key.path}}"; - server = { - enable_gzip = true; - protocol = "socket"; - root_url = "https://bogaledev.ru/grafana"; - }; - }; - }; - nextcloud = { - config.dbtype = "pgsql"; - database.createLocally = true; - enable = true; - hostName = "nextcloud-local"; - maxUploadSize = "4G"; - poolSettings = phpSettings; - settings = { - overwritewebroot = "/nextcloud"; - trusted_domains = [ - "bogaledev.ru" - "wl.bogaledev.ru" - ]; - }; - }; - nginx = { - clientMaxBodySize = "4G"; - enable = true; - recommendedBrotliSettings = true; - recommendedGzipSettings = true; - recommendedOptimisation = true; - recommendedProxySettings = true; - recommendedTlsSettings = true; - virtualHosts = { - nextcloud-local.listen = [ - { - addr = "localhost"; - port = 45837; - } - ]; - main = - let - localNetworks = '' - allow 10.0.0.0/16; - allow fc00::/64; - deny all; - ''; - phpPool = '' - index index.php index.html; - location ~ \.php$ { - fastcgi_pass unix:${config.services.phpfpm.pools.php.socket}; - } - ''; - in - { - default = true; - extraConfig = '' - add_header Alt-Svc 'h3=":443"; ma=2592000' always; - add_header X-Content-Type-Options 'nosniff' always; - ''; - forceSSL = true; - locations = { - "/".extraConfig = phpPool; - "/git/".proxyPass = "http://unix:/run/forgejo/forgejo.sock:/"; - "/grafana/".proxyPass = "http://unix:/run/grafana/grafana.sock:/"; - "/local/".extraConfig = "${phpPool} ${localNetworks}"; - "/nextcloud/".proxyPass = "http://localhost:45837/"; - "/vaultwarden/" = { - extraConfig = localNetworks; - proxyPass = "http://localhost:46151"; - proxyWebsockets = true; - }; - }; - quic = true; - root = "/srv/http"; - useACMEHost = "bogaledev.ru"; - }; - }; - }; - phpfpm.pools.php = { - group = "php"; - settings = phpSettings; - user = "php"; - }; - postgresql = { - enable = true; - ensureDatabases = [ - "grafana" - "php" + services = { + nginx = { + clientMaxBodySize = "4G"; + enable = true; + recommendedBrotliSettings = true; + recommendedGzipSettings = true; + recommendedOptimisation = true; + recommendedProxySettings = true; + recommendedTlsSettings = true; + virtualHosts = { + nextcloud-local.listen = [ + { + addr = "localhost"; + port = 45837; + } ]; - ensureUsers = + main = let - user = name: { - ensureDBOwnership = true; - inherit name; - }; + localNetworks = '' + allow 10.0.0.0/16; + allow fc00::/64; + deny all; + ''; + phpPool = '' + index index.php index.html; + location ~ \.php$ { + fastcgi_pass unix:${config.services.phpfpm.pools.php.socket}; + } + ''; in - map user [ - "grafana" - "php" - ]; + { + default = true; + extraConfig = '' + add_header Alt-Svc 'h3=":443"; ma=2592000' always; + add_header X-Content-Type-Options 'nosniff' always; + ''; + forceSSL = true; + locations = { + "/".extraConfig = phpPool; + "/git/".proxyPass = "http://unix:/run/forgejo/forgejo.sock:/"; + "/grafana/".proxyPass = "http://unix:/run/grafana/grafana.sock:/"; + "/local/".extraConfig = "${phpPool} ${localNetworks}"; + "/nextcloud/".proxyPass = "http://localhost:45837/"; + "/vaultwarden/" = { + extraConfig = localNetworks; + proxyPass = "http://localhost:46151"; + proxyWebsockets = true; + }; + }; + quic = true; + root = "/srv/http"; + useACMEHost = "bogaledev.ru"; + }; }; - postgresqlBackup = { - compression = "none"; - databases = [ - "forgejo" + }; + postgresql = { + enable = true; + ensureDatabases = [ + "grafana" + "php" + ]; + ensureUsers = + let + user = name: { + ensureDBOwnership = true; + inherit name; + }; + in + map user [ "grafana" - "nextcloud" "php" - "vaultwarden" ]; - enable = true; - startAt = "16:00"; - }; - vaultwarden = { - config = { - DOMAIN = "https://bogaledev.ru/vaultwarden/"; - EMERGENCY_ACCESS_ALLOWED = false; - PASSWORD_HINTS_ALLOWED = false; - ROCKET_PORT = 46151; - SIGNUPS_ALLOWED = false; - TRASH_AUTO_DELETE_DAYS = 90; - }; - configurePostgres = true; - dbBackend = "postgresql"; - enable = true; - environmentFile = config.sops.secrets.vaultwarden-env.path; - package = pkgs.vaultwarden-postgresql; - }; }; - sops.secrets = { - grafana-key = { - group = "grafana"; - mode = "0440"; - restartUnits = [ "grafana.service" ]; + postgresqlBackup = { + compression = "none"; + databases = [ + "forgejo" + "grafana" + "nextcloud" + "php" + "vaultwarden" + ]; + enable = true; + startAt = "16:00"; }; - vaultwarden-env.restartUnits = [ "vaultwarden.service" ]; }; }