My Nix Configuration
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

[lib] add mkAnubisInstance

dish 10e896f9 e1630f55

+49 -4
+2 -1
.harper-dictionary.txt
··· 1 1 DN42 2 2 Jellyfin 3 + PQ 3 4 Vaultwarden 5 + customPolicy 4 6 nixd 5 - PQ 6 7 zaphod
+2 -2
hosts/marvin/services/git.nix
··· 7 7 ... 8 8 }: 9 9 let 10 - cfg = config.services.forgejo.settings; 10 + cfg = config.services.forgejo; 11 11 sec = config.age.secrets; 12 12 d = self.lib.data.services.git; 13 13 in ··· 71 71 DISABLE_SSH = true; 72 72 DOMAIN = d.extUrl; 73 73 HTTP_PORT = d.port; 74 - ROOT_URL = "https://${cfg.server.DOMAIN}"; 74 + ROOT_URL = "https://${cfg.settings.server.DOMAIN}"; 75 75 LFS_START_SERVER = true; 76 76 }; 77 77 #
+9 -1
lib/default.nix
··· 1 - { lib, self, ... }: 1 + { 2 + lib, 3 + self, 4 + pkgs, 5 + ... 6 + }: 2 7 let 3 8 inherit (self) data; 4 9 strings = import ./strings.nix { inherit lib; }; 10 + misc = import ./misc.nix { inherit self pkgs; }; 5 11 in 6 12 { 7 13 flake = { ··· 9 15 caddy = import ./caddy.nix { inherit data lib; }; 10 16 secrets = import ./secrets.nix; 11 17 inherit data; 18 + inherit misc; 12 19 inherit strings; 13 20 inherit (strings) toPascalCase toUpperSnakeCase; 21 + inherit (misc) mkAnubisInstance; 14 22 }; 15 23 }; 16 24 }
+36
lib/misc.nix
··· 1 + { self, pkgs, ... }: 2 + let 3 + system = pkgs.stdenv.hostPlatform.system; 4 + in 5 + { 6 + /** 7 + Creates an Anubis instance for this service 8 + 9 + # Example 10 + ```nix 11 + mkAnubisInstance "service-a" false 12 + ``` 13 + 14 + # Type 15 + ``` 16 + mkAnubisInstance :: String -> Bool -> AttrSet 17 + ``` 18 + 19 + # Arguments 20 + - [service] The service name that this instance will be proxying 21 + - [customPolicy] Whether the service uses a custom `${service}.yaml` policy file. If false, uses `default.yaml` 22 + */ 23 + mkAnubisInstance = 24 + service: customPolicy: 25 + let 26 + serviceData = self.data.services.${service}; 27 + policyFile = if customPolicy then "${service}.yaml" else "default.yaml"; 28 + in 29 + { 30 + settings = { 31 + BIND = ":${toString serviceData.anubis}"; 32 + POLICY_FNAME = "${self.packages.${system}.anubis-files}/policies/${policyFile}"; 33 + TARGET = "http://localhost:${toString serviceData.port}"; 34 + }; 35 + }; 36 + }