From d76bcd0e88686e982fa3cff7c75bc920f6bc89e6 Mon Sep 17 00:00:00 2001 From: Anish L Date: Tue, 26 Apr 2022 20:06:44 +1000 Subject: [PATCH] doing box stuff --- hosts/box/configuration.nix | 2 +- modules/wallabag.nix | 40 ++++++++++++++++-------------- profiles/headphones/default.nix | 4 +-- profiles/mossnet-hosts/default.nix | 16 ++++++------ profiles/nextcloud/default.nix | 15 +++++------ profiles/wireguard-box/default.nix | 38 ++++++++++++++-------------- users/profiles/nvim/default.nix | 2 +- 7 files changed, 60 insertions(+), 57 deletions(-) diff --git a/hosts/box/configuration.nix b/hosts/box/configuration.nix index c18531a3..c093ff59 100644 --- a/hosts/box/configuration.nix +++ b/hosts/box/configuration.nix @@ -65,7 +65,7 @@ }; networking.hostName = "box"; # Define your hostname. - networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # The global useDHCP flag is deprecated, therefore explicitly set to false here. # Per-interface useDHCP will be mandatory in the future, so this generated config diff --git a/modules/wallabag.nix b/modules/wallabag.nix index dda36c14..2ea0dacf 100644 --- a/modules/wallabag.nix +++ b/modules/wallabag.nix @@ -19,7 +19,8 @@ let paths = [ configFile "${cfg.package}/app" ]; }; -in { +in +{ options = { @@ -86,23 +87,23 @@ in { config = mkIf cfg.enable { services.phpfpm.pools."${poolName}" = { - user = "${cfg.user}"; - group = "nginx"; - settings = { - "listen.owner" = "nginx"; - "listen.group" = "nginx"; - "listen.mode" = "0600"; - "user" = "${cfg.user}"; - "group" = "nginx"; - "env[WALLABAG_DATA]" = "${cfg.dataDir}"; - "pm" = "dynamic"; - "pm.max_children" = "75"; - "pm.min_spare_servers" = "5"; - "pm.max_spare_servers" = "20"; - "pm.max_requests" = "10"; - "catch_workers_output" = "1"; - "php_admin_value[error_log]" = "/var/log/nginx/${poolName}-phpfpm-error.log"; - }; + user = "${cfg.user}"; + group = "nginx"; + settings = { + "listen.owner" = "nginx"; + "listen.group" = "nginx"; + "listen.mode" = "0600"; + "user" = "${cfg.user}"; + "group" = "nginx"; + "env[WALLABAG_DATA]" = "${cfg.dataDir}"; + "pm" = "dynamic"; + "pm.max_children" = "75"; + "pm.min_spare_servers" = "5"; + "pm.max_spare_servers" = "20"; + "pm.max_requests" = "10"; + "catch_workers_output" = "1"; + "php_admin_value[error_log]" = "/var/log/nginx/${poolName}-phpfpm-error.log"; + }; }; services.phpfpm.phpOptions = '' max_execution_time = 120 @@ -176,7 +177,7 @@ in { wantedBy = [ "multi-user.target" ]; before = [ "phpfpm-wallabag.service" ]; after = [ "mysql.service" "postgresql.service" ]; - path = with pkgs; [ coreutils php phpPackages.composer ]; + path = with pkgs; [ coreutils php74 php74Packages.composer ]; serviceConfig = { User = cfg.user; @@ -201,6 +202,7 @@ in { export WALLABAG_DATA="${cfg.dataDir}" if [ ! -f installed ]; then + echo "Install file not found, installing ..." php ${cfg.package}/bin/console --env=prod doctrine:database:create --if-not-exists --no-interaction php ${cfg.package}/bin/console --env=prod doctrine:migrations:migrate --no-interaction # Until https://github.com/wallabag/wallabag/issues/3662 is fixed diff --git a/profiles/headphones/default.nix b/profiles/headphones/default.nix index a4211f76..c2d2830c 100644 --- a/profiles/headphones/default.nix +++ b/profiles/headphones/default.nix @@ -1,8 +1,8 @@ -{config, lib, pkgs, ... }: +{ config, lib, pkgs, ... }: { services.headphones = { enable = true; - host = "172.16.11.240"; + host = "192.168.1.240"; port = 8181; user = "headphones"; group = "audio"; diff --git a/profiles/mossnet-hosts/default.nix b/profiles/mossnet-hosts/default.nix index bd3db15a..3f357072 100644 --- a/profiles/mossnet-hosts/default.nix +++ b/profiles/mossnet-hosts/default.nix @@ -1,12 +1,12 @@ { networking.extraHosts = '' - 10.0.69.4 mossnet.lan - 10.0.69.4 links.mossnet.lan - 10.0.69.4 read.mossnet.lan - 10.0.69.4 stats.mossnet.lan + 192.168.1.240 mossnet.lan + 192.168.1.240 links.mossnet.lan + 192.168.1.240 read.mossnet.lan + 192.168.1.240 stats.mossnet.lan ''; - #192.168.1.240 mossnet.lan - #192.168.1.240 links.mossnet.lan - #192.168.1.240 read.mossnet.lan - #192.168.1.240 stats.mossnet.lan + # 10.0.69.4 mossnet.lan + # 10.0.69.4 links.mossnet.lan + # 10.0.69.4 read.mossnet.lan + # 10.0.69.4 stats.mossnet.lan } diff --git a/profiles/nextcloud/default.nix b/profiles/nextcloud/default.nix index 35ff23dd..de039dd1 100644 --- a/profiles/nextcloud/default.nix +++ b/profiles/nextcloud/default.nix @@ -8,11 +8,11 @@ enable = true; hostName = "mossnet.lan"; home = "/data/nextcloud"; - package = pkgs.nextcloud21; + package = pkgs.nextcloud22; # Use HTTPS for links https = false; - + # Auto-update Nextcloud Apps autoUpdateApps.enable = true; # Set what time makes sense for you @@ -41,16 +41,17 @@ # Ensure the database, user, and permissions always exist ensureDatabases = [ "nextcloud" ]; ensureUsers = [ - { name = "nextcloud"; - ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES"; - } + { + name = "nextcloud"; + ensurePermissions."DATABASE nextcloud" = "ALL PRIVILEGES"; + } ]; }; # Ensure that postgres is running before running the setup systemd.services."nextcloud-setup" = { - requires = ["postgresql.service"]; - after = ["postgresql.service"]; + requires = [ "postgresql.service" ]; + after = [ "postgresql.service" ]; }; networking.firewall.allowedTCPPorts = [ 80 443 ]; diff --git a/profiles/wireguard-box/default.nix b/profiles/wireguard-box/default.nix index 55e179aa..56833eba 100644 --- a/profiles/wireguard-box/default.nix +++ b/profiles/wireguard-box/default.nix @@ -31,7 +31,7 @@ #allowedIPs = [ "10.100.0.1" "91.108.12.0/22" ]; # Set this to the server IP and port. - endpoint = "sealight.xyz:60990"; # ToDo: route to endpoint not automatically configured https://wiki.archlinux.org/index.php/WireGuard#Loop_routing https://discourse.nixos.org/t/solved-minimal-firewall-setup-for-wireguard-client/7577 + endpoint = "149.28.163.78:60990"; # ToDo: route to endpoint not automatically configured https://wiki.archlinux.org/index.php/WireGuard#Loop_routing https://discourse.nixos.org/t/solved-minimal-firewall-setup-for-wireguard-client/7577 # Send keepalives every 25 seconds. Important to keep NAT tables alive. persistentKeepalive = 25; @@ -40,22 +40,22 @@ }; }; -# boot.extraModulePackages = with config.boot.kernelPackages; [ wireguard ]; -# environment.systemPackages = [ pkgs.wireguard ]; -# networking.wireguard.enable = true; -# networking.wireguard.interfaces = { -# wg0 = { -# ips = [ "10.0.69.4/32" ]; -# privateKeyFile = "/home/anish/wg/privkey"; -# listenPort = 60990; -# -# peers = [ -# { # helix - server -# publicKey = "{c1J4p63rD3IlszugMZiki7UBV3YmDdqa3DU4UejXzAI=}"; -# allowedIPs = [ "10.0.69.1/24" ]; -# endpoint = "sealight.xyz:60990"; -# persistentKeepalive = 25; -# } ]; -# }; -# }; + # boot.extraModulePackages = with config.boot.kernelPackages; [ wireguard ]; + # environment.systemPackages = [ pkgs.wireguard ]; + # networking.wireguard.enable = true; + # networking.wireguard.interfaces = { + # wg0 = { + # ips = [ "10.0.69.4/32" ]; + # privateKeyFile = "/home/anish/wg/privkey"; + # listenPort = 60990; + # + # peers = [ + # { # helix - server + # publicKey = "{c1J4p63rD3IlszugMZiki7UBV3YmDdqa3DU4UejXzAI=}"; + # allowedIPs = [ "10.0.69.1/24" ]; + # endpoint = "sealight.xyz:60990"; + # persistentKeepalive = 25; + # } ]; + # }; + # }; } diff --git a/users/profiles/nvim/default.nix b/users/profiles/nvim/default.nix index 89831431..a8c2e0e0 100644 --- a/users/profiles/nvim/default.nix +++ b/users/profiles/nvim/default.nix @@ -176,7 +176,7 @@ in " general commands map t :NERDTreeToggle map s :w - map q :wq + map q :q map r :RainbowParenthesesToggleAll map :noh nnoremap Y y$