Modify Lenovo and add iwd to persistence

This commit is contained in:
Jimbo 2024-11-02 21:05:59 -04:00
parent 15ab10152b
commit f80f0dd53d
9 changed files with 166 additions and 53 deletions

View file

@ -82,7 +82,7 @@
shuttle = mkNix [ ./hosts/shuttleworth/system ]; # Pinebook Pro
lacros = mkNix [ ./hosts/lacros/system ]; # Dell Chromebook
redmond = mkNix [ ./hosts/redmond/system ]; # Lenovo Laptop
redmond = mkNix [ ./hosts/redmond ]; # Lenovo Dual-Boot Laptop
treefruit = mkNix [ ./hosts/treefruit/system ]; # Macbook Pro 14,1
cyberspark = mkNix [ ./hosts/cyberspark/system ]; # Dell Optiplex 7010

View file

@ -0,0 +1,40 @@
{ pkgs, ... }:
{
boot = {
kernelPackages = pkgs.linuxPackages_latest;
kernel.sysctl."vm.max_map_count" = 2147483642;
initrd = {
systemd = {
enable = true;
services.root-reset = {
description = "Reset BTRFS root and snapshot last boot";
wantedBy = [ "initrd.target" ];
after = [ "dev-nixos-root.device" ];
before = [ "sysroot.mount" ];
unitConfig.DefaultDependencies = "no";
serviceConfig.Type = "oneshot";
script = ''
mkdir -p /mnt
mount /dev/nixos/root /mnt
if [[ -e /mnt/@prev ]]; then
btrfs subvolume delete /mnt/@prev
fi
btrfs subvolume snapshot /mnt/@ /mnt/@prev
btrfs subvolume list -o /mnt/@ | cut -f9 -d' ' | while read subvolume; do
btrfs subvolume delete "/mnt/$subvolume"
done
btrfs subvolume delete /mnt/@
btrfs subvolume create /mnt/@
umount /mnt
'';
};
};
};
};
}

29
hosts/redmond/default.nix Normal file
View file

@ -0,0 +1,29 @@
{ config, ... }:
{
imports = [
./boot
./disko
./hardware
# Apps and programs
../../modules/system
../../modules/system/accounts
../../modules/system/desktop
../../modules/system/programs
../../modules/system/services
# Devices and hardware
../../modules/system/devices
../../modules/system/devices/boot/systemd
../../modules/system/devices/networking/wireless
../../modules/system/devices/networking/firewall/pc
../../modules/system/devices/networking/wireguard/pc
# Extras
../../overlays
../../variables
];
networking.hostName = "redmond";
networking.wireguard.interfaces."${config.ips.wgInt}".ips = [ "${config.ips.wgSpan}.20/24" ];
}

View file

@ -0,0 +1,95 @@
{ disko, ... }:
{
imports = [
disko.nixosModules.disko
];
disko.devices = {
disk = {
main = {
type = "disk";
device = "/dev/sda";
content = {
type = "gpt";
partitions = {
ESP = {
size = "2G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "fmask=0022" "dmask=0022" ];
};
};
luks = {
size = "100%";
content = {
type = "luks";
name = "crypt-hdd";
settings.allowDiscards = true;
#passwordFile = "/tmp/secret.key";
content = {
type = "lvm_pv";
vg = "nixos";
};
};
};
};
};
};
};
lvm_vg = {
nixos = {
type = "lvm_vg";
lvs = {
root = {
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"/@" = {
mountpoint = "/";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/@prev" = {
mountpoint = "/prev";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/@nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" "noatime" ];
};
# Impermanence
"/@root" = {
mountpoint = "/persist";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/@jimbo" = {
mountpoint = "/persist/home/jimbo";
mountOptions = [ "compress=zstd" "noatime" ];
};
};
};
};
swap = {
size = "8G";
content = {
type = "swap";
discardPolicy = "both";
};
};
};
};
};
};
# Needed for impermanence
fileSystems = {
"/persist".neededForBoot = true;
"/persist/home/jimbo".neededForBoot = true;
};
}

View file

@ -16,15 +16,6 @@
};
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/c0fe8419-88f9-48a0-8c5b-acd4c11f8037";
fsType = "ext4";
};
"/boot" = {
device = "/dev/disk/by-uuid/BF2B-9AE0";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
"/home/jimbo/JimboNFS" = {
device = "${config.ips.wgSpan}.1:/export/JimboNFS";
fsType = "nfs4";

View file

@ -1,8 +0,0 @@
{ ... }:
{
imports = [
../../../modules/home
../../../modules/home/programs/misc/gaming/launchers
../../../modules/home/programs/misc/remote-desktop
];
}

View file

@ -1,7 +0,0 @@
{ pkgs, ... }:
{
boot = {
kernelPackages = pkgs.linuxPackages_latest;
kernel.sysctl."vm.max_map_count" = 2147483642;
};
}

View file

@ -1,28 +0,0 @@
{ config, ... }:
{
imports = [
./hardware
./boot
# Apps and programs
../../../modules/system
../../../modules/system/accounts
../../../modules/system/desktop
../../../modules/system/programs
../../../modules/system/services
# Devices and hardware
../../../modules/system/devices
../../../modules/system/devices/boot/systemd
../../../modules/system/devices/networking/wireless
../../../modules/system/devices/networking/firewall/pc
../../../modules/system/devices/networking/wireguard/pc
# Extras
../../../overlays
../../../variables
];
networking.hostName = "redmond";
networking.wireguard.interfaces."${config.ips.wgInt}".ips = [ "${config.ips.wgSpan}.20/24" ];
}

View file

@ -11,6 +11,7 @@
"/var/lib/mpd"
"/var/lib/nixos"
"/var/lib/fail2ban"
"/var/lib/iwd/"
"/var/lib/systemd/coredump"
];
files = [