From e5f2d96e8e1184ce4a98bcb2203ef853f1c0c41f Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Sat, 22 Mar 2025 17:18:25 -0700 Subject: [PATCH] elnudrop: get git.elnu.com working --- hosts/configuration.nix | 1 + hosts/elnudrop/default.nix | 4 +++ hosts/elnudrop/hardware-configuration.nix | 1 + hosts/elnudrop/hosts/git.elnu.com/default.nix | 35 +++++++++++++++++++ 4 files changed, 41 insertions(+) create mode 100644 hosts/elnudrop/hosts/git.elnu.com/default.nix diff --git a/hosts/configuration.nix b/hosts/configuration.nix index 1db9edb..4dcc28f 100644 --- a/hosts/configuration.nix +++ b/hosts/configuration.nix @@ -16,6 +16,7 @@ }; nixpkgs.config.allowUnfree = true; + programs.git.enable = true; nix = { package = pkgs.nixVersions.stable; # flakes diff --git a/hosts/elnudrop/default.nix b/hosts/elnudrop/default.nix index 2d7f73a..e498e5b 100644 --- a/hosts/elnudrop/default.nix +++ b/hosts/elnudrop/default.nix @@ -13,9 +13,11 @@ #./modules/headscale.nix ./modules/tailscale.nix + ./hosts/git.elnu.com #./hosts/jichan.org #./hosts/tegakituesday.com ]; + fileSystems."/mnt/data" = { device = "/dev/sda"; fsType = "ext4"; }; networking = { # May cause some issues @@ -33,12 +35,14 @@ services.nginx = { enable = true; + /* virtualHosts."default" = { default = true; serverName = null; # https://stackoverflow.com/a/42802777 locations."/".return = "444"; }; + */ }; #services.do-agent.enable = true; diff --git a/hosts/elnudrop/hardware-configuration.nix b/hosts/elnudrop/hardware-configuration.nix index 7623409..e43d1ac 100644 --- a/hosts/elnudrop/hardware-configuration.nix +++ b/hosts/elnudrop/hardware-configuration.nix @@ -6,4 +6,5 @@ boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "xen_blkfront" "vmw_pvscsi" ]; boot.initrd.kernelModules = [ "nvme" ]; fileSystems."/" = { device = "/dev/vda1"; fsType = "ext4"; }; + fileSystems."/mnt/data" = { device = "/dev/sda"; fsType = "ext4" }; } \ No newline at end of file diff --git a/hosts/elnudrop/hosts/git.elnu.com/default.nix b/hosts/elnudrop/hosts/git.elnu.com/default.nix new file mode 100644 index 0000000..cfa7768 --- /dev/null +++ b/hosts/elnudrop/hosts/git.elnu.com/default.nix @@ -0,0 +1,35 @@ +{ config, pkgs, lib, enableSSL, ... }: + +let + host = "git.elnu.com"; + port = 3000; +in { + services.forgejo = { + package = pkgs.forgejo; # Don't use LTS + enable = true; + stateDir = "/mnt/data/forgejo"; + settings = { + server = { + HTTP_PORT = port; + DOMAIN = host; + SSH_DOMAIN = host; + # security keys will get messed up if this isn't set exactly + # will default to http://git.elnu.com:3000/ otherwise + ROOT_URL = "https://${host}/"; + # make gravatar etc work + OFFLINE_MODE = false; + }; + service = { + DISABLE_REGISTRATION = true; + }; + }; + }; + services.nginx.virtualHosts."${host}" = { + forceSSL = enableSSL; + enableACME = enableSSL; + default = true; + locations = { + "/".proxyPass = "http://localhost:${builtins.toString port}"; + }; + }; +} \ No newline at end of file