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.

nix: update nix modules & VM to new knot interface

Signed-off-by: oppiliappan <me@oppi.li>

authored by

oppiliappan and committed by
Tangled
390c8947 f7d68908

+41 -47
+41 -47
flake.nix
··· 49 49 inherit (gitignore.lib) gitignoreSource; 50 50 in { 51 51 overlays.default = final: prev: let 52 - goModHash = "sha256-H/sKps9um8vvv/WAZ1hEN+ZVhmXlddRNSVWVRBK1zEo="; 53 - buildCmdPackage = name: 54 - final.buildGoModule { 55 - pname = name; 56 - version = "0.1.0"; 57 - src = gitignoreSource ./.; 58 - subPackages = ["cmd/${name}"]; 59 - vendorHash = goModHash; 60 - env.CGO_ENABLED = 0; 61 - }; 52 + goModHash = "sha256-H2gBkkuJaZtHlvW33aWZu0pS9vsS/A2ojeEUbp6o7Go="; 62 53 in { 63 54 indigo-lexgen = final.buildGoModule { 64 55 pname = "indigo-lexgen"; ··· 83 92 stdenv = pkgsStatic.stdenv; 84 93 }; 85 94 86 - knotserver = with final; 95 + knot = with final; 87 96 final.pkgsStatic.buildGoModule { 88 - pname = "knotserver"; 97 + pname = "knot"; 89 98 version = "0.1.0"; 90 99 src = gitignoreSource ./.; 91 100 nativeBuildInputs = [final.makeWrapper]; 92 - subPackages = ["cmd/knotserver"]; 101 + subPackages = ["cmd/knot"]; 93 102 vendorHash = goModHash; 94 103 installPhase = '' 95 104 runHook preInstall 96 105 97 106 mkdir -p $out/bin 98 - cp $GOPATH/bin/knotserver $out/bin/knotserver 107 + cp $GOPATH/bin/knot $out/bin/knot 99 108 100 - wrapProgram $out/bin/knotserver \ 109 + wrapProgram $out/bin/knot \ 101 110 --prefix PATH : ${pkgs.git}/bin 102 111 103 112 runHook postInstall 104 113 ''; 105 114 env.CGO_ENABLED = 1; 106 115 }; 107 - knotserver-unwrapped = final.pkgsStatic.buildGoModule { 108 - pname = "knotserver"; 116 + knot-unwrapped = final.pkgsStatic.buildGoModule { 117 + pname = "knot"; 109 118 version = "0.1.0"; 110 119 src = gitignoreSource ./.; 111 - subPackages = ["cmd/knotserver"]; 120 + subPackages = ["cmd/knot"]; 112 121 vendorHash = goModHash; 113 122 env.CGO_ENABLED = 1; 114 123 }; 115 - repoguard = buildCmdPackage "repoguard"; 116 - keyfetch = buildCmdPackage "keyfetch"; 117 - genjwks = buildCmdPackage "genjwks"; 124 + genjwks = final.pkgsStatic.buildGoModule { 125 + pname = "genjwks"; 126 + version = "0.1.0"; 127 + src = gitignoreSource ./.; 128 + subPackages = ["cmd/genjwks"]; 129 + vendorHash = goModHash; 130 + env.CGO_ENABLED = 0; 131 + }; 118 132 }; 119 133 packages = forAllSystems (system: { 120 134 inherit 121 135 (nixpkgsFor."${system}") 122 136 indigo-lexgen 123 137 appview 124 - knotserver 125 - knotserver-unwrapped 126 - repoguard 127 - keyfetch 138 + knot 139 + knot-unwrapped 128 140 genjwks 129 141 ; 130 142 }); ··· 166 172 }); 167 173 apps = forAllSystems (system: let 168 174 pkgs = nixpkgsFor."${system}"; 169 - air-watcher = name: 175 + air-watcher = name: arg: 170 176 pkgs.writeShellScriptBin "run" 171 177 '' 172 178 ${pkgs.air}/bin/air -c /dev/null \ 173 179 -build.cmd "${pkgs.go}/bin/go build -o ./out/${name}.out ./cmd/${name}/main.go" \ 174 - -build.bin "./out/${name}.out" \ 180 + -build.bin "./out/${name}.out ${arg}" \ 175 181 -build.stop_on_error "true" \ 176 182 -build.include_ext "go" 177 183 ''; ··· 183 189 in { 184 190 watch-appview = { 185 191 type = "app"; 186 - program = ''${air-watcher "appview"}/bin/run''; 192 + program = ''${air-watcher "appview" ""}/bin/run''; 187 193 }; 188 - watch-knotserver = { 194 + watch-knot = { 189 195 type = "app"; 190 - program = ''${air-watcher "knotserver"}/bin/run''; 196 + program = ''${air-watcher "knot" "server"}/bin/run''; 191 197 }; 192 198 watch-tailwind = { 193 199 type = "app"; ··· 241 247 }; 242 248 }; 243 249 244 - nixosModules.knotserver = { 250 + nixosModules.knot = { 245 251 config, 246 252 pkgs, 247 253 lib, 248 254 ... 249 255 }: let 250 - cfg = config.services.tangled-knotserver; 256 + cfg = config.services.tangled-knot; 251 257 in 252 258 with lib; { 253 259 options = { 254 - services.tangled-knotserver = { 260 + services.tangled-knot = { 255 261 enable = mkOption { 256 262 type = types.bool; 257 263 default = false; 258 - description = "Enable a tangled knotserver"; 264 + description = "Enable a tangled knot"; 259 265 }; 260 266 261 267 appviewEndpoint = mkOption { ··· 377 383 mode = "0555"; 378 384 text = '' 379 385 #!${pkgs.stdenv.shell} 380 - ${self.packages.${pkgs.system}.keyfetch}/bin/keyfetch \ 381 - -repoguard-path ${self.packages.${pkgs.system}.repoguard}/bin/repoguard \ 386 + ${self.packages.${pkgs.system}.knot}/bin/knot keys \ 387 + -output authorized-keys \ 382 388 -internal-api "http://${cfg.server.internalListenAddr}" \ 383 389 -git-dir "${cfg.repo.scanPath}" \ 384 - -log-path /tmp/repoguard.log 390 + -log-path /tmp/knotguard.log 385 391 ''; 386 392 }; 387 393 388 - systemd.services.knotserver = { 389 - description = "knotserver service"; 394 + systemd.services.knot = { 395 + description = "knot service"; 390 396 after = ["network.target" "sshd.service"]; 391 397 wantedBy = ["multi-user.target"]; 392 398 serviceConfig = { ··· 402 408 "KNOT_SERVER_HOSTNAME=${cfg.server.hostname}" 403 409 ]; 404 410 EnvironmentFile = cfg.server.secretFile; 405 - ExecStart = "${self.packages.${pkgs.system}.knotserver}/bin/knotserver"; 411 + ExecStart = "${self.packages.${pkgs.system}.knot}/bin/knot server"; 406 412 Restart = "always"; 407 413 }; 408 414 }; ··· 414 420 nixosConfigurations.knotVM = nixpkgs.lib.nixosSystem { 415 421 system = "x86_64-linux"; 416 422 modules = [ 417 - self.nixosModules.knotserver 423 + self.nixosModules.knot 418 424 ({ 419 425 config, 420 426 pkgs, ··· 426 432 services.getty.autologinUser = "root"; 427 433 environment.systemPackages = with pkgs; [curl vim git]; 428 434 systemd.tmpfiles.rules = let 429 - u = config.services.tangled-knotserver.gitUser; 430 - g = config.services.tangled-knotserver.gitUser; 435 + u = config.services.tangled-knot.gitUser; 436 + g = config.services.tangled-knot.gitUser; 431 437 in [ 432 - "d /var/lib/knotserver 0770 ${u} ${g} - -" # Create the directory first 433 - "f+ /var/lib/knotserver/secret 0660 ${u} ${g} - KNOT_SERVER_SECRET=38a7c3237c2a585807e06a5bcfac92eb39442063f3da306b7acb15cfdc51d19d" 438 + "d /var/lib/knot 0770 ${u} ${g} - -" # Create the directory first 439 + "f+ /var/lib/knot/secret 0660 ${u} ${g} - KNOT_SERVER_SECRET=38a7c3237c2a585807e06a5bcfac92eb39442063f3da306b7acb15cfdc51d19d" 434 440 ]; 435 - services.tangled-knotserver = { 441 + services.tangled-knot = { 436 442 enable = true; 437 443 server = { 438 - secretFile = "/var/lib/knotserver/secret"; 444 + secretFile = "/var/lib/knot/secret"; 439 445 hostname = "localhost:6000"; 440 446 listenAddr = "0.0.0.0:6000"; 441 447 };