summary refs log tree commit diff stats
path: root/user/install.sh
blob: e33b70ae054fa4e2cd82d1c41293bd90faab9f14 (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
32
33
34
#!/bin/sh

set -eu

if [ -z "$1" ]
then
  echo "Usage: $0 <machine-file.nix>"
  exit 1
fi

NIXDIR="$HOME/.config/nixpkgs"

if [ ! -f "$1" ]
then
  echo "$1 does not exist"
  exit 1
fi

if [ -d "$NIXDIR" ]
then
  echo "$NIXDIR already exists as a directory!"
  ls -l "$NIXDIR"
  exit
fi

if [ -f "$NIXDIR" ]
then
  echo "$NIXDIR already exists as a file"
  ls -l "$NIXDIR"
  exit
fi

ln -s $PWD $NIXDIR
ln -s $1 home.nix