mkhost
This commit is contained in:
parent
f28d3ea99d
commit
3ad9e0f87a
40
bin/mkhost
Executable file
40
bin/mkhost
Executable file
|
|
@ -0,0 +1,40 @@
|
||||||
|
#!/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 > "$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" "podman"];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
mkdir -p "$HOST/users/$USER"
|
||||||
|
cat << EOF > "$HOST/users/$USER/default.nix"
|
||||||
|
{...}: {
|
||||||
|
imports = [
|
||||||
|
../../../../user
|
||||||
|
];
|
||||||
|
|
||||||
|
home.username = "$USER";
|
||||||
|
}
|
||||||
|
EOF
|
||||||
Loading…
Reference in a new issue