mirror of
https://github.com/elkowar/dots-of-war.git
synced 2024-12-25 13:42:23 +00:00
Improve nix-stash
This commit is contained in:
parent
37ad815725
commit
c15e7375c6
1 changed files with 5 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
FILE_STACK_PATH="/tmp/nix_stash_stack"
|
NIX_STASH_DIR="$XDG_CONFIG_HOME/nix_stash"
|
||||||
|
FILE_STACK_PATH="$NIX_STASH_DIR/nix_stash_stack"
|
||||||
|
|
||||||
# pop the last line from the file-stack and return it
|
# pop the last line from the file-stack and return it
|
||||||
pop_from_file_stack() {
|
pop_from_file_stack() {
|
||||||
|
@ -17,7 +18,8 @@ do_pop() {
|
||||||
last_file="$(pop_from_file_stack)" || exit 1
|
last_file="$(pop_from_file_stack)" || exit 1
|
||||||
echo "restoring $last_file"
|
echo "restoring $last_file"
|
||||||
trash "$last_file"
|
trash "$last_file"
|
||||||
home-manager switch
|
|
||||||
|
[ ! -s "$FILE_STACK_PATH" ] && home-manager switch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,6 +38,7 @@ do_stash() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# remove the symlink and write the path to the stack
|
# remove the symlink and write the path to the stack
|
||||||
|
mkdir -p "$NIX_STASH_DIR"
|
||||||
rm -rf "$config_file"
|
rm -rf "$config_file"
|
||||||
echo "$config_file" >> "$FILE_STACK_PATH"
|
echo "$config_file" >> "$FILE_STACK_PATH"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue