Files
nixos-config/install-dotfiles.nu
Fredrik Robertsen 7e655fa1bb add .ssh/config to dotfiles
also fix the install script
2026-03-25 23:57:02 +01:00

24 lines
597 B
Nu
Executable File

#!/usr/bin/env nu
let dotfiles = ($env.HOME | path join "nixos-config/dotfiles")
glob $"($dotfiles)/**/*" | where ($it | path type) == "file" | each {|file|
let rel = ($file | str replace $"($dotfiles)/" "")
let target = ($env.HOME | path join $rel)
let target_dir = ($target | path dirname)
mkdir $target_dir
if ($target | path type) == "symlink" {
return
}
if ($target | path exists) {
print $"backing up ($target)($target).bak"
mv $target $"($target).bak"
}
print $"linking ($target)($file)"
ln -s $file $target
}