forked from tangled.org/core
this repo has no description
at test-ci 2.9 kB view raw
1{self}: { 2 config, 3 pkgs, 4 lib, 5 ... 6}: let 7 cfg = config.services.tangled-spindle; 8in 9 with lib; { 10 options = { 11 services.tangled-spindle = { 12 enable = mkOption { 13 type = types.bool; 14 default = false; 15 description = "Enable a tangled spindle"; 16 }; 17 18 server = { 19 listenAddr = mkOption { 20 type = types.str; 21 default = "0.0.0.0:6555"; 22 description = "Address to listen on"; 23 }; 24 25 dbPath = mkOption { 26 type = types.path; 27 default = "/var/lib/spindle/spindle.db"; 28 description = "Path to the database file"; 29 }; 30 31 hostname = mkOption { 32 type = types.str; 33 example = "spindle.tangled.sh"; 34 description = "Hostname for the server (required)"; 35 }; 36 37 jetstreamEndpoint = mkOption { 38 type = types.str; 39 default = "wss://jetstream1.us-west.bsky.network/subscribe"; 40 description = "Jetstream endpoint to subscribe to"; 41 }; 42 43 dev = mkOption { 44 type = types.bool; 45 default = false; 46 description = "Enable development mode (disables signature verification)"; 47 }; 48 49 owner = mkOption { 50 type = types.str; 51 example = "did:plc:qfpnj4og54vl56wngdriaxug"; 52 description = "DID of owner (required)"; 53 }; 54 }; 55 56 pipelines = { 57 nixery = mkOption { 58 type = types.str; 59 default = "nixery.tangled.sh"; 60 description = "Nixery instance to use"; 61 }; 62 63 stepTimeout = mkOption { 64 type = types.str; 65 default = "5m"; 66 description = "Timeout for each step of a pipeline"; 67 }; 68 }; 69 }; 70 }; 71 72 config = mkIf cfg.enable { 73 virtualisation.docker.enable = true; 74 75 systemd.services.spindle = { 76 description = "spindle service"; 77 after = ["network.target" "docker.service"]; 78 wantedBy = ["multi-user.target"]; 79 serviceConfig = { 80 LogsDirectory = "spindle"; 81 StateDirectory = "spindle"; 82 Environment = [ 83 "SPINDLE_SERVER_LISTEN_ADDR=${cfg.server.listenAddr}" 84 "SPINDLE_SERVER_DB_PATH=${cfg.server.dbPath}" 85 "SPINDLE_SERVER_HOSTNAME=${cfg.server.hostname}" 86 "SPINDLE_SERVER_JETSTREAM=${cfg.server.jetstreamEndpoint}" 87 "SPINDLE_SERVER_DEV=${lib.boolToString cfg.server.dev}" 88 "SPINDLE_SERVER_OWNER=${cfg.server.owner}" 89 "SPINDLE_PIPELINES_NIXERY=${cfg.pipelines.nixery}" 90 "SPINDLE_PIPELINES_STEP_TIMEOUT=${cfg.pipelines.stepTimeout}" 91 ]; 92 ExecStart = "${self.packages.${pkgs.system}.spindle}/bin/spindle"; 93 Restart = "always"; 94 }; 95 }; 96 }; 97 }