diff --git a/configs/nixos/forgejo.nix b/configs/nixos/forgejo.nix new file mode 100644 index 0000000..e8a7a53 --- /dev/null +++ b/configs/nixos/forgejo.nix @@ -0,0 +1,41 @@ +{ + inputs, + config, + pkgs, + lib, + ... +}: let + cfg = config.services.forgejo; + srv = cfg.settings.server; +in { + services.forgejo = { + enable = true; + database.type = "sqlite3"; + lfs.enable = true; + settings = { + server = { + DOMAIN = "test.venberg.xyz"; + ROOT_URL = "https://${srv.DOMAIN}"; + HTTP_PORT = 3000; + ENABLE_GZIP = true; + }; + service.DISABLE_REGISTRATION = true; + ui.DEFAULT_THEME = "forgejo-dark"; + log.LEVEL = "Warn"; + "cron.git_gc_repos".ENABLED = true; + "cron.resync_all_sshkeys".ENABLED = true; + "cron.reinit_missing_repos".ENABLED = true; + "cron.delete_old_actions".ENABLED = true; + "cron.delete_old_system_notices".ENABLED = true; + "cron.gc_lfs".ENABLED = true; + }; + }; + + services.nginx.virtualHosts.${srv.DOMAIN} = { + enableACME = true; + forceSSL = true; + locations."/" = { + proxyPass = "http://localhost:${toString srv.HTTP_PORT}"; + }; + }; +} diff --git a/configs/nixos/radicale.nix b/configs/nixos/radicale.nix index bcfe4e4..5aa2a21 100644 --- a/configs/nixos/radicale.nix +++ b/configs/nixos/radicale.nix @@ -5,18 +5,23 @@ lib, ... }: { - services.radicale={ - enable=true; - settings={ - server={ - hosts=[ "0.0.0.0:5232" "[::]:5232" ]; - }; - auth={ - type="htpasswd"; - htpasswd_encryption="md5"; - htpasswd_filename="${inputs.nix-secrets}/radicale-users"; + services.radicale = { + enable = true; + settings = { + auth = { + type = "htpasswd"; + htpasswd_encryption = "md5"; + htpasswd_filename = "${inputs.nix-secrets}/radicale-users"; }; }; }; networking.firewall.allowedTCPPorts = [5232]; + + services.nginx.virtualHosts."cal.venberg.xyz" = { + enableACME = true; + forceSSL = true; + locations."/" = { + proxyPass = "http://localhost:5232"; + }; + }; } diff --git a/hosts/cirrus/default.nix b/hosts/cirrus/default.nix index 60a1f98..01576bd 100644 --- a/hosts/cirrus/default.nix +++ b/hosts/cirrus/default.nix @@ -19,6 +19,7 @@ inputs.nixpkgs.lib.nixosSystem { ../../configs/nixos/sshd.nix ../../configs/nixos/secrets.nix ../../configs/nixos/radicale.nix + # ../../configs/nixos/forgejo.nix ({ config, pkgs, diff --git a/hosts/cirrus/disk-config.nix b/hosts/cirrus/disk-config.nix index 4fff720..d439fcc 100644 --- a/hosts/cirrus/disk-config.nix +++ b/hosts/cirrus/disk-config.nix @@ -35,4 +35,3 @@ }; }; } - diff --git a/hosts/cirrus/nginx.nix b/hosts/cirrus/nginx.nix index 43c7836..3169682 100644 --- a/hosts/cirrus/nginx.nix +++ b/hosts/cirrus/nginx.nix @@ -8,12 +8,10 @@ imports = [ ../../configs/nixos/nginx.nix ]; - services.nginx.virtualHosts."cal.venberg.xyz" = { + services.nginx.virtualHosts."gabevenberg.com" = { enableACME = true; forceSSL = true; - locations."/" = { - proxyPass = "http://localhost:5232"; - }; + root = "/var/www/gabevenberg.com"; }; networking.firewall.allowedTCPPorts = [443 80]; } diff --git a/hosts/rockhole64/adguard.nix b/hosts/rockhole64/adguard.nix index 224801e..868ba4e 100644 --- a/hosts/rockhole64/adguard.nix +++ b/hosts/rockhole64/adguard.nix @@ -6,9 +6,9 @@ lib, ... }: { - services.adguardhome={ - enable=true; - mutableSettings=true; - allowDHCP=true; + services.adguardhome = { + enable = true; + mutableSettings = true; + allowDHCP = true; }; } diff --git a/lib/default.nix b/lib/default.nix index 52171ce..425fa9d 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,8 +1,6 @@ -{lib}:let +{lib}: let net = import ./net.nix {inherit lib;}; -in -{ - +in { dirToStrings = dir: (map (v: builtins.readFile "${dir}/${v}") (builtins.filter (v: (builtins.readFileType "${dir}/${v}") == "regular") ( @@ -14,8 +12,11 @@ in else [] ))); - - calcSystemdDhcpPoolOffset = {base, start, end}: { + calcSystemdDhcpPoolOffset = { + base, + start, + end, + }: { offset = net.lib.net.ip.diff start base; size = net.lib.net.ip.diff end start; }; diff --git a/modules/home-manager/nvim/which-key.nix b/modules/home-manager/nvim/which-key.nix index 5210fb0..3a1c056 100644 --- a/modules/home-manager/nvim/which-key.nix +++ b/modules/home-manager/nvim/which-key.nix @@ -14,13 +14,13 @@ enable = true; # TODO: remvoe this once https://github.com/nix-community/nixvim/issues/1901 is fixed. package = pkgs.vimPlugins.which-key-nvim.overrideAttrs (oldAttrs: { - src = pkgs.fetchFromGitHub { - owner = oldAttrs.src.owner; - repo = oldAttrs.src.repo; - rev = "0539da005b98b02cf730c1d9da82b8e8edb1c2d2"; # v2.1.0 - hash = "sha256-gc/WJJ1s4s+hh8Mx8MTDg8pGGNOXxgKqBMwudJtpO4Y="; - }; - }); + src = pkgs.fetchFromGitHub { + owner = oldAttrs.src.owner; + repo = oldAttrs.src.repo; + rev = "0539da005b98b02cf730c1d9da82b8e8edb1c2d2"; # v2.1.0 + hash = "sha256-gc/WJJ1s4s+hh8Mx8MTDg8pGGNOXxgKqBMwudJtpO4Y="; + }; + }); }; }; };