summaryrefslogtreecommitdiff
path: root/install.sh
blob: ebb84c54dd94616b7d76f4e53d20c73a54537c2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash
#
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
# NOTMUCH_CONFIG (emacs), then it won't find the right config file, so I
# override with a symlink.
#
mkdir -p ~/.config/notmuch
[[ -e ~/.notmuch-config ]] || ln -s ~/.config/notmuch/notmuchrc ~/.notmuch-config
#
# symlinking must occur before initial generation. now we can install, and
# pin our own nixpkgs.
#
# set channels
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
nix-shell '<home-manager>' -A install