summary refs log tree commit diff
path: root/build.sh
blob: 1fdf453d7752f7f4c42f828d840f334c6dfc9360 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env sh
if [ $# -ne 2 ]; then
    echo "Usage: $0 <root> <config>"
    echo "NOTE: hardware config will be generated from root!"
    echo "Defined configs:"
    cat flake.nix | grep 'nixpkgs.lib.nixosSystem' | sed 's/ =.*//' | sed 's/^[ \t]*//;s/[ \t]*$//' | while read cfg; do echo " - $cfg"; done
    exit 1
fi
if [ "$1" = "/" ]; then
    nixos-generate-config --show-hardware-config > hardware-configuration.nix
    nixos-rebuild --flake ".#${2}" build
    exit 1
else
    nixos-generate-config --show-hardware-config > hardware-configuration.nix
    nixos-install --root "${1}" --flake ".#${2}" 
    exit 1
fi