1#!/usr/bin/env bash
2
3# partition the files yourself sorry
4
5sudo fatlabel /dev/vda1 NIXBOOT
6sudo mkfs.ext4 /dev/vda2 -L NIXROOT
7sudo mount /dev/disk/by-label/NIXROOT /mnt
8sudo mkdir -p /mnt/boot
9sudo mount /dev/disk/by-label/NIXBOOT /mnt/boot
10
11sudo nixos-generate-config --root /mnt
12cat > /mnt/etc/nixos/configuration.nix <<'endmsg'
13{ config, pkgs, ... }:
14
15{
16 imports =
17 [ # Include the results of the hardware scan.
18 ./hardware-configuration.nix
19 ];
20
21 boot.loader.grub.enable = true;
22 boot.loader.grub.version = 2;
23 # Define on which hard drive you want to install Grub.
24 boot.loader.grub.device = "/dev/vda"; # or "nodev" for efi only
25
26 # Enable Flakes
27 nix = {
28 package = pkgs.nixUnstable;
29 extraOptions = ''
30 experimental-features = nix-command flakes
31 '';
32 };
33
34 time.timeZone = "Australia/Brisbane";
35
36 networking.useDHCP = false;
37 networking.interfaces.ens3.useDHCP = true; # TODO you probably want to change this
38
39 i18n.defaultLocale = "en_US.UTF-8";
40
41 users.users.anish = {
42 isNormalUser = true;
43 hashedPassword = "MVHHpy9gbe3ow";
44 extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
45 openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDM0Zvei46x/yZl/IeBCq6+IYQQ0avulzVyBysF9cPigZMCybWRV7IEU+E3k9t6JrbdbdGfJkcZIWmsWDdKS8W8mBnZpVoT0ffLynu8JQ/TKdGm4Qv6bgUeKNrGsNv0ZPs2CDaGSLj0oJfRF7Ko10tcLP0vW+yujrh+y6TH/vVzJioaV4TGvtCUpn+wEQah9ROwPQLUUofsSWdnRsDJ/gp37zXWs4l5wyjSKtP3O9RZUP7kBekbSqEgSXiTk0oUQSVqIWl9NDiP6onk/gSOjXsR/JPqsSN/XI/c/yj6gyY0f51Ru2D7iBxuMJIJcWV+rU6coIj+ULcQWLzt/7TI8jq5AOOzI/ll4zbL24Eo84Rz+TP9tvMMhDZ0VaMN22AJ8qQEjc5P09tWKsX7Jg39XelyV1jHXncE4yvIE9F4RSCHzWCeKeXakizQNuzSaxTxIExRFYHjNW5bR6+3MTGwVrEIXU+qML+0yFTR86MT+tdY5AreAJQLwbog79O1NupeXJE= anish@curve" ];
46 };
47 security.sudo.wheelNeedsPassword = false; # needed for deploy-rs
48
49 services.openssh.enable = true;
50
51 # This value determines the NixOS release from which the default
52 # settings for stateful data, like file locations and database versions
53 # on your system were taken. It‘s perfectly fine and recommended to leave
54 # this value at the release version of the first install of this system.
55 # Before changing this value read the documentation for this option
56 # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
57 system.stateVersion = "21.11"; # Did you read the comment?
58}
59
60endmsg
61
62sudo nixos-install