Compare commits

..

2 Commits

Author SHA1 Message Date
Peder Bergebakken Sundt dfd8f31f1e :) 2024-10-10 21:24:11 +02:00
Peder Bergebakken Sundt 9bc3213367 just timeout 2024-10-10 21:08:00 +02:00
2 changed files with 13 additions and 3 deletions

View File

@ -28,10 +28,12 @@ update:
| gum choose --no-limit --height=15 \
| xargs nix flake update --commit-lock-file
build hostname=`if test -z "${IS_REMOTE_ENV:-}"; then just _a_host; else echo; fi`:
#build hostname=`if test -z "${IS_REMOTE_ENV:-}"; then just _a_host_timeout; else echo; fi`:
build hostname="":
nixos-rebuild build --accept-flake-config --show-trace --flake .#"{{hostname}}"
build-no-remote-builders hostname=`if test -z "$IS_REMOTE_ENV"; then just _a_host; else echo; fi`:
#build-no-remote-builders hostname=`if test -z "$IS_REMOTE_ENV"; then just _a_host_timeout; else echo; fi`:
build-no-remote-builders hostname="":
nixos-rebuild build --accept-flake-config --show-trace --flake .#"{{hostname}}" --builders ""
build-vm hostname=`just _a_host`:
@ -67,6 +69,12 @@ inspect-config host=`just _a_host` prefix="":
if test "$(grep <<<"$hostnames" "^$(hostname)$" | wc -l)" -eq 1; then hostnames="$(hostname; grep <<<"$hostnames" -v "^$(hostname)$")"; fi; \
gum <<<"$hostnames" filter --placeholder "Pick a host..."
# ctrl-c is counted as a timeout...
@_a_host_timeout:
hostnames="$(nix eval .#nixosConfigurations --apply builtins.attrNames --json 2>/dev/null | jq '.[]' -r)"; \
if test "$(grep <<<"$hostnames" "^$(hostname)$" | wc -l)" -eq 1; then hostnames="$(hostname; grep <<<"$hostnames" -v "^$(hostname)$")"; fi; \
gum <<<"$hostnames" filter --placeholder "Pick a host..." --timeout 5s || hostname
@_some_hosts:
hostnames="$(nix eval .#nixosConfigurations --apply builtins.attrNames --json 2>/dev/null | jq '.[]' -r)"; \
if test "$(grep <<<"$hostnames" "^$(hostname)$" | wc -l)" -eq 1; then hostnames="$(hostname; grep <<<"$hostnames" -v "^$(hostname)$")"; fi; \

View File

@ -8,7 +8,7 @@
(pkgs.makeDesktopItem {
desktopName = "Open Syncthing";
name = "Syncthing";
exec = "${pkgs.xdg-utils}/bin/xdg-open ${config.services.syncthing.guiAddress}";
exec = "${pkgs.xdg-utils}/bin/xdg-open http://${config.services.syncthing.guiAddress}";
icon = "${pkgs.syncthing.src}/assets/logo-512.png";
})
];
@ -41,7 +41,9 @@
/* devices."bjarte".autoAcceptFolders = true; # TODO */
folders = lib.flip lib.pipe [
# add `path` default
(lib.mapAttrs (name: attrs: { path = lib.mkDefault "${config.services.syncthing.dataDir}/${name}"; } // attrs ))
# filter folders this host does not have access to
(lib.mapAttrsToList (name: attrs: lib.mkIf (builtins.elem config.networking.hostName (attrs.devices or [])) { ${name} = attrs; } ))
lib.mkMerge
] {