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
|
||||
_*
|
||||
/logs
|
||||
mprocs.log
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
export HOST_SHELL="$(command -v "$SHELL")"
|
||||
export IS_REMOTE_ENV=1
|
||||
eval "$(nix print-dev-env .#remoteenv)"
|
||||
echo Entered "$(hostname --fqdn)"
|
||||
df -h /nix/store
|
||||
|
|
|
@ -321,9 +321,9 @@
|
|||
# TODO: get faketty to work ${expect}/bin/unbuffer is bad
|
||||
nixos-rebuild-nom = pkgs.writeScriptBin "nixos-rebuild" ''
|
||||
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
|
||||
exec ${lib.getExe pkgs.nixos-rebuild} "$@" -L
|
||||
exec ${lib.getExe pkgs.nixos-rebuild} -L "$@"
|
||||
fi
|
||||
'';
|
||||
|
||||
|
@ -383,6 +383,7 @@
|
|||
pkgs.ssh-to-age
|
||||
pkgs.just
|
||||
pkgs.gum
|
||||
pkgs.mprocs
|
||||
];
|
||||
in {
|
||||
envrc-local = mkShell envrc-pkgs;
|
||||
|
|
|
@ -44,6 +44,8 @@
|
|||
#../../profiles/domeneshop-dyndns # handled by noximilien
|
||||
];
|
||||
|
||||
nix.settings.max-jobs = 1; # this host do be stinky
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 57621 ]; # spotify local discovery
|
||||
|
||||
#networking.wireguard.interfaces."wg0".ips = [ "172.22.48.4/24" ]; # fyrkat
|
||||
|
|
|
@ -100,6 +100,8 @@
|
|||
"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.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 \
|
||||
| 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}}"
|
||||
|
||||
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`:
|
||||
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; \
|
||||
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:
|
||||
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..."
|
||||
|
||||
@_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:
|
||||
>&2 echo Current remote: $(remote-host)
|
||||
|
||||
@remote-list:
|
||||
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}}
|
||||
|
||||
@_a-remote-label:
|
||||
@_a_remote_label:
|
||||
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-
|
||||
|
||||
@_some_remote_fqdns:
|
||||
just remote-list | gum filter --placeholder "Pick remote..." --no-limit | cut -d' ' -f5-
|
||||
|
||||
@_remote_ensure hostname=`just _a_fqdn`:
|
||||
if test ! -s .remote.toml; then remote-init "{{ hostname }}"; \
|
||||
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
|
||||
|
||||
@_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
|
||||
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=`just _a_remote_label` cmd=`printf "just %s\n" $(just --summary --unsorted) | gum filter --placeholder "Pick a recipie..."`:
|
||||
# remote --label={{label}} {{cmd}}
|
||||
|
||||
# TODO: packaged as nix-web
|
||||
@gorgon:
|
||||
|
|
|
@ -8,7 +8,16 @@
|
|||
system.autoUpgrade.enable = true;
|
||||
#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 = "github:pbsds/nix-config"; # TODO: use this instead?
|
||||
|
|
|
@ -21,6 +21,7 @@ with lib.hm.gvariant;
|
|||
font-antialiasing = "grayscale";
|
||||
font-hinting = "slight";
|
||||
font-name = "Noto Sans 10";
|
||||
#gtk-enable-primary-paste = false;
|
||||
gtk-theme = "Colloid-Dark";
|
||||
icon-theme = "Flat-Remix-Blue-Dark";
|
||||
locate-pointer = false;
|
||||
|
|
Loading…
Reference in New Issue