From 3ea8a7ade99cff0367ad1fe2174b0e91a891587a Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Sun, 12 Apr 2026 01:29:33 +0200 Subject: [PATCH] lkjdsalkjlkjsa --- .../files/opt/python-interactive-imports.py | 2 +- .../files/opt/sympy-interactive-imports.py | 2 +- .../desktop/gnome/dconf-gnome-bindings.nix | 4 +- .../home/profiles/desktop/pulsar/default.nix | 7 ++- .../minimal/bashrc.d/nix-store-from-here.sh | 44 +++++++++++++++++++ 5 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 users/pbsds/home/profiles/minimal/bashrc.d/nix-store-from-here.sh diff --git a/users/pbsds/home/files/opt/python-interactive-imports.py b/users/pbsds/home/files/opt/python-interactive-imports.py index 960f645..8cd6fd8 100755 --- a/users/pbsds/home/files/opt/python-interactive-imports.py +++ b/users/pbsds/home/files/opt/python-interactive-imports.py @@ -1,4 +1,4 @@ -#!/usb/bin/env python3 +#!/usb/bin/env -S python3 -i #run with: #gnome-terminal --hide-menubar --window-with-profile=manjaro -x python -i $HOME/.local/opt/python-interactive-imports.py diff --git a/users/pbsds/home/files/opt/sympy-interactive-imports.py b/users/pbsds/home/files/opt/sympy-interactive-imports.py index f385547..eb1df81 100755 --- a/users/pbsds/home/files/opt/sympy-interactive-imports.py +++ b/users/pbsds/home/files/opt/sympy-interactive-imports.py @@ -1,4 +1,4 @@ -#!/usb/bin/env python3 +#!/usb/bin/env -S python3 -i #run with: #gnome-terminal --hide-menubar --window-with-profile=manjaro -x python -i $HOME/.local/opt/sympy-interactive-imports.py diff --git a/users/pbsds/home/profiles/desktop/gnome/dconf-gnome-bindings.nix b/users/pbsds/home/profiles/desktop/gnome/dconf-gnome-bindings.nix index e83a528..599ebd3 100644 --- a/users/pbsds/home/profiles/desktop/gnome/dconf-gnome-bindings.nix +++ b/users/pbsds/home/profiles/desktop/gnome/dconf-gnome-bindings.nix @@ -142,7 +142,7 @@ with lib.hm.gvariant; "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom12" = { binding = ""; - command = "ghostty -e \"python3 -i $HOME/.local/opt/sympy-interactive-imports.py\""; + command = "ghostty -e \"$(command -v ptpython || echo python3)\" -i \"$HOME/.local/opt/sympy-interactive-imports.py\""; name = "Open SymPy terminal"; }; @@ -178,7 +178,7 @@ with lib.hm.gvariant; "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom5" = { binding = "space"; - command = "ghostty -e \"`command -v ptpython || echo python3` -i $HOME/.local/opt/python-interactive-imports.py\""; + command = "ghostty -e \"$(command -v ptpython || echo python3)\" -i \"$HOME/.local/opt/python-interactive-imports.py\""; name = "Open Python Terminal"; }; diff --git a/users/pbsds/home/profiles/desktop/pulsar/default.nix b/users/pbsds/home/profiles/desktop/pulsar/default.nix index a66b073..aca0615 100644 --- a/users/pbsds/home/profiles/desktop/pulsar/default.nix +++ b/users/pbsds/home/profiles/desktop/pulsar/default.nix @@ -6,12 +6,11 @@ home.shellAliases.atom = lib.mkDefault "pulsar"; home.packages = with pkgs; [ - #atom - pulsar + #pkgs.atom + pkgs.pulsar - nodePackages.bash-language-server + (pkgs.bash-language-server or pkgs.nodePackages.bash-language-server) # TODO: ensure python-lsp-server? - ]; home.file.".pulsar/config.cson".source = ./config.cson; diff --git a/users/pbsds/home/profiles/minimal/bashrc.d/nix-store-from-here.sh b/users/pbsds/home/profiles/minimal/bashrc.d/nix-store-from-here.sh new file mode 100644 index 0000000..2eda4a5 --- /dev/null +++ b/users/pbsds/home/profiles/minimal/bashrc.d/nix-store-from-here.sh @@ -0,0 +1,44 @@ +nix-store-from-here() ( + paths=("$@") + if [[ "${#paths[@]}" -le 0 ]]; then + echo >&2 "ERROR: no paths provided!" + return 0 + fi + + # nix_store=$(nix config show TODO) + nix_store="/nix/store" + store_paths=() + # set -x + + for path in "${paths[@]}"; do + if [[ ! -e "$path" ]]; then + echo >&2 "WARNING: not found: '$path'" + continue + fi + + resolved="$( realpath --no-symlinks "$path" )" # we prefer the originally referenced file and not the path it points to if a in-store symlink + if [[ ! "$resolved" =~ ^"$nix_store"/*/ ]]; then + resolved="$( realpath "$path" )" # to resolve files in "result" symlinks + if [[ ! "$resolved" =~ ^"$nix_store"/*/ ]]; then + echo >&2 "WARNING: not in store: '$path'" + continue + fi + fi + + # simple + # store_paths+=("$resolved") + + # only reference top-level store path + resolved_base="${resolved#"$nix_store/"}" + resolved_base="${resolved_base%%+(/*)}" + store_paths+=("$nix_store/$resolved_base") + done + + if [[ "${#store_paths[@]}" -gt 0 ]]; then + { + for fqdn in $(printf "%q\n" $(hostname -f) $(hostname -A) | sort -u); do + printf "nix copy --from ssh://%q %s --out-link result\n" "${fqdn}" "$(printf " %q" "${store_paths[@]}")" + done + } | column -t -s' ' -o' ' + fi +)