41 lines
753 B
Bash
Executable file
41 lines
753 B
Bash
Executable file
#!/bin/sh
|
|
|
|
if [ $# -ne 1 ]; then
|
|
echo "usage: ${0##*/} <name>"
|
|
exit 1
|
|
fi
|
|
DIR="$(dirname "$0")"
|
|
HOST="$(realpath "$DIR/../hosts/$1")"
|
|
USER="ahnwuoa"
|
|
if [ -e "$HOST" ]; then
|
|
echo "$1 already exists"
|
|
exit 2
|
|
fi
|
|
mkdir "$HOST"
|
|
nixos-generate-config --show-hardware-config --no-filesystems > "$HOST/hardware-configuration.nix"
|
|
cat << EOF > "$HOST/default.nix"
|
|
{...}: {
|
|
imports = [
|
|
../../system
|
|
./hardware-configuration.nix
|
|
];
|
|
|
|
networking.hostName = "$1";
|
|
time.timeZone = "America/Chicago";
|
|
users.users.$USER = {
|
|
isNormalUser = true;
|
|
extraGroups = ["wheel"];
|
|
};
|
|
}
|
|
EOF
|
|
mkdir -p "$HOST/users/$USER"
|
|
cat << EOF > "$HOST/users/$USER/default.nix"
|
|
{...}: {
|
|
imports = [
|
|
../../../../user
|
|
];
|
|
|
|
home.username = "$USER";
|
|
}
|
|
EOF
|