Skip to content

Instantly share code, notes, and snippets.

@azdle
Last active February 8, 2018 23:55
Show Gist options
  • Save azdle/6493875089704cbd7359a5ab7adb6322 to your computer and use it in GitHub Desktop.
Save azdle/6493875089704cbd7359a5ab7adb6322 to your computer and use it in GitHub Desktop.
QEMU Guest Base NixOS Config
{ config, pkgs, ... }:
{
imports =
[
./hardware-configuration.nix
];
# Use the GRUB 2 boot loader.
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.device = "/dev/sda";
networking.hostName = "nixos"; # Define your hostname.
# Set your time zone.
time.timeZone = "Etc/UTC";
# System Applications
environment.systemPackages = with pkgs; [
neovim
];
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.openssh.passwordAuthentication = false;
users.extraUsers.USERNAME_HERE = {
isNormalUser = true;
description = "NAME HERE";
extraGroups = [ "wheel" ];
openssh.authorizedKeys.keys = [
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKj/WUfgM9jBsUkKy9DYV5gaYDeCbqMAT/bojdI3exE9Br71BXtRBXKGlg1HiHhFYenCWGwwfx1dEPGhLAuWJI4= [email protected]"
];
};
system.stateVersion = "17.09";
}
# Disks: BIOS BOOT partition (ef02?): 16 MiB, EFI System (ef00): 496 MiB, Linux filesystem: Rest
gdisk /dev/sda
mkfs.btrfs -L nixos -f /dev/sda3
mkfs.vfat -n BOOT /dev/sda2
mount -t btrfs -o noatime,discard,ssd,autodefrag,compress=lzo,space_cache /dev/sda3 /mnt/
btrfs subvolume create /mnt/root
umount /mnt
mount -t btrfs -o noatime,discard,ssd,autodefrag,compress=lzo,space_cache,subvol=root /dev/sda3 /mnt/
btrfs subvolume create /mnt/var
btrfs subvolume create /mnt/home
btrfs subvolume create /mnt/tmp
mkdir /mnt/boot
mount /dev/sda2 /mnt/boot/
# Generate Stock Config
nixos-generate-config --root /mnt/
# Setup Actual Config (See Below)
vim /mnt/etc/nixos/configuration.nix
# Do Install
nixos-install --root /mnt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment