From 987277b997ddd49bd51c89d2bf2e7f91b9b0128c Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Wed, 21 May 2025 16:04:54 +0200 Subject: [PATCH] kladslkjdljkasd --- justfile | 20 +++++++------- profiles/known-hosts/hosts.toml | 10 +++---- users/pbsds/home/default.nix | 2 +- users/pbsds/home/profiles/bat.nix | 4 +-- users/pbsds/home/profiles/desktop/salert.nix | 27 ++++++++++++++++--- .../home/profiles/desktop/zed/default.nix | 15 +++++++---- users/pbsds/home/profiles/git.nix | 10 ++++--- users/pbsds/home/profiles/shell.nix | 6 +++++ 8 files changed, 63 insertions(+), 31 deletions(-) diff --git a/justfile b/justfile index a14b770..fdcf7d6 100644 --- a/justfile +++ b/justfile @@ -10,22 +10,20 @@ export FZF_DEFAULT_OPTS := "--height 15 --cycle --bind 'ctrl-a:toggle-all' " + e @_default: just "$(gum filter --placeholder "Pick a recipie..." $(just --summary --unsorted))" -# @val $hostname=`just _a_host` $attrpath="" *_="_sentinel_": -eval $hostname=`just _a_host` $attrpath="" *_: +eval $hostname=`just _a_host` $attrpath="" *args: #!/usr/bin/env -S bash -euo pipefail - attrpath="${attrpath:-system.build.toplevel.outPath}" - args=("${@:3}") - # [[ "${args[0]}" != "_sentinel_" ]] || args=("${args[@]:1}") + declare attrpath="${attrpath:-system.build.toplevel.outPath}" + declare -a args=("${@:3}") + [[ "$attrpath" =~ ^config\. ]] && attrpath="${attrpath:7}" ||: # pop optional 'config.' prefix set -x nix eval ".#nixosConfigurations.\"$hostname\".config.$attrpath" --show-trace "${args[@]}" -# @val-vm $hostname=`just _a_host` $attrpath="" *_="_sentinel_": -eval-vm $hostname=`just _a_host` $attrpath="" *_: +eval-vm $hostname=`just _a_host` $attrpath="" *args: #!/usr/bin/env -S bash -euo pipefail - # nix eval ".#nixosConfigurations.\"$hostname\".config.system.build.vm.outPath" --show-trace "${@:2}" - attrpath="${attrpath:-system.build.toplevel.outPath}" - args=("${@:3}") - # [[ "${args[0]}" != "_sentinel_" ]] || args=("${args[@]:1}") + declare attrpath="${attrpath:-system.build.toplevel.outPath}" + declare -a args=("${@:3}") + [[ "$attrpath" =~ ^config\. ]] && attrpath="${attrpath:7}" ||: # pop optional 'config.' prefix set -x + # nix eval ".#nixosConfigurations.\"$hostname\".config.system.build.vm.outPath" --show-trace "${@:3}" nix eval ".#nixosConfigurations.\"$hostname\".config.virtualisation.vmVariant.$attrpath" --show-trace "${args[@]}" repl $hostname=`just _a_host`: diff --git a/profiles/known-hosts/hosts.toml b/profiles/known-hosts/hosts.toml index ca511dd..2b57aa9 100644 --- a/profiles/known-hosts/hosts.toml +++ b/profiles/known-hosts/hosts.toml @@ -52,7 +52,7 @@ aliases = [ "bolle.tail9aac63.ts.net" ] buildMachine.systems = ["x86_64-linux", "i686-linux", "riscv64-linux"] buildMachine.maxJobs = 3 # 12 threads 32GB buildMachine.speedFactor = 4 # ??? -buildMachine.supportedFeatures = ["kvm", "nixos-test"] +buildMachine.supportedFeatures = ["kvm", "nixos-test"] # , "ccache" ] ssh.listenPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILeOB/57N1fQPVorIUlkkJZaQduBo+4+km2Qbj4ebd/k" ssh.proxyJump = "hildring.pvv.ntnu.no" # wakeonlan e4:54:e8:51:8c:e9 @@ -62,7 +62,7 @@ aliases = [ "eple.tail9aac63.ts.net" ] buildMachine.systems = ["x86_64-linux", "i686-linux", "riscv64-linux"] buildMachine.maxJobs = 3 # 12 threads 32GB buildMachine.speedFactor = 3 # i7-5820K -buildMachine.supportedFeatures = ["kvm", "nixos-test"] +buildMachine.supportedFeatures = ["kvm", "nixos-test"] # , "ccache" ] # useAsSubstituter = true ssh.listenPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH03MEINNnjBvtmvN2QsCDCLkvF9ow5FQJp9uiyQ1Iwi" ssh.proxyJump = "hildring.pvv.ntnu.no" @@ -73,7 +73,7 @@ aliases = [ "garp.tail9aac63.ts.net" ] buildMachine.systems = ["x86_64-linux", "i686-linux", "riscv64-linux"] buildMachine.maxJobs = 2 # 8 threads 32GB buildMachine.speedFactor = 4 # i7-6700 -buildMachine.supportedFeatures = ["kvm", "nixos-test", "cuda"] +buildMachine.supportedFeatures = ["kvm", "nixos-test", "cuda"] # , "ccache" ] ssh.listenPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOkcZ3cUAKk8uUvZPsX7PDBInkb3Eps3Xh+xVrhPY+sx" ssh.proxyJump = "hildring.pvv.ntnu.no" # wakeonlan 4c:cc:6a:61:d0:20 @@ -91,7 +91,7 @@ ssh.userPublicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC7fYndgIXJM+tLSfkbprW aliases = [ "sopp.tail9aac63.ts.net" ] # "sopp.pbsds.net", # buildMachine.maxJobs = 2 # 8 threads 32GB buildMachine.speedFactor = 2 # i7-4790K -buildMachine.supportedFeatures = ["kvm", "nixos-test", "cuda"] +buildMachine.supportedFeatures = ["kvm", "nixos-test", "cuda"] # , "ccache" ] # useAsSubstituter = true remoteStoreSpecialization = true # ssh.listenPort = 26 @@ -104,7 +104,7 @@ ssh.userPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL6eTQkxO/1XflHpGf3478+ aliases = [ "nord.tail9aac63.ts.net" ] # "nord.pbsds.net", # buildMachine.maxJobs = 1 # 4 threads 32GB buildMachine.speedFactor = 1 # i5-2500 -buildMachine.supportedFeatures = ["kvm", "nixos-test"] +buildMachine.supportedFeatures = ["kvm", "nixos-test"] # , "ccache" ] # useAsSubstituter = true # ssh.listenPort = 24 ssh.listenPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIBSdIUtUfAxnVbPDmDDFdP2S3Wd3+CC8IfZAANJ76oh" diff --git a/users/pbsds/home/default.nix b/users/pbsds/home/default.nix index 7cb523c..ded6fa8 100644 --- a/users/pbsds/home/default.nix +++ b/users/pbsds/home/default.nix @@ -19,7 +19,7 @@ ./profiles/ssh.nix /* ./profiles/tmate.nix */ ./profiles/update-diff.nix - ./profiles/desktop/zed/remote.nix + ./profiles/desktop/zed/remote.nix # lsps for remote zed development ]; # TODO: add remote-exec once packaged diff --git a/users/pbsds/home/profiles/bat.nix b/users/pbsds/home/profiles/bat.nix index b319cb9..c3e9cd3 100644 --- a/users/pbsds/home/profiles/bat.nix +++ b/users/pbsds/home/profiles/bat.nix @@ -12,14 +12,14 @@ in { home.packages = with pkgs; [ bat - #bat-extras.batman + bat-extras.batman ]; # bat - TODO: condition these on programs.bat.enable ? home.shellAliases.cat = "bat --style=plain --paging=never"; home.shellAliases.cata = mkArgsAlias ''printf "echo + "$@"; bat --style plain --paging never %q\n" "$@" | xargs -d'\n' ${lib.getExe pkgs.mprocs}''; home.shellAliases.bata = mkArgsAlias ''printf "echo + "$@"; bat --style plain %q\n" "$@" | xargs -d'\n' ${lib.getExe pkgs.mprocs}''; - #home.shellAliases.man = "batman"; + home.shellAliases.man = "batman"; #home.shellAliases.man = "PAGER=${pkgs.most}/bin/most man"; home.shellAliases.zbat = mkArgsAliasX ''atool "$1" --cat | bat --file-name "$1"''; diff --git a/users/pbsds/home/profiles/desktop/salert.nix b/users/pbsds/home/profiles/desktop/salert.nix index caaf74e..3ce6d87 100644 --- a/users/pbsds/home/profiles/desktop/salert.nix +++ b/users/pbsds/home/profiles/desktop/salert.nix @@ -6,16 +6,35 @@ in { programs = let # TODO: a notification based variant + opts = lib.escapeShellArgs [ + # no gui + "--no-video" + # no stdout + "--really-quiet" + # prime tv audio + "--audio-wait-open=1" # TODO: no work? "" + "--audio-stream-silence=yes" # "Not all AOs support this" + ]; rcScript = '' salert() { local retval=$? + local -a opts=(${opts}) if test $retval -eq 0; then - #${getExe mpv} ${../../files/sounds/TFH_MadameC_Sing.wav} --no-video --really-quiet || true - #${getExe mpv} ${../../files/sounds/NTR-BKIE-USA-0065.wav} --no-video --really-quiet || true - ${getExe mpv} ${../../files/sounds/NTR-BKIE-USA-0134.wav} --no-video --really-quiet || true + case $(( $RANDOM % 10 )) in + 0 | 1 | 2 | 3 | 4) + ${getExe mpv} "''${opts[@]}" --volume-gain=10 ${../../files/sounds/NTR-BKIE-USA-0134.wav} ||: + ;; + 5 | 6 | 7 | 8) + ${getExe mpv} "''${opts[@]}" --volume-gain=12 ${../../files/sounds/NTR-BKIE-USA-0065.wav} ||: + ;; + 9) + ${getExe mpv} "''${opts[@]}" --volume-gain=3 ${../../files/sounds/TFH_MadameC_Sing.wav} ||: + ;; + esac else - ${getExe mpv} ${../../files/sounds/NTR-BKIE-USA-0137.wav} --no-video --really-quiet || true + ${getExe mpv} "''${opts[@]}" --volume-gain=8 ${../../files/sounds/NTR-BKIE-USA-0137.wav} ||: fi + return $retval } ''; diff --git a/users/pbsds/home/profiles/desktop/zed/default.nix b/users/pbsds/home/profiles/desktop/zed/default.nix index 33aa30e..28612a7 100644 --- a/users/pbsds/home/profiles/desktop/zed/default.nix +++ b/users/pbsds/home/profiles/desktop/zed/default.nix @@ -9,6 +9,7 @@ pkgs.unstable.zed-editor ]; + # setup lsp dependencies, useful for headless hosts to import too imports = [ ./remote.nix ]; systemd.user.services."update-zed-config" = { @@ -17,15 +18,19 @@ Service.ExecStart = toString ( # TODO: do I want to clone it if missing? Requires git keys, I should clone on OnActiveSec pkgs.writers.writeBash "update-zed-config" { } '' - PATH="${lib.makeBinPath [ pkgs.git ]}''${PATH:-":$PATH"}" - if [[ -e "$HOME".config/zed/.git ]]; then - cd "$HOME".config/zed/ + PATH="${lib.makeBinPath [ pkgs.git ]}''${PATH:+":$PATH"}" + if [[ -e "$HOME"/.config/zed/.git ]]; then + cd "$HOME"/.config/zed/ git add . + set -x if ! git diff --staged --exit-code --quiet; then + git status ||: git commit -m "Daily auto-commit $(date -u +%Y-%m-%dT%H:%M:%S%Z) @ $(hostname)" + git pull --rebase --autostash + git push + else + git pull --rebase --autostash fi - git pull --rebase --autostash - git push fi '' ); diff --git a/users/pbsds/home/profiles/git.nix b/users/pbsds/home/profiles/git.nix index 79bec39..20da347 100644 --- a/users/pbsds/home/profiles/git.nix +++ b/users/pbsds/home/profiles/git.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, ... }: +{ config, pkgs, lib, ... }: { home.packages = with pkgs; [ #git @@ -34,8 +34,12 @@ programs.git.enable = true; programs.git.lfs.enable = true; programs.git.delta.enable = true; - programs.git.delta.options.tabs = 4; - programs.git.delta.options.max-line-length = 0; + programs.git.delta.options = { + # Delta uses ~/.gitconfig even when not invoked by git + tabs = 4; + max-line-length = 0; + features.syntax-theme = lib.mkIf config.programs.bat.enable config.programs.bat.config.theme; + }; #programs.git.lfs.enable = true; #programs.git.signing #programs.git.userName = "pbsds" diff --git a/users/pbsds/home/profiles/shell.nix b/users/pbsds/home/profiles/shell.nix index 4a3bf3e..60d5ccc 100644 --- a/users/pbsds/home/profiles/shell.nix +++ b/users/pbsds/home/profiles/shell.nix @@ -79,6 +79,7 @@ in "--bind 'end:last'" "--cycle" + # bat is installed in bat.nix #"--preview 'head {}'" # "--preview 'bat {}'" # "--preview 'tail -n$LINES {} | bat --file-name {} --paging never --style plain'" @@ -160,12 +161,17 @@ in home.shellAliases.fda = "fd --no-ignore --hidden"; home.shellAliases.afd = "fd --no-ignore --hidden"; + home.shellAliases.drg = lib.mkIf (config.programs.git.enable && config.programs.git.delta.enable) ( + mkArgsAlias ''rg "$@" --json | delta'' + ); + # via nix-index-with-full-db home.shellAliases.nlocate = "nix-locate --top-level --regex"; home.shellAliases.nlocateo = mkArgsAlias ''nix-locate --top-level --regex "$@" | tr -s ' ' | cut -d' ' -f4''; home.shellAliases.kaomoji = "curl -s 'https://kaomoji.ru/en/' | htmlq tr td span --text | grep . | shuf | head -n1"; + home.packages = lib.filter (x: x != null) (with pkgs; [ rsync bind.dnsutils # dig