From 1c0fb275f3f302d6abc3ef560a80ceec8a8e6b8c Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Tue, 6 Jan 2026 22:54:41 +0100 Subject: refactor: move scripts to cmd50 --- nixos/npins/sources.json | 12 ++++++++++++ nixos/profiles/workstation/default.nix | 11 ++++++++--- nixos/profiles/workstation/dev.nix | 3 --- nixos/profiles/workstation/graphical.nix | 20 -------------------- nixos/profiles/workstation/scripts/deploy-dir | 17 ----------------- nixos/profiles/workstation/scripts/reset-bg | 4 ---- nixos/profiles/workstation/scripts/set-bg | 5 ----- user/open/config.toml | 11 +++++++++++ user/zsh/zshrc-workstation.sh | 4 +++- 9 files changed, 34 insertions(+), 53 deletions(-) delete mode 100755 nixos/profiles/workstation/scripts/deploy-dir delete mode 100644 nixos/profiles/workstation/scripts/reset-bg delete mode 100644 nixos/profiles/workstation/scripts/set-bg create mode 100644 user/open/config.toml diff --git a/nixos/npins/sources.json b/nixos/npins/sources.json index 73b3165..b011c48 100644 --- a/nixos/npins/sources.json +++ b/nixos/npins/sources.json @@ -27,6 +27,18 @@ "url": null, "hash": "1mdgv6jfbjs3xsqk9dxli6w345jws8j5qgzqf6wljmxlvibbic6y" }, + "my-cmd50": { + "type": "Git", + "repository": { + "type": "Git", + "url": "https://git.push-f.com/cmd50" + }, + "branch": "main", + "submodules": false, + "revision": "222b4dc884892d5927dabbab2b2b6e64d3244002", + "url": null, + "hash": "0md1n8rvbblqgi4bygp5hsw7nfp0xsjbac5jskkgsjwmj0lmygl3" + }, "my-geopos-link": { "type": "Git", "repository": { diff --git a/nixos/profiles/workstation/default.nix b/nixos/profiles/workstation/default.nix index 38b4723..3b24674 100644 --- a/nixos/profiles/workstation/default.nix +++ b/nixos/profiles/workstation/default.nix @@ -3,6 +3,7 @@ let cfg = config.workstation; sources = import ; + cmd50 = (pkgs.callPackage sources.my-cmd50 {}); in { options.workstation = { @@ -42,12 +43,16 @@ in (callPackage "${sources.agenix}/pkgs/agenix.nix" {}) (callPackage sources.my-vdf {}) nixfmt-rfc-style - restic vim-full - skim - (writeShellScriptBin "ed" (builtins.readFile ./scripts/ed)) + cmd50 + (writeShellScriptBin "xdg-open" '' + ${cmd50}/bin/open "$@" + '') + (writeShellScriptBin "ed" (builtins.readFile ./scripts/ed)) + restic + skim unzip # Android diff --git a/nixos/profiles/workstation/dev.nix b/nixos/profiles/workstation/dev.nix index 262c55e..e73309d 100644 --- a/nixos/profiles/workstation/dev.nix +++ b/nixos/profiles/workstation/dev.nix @@ -11,7 +11,6 @@ nix-direnv # CLI tools - skim docker-compose gnumake jq @@ -22,8 +21,6 @@ fastmod license-generator - (writeShellScriptBin "deploy-dir" (builtins.readFile ./scripts/deploy-dir)) - gcc # rustc fails if cc linker isn't found chromium diff --git a/nixos/profiles/workstation/graphical.nix b/nixos/profiles/workstation/graphical.nix index 3100e8a..c2a835e 100644 --- a/nixos/profiles/workstation/graphical.nix +++ b/nixos/profiles/workstation/graphical.nix @@ -53,11 +53,6 @@ grim libnotify # for notify-send - # When I ssh into a server my terminal changes to a host-specific background color via - # a LocalCommand configured in ~/.ssh/config and a ZSH function to reset the color on exit. - (writeShellScriptBin "set-bg" (builtins.readFile ./scripts/set-bg)) - (writeShellScriptBin "reset-bg" (builtins.readFile ./scripts/reset-bg)) - # graphical tools foot imv @@ -75,21 +70,6 @@ poweralertd ]; - # This generates /etc/xdg/mimeapps.list. The XDG spec and xdg-open don't support wildcards in MIME types. - # TODO: use an xdg-open alternative that supports wildcards in MIME types and doesn't use mimeapps.list - xdg.mime.defaultApplications = - let - defaultBrowser = "firefox.desktop"; - in - { - "text/html" = defaultBrowser; - "application/pdf" = "org.pwmt.zathura.desktop"; - - "x-scheme-handler/http" = defaultBrowser; - "x-scheme-handler/https" = defaultBrowser; - "x-scheme-handler/mailto" = "thunderbird.desktop"; - }; - programs.thunderbird = { enable = true; }; diff --git a/nixos/profiles/workstation/scripts/deploy-dir b/nixos/profiles/workstation/scripts/deploy-dir deleted file mode 100755 index f90a4ae..0000000 --- a/nixos/profiles/workstation/scripts/deploy-dir +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -# Replaces the contents of a remote directory with the contents of a local directory. - -if [ "$#" -ne 3 ]; then - echo "usage: $0 " - exit 1 -fi -printf -v remote_dir %q $3 - -cd $1 -tar cf - . | ssh $2 "set -xe -TEMP_DIR=\$(mktemp -d) -cd \$TEMP_DIR -tar xvf - -rm -rf $remote_dir -mv \$TEMP_DIR $remote_dir -" diff --git a/nixos/profiles/workstation/scripts/reset-bg b/nixos/profiles/workstation/scripts/reset-bg deleted file mode 100644 index 049954d..0000000 --- a/nixos/profiles/workstation/scripts/reset-bg +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -# Resets the background color of the current foot terminal to the default. - -echo -en "\033]111\007" diff --git a/nixos/profiles/workstation/scripts/set-bg b/nixos/profiles/workstation/scripts/set-bg deleted file mode 100644 index 2ed0a78..0000000 --- a/nixos/profiles/workstation/scripts/set-bg +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -# Sets the background color of the current foot terminal to the given hex color. - -rgb_with_slashes=$(echo "$1" | sed -r 's,(..)(..),\1/\2/,') -echo -en "\033]11;rgb:$rgb_with_slashes\007" diff --git a/user/open/config.toml b/user/open/config.toml new file mode 100644 index 0000000..c99864d --- /dev/null +++ b/user/open/config.toml @@ -0,0 +1,11 @@ +[mime-types] +"application/pdf" = ["zathura"] +"image/*" = ["imv"] +"text/html" = ["firefox"] +"text/*" = ["foot", "vim"] +"video/*" = ["mpv"] + +[uri-schemes] +"http" = ["firefox"] +"https" = ["firefox"] +"mailto" = ["thunderbird"] diff --git a/user/zsh/zshrc-workstation.sh b/user/zsh/zshrc-workstation.sh index b7458b0..a31627b 100644 --- a/user/zsh/zshrc-workstation.sh +++ b/user/zsh/zshrc-workstation.sh @@ -20,7 +20,9 @@ path+=$NPM_CONFIG_PREFIX/bin eval "$(direnv hook zsh)" function ssh() { - # In my ~/.ssh/config I configure host-specific background colors, for example: + # When I ssh into a server my terminal changes to a host-specific background color via + # a LocalCommand configured in ~/.ssh/config and this ZSH function resets the color on exit. + # For example in ~/.ssh/config I could configure: # # Host forest # LocalCommand set-bg 003300 -- cgit v1.3.1