From ddc8b2c0aa3e5e222157ed411cb93ed5faf16ad1 Mon Sep 17 00:00:00 2001 From: cashmere Date: Sat, 20 Jun 2026 00:41:39 +0200 Subject: nix: add package.nix and module.nix --- nix/module.nix | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ nix/package.nix | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 nix/module.nix create mode 100644 nix/package.nix (limited to 'nix') 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"; + }; + }; + }; +} diff --git a/nix/package.nix b/nix/package.nix new file mode 100644 index 0000000..22d7d5e --- /dev/null +++ b/nix/package.nix @@ -0,0 +1,49 @@ +{ + python3Packages, + sources ? import ../npins, +}: + +let + rustimport = python3Packages.buildPythonPackage { + pname = "rustimport"; + version = "1.3.4"; + pyproject = true; + src = sources.rustimport; + build-system = [ python3Packages.setuptools ]; + dependencies = [ python3Packages.toml ]; + doCheck = false; + }; + + robyn = python3Packages.buildPythonPackage { + pname = "robyn"; + version = "0.86.0"; + format = "wheel"; + src = sources.robyn; + dependencies = with python3Packages; [ + inquirerpy + multiprocess + orjson + rustimport + uvloop + watchdog + jinja2 + ]; + doCheck = false; + }; +in +python3Packages.buildPythonApplication { + pname = "technical-renaissance"; + version = "0.1.0"; + pyproject = true; + src = ../.; + + build-system = [ python3Packages.uv-build ]; + dependencies = [ robyn ]; + + doCheck = false; + + meta = { + description = "Webring for the #technicalrenaissance IRC channel"; + mainProgram = "technical-renaissance"; + }; +} -- cgit v1.3.1