summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2019-08-27 14:41:59 -0700
committerBen Sima <ben@bsima.me>2019-08-27 14:41:59 -0700
commit9489a7b13e74bddcca14f90c4041d007fbeb5961 (patch)
tree0b1a6722736bcc909d87e9c2025daae3404c1511
parentf3b91d75d2d3153e9fa4d7414929dcc531779727 (diff)
update install
-rwxr-xr-xinstall.sh23
1 files changed, 8 insertions, 15 deletions
diff --git a/install.sh b/install.sh
index 27513cc..c6b9c35 100755
--- a/install.sh
+++ b/install.sh
@@ -1,23 +1,17 @@
#!/usr/bin/env bash
-
-if [ -z "$1" ]
-then
- echo "usage: install.sh <file.nix>"
- exit 1
-fi
-
-echo "Symlinking directories"
-
+#
+set -euxo pipefail
+#
+[[ -z "$1" ]] && echo "usage: install.sh <file.nix>" && exit 1
+#
mkdir -p ~/.config/nixpkgs
-
NIXDIR="$HOME/.config/nixpkgs"
-
HOMEFILE="$NIXDIR/home.nix"
NIXFILE="$(pwd)/$1"
-
+#
[[ -e "$HOMEFILE" ]] || ln -s "$NIXFILE" "$HOMEFILE"
[[ -e "$NIXDIR/config.nix" ]] || ln -s "$(pwd)/lib/config.nix" "$NIXDIR/config.nix"
-
+#
# The notmuch config location is by default ~/.notmuch-config, but home-manager
# puts it at ~/.config/notmuch/notmuchrc (which makes sense) and then sets
# NOTMUCH_CONFIG. However, if a program for some reason doesn't read
@@ -26,8 +20,7 @@ NIXFILE="$(pwd)/$1"
#
mkdir -p ~/.config/notmuch
[[ -e ~/.notmuch-config ]] || ln -s ~/.config/notmuch/notmuchrc ~/.notmuch-config
-
-
+#
# Symlinking must occur before initial generation
#
nix-shell ./home-manager -A install