Compare commits
3 Commits
db8a54305f
...
3f43e3c39f
Author | SHA1 | Date |
---|---|---|
Peder Bergebakken Sundt | 3f43e3c39f | |
Peder Bergebakken Sundt | d125eec709 | |
Peder Bergebakken Sundt | 64dbfdc3cf |
|
@ -5,3 +5,4 @@ result
|
||||||
.remote.toml
|
.remote.toml
|
||||||
_*
|
_*
|
||||||
/logs
|
/logs
|
||||||
|
mprocs.log
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
export HOST_SHELL="$(command -v "$SHELL")"
|
export HOST_SHELL="$(command -v "$SHELL")"
|
||||||
|
export IS_REMOTE_ENV=1
|
||||||
eval "$(nix print-dev-env .#remoteenv)"
|
eval "$(nix print-dev-env .#remoteenv)"
|
||||||
echo Entered "$(hostname --fqdn)"
|
echo Entered "$(hostname --fqdn)"
|
||||||
df -h /nix/store
|
df -h /nix/store
|
||||||
|
|
|
@ -321,9 +321,9 @@
|
||||||
# TODO: get faketty to work ${expect}/bin/unbuffer is bad
|
# TODO: get faketty to work ${expect}/bin/unbuffer is bad
|
||||||
nixos-rebuild-nom = pkgs.writeScriptBin "nixos-rebuild" ''
|
nixos-rebuild-nom = pkgs.writeScriptBin "nixos-rebuild" ''
|
||||||
if test -t 1 && test -z "''${NIX_NO_NOM-}"; then
|
if test -t 1 && test -z "''${NIX_NO_NOM-}"; then
|
||||||
exec ${lib.getExe pkgs.nixos-rebuild} "$@" -L |& ${lib.getExe pkgs.nix-output-monitor}
|
exec ${lib.getExe pkgs.nixos-rebuild} -L "$@" |& ${lib.getExe pkgs.nix-output-monitor}
|
||||||
else
|
else
|
||||||
exec ${lib.getExe pkgs.nixos-rebuild} "$@" -L
|
exec ${lib.getExe pkgs.nixos-rebuild} -L "$@"
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -383,6 +383,7 @@
|
||||||
pkgs.ssh-to-age
|
pkgs.ssh-to-age
|
||||||
pkgs.just
|
pkgs.just
|
||||||
pkgs.gum
|
pkgs.gum
|
||||||
|
pkgs.mprocs
|
||||||
];
|
];
|
||||||
in {
|
in {
|
||||||
envrc-local = mkShell envrc-pkgs;
|
envrc-local = mkShell envrc-pkgs;
|
||||||
|
|
|
@ -44,6 +44,8 @@
|
||||||
#../../profiles/domeneshop-dyndns # handled by noximilien
|
#../../profiles/domeneshop-dyndns # handled by noximilien
|
||||||
];
|
];
|
||||||
|
|
||||||
|
nix.settings.max-jobs = 1; # this host do be stinky
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [ 57621 ]; # spotify local discovery
|
networking.firewall.allowedTCPPorts = [ 57621 ]; # spotify local discovery
|
||||||
|
|
||||||
#networking.wireguard.interfaces."wg0".ips = [ "172.22.48.4/24" ]; # fyrkat
|
#networking.wireguard.interfaces."wg0".ips = [ "172.22.48.4/24" ]; # fyrkat
|
||||||
|
|
|
@ -100,6 +100,8 @@
|
||||||
"kuklef.se"
|
"kuklef.se"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
nix.settings.max-jobs = 1; # this host do be stinky
|
||||||
|
|
||||||
networking.hostId = "e1ffd469"; # needed for zfs: head -c 8 /etc/machine-id
|
networking.hostId = "e1ffd469"; # needed for zfs: head -c 8 /etc/machine-id
|
||||||
|
|
||||||
#networking.wireguard.interfaces."wg0".ips = [ "172.22.48.3/24" ]; # fyrkat
|
#networking.wireguard.interfaces."wg0".ips = [ "172.22.48.3/24" ]; # fyrkat
|
||||||
|
|
38
justfile
38
justfile
|
@ -28,9 +28,12 @@ update:
|
||||||
| gum choose --no-limit --height=15 \
|
| gum choose --no-limit --height=15 \
|
||||||
| xargs nix flake update --commit-lock-file
|
| xargs nix flake update --commit-lock-file
|
||||||
|
|
||||||
build hostname=`just _a_host`:
|
build hostname=`if test -z "$IS_REMOTE_ENV"; then just _a_host; else echo; fi`:
|
||||||
nixos-rebuild build --accept-flake-config --show-trace --flake .#"{{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`:
|
||||||
|
nixos-rebuild build --accept-flake-config --show-trace --flake .#"{{hostname}}" --builders ""
|
||||||
|
|
||||||
build-vm hostname=`just _a_host`:
|
build-vm hostname=`just _a_host`:
|
||||||
nixos-rebuild build-vm --accept-flake-config --show-trace --flake .#"{{hostname}}"
|
nixos-rebuild build-vm --accept-flake-config --show-trace --flake .#"{{hostname}}"
|
||||||
|
|
||||||
|
@ -64,26 +67,42 @@ inspect-config host=`just _a_host`:
|
||||||
if test "$(grep <<<"$hostnames" "^$(hostname)$" | wc -l)" -eq 1; then hostnames="$(hostname; grep <<<"$hostnames" -v "^$(hostname)$")"; fi; \
|
if test "$(grep <<<"$hostnames" "^$(hostname)$" | wc -l)" -eq 1; then hostnames="$(hostname; grep <<<"$hostnames" -v "^$(hostname)$")"; fi; \
|
||||||
gum <<<"$hostnames" filter --placeholder "Pick a host..."
|
gum <<<"$hostnames" filter --placeholder "Pick a host..."
|
||||||
|
|
||||||
|
@_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; \
|
||||||
|
gum <<<"$hostnames" filter --placeholder "Pick a host..." --no-limit
|
||||||
|
|
||||||
@_a_fqdn:
|
@_a_fqdn:
|
||||||
hostnames="$(nix eval .#nixosConfigurations --apply 'c: builtins.attrValues (builtins.mapAttrs (_: x: x.config.networking.fqdn) c)' --json 2>/dev/null | jq '.[]' -r)"; \
|
hostnames="$(nix eval .#nixosConfigurations --apply 'c: builtins.attrValues (builtins.mapAttrs (_: x: x.config.networking.fqdn) c)' --json 2>/dev/null | jq '.[]' -r)"; \
|
||||||
if test "$(grep <<<"$hostnames" "^$(hostname --fqdn)$" | wc -l)" -eq 1; then hostnames="$(hostname --fqdn; grep <<<"$hostnames" -v "^$(hostname --fqdn)$")"; fi; \
|
if test "$(grep <<<"$hostnames" "^$(hostname --fqdn)$" | wc -l)" -eq 1; then hostnames="$(hostname --fqdn; grep <<<"$hostnames" -v "^$(hostname --fqdn)$")"; fi; \
|
||||||
gum <<<"$hostnames" filter --placeholder "Pick a host..."
|
gum <<<"$hostnames" filter --placeholder "Pick a host..."
|
||||||
|
|
||||||
|
@_some_fqdns:
|
||||||
|
hostnames="$(nix eval .#nixosConfigurations --apply 'c: builtins.attrValues (builtins.mapAttrs (_: x: x.config.networking.fqdn) c)' --json 2>/dev/null | jq '.[]' -r)"; \
|
||||||
|
if test "$(grep <<<"$hostnames" "^$(hostname --fqdn)$" | wc -l)" -eq 1; then hostnames="$(hostname --fqdn; grep <<<"$hostnames" -v "^$(hostname --fqdn)$")"; fi; \
|
||||||
|
gum <<<"$hostnames" filter --placeholder "Pick a host..." --no-limit
|
||||||
|
|
||||||
@remote-current:
|
@remote-current:
|
||||||
>&2 echo Current remote: $(remote-host)
|
>&2 echo Current remote: $(remote-host)
|
||||||
|
|
||||||
@remote-list:
|
@remote-list:
|
||||||
tomlq <.remote.toml '.hosts | to_entries[] | "remote-set \(.key+1) # -> \(.value.host)"' -r
|
tomlq <.remote.toml '.hosts | to_entries[] | "remote-set \(.key+1) # -> \(.value.host)"' -r
|
||||||
|
|
||||||
@remote-set remote=`just remote-current && just _a-remote-label`:
|
@remote-set remote=`just remote-current && just _a_remote_label`:
|
||||||
remote-set {{remote}}
|
remote-set {{remote}}
|
||||||
|
|
||||||
@_a-remote-label:
|
@_a_remote_label:
|
||||||
just remote-list | gum filter --placeholder "Pick a remote..." | cut -d' ' -f2
|
just remote-list | gum filter --placeholder "Pick a remote..." | cut -d' ' -f2
|
||||||
|
|
||||||
@_a-remote-fqdn:
|
@_some_remote_labels:
|
||||||
|
just remote-list | gum filter --placeholder "Pick remotes..." --no-limit | cut -d' ' -f2
|
||||||
|
|
||||||
|
@_a_remote_fqdn:
|
||||||
just remote-list | gum filter --placeholder "Pick a remote..." | cut -d' ' -f5-
|
just remote-list | gum filter --placeholder "Pick a remote..." | cut -d' ' -f5-
|
||||||
|
|
||||||
|
@_some_remote_fqdns:
|
||||||
|
just remote-list | gum filter --placeholder "Pick remote..." --no-limit | cut -d' ' -f5-
|
||||||
|
|
||||||
@_remote_ensure hostname=`just _a_fqdn`:
|
@_remote_ensure hostname=`just _a_fqdn`:
|
||||||
if test ! -s .remote.toml; then remote-init "{{ hostname }}"; \
|
if test ! -s .remote.toml; then remote-init "{{ hostname }}"; \
|
||||||
elif tomlq <.remote.toml '.hosts | to_entries[] |.value.host' -r | grep -q "{{ hostname }}"; then true; \
|
elif tomlq <.remote.toml '.hosts | to_entries[] |.value.host' -r | grep -q "{{ hostname }}"; then true; \
|
||||||
|
@ -91,12 +110,17 @@ inspect-config host=`just _a_host`:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@_remote_label_from_fqdn hostname=`just _a_fqdn`:
|
@_remote_label_from_fqdn hostname=`just _a_fqdn`:
|
||||||
tomlq <.remote.toml '.hosts | to_entries[] | select(.value.host == "{{ hostname }}") | .key' -r
|
tomlq <.remote.toml '.hosts | to_entries[] | select(.value.host == "{{ hostname }}") | .key+1' -r
|
||||||
|
|
||||||
|
@remote-mprocs +$cmd=`printf "just %s\n" $(just --summary --unsorted) | gum filter --placeholder "Pick a recipie..."`:
|
||||||
|
just _some_remote_labels | sed -E 's/(.*)/remote --label="\1" "env NIX_NO_NOM=1 $cmd"/g' | xargs -d'\n' mprocs
|
||||||
|
|
||||||
|
@remote-mprocs-new +$cmd=`printf "just %s\n" $(just --summary --unsorted) | gum filter --placeholder "Pick a recipie..."`:
|
||||||
|
just _some_fqdns | xe -s 'just _remote_ensure "$1"; just _remote_label_from_fqdn "$1"' | sed -E 's/(.*)/remote --label="\1" "env NIX_NO_NOM=1 $cmd"/g' | xargs -d'\n' mprocs
|
||||||
|
|
||||||
# TODO: support multiple labels, run in tmux
|
# TODO: support multiple labels, run in tmux
|
||||||
remote label=`just _a-remote-label` cmd=`printf "just %s\n" $(just --summary --unsorted) | gum filter --placeholder "Pick a recipie..."`:
|
#remote label=`just _a_remote_label` cmd=`printf "just %s\n" $(just --summary --unsorted) | gum filter --placeholder "Pick a recipie..."`:
|
||||||
remote --label={{label}} {{cmd}}
|
# remote --label={{label}} {{cmd}}
|
||||||
|
|
||||||
# TODO: packaged as nix-web
|
# TODO: packaged as nix-web
|
||||||
@gorgon:
|
@gorgon:
|
||||||
|
|
|
@ -8,7 +8,16 @@
|
||||||
system.autoUpgrade.enable = true;
|
system.autoUpgrade.enable = true;
|
||||||
#system.autoUpgrade.allowReboot = true; # reboot after a kernel (module) or initrd upgrade, consider also setting `rebootWindow`
|
#system.autoUpgrade.allowReboot = true; # reboot after a kernel (module) or initrd upgrade, consider also setting `rebootWindow`
|
||||||
|
|
||||||
environment.etc."current-system-flake".source = inputs.self; # the plan was to allow me to locate the new flake.lock, but alas https://github.com/NixOS/nix/issues/6895
|
environment.etc."current-system-flake".source = inputs.self;
|
||||||
|
# workaround for https://github.com/NixOS/nix/issues/6895
|
||||||
|
environment.etc."current-system-flake-inputs.json".source
|
||||||
|
= pkgs.writers.writeJSON "flake-inputs.json" (
|
||||||
|
lib.flip lib.mapAttrs inputs (name: input:
|
||||||
|
# inputs.*.sourceInfo sans outPath, since writeJSON will otherwise serialize sourceInfo like derivation
|
||||||
|
lib.filterAttrs (key: val: !builtins.elem key ["outPath"]) (input.sourceInfo or {})
|
||||||
|
// { store-path = input.outPath; } # comment this line if you don't want to retain a store reference to the flake inputs
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
#system.autoUpgrade.flake = inputs.self.outPath; # a nix store path
|
#system.autoUpgrade.flake = inputs.self.outPath; # a nix store path
|
||||||
#system.autoUpgrade.flake = "github:pbsds/nix-config"; # TODO: use this instead?
|
#system.autoUpgrade.flake = "github:pbsds/nix-config"; # TODO: use this instead?
|
||||||
|
|
|
@ -21,6 +21,7 @@ with lib.hm.gvariant;
|
||||||
font-antialiasing = "grayscale";
|
font-antialiasing = "grayscale";
|
||||||
font-hinting = "slight";
|
font-hinting = "slight";
|
||||||
font-name = "Noto Sans 10";
|
font-name = "Noto Sans 10";
|
||||||
|
#gtk-enable-primary-paste = false;
|
||||||
gtk-theme = "Colloid-Dark";
|
gtk-theme = "Colloid-Dark";
|
||||||
icon-theme = "Flat-Remix-Blue-Dark";
|
icon-theme = "Flat-Remix-Blue-Dark";
|
||||||
locate-pointer = false;
|
locate-pointer = false;
|
||||||
|
|
Loading…
Reference in New Issue