add location and do not disturb toggles

This commit is contained in:
Henry Hiles 2026-11-17 23:30:04 -05:00
commit 518ffa31b4
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -26,6 +26,11 @@
quickshell = builtins.unsafeDiscardStringContext (
nixpkgs.lib.getExe nixpkgs.legacyPackages.aarch64-linux.quickshell
);
# This one isn't in the cache, so its derivation is copied over and the phone builds it
locationAgent =
(nixpkgs.legacyPackages.aarch64-linux.extend self.overlays.default).quadshell.locationAgent;
agentDrv = builtins.unsafeDiscardOutputDependency locationAgent.drvPath;
agentBin = "${builtins.unsafeDiscardStringContext locationAgent.outPath}/bin";
in
{
# nix run .#phone [host]: runs the shell on the phone until Ctrl+C.
@ -42,6 +47,11 @@
host=''${1:-phone}
dest=.cache/quadshell-dev
mapfile -t inputs < <(nix-store --query --references ${agentDrv} | grep '\.drv$')
nix-store --realise "''${inputs[@]}" >/dev/null
nix copy --derivation --to "ssh-ng://$host" ${agentDrv}
nix copy --to "ssh-ng://$host" "''${inputs[@]/%/^*}"
# The store's files are read-only, which would stop the next run replacing them
# shellcheck disable=SC2029
tar -C ${self}/src --mode=u+w -c . | ssh "$host" "rm -rf $dest; mkdir -p $dest; tar -C $dest -x"
@ -49,8 +59,9 @@
# shellcheck disable=SC2029
exec ssh -t "$host" "
nix-store --realise ${builtins.dirOf (builtins.dirOf quickshell)} >/dev/null;
nix-store --realise --option substitute false ${agentDrv} >/dev/null;
pkill -f '^/nix/store/[^ ]*/bin/quickshell ';
exec systemd-run --user --pty --quiet --collect ${quickshell} --path ~/$dest
exec systemd-run --user --pty --quiet --collect --setenv=PATH=${agentBin}:\"\$PATH\" ${quickshell} --path ~/$dest
"
'';
}