Skip to content

Instantly share code, notes, and snippets.

@will
Last active May 6, 2024 12:50
Show Gist options
  • Save will/907154187e4552ef8d80cb521f6fb9ce to your computer and use it in GitHub Desktop.
Save will/907154187e4552ef8d80cb521f6fb9ce to your computer and use it in GitHub Desktop.
parted /dev/vda -- mklabel gpt
parted /dev/vda -- mkpart primary 1GiB -8GiB
parted /dev/vda -- mkpart primary linux-swap -8GiB 100%
parted /dev/vda -- mkpart ESP fat32 1MiB 512MiB
parted /dev/vda -- set 3 esp on
mkfs.ext4 -L nixos /dev/vda1
mkswap -L swap /dev/vda2
mkfs.fat -F 32 -n boot /dev/vda3
mount /dev/disk/by-label/nixos /mnt
mkdir -p /mnt/boot
mount /dev/disk/by-label/boot /mnt/boot
nixos-generate-config --root /mnt
# edit /mnt/etc/nixos/configuration.nix
nixos-install --no-root-passwd
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
virtualisation.rosetta.enable = true;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nix.package = pkgs.nixUnstable;
networking.hostName = "nixos";
security.sudo.wheelNeedsPassword = false;
users.users.will = {
isNormalUser = true;
openssh.authorizedKeys.keys =["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGq0NvOp8fyKAS3iHPad2Mz6cOVKNBIElLpnHMy9zNve" ];
extraGroups = [ "wheel" ];
initialHashedPassword=""; # no password local login, still need key for ssh
};
environment.systemPackages = with pkgs; [
neovim
];
services.openssh.enable = true;
system.stateVersion = "23.05"; # Did you read the comment?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment