Skip to content

Instantly share code, notes, and snippets.

@robertodr
Created December 12, 2023 22:27
Show Gist options
  • Save robertodr/334db674b71401e5cdb5c16357192d54 to your computer and use it in GitHub Desktop.
Save robertodr/334db674b71401e5cdb5c16357192d54 to your computer and use it in GitHub Desktop.
btrfs-x1carbon
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, lib, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
"${builtins.fetchGit {url = "https://github.com/NixOS/nixos-hardware.git";}}/lenovo/thinkpad/x1"
];
# Use the systemd-boot EFI boot loader.
boot = {
loader = {
efi.canTouchEfiVariables = true;
grub = {
enable = true;
device = "nodev"; # No device for EFI
efiSupport = true;
enableCryptodisk = false;
useOSProber = false;
};
};
kernelParams = [ "resume_offset=4990208" ];
resumeDevice = "/dev/disk/by-uuid/dc9dec3c-fa2d-4c6a-b557-23080d1659f9";
#initrd.luks.devices."pool0_0".allowDiscards = true ;
};
networking = {
hostName = "derek";
networkmanager.enable = true;
};
# Set your time zone.
time.timeZone = "Europe/Oslo";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
# Enable the X11 windowing system.
services = {
xserver = {
enable = true;
displayManager.gdm.enable = true;
displayManager.gdm.wayland = false;
desktopManager.gnome.enable = true;
xkb = {
layout = "us";
options = "eurosign:e,caps:escape";
};
libinput.enable = true;
};
pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
};
# Enable sound.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
users.users = { roberto = {
isNormalUser = true;
description = "Roberto Di Remigio Eikås";
group = "users" ;
uid = 1000;
extraGroups = ["docker" "networkmanager" "wheel"];
shell = pkgs.fish;
hashedPassword = "$y$j9T$XjRxt45MG3EfE8km7ZrOI/$50NXF9lsPnfzexGL2SSsmnRJOh0SAGHtwSVlP0k.0j7";
packages = with pkgs; [
];
};
karolina = {
isNormalUser = true;
description = "Karolina Di Remigio Eikås";
group = "users" ;
uid = 1001;
extraGroups = ["docker" "networkmanager" "wheel"];
hashedPassword = "$y$j9T$7CQByXkKz41c3QOn9ciBW1$Bw8dQ/XgiB4fnqbKi/cMlmlIUIWlnQfFPMXFtWSuYt9";
packages = with pkgs; [
];
};
};
# Allow unfree packages
nixpkgs = {
config.allowUnfree = true;
};
# List packages installed in system profile. To search, run:
environment.systemPackages = with pkgs; [
neovim
zoom-us
alejandra
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
programs = {
fish.enable = true;
git.enable = true;
_1password.enable = true;
_1password-gui = {
enable = true;
polkitPolicyOwners = ["roberto" "karolina"];
};
};
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
system.copySystemConfiguration = true;
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "23.11"; # Did you read the comment?
}
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/dc9dec3c-fa2d-4c6a-b557-23080d1659f9";
fsType = "btrfs";
options = [ "subvol=root" "compress=zstd" "noatime" ];
};
boot.initrd.luks.devices."pool0_0".device = "/dev/disk/by-uuid/7be45476-f72e-4618-bdb0-153a5f3e7233";
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/dc9dec3c-fa2d-4c6a-b557-23080d1659f9";
fsType = "btrfs";
options = [ "subvol=home/active" "compress=zstd" "noatime" ];
};
fileSystems."/home/.snapshots" =
{ device = "/dev/disk/by-uuid/dc9dec3c-fa2d-4c6a-b557-23080d1659f9";
fsType = "btrfs";
options = [ "subvol=home/snapshots" "compress=zstd" "noatime" ];
};
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/dc9dec3c-fa2d-4c6a-b557-23080d1659f9";
fsType = "btrfs";
options = [ "subvol=nix" "compress=zstd" "noatime" ];
};
fileSystems."/persist" =
{ device = "/dev/disk/by-uuid/dc9dec3c-fa2d-4c6a-b557-23080d1659f9";
fsType = "btrfs";
options = [ "subvol=persist/active" "compress=zstd" "noatime" ];
neededForBoot = true;
};
fileSystems."/persist/.snapshots" =
{ device = "/dev/disk/by-uuid/dc9dec3c-fa2d-4c6a-b557-23080d1659f9";
fsType = "btrfs";
options = [ "subvol=persist/snapshots" "compress=zstd" "noatime" ];
};
fileSystems."/var/local" =
{ device = "/dev/disk/by-uuid/dc9dec3c-fa2d-4c6a-b557-23080d1659f9";
fsType = "btrfs";
options = [ "subvol=var_local/active" "compress=zstd" "noatime" ];
};
fileSystems."/var/local/.snapshots" =
{ device = "/dev/disk/by-uuid/dc9dec3c-fa2d-4c6a-b557-23080d1659f9";
fsType = "btrfs";
options = [ "subvol=var_local/snapshots" "compress=zstd" "noatime" ];
};
fileSystems."/var/log" =
{ device = "/dev/disk/by-uuid/dc9dec3c-fa2d-4c6a-b557-23080d1659f9";
fsType = "btrfs";
options = [ "subvol=var_log" "compress=zstd" "noatime" ];
neededForBoot = true;
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/0539-990A";
fsType = "vfat";
};
fileSystems."/swap" =
{ device = "/dev/disk/by-uuid/dc9dec3c-fa2d-4c6a-b557-23080d1659f9";
fsType = "btrfs";
options = [ "subvol=swap" "compress=none" "noatime" ];
};
swapDevices = [
{ device = "/swap/swapfile";
size = 18 * 1024;
}
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment