nixos-config/install.sh

30 lines
577 B
Bash
Raw Normal View History

2019-10-18 20:08:05 +02:00
#!/bin/sh
2019-08-24 13:12:32 +02:00
set -e
2019-08-24 13:12:32 +02:00
if [ $EUID != 0 ]; then
sudo "$0" "$@"
exit $?
fi
2019-10-18 20:08:05 +02:00
CONFIG=$1
2019-08-24 13:12:32 +02:00
if [ -z "$CONFIG" ]
then
echo "path to config to use as configuration.nix needs to be passed as first argument"
exit 1
2019-10-18 20:08:05 +02:00
else
echo "using configuration: '$CONFIG'"
2019-08-24 13:12:32 +02:00
fi
ln -s $CONFIG configuration.nix
nixos-generate-config --root /mnt
# add nixos-unstable and home-manager channels
nix-channel --add https://nixos.org/channels/nixos-unstable nixos
2020-09-23 09:40:08 +02:00
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
2019-08-24 13:12:32 +02:00
nix-channel --update
nixos-install