From f6ed5e951b5b068f646dfbbf169c4481e93487ec Mon Sep 17 00:00:00 2001 From: uku Date: Tue, 7 Jan 2025 18:50:30 +0100 Subject: [PATCH 1/2] feat(utils): add mkNginxFile --- global/utils.nix | 17 ++++++++++++++++- systems/default.nix | 7 +++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/global/utils.nix b/global/utils.nix index d89af09..a98b0a5 100644 --- a/global/utils.nix +++ b/global/utils.nix @@ -1,4 +1,4 @@ -{ lib, ... }: +{ lib, pkgs, ... }: { setupSecrets = _config: @@ -96,4 +96,19 @@ } ]; }; + + # shamelessly stolen from soopyc's gensokyo + mkNginxFile = + { + filename ? "index.html", + content, + status ? 200, + }: + { + # gets the store path of the directory in which the file is contained + # we have to use writeTextDir because we don't want to expose the whole nix store to nginx + # and because you can't just return an absolute path to a file + alias = builtins.toString (pkgs.writeTextDir filename content) + "/"; + tryFiles = "${filename} =${builtins.toString status}"; + }; } diff --git a/systems/default.nix b/systems/default.nix index 92a0646..18937a3 100644 --- a/systems/default.nix +++ b/systems/default.nix @@ -4,7 +4,7 @@ ... }: let - _utils = import ../global/utils.nix { inherit lib; }; + mkUtils = import ../global/utils.nix; toSystem = name: @@ -24,7 +24,10 @@ let ]; specialArgs = inputs // { - inherit _utils; + _utils = mkUtils { + inherit lib; + pkgs = inputs.nixpkgs.legacyPackages.${system}; + }; }; }; in From da0324ccf97c279eff32abb566df8f23f09fc503 Mon Sep 17 00:00:00 2001 From: uku Date: Tue, 7 Jan 2025 18:51:47 +0100 Subject: [PATCH 2/2] chore(common): move ghostty terminfo to server --- configs/common.nix | 2 -- configs/server.nix | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/configs/common.nix b/configs/common.nix index f02a143..f7ad2d4 100644 --- a/configs/common.nix +++ b/configs/common.nix @@ -70,8 +70,6 @@ in neovim ripgrep wget - - ghostty.terminfo ]; hm = { diff --git a/configs/server.nix b/configs/server.nix index 0177506..3ed62c1 100644 --- a/configs/server.nix +++ b/configs/server.nix @@ -1,4 +1,5 @@ { + pkgs, config, _utils, ... @@ -22,6 +23,10 @@ in hermetic = false; # hermetic fucks up for cross-system deployments }; + environment.systemPackages = with pkgs; [ + ghostty.terminfo + ]; + services = { tailscale.extraUpFlags = [ "--advertise-exit-node" ];