Created
April 3, 2018 01:05
-
-
Save mfine/ffaa71949daeef2f93bd49657a8c496c to your computer and use it in GitHub Desktop.
NixOS install.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
gdisk /dev/sda <<'EOF' | |
o | |
y | |
n | |
1 | |
2048 | |
+512M | |
EF00 | |
n | |
2 | |
1050624 | |
+216G | |
8300 | |
c | |
2 | |
nixos | |
n | |
3 | |
454035456 | |
488397134 | |
8200 | |
w | |
y | |
EOF | |
mkfs.vfat /dev/sda1 | |
mkfs.ext4 -L nixos /dev/sda2 | |
mkswap -L swap /dev/sda3 | |
swapon /dev/sda3 | |
mount /dev/sda2 /mnt | |
mkdir /mnt/boot | |
mount /dev/sda1 /mnt/boot | |
nixos-generate-config --root /mnt | |
tee /mnt/etc/nixos/configuration.nix <<'EOF' | |
{ config, pkgs, ... }: | |
{ | |
imports = [ | |
./hardware-configuration.nix | |
]; | |
# Defined hostname. | |
networking.hostName = "nixy"; | |
# Use the gummiboot efi boot loader. | |
boot.loader.systemd-boot.enable = true; | |
boot.loader.efi.canTouchEfiVariables = true; | |
# The NixOS release to be compatible with for stateful data such as databases. | |
system.stateVersion = "17.09"; | |
# Enable the OpenSSH daemon. | |
services.openssh.enable = true; | |
# Set the root public key. | |
users.extraUsers.root.openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDQ9O+WmtQ+UeyHxXXU4J3hWSQeWv3LhiNN/vfzf/NiVUBElCnhni7ypt5emEqhUGpwDizf0ADfHwPRhOioDe/oJgEHZZNDx8QWpide2QCnP7ShQJmMNKEHAcqG05iTcTqddC5L9fH5ZRiQcpOyuxpJdIxnIthhDGZnaOs7SMexND/7st2a+NEL02WbKijdgmEe64SqMLZd6nAIfMbLwzxnS9tSBNzDX2pA+fSu+SPocK05tyNDpI4KUij1ZqNz3CoY8D5EgEXSx55FtenslgYmedvcy4/uwpiUKoYEgL0KcCzWkIw3eUrNmhsnt22K/IDUpwlnreKTfA1AEj8HwaVMfkoa2iNRDTg+qGQ//mbFwZW10mAqWewtclCoEPyqrb7ZJpmD6GcCtsDk6z+EH0VNQLlaoAkqY/SEBXOtu79pkoxstlJAlU+8Lu2hz1Z99JmDpMEpQe47qXwYQMToli9SiunWpTqiBIBOy0pSzYsaaQD7l7VgCiYF1f0P6yc4Oh9j9JaXalHEpuemfVSMbt8vLWHm4gISEpOXKXw1Rp4t9NaV4lRljh4ej6D6Gh0MPA/JTMvTY4C42WevxtnBFXgnS9u4Kntq8XkG/XRDWOeeSZSA/UBGhYNOtxL6kZB4NXGBdNk6+H5Qbtn+DFFFg/PoLkuI7a/0A9lCyeqgKt0EBQ== operations@swift-nav.com" ]; | |
} | |
EOF | |
nixos-install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On a fresh NixOS install, run this script:
$ curl https://gist.githubusercontent.com/mfine/ffaa71949daeef2f93bd49657a8c496c/raw/5b5a0a5af5b02b33150daaaf1d017b9e825150ec/install.sh | bash