framework-2024-11-25-00-02-03

This commit is contained in:
Alexander Szczepanski
2024-11-25 00:02:03 +01:00
parent fe9beaa67b
commit a0f0e1a1f8
12 changed files with 103 additions and 405 deletions

View File

@ -1,13 +0,0 @@
{
config,
lib,
pkgs,
...
}: {
imports = [../configs/common.nix ../configs/docker.nix ../configs/user.nix];
fileSystems."/export/docker" = {
device = "/home/alex/docker";
options = ["bind"];
};
}

View File

@ -5,14 +5,73 @@
inputs,
...
}: {
nixpkgs = {
config = {
allowUnfree = true;
};
};
boot = {
loader = {
efi.canTouchEfiVariables = true;
grub = {
enable = true;
device = "nodev";
efiSupport = true;
configurationLimit = 5;
enableCryptodisk = true;
useOSProber = true;
};
};
tmp = {
useTmpfs = lib.mkDefault true;
cleanOnBoot = true;
};
consoleLogLevel = 0;
kernel.sysctl = {"vm.max_map_count" = 262144;};
supportedFilesystems = ["ntfs"];
supportedFilesystems = ["ntfs" "btrfs"];
initrd = {
postDeviceCommands = pkgs.lib.mkBefore ''
mkdir -p /mnt
# We first mount the btrfs root to /mnt
# so we can manipulate btrfs subvolumes.
mount -o subvol=/ /dev/mapper/lvm-root /mnt
# While we're tempted to just delete /root and create
# a new snapshot from /root-blank, /root is already
# populated at this point with a number of subvolumes,
# which makes `btrfs subvolume delete` fail.
# So, we remove them first.
#
# /root contains subvolumes:
# - /root/var/lib/portables
# - /root/var/lib/machines
#
# I suspect these are related to systemd-nspawn, but
# since I don't use it I'm not 100% sure.
# Anyhow, deleting these subvolumes hasn't resulted
# in any issues so far, except for fairly
# benign-looking errors from systemd-tmpfiles.
btrfs subvolume list -o /mnt/root |
cut -f9 -d' ' |
while read subvolume; do
echo "deleting /$subvolume subvolume..."
btrfs subvolume delete "/mnt/$subvolume"
done &&
echo "deleting /root subvolume..." &&
btrfs subvolume delete /mnt/root
echo "restoring blank /root subvolume..."
btrfs subvolume snapshot /mnt/root-blank /mnt/root
# Once we're done rolling back to a blank snapshot,
# we can unmount /mnt and continue on the boot process.
umount /mnt
'';
};
};
# Work around for https://github.com/NixOS/nixpkgs/issues/124215
@ -88,6 +147,23 @@
man-pages
man-pages-posix
];
persistence."/persist" = {
directories = [
"/var/lib/nixos"
"/var/lib/tailscale"
"/var/lib/tuptime"
"/var/lib/vnstat"
];
files = [
"/etc/machine-id"
"/etc/NIXOS"
"/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_ed25519_key.pub"
"/etc/ssh/ssh_host_rsa_key"
"/etc/ssh/ssh_host_rsa_key.pub"
];
};
};
i18n = {

View File

@ -49,6 +49,7 @@
ktimetracker
kdiff3
kdiskmark
maliit-keyboard
];
};

View File

@ -32,11 +32,6 @@
];
};
# services = {
# gvfs.enable = true;
# mullvad-vpn.enable = true;
# };
programs = {
ssh = {startAgent = true;};
# dconf.enable = true;
@ -49,7 +44,6 @@
environment.systemPackages = with pkgs; [
czkawka # fslint before
grsync
handbrake
keepassxc
nextcloud-client
@ -66,6 +60,8 @@
kitty
lan-mouse_git
libreoffice
];
home-manager.users.alex = {pkgs, ...}: {

38
flake.lock generated
View File

@ -8,11 +8,11 @@
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1732150710,
"narHash": "sha256-H6ps/jlPn3kkGtrZeduLtfMnV8htI117/qUgMtUzJBM=",
"lastModified": 1732400024,
"narHash": "sha256-uf1QzIl0Jj5dr7+erWjHWiCUEvywLaR7ir1jcqGgjeQ=",
"owner": "chaotic-cx",
"repo": "nyx",
"rev": "4621aec08aa50869a305e275c2b8a0c766f3b59b",
"rev": "376a2e022a5d8fa21cecb5bb0fef0cb54db5cdfc",
"type": "github"
},
"original": {
@ -82,11 +82,11 @@
]
},
"locked": {
"lastModified": 1732025103,
"narHash": "sha256-qjEI64RKvDxRyEarY0jTzrZMa8ebezh2DEZmJJrpVdo=",
"lastModified": 1732303962,
"narHash": "sha256-5Umjb5AdtxV5jSJd5jxoCckh5mlg+FBQDsyAilu637g=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "a46e702093a5c46e192243edbd977d5749e7f294",
"rev": "8cf9cb2ee78aa129e5b8220135a511a2be254c0c",
"type": "github"
},
"original": {
@ -102,11 +102,11 @@
]
},
"locked": {
"lastModified": 1732303962,
"narHash": "sha256-5Umjb5AdtxV5jSJd5jxoCckh5mlg+FBQDsyAilu637g=",
"lastModified": 1732482255,
"narHash": "sha256-GUffLwzawz5WRVfWaWCg78n/HrBJrOG7QadFY6rtV8A=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "8cf9cb2ee78aa129e5b8220135a511a2be254c0c",
"rev": "a9953635d7f34e7358d5189751110f87e3ac17da",
"type": "github"
},
"original": {
@ -161,11 +161,11 @@
"utils": "utils"
},
"locked": {
"lastModified": 1730468752,
"narHash": "sha256-PixWHyqvcwst38jnOunWe/WjwlZ5R327zR/C+e0slAA=",
"lastModified": 1732459504,
"narHash": "sha256-WSHxq6cZz/GWkEK8LeYR4PM5Wh/KsG+WTZklB4pHJSQ=",
"owner": "taj-ny",
"repo": "kwin-effects-forceblur",
"rev": "411567be19109495f9afe56a2ccf404be0599d86",
"rev": "669ba8729d5703823c2e9712e2d68abe57eb342e",
"type": "github"
},
"original": {
@ -199,11 +199,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1731797098,
"narHash": "sha256-UhWmEZhwJZmVZ1jfHZFzCg+ZLO9Tb/v3Y6LC0UNyeTo=",
"lastModified": 1732483221,
"narHash": "sha256-kF6rDeCshoCgmQz+7uiuPdREVFuzhIorGOoPXMalL2U=",
"owner": "nixos",
"repo": "nixos-hardware",
"rev": "672ac2ac86f7dff2f6f3406405bddecf960e0db6",
"rev": "45348ad6fb8ac0e8415f6e5e96efe47dd7f39405",
"type": "github"
},
"original": {
@ -231,16 +231,16 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1732310578,
"narHash": "sha256-kk5Cv6wB20ujrB8w2ny5Co20xCHYOjUSyk2VRuP0sZw=",
"lastModified": 1732014248,
"narHash": "sha256-y/MEyuJ5oBWrWAic/14LaIr/u5E0wRVzyYsouYY3W6w=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "72f68849662579c8d4e5d13bd4d400723a1d8edd",
"rev": "23e89b7da85c3640bbc2173fe04f4bd114342367",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable-small",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}

View File

@ -3,7 +3,7 @@
inputs = {
# nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable-small";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:nixos/nixos-hardware/master";
chaotic.url = "github:chaotic-cx/nyx/nyxpkgs-unstable";

View File

@ -7,16 +7,6 @@
}: let
be = import ../../configs/borg-exclude.nix;
in {
nixpkgs = {
overlays = [
outputs.overlays.additions
outputs.overlays.modifications
];
config = {
allowUnfree = true;
};
};
imports = [
./hardware-configuration.nix
../../configs/browser.nix
@ -25,7 +15,7 @@ in {
../../configs/games.nix
../../configs/develop.nix
../../configs/hardware.nix
../../configs/virtualisation.nix
../../configs/virtualization.nix
../../configs/plasma.nix
../../configs/user-gui.nix
../../configs/user.nix
@ -75,19 +65,7 @@ in {
# };
boot = {
loader = {
grub = {
enable = true;
efiSupport = true;
device = "nodev";
configurationLimit = 5;
useOSProber = true;
};
efi = {canTouchEfiVariables = true;};
};
tmp.useTmpfs = false;
supportedFilesystems = ["btrfs"];
kernelPackages = pkgs.linuxPackages_cachyos;
kernelParams = ["clearcpuid=514" "ip=dhcp"];
kernelModules = ["nct6775"];
@ -116,45 +94,6 @@ in {
preLVM = true;
};
};
postDeviceCommands = pkgs.lib.mkBefore ''
mkdir -p /mnt
# We first mount the btrfs root to /mnt
# so we can manipulate btrfs subvolumes.
mount -o subvol=/ /dev/mapper/lvm-root /mnt
# While we're tempted to just delete /root and create
# a new snapshot from /root-blank, /root is already
# populated at this point with a number of subvolumes,
# which makes `btrfs subvolume delete` fail.
# So, we remove them first.
#
# /root contains subvolumes:
# - /root/var/lib/portables
# - /root/var/lib/machines
#
# I suspect these are related to systemd-nspawn, but
# since I don't use it I'm not 100% sure.
# Anyhow, deleting these subvolumes hasn't resulted
# in any issues so far, except for fairly
# benign-looking errors from systemd-tmpfiles.
btrfs subvolume list -o /mnt/root |
cut -f9 -d' ' |
while read subvolume; do
echo "deleting /$subvolume subvolume..."
btrfs subvolume delete "/mnt/$subvolume"
done &&
echo "deleting /root subvolume..." &&
btrfs subvolume delete /mnt/root
echo "restoring blank /root subvolume..."
btrfs subvolume snapshot /mnt/root-blank /mnt/root
# Once we're done rolling back to a blank snapshot,
# we can unmount /mnt and continue on the boot process.
umount /mnt
'';
};
};
@ -205,21 +144,9 @@ in {
"/etc/NetworkManager/system-connections"
"/var/lib/bluetooth"
"/var/lib/docker"
"/var/lib/nixos"
"/var/lib/samba"
"/var/lib/sddm"
"/var/lib/systemd/rfkill"
"/var/lib/tailscale"
"/var/lib/tuptime"
"/var/lib/vnstat"
];
files = [
# "/etc/machine-id"
"/etc/NIXOS"
"/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_ed25519_key.pub"
"/etc/ssh/ssh_host_rsa_key"
"/etc/ssh/ssh_host_rsa_key.pub"
];
};
};

View File

@ -8,26 +8,13 @@
}: let
be = import ../../configs/borg-exclude.nix;
in {
nixpkgs = {
overlays = [
outputs.overlays.additions
];
config = {
allowUnfree = true;
# packageOverrides = pkgs: {
# intel-vaapi-driver =
# pkgs.intel-vaapi-driver.override { enableHybridCodec = true; };
# };
};
};
imports = [
./hardware-configuration.nix
../../configs/browser.nix
../../configs/common.nix
../../configs/docker.nix
../../configs/games.nix
../../configs/virtualisation.nix
../../configs/virtualization.nix
../../configs/plasma.nix
../../configs/user-gui.nix
../../configs/user.nix
@ -70,19 +57,7 @@ in {
# };
boot = {
loader = {
grub = {
enable = true;
efiSupport = true;
device = "nodev";
configurationLimit = 5;
# enableCryptodisk = true;
};
efi = {canTouchEfiVariables = true;};
};
tmp.useTmpfs = false;
supportedFilesystems = ["btrfs"];
kernelPackages = pkgs.linuxPackages_6_11;
initrd = {
@ -93,45 +68,6 @@ in {
preLVM = true;
};
};
postDeviceCommands = pkgs.lib.mkBefore ''
mkdir -p /mnt
# We first mount the btrfs root to /mnt
# so we can manipulate btrfs subvolumes.
mount -o subvol=/ /dev/mapper/lvm-root /mnt
# While we're tempted to just delete /root and create
# a new snapshot from /root-blank, /root is already
# populated at this point with a number of subvolumes,
# which makes `btrfs subvolume delete` fail.
# So, we remove them first.
#
# /root contains subvolumes:
# - /root/var/lib/portables
# - /root/var/lib/machines
#
# I suspect these are related to systemd-nspawn, but
# since I don't use it I'm not 100% sure.
# Anyhow, deleting these subvolumes hasn't resulted
# in any issues so far, except for fairly
# benign-looking errors from systemd-tmpfiles.
btrfs subvolume list -o /mnt/root |
cut -f9 -d' ' |
while read subvolume; do
echo "deleting /$subvolume subvolume..."
btrfs subvolume delete "/mnt/$subvolume"
done &&
echo "deleting /root subvolume..." &&
btrfs subvolume delete /mnt/root
echo "restoring blank /root subvolume..."
btrfs subvolume snapshot /mnt/root-blank /mnt/root
# Once we're done rolling back to a blank snapshot,
# we can unmount /mnt and continue on the boot process.
umount /mnt
'';
};
};
@ -293,21 +229,8 @@ in {
"/etc/NetworkManager/system-connections"
# "/var/lib/bluetooth"
"/var/lib/docker"
"/var/lib/nixos"
# "/var/lib/samba"
"/var/lib/sddm"
# "/var/lib/systemd/rfkill"
"/var/lib/tailscale"
"/var/lib/tuptime"
"/var/lib/vnstat"
];
files = [
"/etc/machine-id"
"/etc/NIXOS"
"/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_ed25519_key.pub"
"/etc/ssh/ssh_host_rsa_key"
"/etc/ssh/ssh_host_rsa_key.pub"
];
};
};

View File

@ -5,17 +5,6 @@
outputs,
...
}: {
nixpkgs = {
overlays = [
outputs.overlays.additions
outputs.overlays.modifications
outputs.overlays.unstable-packages
];
config = {
allowUnfree = true;
};
};
imports = [
./hardware-configuration.nix
../../configs/docker.nix
@ -46,17 +35,6 @@
};
boot = {
loader = {
grub = {
enable = true;
device = "nodev";
efiSupport = true;
configurationLimit = 5;
};
efi.canTouchEfiVariables = true;
};
initrd = {
availableKernelModules = ["r8169"];
systemd.users.root.shell = "/bin/cryptsetup-askpass";
@ -79,50 +57,8 @@
preLVM = true;
};
};
postDeviceCommands = pkgs.lib.mkBefore ''
mkdir -p /mnt
# We first mount the btrfs root to /mnt
# so we can manipulate btrfs subvolumes.
mount -o subvol=/ /dev/mapper/lvm-root /mnt
# While we're tempted to just delete /root and create
# a new snapshot from /root-blank, /root is already
# populated at this point with a number of subvolumes,
# which makes `btrfs subvolume delete` fail.
# So, we remove them first.
#
# /root contains subvolumes:
# - /root/var/lib/portables
# - /root/var/lib/machines
#
# I suspect these are related to systemd-nspawn, but
# since I don't use it I'm not 100% sure.
# Anyhow, deleting these subvolumes hasn't resulted
# in any issues so far, except for fairly
# benign-looking errors from systemd-tmpfiles.
btrfs subvolume list -o /mnt/root |
cut -f9 -d' ' |
while read subvolume; do
echo "deleting /$subvolume subvolume..."
btrfs subvolume delete "/mnt/$subvolume"
done &&
echo "deleting /root subvolume..." &&
btrfs subvolume delete /mnt/root
echo "restoring blank /root subvolume..."
btrfs subvolume snapshot /mnt/root-blank /mnt/root
# Once we're done rolling back to a blank snapshot,
# we can unmount /mnt and continue on the boot process.
umount /mnt
'';
};
supportedFilesystems = ["btrfs"];
kernelPackages = pkgs.linuxPackages_latest;
extraModulePackages = with pkgs.linuxPackages_latest; [rtl88x2bu];
};
@ -175,19 +111,7 @@
persistence."/persist" = {
directories = [
# "/var/lib/docker"
"/var/lib/nixos"
"/var/lib/tor"
"/var/lib/tailscale"
"/var/lib/tuptime"
"/var/lib/vnstat"
];
files = [
"/etc/machine-id"
"/etc/NIXOS"
"/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_ed25519_key.pub"
"/etc/ssh/ssh_host_rsa_key"
"/etc/ssh/ssh_host_rsa_key.pub"
];
};
};

View File

@ -5,12 +5,6 @@
outputs,
...
}: {
nixpkgs = {
config = {
allowUnfree = true;
};
};
imports = [
./hardware-configuration.nix
../../configs/common.nix
@ -37,57 +31,9 @@
time.timeZone = "Europe/Berlin";
boot = {
loader = {
efi.canTouchEfiVariables = true;
grub = {
enable = true;
efiSupport = true;
device = "nodev";
};
};
supportedFilesystems = ["btrfs"];
initrd = {
enable = true;
supportedFilesystems = ["btrfs"];
postResumeCommands = lib.mkAfter ''
mkdir -p /mnt
# We first mount the btrfs root to /mnt
# so we can manipulate btrfs subvolumes.
mount -o subvol=/ /dev/vda3 /mnt
# While we're tempted to just delete /root and create
# a new snapshot from /root-blank, /root is already
# populated at this point with a number of subvolumes,
# which makes `btrfs subvolume delete` fail.
# So, we remove them first.
#
# /root contains subvolumes:
# - /root/var/lib/portables
# - /root/var/lib/machines
#
# I suspect these are related to systemd-nspawn, but
# since I don't use it I'm not 100% sure.
# Anyhow, deleting these subvolumes hasn't resulted
# in any issues so far, except for fairly
# benign-looking errors from systemd-tmpfiles.
btrfs subvolume list -o /mnt/root |
cut -f9 -d' ' |
while read subvolume; do
echo "deleting /$subvolume subvolume..."
btrfs subvolume delete "/mnt/$subvolume"
done &&
echo "deleting /root subvolume..." &&
btrfs subvolume delete /mnt/root
echo "restoring blank /root subvolume..."
btrfs subvolume snapshot /mnt/root-blank /mnt/root
# Once we're done rolling back to a blank snapshot,
# we can unmount /mnt and continue on the boot process.
umount /mnt
'';
};
};
@ -100,15 +46,6 @@
persistence."/persist" = {
directories = [
"/var/lib/docker"
"/var/lib/nixos"
"/var/lib/tuptime"
"/var/lib/vnstat"
];
files = [
"/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_ed25519_key.pub"
"/etc/ssh/ssh_host_rsa_key"
"/etc/ssh/ssh_host_rsa_key.pub"
];
};
};

View File

@ -9,17 +9,6 @@
secrets = import ../../configs/secrets.nix;
be = import ../../configs/borg-exclude.nix;
in {
nixpkgs = {
overlays = [
outputs.overlays.additions
outputs.overlays.modifications
outputs.overlays.unstable-packages
];
config = {
allowUnfree = true;
};
};
imports = [
./hardware-configuration.nix
../../configs/common.nix
@ -80,18 +69,7 @@ in {
};
boot = {
loader = {
efi.canTouchEfiVariables = true;
grub = {
enable = true;
device = "nodev";
efiSupport = true;
enableCryptodisk = true;
};
};
kernelPackages = pkgs.linuxPackages_latest;
supportedFilesystems = ["btrfs"];
kernelParams = ["ip=dhcp"];
initrd = {
availableKernelModules = ["virtio-pci"];
@ -115,45 +93,6 @@ in {
preLVM = true;
};
};
postDeviceCommands = pkgs.lib.mkBefore ''
mkdir -p /mnt
# We first mount the btrfs root to /mnt
# so we can manipulate btrfs subvolumes.
mount -o subvol=/ /dev/mapper/lvm-root /mnt
# While we're tempted to just delete /root and create
# a new snapshot from /root-blank, /root is already
# populated at this point with a number of subvolumes,
# which makes `btrfs subvolume delete` fail.
# So, we remove them first.
#
# /root contains subvolumes:
# - /root/var/lib/portables
# - /root/var/lib/machines
#
# I suspect these are related to systemd-nspawn, but
# since I don't use it I'm not 100% sure.
# Anyhow, deleting these subvolumes hasn't resulted
# in any issues so far, except for fairly
# benign-looking errors from systemd-tmpfiles.
btrfs subvolume list -o /mnt/root |
cut -f9 -d' ' |
while read subvolume; do
echo "deleting /$subvolume subvolume..."
btrfs subvolume delete "/mnt/$subvolume"
done &&
echo "deleting /root subvolume..." &&
btrfs subvolume delete /mnt/root
echo "restoring blank /root subvolume..."
btrfs subvolume snapshot /mnt/root-blank /mnt/root
# Once we're done rolling back to a blank snapshot,
# we can unmount /mnt and continue on the boot process.
umount /mnt
'';
};
};
@ -210,23 +149,11 @@ in {
"/var/lib/gitea"
"/var/lib/headscale"
"/var/lib/nextcloud"
"/var/lib/nixos"
"/var/lib/postgresql"
"/var/lib/private"
"/var/lib/redis-nextcloud"
"/var/lib/tailscale"
"/var/lib/tuptime"
"/var/lib/vnstat"
"/var/www"
];
files = [
"/etc/machine-id"
"/etc/NIXOS"
"/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_ed25519_key.pub"
"/etc/ssh/ssh_host_rsa_key"
"/etc/ssh/ssh_host_rsa_key.pub"
];
};
};