Skip to content

Instantly share code, notes, and snippets.

@RobBlackwell
Last active July 19, 2021 06:27
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save RobBlackwell/64149c868f2361bb4c6e9d4fede65633 to your computer and use it in GitHub Desktop.
Save RobBlackwell/64149c868f2361bb4c6e9d4fede65633 to your computer and use it in GitHub Desktop.
NixOS on Dell XPS 13
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Supposedly better for SSD
fileSystems."/".options = [ "noatime" "nodiratime" "discard" ];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.initrd.luks.devices = [
{
name = "root";
device = "/dev/nvme0n1p2";
preLVM = true;
}
];
powerManagement.enable = true;
networking.networkmanager.enable = true;
networking.hostName = "hostname"; # Define your hostname.
#networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Select internationalisation properties.
i18n = {
consoleFont = "latarcyrheb-sun32";
consoleKeyMap = "uk";
defaultLocale = "en_GB.UTF-8";
};
# Set your time zone.
time.timeZone = "Europe/London";
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
environment.systemPackages = with pkgs; [
wget git curl openssh stow
];
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable the X11 windowing system.
#services.xserver.enable = true;
#services.xserver.layout = "gb";
# services.xserver.xkbOptions = "eurosign:e";
# Enable the KDE Desktop Environment.
#services.xserver.displayManager.sddm.enable = true;
#services.xserver.desktopManager.plasma5.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
# users.extraUsers.guest = {
# isNormalUser = true;
# uid = 1000;
# };
users.extraUsers.reb = {
isNormalUser = true;
uid = 1000;
extraGroups = ["wheel" "networkmanager"];
};
# The NixOS release to be compatible with for stateful data such as databases.
system.stateVersion = "17.03";
services.xserver = {
enable = true;
layout = "gb";
desktopManager = {
gnome3.enable = true;
default = "gnome3";
};
displayManager.gdm.enable = true;
};
}
# Notes on installing NixOS on Dell XPS-13 Late 2016 9360
# Build a NixOS bootable USB stick Via RUFUS and NixOS image
# Boot from the usb.
# F12 to enter boot menu
# Set UK keymap
loadkeys uk
# Set large font
setfont latarcyrheb-sun32
# Create two partitions:
# 1 512MB EFI partition # Hex code ef00 called "boot"
# 2 100% Linux partiton (to be encrypted) # Hex code 8300 called "linux"
cgdisk /dev/nvme0n1
# Setup the encryption of the system
cryptsetup luksFormat /dev/nvme0n1p2
cryptsetup luksOpen /dev/nvme0n1p2 enc-pv
# Create LVM partitions
pvcreate /dev/mapper/enc-pv
vgcreate vg0 /dev/mapper/enc-pv
lvcreate -L 16G -n swap vg0
lvcreate -l '100%FREE' -n root vg0
# Format
mkfs.fat /dev/nvme0n1p1
mkfs.ext4 -L root /dev/vg0/root
mkswap -L swap /dev/vg0/swap
mount /dev/vg0/root /mnt
mkdir /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot
swapon /dev/vg0/swap
nixos-generate-config
# change /etc/nixos/configuration.nix
# DO NOT networking.wireless.enable = true, we'll
# use NetworkManager with gnome3 instead
# Networking
## Wifi is a bit of bugger, but restarting network-manager and using nmcli seems to help
systemctl stop wpa_supplicant.service
systemctl stop network-manager.service
systemctl start network-manager.service
nmcli dev
nmcli dev wifi list
nmcli dev wifi con "myssid" password "myssidpassword"
# If you screw up and need to reboot
cryptsetup luksOpen /dev/nvme0n1p2 enc-pv
lvchange -a y /dev/vg0/swap
lvchange -a y /dev/vg0/root
mount /dev/vg/root /mnt
mount /dev/nvme0n1p1 /mnt/boot
swapon /dev/vg0/swap
# If you have a DA200 adapter plug it in an redo
nixos-generate-config
# Also see
https://gist.github.com/martijnvermaat/76f2e24d0239470dd71050358b4d5134
# Notes
# Bit of a pity that NixOS isnt using wayland yet, HiDPI is a bit of a bugger, but
# gsettings set org.gnome.desktop.interface scaling-factor 2
# from the command line helps
#
# Had to manually install /etc/ssl/certs/AddTrust_External_CA_Root_DER_X.509.cer
# to get eduroam to work, but this is probably in a package somewhere?
#
@eethann
Copy link

eethann commented Oct 17, 2019

I believe nixos-generate-config should be nixos-generate-config --root /mnt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment