diff options
| author | cashmere <cashmere@autistici.org> | 2026-06-20 00:41:39 +0200 |
|---|---|---|
| committer | cashmere <cashmere@autistici.org> | 2026-06-20 00:41:39 +0200 |
| commit | ddc8b2c0aa3e5e222157ed411cb93ed5faf16ad1 (patch) | |
| tree | 17b662be6df655cde263ec26fcbd813777301e5d /nix/module.nix | |
| parent | 7aa8b149e20c75a97720b8e896be8bda99fb9ec1 (diff) | |
| download | technical-renaissance-ddc8b2c0aa3e5e222157ed411cb93ed5faf16ad1.tar.gz | |
nix: add package.nix and module.nix
Diffstat (limited to 'nix/module.nix')
| -rw-r--r-- | nix/module.nix | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/nix/module.nix b/nix/module.nix new file mode 100644 index 0000000..7718ee8 --- /dev/null +++ b/nix/module.nix @@ -0,0 +1,52 @@ +{ + config, + lib, + pkgs, + ... +}: + +let + cfg = config.services.technical-renaissance; +in +{ + options.services.technical-renaissance = { + enable = lib.mkEnableOption "the Technical Renaissance webring"; + + package = lib.mkOption { + type = lib.types.package; + default = pkgs.callPackage ./package.nix { }; + description = "The technical-renaissance package to run."; + }; + + host = lib.mkOption { + type = lib.types.str; + default = "127.0.0.1"; + description = "Address the webring listens on."; + }; + + port = lib.mkOption { + type = lib.types.port; + default = 8080; + description = "Port the webring listens on."; + }; + }; + + config = lib.mkIf cfg.enable { + systemd.services.technical-renaissance = { + description = "Technical Renaissance webring"; + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ]; + + environment = { + HOST = cfg.host; + PORT = toString cfg.port; + }; + + serviceConfig = { + ExecStart = lib.getExe cfg.package; + DynamicUser = true; + Restart = "on-failure"; + }; + }; + }; +} |
