Moving thinker back to nixos

This commit is contained in:
Daniel Flanagan 2024-07-17 20:22:16 -05:00
parent 1364e4b6e9
commit 78c2222162
4 changed files with 104 additions and 99 deletions

View file

@ -1,4 +1,83 @@
{ {
standardWithHibernateSwap = {
disks ? ["/dev/sda"],
swapSize,
...
}: {
# this is my standard partitioning scheme for my machines which probably want hibernation capabilities
# a UEFI-compatible boot partition
# it includes an LUKS-encrypted btrfs volume
# a swap partition big enough to dump all the machine's RAM into
# this is my standard partitioning scheme for my machines: an LUKS-encrypted
# btrfs volume
disko.devices = {
disk = {
primary = {
type = "disk";
device = builtins.elemAt disks 0;
content = {
type = "gpt";
partitions = {
ESP = {
label = "EFI";
name = "ESP";
size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [
"defaults"
];
};
};
swap = {
size = swapSize;
content = {
type = "swap";
discardPolicy = "both";
resumeDevice = true; # resume from hiberation from this device
};
};
luks = {
size = "100%";
content = {
type = "luks";
name = "crypted";
extraOpenArgs = ["--allow-discards"];
# if you want to use the key for interactive login be sure there is no trailing newline
# for example use `echo -n "password" > /tmp/secret.key`
keyFile = "/tmp/secret.key"; # Interactive
# settings.keyFile = "/tmp/password.key";
# additionalKeyFiles = ["/tmp/additionalSecret.key"];
content = {
type = "btrfs";
extraArgs = ["-f"];
subvolumes = {
"/root" = {
mountpoint = "/";
mountOptions = ["compress=zstd" "noatime"];
};
"/home" = {
mountpoint = "/home";
mountOptions = ["compress=zstd" "noatime"];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = ["compress=zstd" "noatime"];
};
};
};
};
};
};
};
};
};
};
};
standard = {disks ? ["/dev/vda"], ...}: { standard = {disks ? ["/dev/vda"], ...}: {
# this is my standard partitioning scheme for my machines: an LUKS-encrypted # this is my standard partitioning scheme for my machines: an LUKS-encrypted
# btrfs volume # btrfs volume

View file

@ -281,6 +281,7 @@
common common
password-manager password-manager
graphical-workstation graphical-workstation
music-production
laptop laptop
gaming gaming
@ -329,8 +330,28 @@
thinker = nixpkgs.lib.nixosSystem { thinker = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
modules = with nixosModules; [ modules = with nixosModules; [
outputs.diskoConfigurations.standard
inputs.hardware.nixosModules.lenovo-thinkpad-t480
inputs.hardware.nixosModules.common-pc-laptop-ssd
music-production
common common
password-manager
graphical-workstation
laptop
gaming
./nixos/thinker.nix ./nixos/thinker.nix
{
home-manager.users.daniel = {
imports = with homeManagerModules; [
iex
cargo
linux-desktop-environment-config
];
};
}
]; ];
}; };

View file

@ -56,7 +56,7 @@
in { in {
donokai = mkColorScheme { donokai = mkColorScheme {
scheme-name = "donokai"; scheme-name = "donokai";
bg = "111111"; bg = "110f0a";
bg2 = "181818"; bg2 = "181818";
bg3 = "222222"; bg3 = "222222";
bg4 = "292929"; bg4 = "292929";

View file

@ -1,42 +1,6 @@
{ {...}: {
inputs,
outputs,
lib,
# config,
pkgs,
...
}: {
networking.hostName = "thinker"; networking.hostName = "thinker";
imports = with outputs.nixosModules; [
outputs.diskoConfigurations.thinker
inputs.hardware.nixosModules.lenovo-thinkpad-t480
inputs.hardware.nixosModules.common-pc-laptop-ssd
desktop-usage
music-production
podman
# gnome
kde-plasma
postgres
wifi
];
environment = {
systemPackages = with pkgs; [
spotify
discord
slack
godot_4
fractal
prismlauncher
variety
radeontop
sops
obs-studio
xh
];
};
boot = { boot = {
loader = { loader = {
efi.canTouchEfiVariables = true; efi.canTouchEfiVariables = true;
@ -46,68 +10,9 @@
# the above won't work for btrfs, instead you need # the above won't work for btrfs, instead you need
# btrfs inspect-internal map-swapfile -r /swap/swapfile # btrfs inspect-internal map-swapfile -r /swap/swapfile
# https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Hibernation_into_swap_file # https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Hibernation_into_swap_file
kernelParams = ["boot.shell_on_fail" "resume_offset=22816000"]; kernelParams = ["boot.shell_on_fail"];
initrd.availableKernelModules = ["xhci_pci" "nvme" "ahci"]; initrd.availableKernelModules = ["xhci_pci" "nvme" "ahci"];
}; };
services.tlp = {
enable = false;
};
services.power-profiles-daemon.enable = true;
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
services.printing.enable = true; # I own a printer in the year of our Lord 2023
home-manager.users.daniel = {
imports = with outputs.homeManagerModules; [
sway
password-manager
firefox-no-tabs
# wallpaper-manager
# sway-laptop
# hyprland
];
home = {
stateVersion = "24.05";
};
services.mako.enable = lib.mkForce false; # don't use mako when using plasma
};
swapDevices = [
# TODO: move this to disko?
# sudo btrfs subvolume create /swap
# sudo btrfs filesystem mkswapfile --size 32g --uuid clear /swap/swapfile
# sudo swapon /swap/swapfile
{device = "/swap/swapfile";}
];
# findmnt -no UUID -T /swap/swapfile
boot.resumeDevice = "/dev/disk/by-uuid/aacd6814-a5a2-457a-bf65-8d970cb1f03d";
# services.logind = {
# lidSwitch = "suspend-then-hibernate";
# extraConfig = ''
# HandlePowerKey=suspend-then-hibernate
# IdleAction=suspend-then-hibernate
# IdleActionSec=10m
# HandleLidSwitchDocked=ignore
# '';
# };
# systemd.sleep.extraConfig = "HibernateDelaySec=30m";
networking = {
firewall = {
enable = true;
allowPing = true;
allowedTCPPorts = [22];
allowedUDPPorts = [];
};
};
# networking.networkmanager.enable = false;
# systemd.services.NetworkManager-wait-online.enable = lib.mkDefault false;
# networking.wireless.iwd.enable = true;
system.stateVersion = "23.11";
} }