Mirror of @tangled.org/core. Running on a Raspberry Pi Zero 2 (Please be gentle).
0
fork

Configure Feed

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

flake.nix,nix/modules: add package option for all the nixos modules

Signed-off-by: dusk <y.bera003.06@protonmail.com>

authored by

dusk and committed by
Tangled
ec15a633 096eb308

+89 -52
+27 -3
flake.nix
··· 190 190 }; 191 191 }); 192 192 193 - nixosModules.appview = import ./nix/modules/appview.nix {inherit self;}; 194 - nixosModules.knot = import ./nix/modules/knot.nix {inherit self;}; 195 - nixosModules.spindle = import ./nix/modules/spindle.nix {inherit self;}; 193 + nixosModules.appview = { 194 + lib, 195 + pkgs, 196 + ... 197 + }: { 198 + imports = [./nix/modules/appview.nix]; 199 + 200 + services.tangled-appview.package = lib.mkDefault self.packages.${pkgs.system}.appview; 201 + }; 202 + nixosModules.knot = { 203 + lib, 204 + pkgs, 205 + ... 206 + }: { 207 + imports = [./nix/modules/knot.nix]; 208 + 209 + services.tangled-knot.package = lib.mkDefault self.packages.${pkgs.system}.knot; 210 + }; 211 + nixosModules.spindle = { 212 + lib, 213 + pkgs, 214 + ... 215 + }: { 216 + imports = [./nix/modules/spindle.nix]; 217 + 218 + services.tangled-spindle.package = lib.mkDefault self.packages.${pkgs.system}.spindle; 219 + }; 196 220 nixosConfigurations.vm = import ./nix/vm.nix {inherit self nixpkgs;}; 197 221 }; 198 222 }
+45 -40
nix/modules/appview.nix
··· 1 - {self}: { 1 + { 2 2 config, 3 - pkgs, 4 3 lib, 5 4 ... 6 - }: 7 - with lib; { 8 - options = { 9 - services.tangled-appview = { 10 - enable = mkOption { 11 - type = types.bool; 12 - default = false; 13 - description = "Enable tangled appview"; 14 - }; 15 - port = mkOption { 16 - type = types.int; 17 - default = 3000; 18 - description = "Port to run the appview on"; 19 - }; 20 - cookie_secret = mkOption { 21 - type = types.str; 22 - default = "00000000000000000000000000000000"; 23 - description = "Cookie secret"; 24 - }; 25 - }; 26 - }; 27 - 28 - config = mkIf config.services.tangled-appview.enable { 29 - systemd.services.tangled-appview = { 30 - description = "tangled appview service"; 31 - wantedBy = ["multi-user.target"]; 32 - 33 - serviceConfig = { 34 - ListenStream = "0.0.0.0:${toString config.services.tangled-appview.port}"; 35 - ExecStart = "${self.packages.${pkgs.system}.appview}/bin/appview"; 36 - Restart = "always"; 37 - }; 38 - 39 - environment = { 40 - TANGLED_DB_PATH = "appview.db"; 41 - TANGLED_COOKIE_SECRET = config.services.tangled-appview.cookie_secret; 5 + }: let 6 + cfg = config.services.tangled-appview; 7 + in 8 + with lib; { 9 + options = { 10 + services.tangled-appview = { 11 + enable = mkOption { 12 + type = types.bool; 13 + default = false; 14 + description = "Enable tangled appview"; 15 + }; 16 + package = mkOption { 17 + type = types.package; 18 + description = "Package to use for the appview"; 19 + }; 20 + port = mkOption { 21 + type = types.int; 22 + default = 3000; 23 + description = "Port to run the appview on"; 24 + }; 25 + cookie_secret = mkOption { 26 + type = types.str; 27 + default = "00000000000000000000000000000000"; 28 + description = "Cookie secret"; 29 + }; 42 30 }; 43 31 }; 44 - }; 45 - } 32 + 33 + config = mkIf cfg.enable { 34 + systemd.services.tangled-appview = { 35 + description = "tangled appview service"; 36 + wantedBy = ["multi-user.target"]; 37 + 38 + serviceConfig = { 39 + ListenStream = "0.0.0.0:${toString cfg.port}"; 40 + ExecStart = "${cfg.package}/bin/appview"; 41 + Restart = "always"; 42 + }; 43 + 44 + environment = { 45 + TANGLED_DB_PATH = "appview.db"; 46 + TANGLED_COOKIE_SECRET = cfg.cookie_secret; 47 + }; 48 + }; 49 + }; 50 + }
+11 -6
nix/modules/knot.nix
··· 1 - {self}: { 1 + { 2 2 config, 3 3 pkgs, 4 4 lib, ··· 13 13 type = types.bool; 14 14 default = false; 15 15 description = "Enable a tangled knot"; 16 + }; 17 + 18 + package = mkOption { 19 + type = types.package; 20 + description = "Package to use for the knot"; 16 21 }; 17 22 18 23 appviewEndpoint = mkOption { ··· 99 94 }; 100 95 101 96 config = mkIf cfg.enable { 102 - environment.systemPackages = with pkgs; [ 103 - git 104 - self.packages."${pkgs.system}".knot 97 + environment.systemPackages = [ 98 + pkgs.git 99 + cfg.package 105 100 ]; 106 101 107 102 system.activationScripts.gitConfig = '' ··· 140 135 mode = "0555"; 141 136 text = '' 142 137 #!${pkgs.stdenv.shell} 143 - ${self.packages.${pkgs.system}.knot}/bin/knot keys \ 138 + ${cfg.package}/bin/knot keys \ 144 139 -output authorized-keys \ 145 140 -internal-api "http://${cfg.server.internalListenAddr}" \ 146 141 -git-dir "${cfg.repo.scanPath}" \ ··· 165 160 "KNOT_SERVER_HOSTNAME=${cfg.server.hostname}" 166 161 ]; 167 162 EnvironmentFile = cfg.server.secretFile; 168 - ExecStart = "${self.packages.${pkgs.system}.knot}/bin/knot server"; 163 + ExecStart = "${cfg.package}/bin/knot server"; 169 164 Restart = "always"; 170 165 }; 171 166 };
+6 -3
nix/modules/spindle.nix
··· 1 - {self}: { 1 + { 2 2 config, 3 - pkgs, 4 3 lib, 5 4 ... 6 5 }: let ··· 12 13 type = types.bool; 13 14 default = false; 14 15 description = "Enable a tangled spindle"; 16 + }; 17 + package = mkOption { 18 + type = types.package; 19 + description = "Package to use for the spindle"; 15 20 }; 16 21 17 22 server = { ··· 92 89 "SPINDLE_PIPELINES_NIXERY=${cfg.pipelines.nixery}" 93 90 "SPINDLE_PIPELINES_WORKFLOW_TIMEOUT=${cfg.pipelines.workflowTimeout}" 94 91 ]; 95 - ExecStart = "${self.packages.${pkgs.system}.spindle}/bin/spindle"; 92 + ExecStart = "${cfg.package}/bin/spindle"; 96 93 Restart = "always"; 97 94 }; 98 95 };