summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Vink <59492084+ivi-vink@users.noreply.github.com>2025-01-22 14:19:59 +0100
committerMike Vink <59492084+ivi-vink@users.noreply.github.com>2025-01-22 14:19:59 +0100
commit3000da50139ff3b044c5742140bc1ede8e3f4ad6 (patch)
treec20dc0d4851ef2c9163392b9c5441b51a174b85d
parent6043502305e3d5ccc6c537d4ed085d8b2454c5c8 (diff)
fix git and nushell
-rw-r--r--justfile5
-rw-r--r--machines/work.nix2
-rwxr-xr-xmut/bin/desktop-open-pipe18
-rwxr-xr-xmut/bin/xdg-open2
-rw-r--r--mut/git/config25
-rw-r--r--mut/git/github2
-rw-r--r--mut/git/ignore6
-rw-r--r--mut/nushell/config.nu10
-rw-r--r--mut/nushell/env.nu91
9 files changed, 128 insertions, 33 deletions
diff --git a/justfile b/justfile
index 7f4ba4b..7069b88 100644
--- a/justfile
+++ b/justfile
@@ -70,8 +70,11 @@ NIXNAME := "vm-aarch64"
ln -sf /nix-config/mut/DefaultKeyBinding.dict ~/Library/KeyBindings/DefaultKeyBinding.dict
! [ -d ~/.config/aerospace ] && ln -sf /nix-config/mut/aerospace ~/.config/aerospace
! [ -d ~/.config/ghostty ] && ln -sf /nix-config/mut/ghostty ~/.config/ghostty
- ! [ -d ~/.config/nushell ] && ln -sf /nix-config/mut/nushell ~/.config/nushell
! [ -d ~/.config/nvim ] && ln -sf /nix-config/mut/neovim ~/.config/nvim
! [ -d ~/.config/k9s ] && ln -sf /nix-config/mut/k9s ~/.config/k9s
! [ -d ~/.config/carapace ] && ln -sf /nix-config/mut/carapace ~/.config/carapace
+ ! [ -d ~/.config/git ] && ln -sf /nix-config/mut/git ~/.config/git
+
+ ! [ -d ~/.config/nushell ] && ln -sf /nix-config/mut/nushell ~/.config/nushell
+ rm -rf "$HOME/Library/Application Support/nushell"; ln -sf /nix-config/mut/nushell "$HOME/Library/Application Support/nushell"
true
diff --git a/machines/work.nix b/machines/work.nix
index 1899dcd..b1d9127 100644
--- a/machines/work.nix
+++ b/machines/work.nix
@@ -41,9 +41,11 @@
pkgs.zsh
pkgs.bashInteractive
pkgs.just
+ pkgs.git
];
hm = {
# services.ssh-agent.enable = true;
+ programs.git.enable = mkForce false;
home = {
sessionPath = [
"/opt/homebrew/bin"
diff --git a/mut/bin/desktop-open-pipe b/mut/bin/desktop-open-pipe
index 0ef1901..796bc5b 100755
--- a/mut/bin/desktop-open-pipe
+++ b/mut/bin/desktop-open-pipe
@@ -1,13 +1,7 @@
-#!/usr/bin/env bash
-name="$HOME/.cache/desktop-open.pipe"
-while true; do
- {
- /nix/store/zcw13r2mmpzlnv2yvfl13mcpky3hivq1-system-path/bin/xdg-open "$(cat "$name")"
-} >/dev/null 2>&1
-done
-
-finish () {
- rm -vf "$name"
+#!/usr/bin/env nu
+echo listening for open commands
+loop {
+ let line = nc -l 127.0.0.1 1994
+ echo $line | save --append /tmp/debuglogs
+ ^open $line
}
-
-trap finish EXIT
diff --git a/mut/bin/xdg-open b/mut/bin/xdg-open
index 6a5d254..ca18836 100755
--- a/mut/bin/xdg-open
+++ b/mut/bin/xdg-open
@@ -1,2 +1,2 @@
#!/bin/bash
-echo "$@" | tee "$HOME/.cache/desktop-open.pipe"
+nu --commands "^echo $1 | nc 127.0.0.1 1994 | echo"
diff --git a/mut/git/config b/mut/git/config
new file mode 100644
index 0000000..9d9b277
--- /dev/null
+++ b/mut/git/config
@@ -0,0 +1,25 @@
+[commit]
+ gpgsign = false
+
+[gpg]
+ format = "ssh"
+
+[merge]
+ tool = "fugitive"
+
+[mergetool "fugitive"]
+ cmd = "vim -f -c \"Gdiff\" \"$MERGED\""
+
+[user]
+ email = "ivi@vinkies.net"
+ name = "Mike Vink"
+ signingKey = "/Users/ivi/.ssh/id_ed25519_sk.pub"
+
+[worktree]
+ guessRemote = true
+
+[includeIf "hasconfig:remote.*.url:git@github.com:**/**"]
+ path = "/nix-config/mut/git/github"
+
+[includeIf "hasconfig:remote.*.url:https://github.com/**/**"]
+ path = "/nix-config/mut/git/github"
diff --git a/mut/git/github b/mut/git/github
new file mode 100644
index 0000000..421194d
--- /dev/null
+++ b/mut/git/github
@@ -0,0 +1,2 @@
+[user]
+ email = "59492084+ivi-vink@users.noreply.github.com"
diff --git a/mut/git/ignore b/mut/git/ignore
new file mode 100644
index 0000000..1ea4fc3
--- /dev/null
+++ b/mut/git/ignore
@@ -0,0 +1,6 @@
+/.direnv/
+/.envrc
+/.env
+.vimsession.vim
+tfplan
+plan
diff --git a/mut/nushell/config.nu b/mut/nushell/config.nu
index 38decfd..d47f885 100644
--- a/mut/nushell/config.nu
+++ b/mut/nushell/config.nu
@@ -900,10 +900,10 @@ $env.config = {
]
}
-if ($"($env.HOME)/.cache/wal/sequences" | path exists) { ^cat ~/.cache/wal/sequences }
+if ("~/.cache/wal/sequences" | path exists) { ^cat ~/.cache/wal/sequences }
source ~/.cache/zoxide.nu
-if ($"($env.HOME)/.cache/starship.nu" | path exists) { source ~/.cache/starship.nu }
-if ($"($env.HOME)/.cache/carapace.nu" | path exists) { source ~/.cache/carapace.nu }
+if ("~/.cache/starship.nu" | path exists) { source ~/.cache/starship.nu }
+if ("~/.cache/carapace.nu" | path exists) { source ~/.cache/carapace.nu }
$env.K9S_DEFAULT_PF_ADDRESS = "0.0.0.0"
$env.config.show_banner = false
@@ -913,7 +913,7 @@ alias k = kubectl
alias d = docker
alias t = terraform
-let pistarchio_dir = $"($env.HOME)/Programming/Pionative/pistarchio"
+let pistarchio_dir = "~/Programming/Pionative/pistarchio" | path expand
$env.PISTARCHIO_STACKS_DIR = $pistarchio_dir + "/stacks"
$env.PISTARCHIO_LIBRARY_DIR = $pistarchio_dir + "/library"
-$env.PISTARCHIO_VENDOR_DESTINATION_DIR = $pistarchio_dir + "/../clients"
+$env.PISTARCHIO_VENDOR_DESTINATION_DIR = ($pistarchio_dir + "/../clients") | path expand
diff --git a/mut/nushell/env.nu b/mut/nushell/env.nu
index ac0ac47..435a090 100644
--- a/mut/nushell/env.nu
+++ b/mut/nushell/env.nu
@@ -86,6 +86,70 @@ $env.NU_PLUGIN_DIRS = [
($nu.default-config-dir | path join 'plugins') # add <nushell-config-dir>/plugins
]
+# To load from a custom file you can use:
+# source ($nu.default-config-dir | path join 'custom.nu')
+
+let darwin: bool = (uname | get operating-system) == "Darwin"
+let nix: bool = "/nix" | path exists
+
+if $darwin and $nix {
+ $env.__NIX_DARWIN_SET_ENVIRONMENT_DONE = 1
+
+ $env.PATH = [
+ $"($env.HOME)/.nix-profile/bin"
+ $"/etc/profiles/per-user/($env.USER)/bin"
+ "/run/current-system/sw/bin"
+ "/nix/var/nix/profiles/default/bin"
+ "/usr/local/bin"
+ "/usr/bin"
+ "/usr/sbin"
+ "/bin"
+ "/sbin"
+ ]
+ $env.EDITOR = "VIM"
+ $env.NIX_PATH = [
+ $"darwin-config=($env.HOME)/.nixpkgs/darwin-configuration.nix"
+ "/nix/var/nix/profiles/per-user/root/channels"
+ ]
+ $env.NIX_SSL_CERT_FILE = "/etc/ssl/certs/ca-certificates.crt"
+ $env.PAGER = "less -R"
+ $env.TERMINFO_DIRS = [
+ $"($env.HOME)/.nix-profile/share/terminfo"
+ $"/etc/profiles/per-user/($env.USER)/share/terminfo"
+ "/run/current-system/sw/share/terminfo"
+ "/nix/var/nix/profiles/default/share/terminfo"
+ "/usr/share/terminfo"
+ ]
+ $env.XDG_CONFIG_DIRS = [
+ $"($env.HOME)/.nix-profile/etc/xdg"
+ $"/etc/profiles/per-user/($env.USER)/etc/xdg"
+ "/run/current-system/sw/etc/xdg"
+ "/nix/var/nix/profiles/default/etc/xdg"
+ ]
+ $env.XDG_DATA_DIRS = [
+ $"($env.HOME)/.nix-profile/share"
+ $"/etc/profiles/per-user/($env.USER)/share"
+ "/run/current-system/sw/share"
+ "/nix/var/nix/profiles/default/share"
+ ]
+ $env.TERM = $env.TERM
+ $env.NIX_USER_PROFILE_DIR = $"/nix/var/nix/profiles/per-user/($env.USER)"
+ $env.NIX_PROFILES = [
+ "/nix/var/nix/profiles/default"
+ "/run/current-system/sw"
+ $"/etc/profiles/per-user/($env.USER)"
+ $"($env.HOME)/.nix-profile"
+ ]
+
+ if ($"($env.HOME)/.nix-defexpr/channels" | path exists) {
+ $env.NIX_PATH = ($env.PATH | split row (char esep) | append $"($env.HOME)/.nix-defexpr/channels")
+ }
+
+ if (false in (ls -l `/nix/var/nix`| where type == dir | where name == "/nix/var/nix/db" | get mode | str contains "w")) {
+ $env.NIX_REMOTE = "daemon"
+ }
+}
+
# To add entries to PATH (on Windows you might use Path), you can use the following pattern:
# $env.PATH = ($env.PATH | split row (char esep) | prepend '/some/path')
# An alternate way to add entries to $env.PATH is to use the custom command `path add`
@@ -95,33 +159,32 @@ use std "path add"
# path add /some/path
# path add ($env.CARGO_HOME | path join "bin")
try {
- if (uname | get "operating-system") == "Darwin" {
+ if $darwin {
$env.PATH = ["/opt/homebrew/bin" "/opt/X11/bin" "/opt/local/bin" "/opt/local/sbin"] ++ $env.PATH
}
}
path add ($env.HOME | path join ".local" "bin")
$env.PATH = ($env.PATH | uniq)
-# To load from a custom file you can use:
-# source ($nu.default-config-dir | path join 'custom.nu')
+$env.XDG_CACHE_HOME = "~/.cache" | path expand
+$env.XDG_DATA_HOME = "~/.local/share" | path expand
+$env.XDG_CONFIG_HOME = "~/.config" | path expand
if (which carapace | is-not-empty) {
- $env.CARAPACE_BRIDGES = 'zsh,fish,bash,inshellisense' # optional
- mkdir ~/.cache/carapace
- carapace _carapace nushell | save --force ~/.cache/carapace.nu
+ $env.CARAPACE_BRIDGES = 'zsh,fish,bash,inshellisense' # optional
+ carapace _carapace nushell | save --force ~/.cache/carapace.nu
+}
+if (which zoxide | is-not-empty) {
+ zoxide init nushell --cmd=cd | save --force ~/.cache/zoxide.nu
+}
+if (which starship | is-not-empty) {
+ starship init nu | save --force ~/.cache/starship.nu
}
-mkdir ~/.cache/zoxide
-zoxide init nushell --cmd=cd | save --force ~/.cache/zoxide.nu
-starship init nu | save --force ~/.cache/starship.nu
-if (not ("/var/run/docker.sock" | path exists)) and (not ((uname | get operating-system) == "Darwin")) {
+if (not ("/var/run/docker.sock" | path exists)) and (not darwin) {
$env.DOCKER_HOST = $"unix://($env | default $"/run/($env.USER)" XDG_RUNTIME_DIR | get XDG_RUNTIME_DIR)/docker.sock"
}
-$env.XDG_CACHE_HOME = $"($env.HOME)/.cache"
-$env.XDG_DATA_HOME = $"($env.HOME)/.local/share"
-$env.XDG_CONFIG_HOME = $"($env.HOME)/.config"
-
# if not ("/.dockerenv" | path exists) {
# do --env {
# let ssh_agent_file = (