Add back the PineBook for later and make etc immutable

This commit is contained in:
Jimbo 2024-11-14 02:29:05 -05:00
parent 6f09998656
commit 8bad6194bc
18 changed files with 245 additions and 43 deletions

View file

@ -61,11 +61,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1731060864, "lastModified": 1731274291,
"narHash": "sha256-aYE7oAYZ+gPU1mPNhM0JwLAQNgjf0/JK1BF1ln2KBgk=", "narHash": "sha256-cZ0QMpv5p2a6WEE+o9uu0a4ma6RzQDOQTbm7PbixWz8=",
"owner": "nix-community", "owner": "nix-community",
"repo": "disko", "repo": "disko",
"rev": "5e40e02978e3bd63c2a6a9fa6fa8ba0e310e747f", "rev": "486250f404f4a4f4f33f8f669d83ca5f6e6b7dfc",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -203,11 +203,11 @@
}, },
"hardware": { "hardware": {
"locked": { "locked": {
"lastModified": 1730919458, "lastModified": 1731403644,
"narHash": "sha256-yMO0T0QJlmT/x4HEyvrCyigGrdYfIXX3e5gWqB64wLg=", "narHash": "sha256-T9V7CTucjRZ4Qc6pUEV/kpgNGzQbHWfGcfK6JJLfUeI=",
"owner": "nixos", "owner": "nixos",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "e1cc1f6483393634aee94514186d21a4871e78d7", "rev": "f6581f1c3b137086e42a08a906bdada63045f991",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -240,11 +240,11 @@
}, },
"impermanence": { "impermanence": {
"locked": { "locked": {
"lastModified": 1730403150, "lastModified": 1731242966,
"narHash": "sha256-W1FH5aJ/GpRCOA7DXT/sJHFpa5r8sq2qAUncWwRZ3Gg=", "narHash": "sha256-B3C3JLbGw0FtLSWCjBxU961gLNv+BOOBC6WvstKLYMw=",
"owner": "nix-community", "owner": "nix-community",
"repo": "impermanence", "repo": "impermanence",
"rev": "0d09341beeaa2367bac5d718df1404bf2ce45e6f", "rev": "3ed3f0eaae9fcc0a8331e77e9319c8a4abd8a71a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -310,11 +310,11 @@
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {
"lastModified": 1731030299, "lastModified": 1731375802,
"narHash": "sha256-PwtzMWPJhz9Rn/0rzQfMb6icSA6DtJZKCuK88IwFSos=", "narHash": "sha256-CvWPEzrl2EA3xrtg9X6K8aqV7T5r0SaDz6PLpGA0yIY=",
"owner": "Infinidoge", "owner": "Infinidoge",
"repo": "nix-minecraft", "repo": "nix-minecraft",
"rev": "11ca743d2e4602d5b8bfc8d65303f969d58ec338", "rev": "b873a123366b9a62f9262414ada8d83b03f1f0bf",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -401,11 +401,11 @@
}, },
"nixpkgs_4": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1730883749, "lastModified": 1731239293,
"narHash": "sha256-mwrFF0vElHJP8X3pFCByJR365Q2463ATp2qGIrDUdlE=", "narHash": "sha256-q2yjIWFFcTzp5REWQUOU9L6kHdCDmFDpqeix86SOvDc=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "dba414932936fde69f0606b4f1d87c5bc0003ede", "rev": "9256f7c71a195ebe7a218043d9f93390d49e6884",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -416,11 +416,11 @@
}, },
"nur": { "nur": {
"locked": { "locked": {
"lastModified": 1731065793, "lastModified": 1731508175,
"narHash": "sha256-BzqzhXtRif4sY3C88yTyuNxKA0UgR97iA7JVhWd+Sog=", "narHash": "sha256-CvW2AqSvTwjSB2nyR/8Ab9ZCzShDkaZkwlUUgw1EJ4M=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "11b502b497b58f04eb7acd9463d72a6aab9bbc5a", "rev": "ce861b4f99968fd26b93534f5d86c4f9df99964f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -543,11 +543,11 @@
}, },
"unstable": { "unstable": {
"locked": { "locked": {
"lastModified": 1730785428, "lastModified": 1731139594,
"narHash": "sha256-Zwl8YgTVJTEum+L+0zVAWvXAGbWAuXHax3KzuejaDyo=", "narHash": "sha256-IigrKK3vYRpUu+HEjPL/phrfh7Ox881er1UEsZvw9Q4=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "4aa36568d413aca0ea84a1684d2d46f55dbabad7", "rev": "76612b17c0ce71689921ca12d9ffdc9c23ce40b2",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -76,6 +76,7 @@
nixosConfigurations = { nixosConfigurations = {
tower = mkNix [ ./hosts/tower ]; # Main Desktop tower = mkNix [ ./hosts/tower ]; # Main Desktop
axolotl = mkNix [ ./hosts/axolotl ]; # PineBook Pro
lacros = mkNix [ ./hosts/lacros ]; # Dell Chromebook lacros = mkNix [ ./hosts/lacros ]; # Dell Chromebook
redmond = mkNix [ ./hosts/redmond ]; # Lenovo Dual-Boot Laptop redmond = mkNix [ ./hosts/redmond ]; # Lenovo Dual-Boot Laptop
pomme = mkNix [ ./hosts/treefruit ]; # Macbook Pro 14,1 pomme = mkNix [ ./hosts/treefruit ]; # Macbook Pro 14,1

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/axolotl/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,96 @@
{ disko, config, ... }:
{
imports = [ disko.nixosModules.disko ];
disko.devices = {
disk = {
"${config.networking.hostName}" = {
type = "disk";
device = "/dev/nvme0n1";
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-nvme";
settings.allowDiscards = true;
passwordFile = "/tmp/secret.key";
content = {
type = "lvm_pv";
vg = "${config.networking.hostName}";
};
};
};
};
};
};
};
lvm_vg = {
"${config.networking.hostName}" = {
type = "lvm_vg";
lvs = {
root = {
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"/root" = {
mountpoint = "/";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/prev" = {
mountpoint = "/prev";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/nix" = {
mountpoint = "/nix";
mountOptions = [ "compress=zstd" "noatime" ];
};
# Impermanence
"/persist" = {
mountpoint = "/persist";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/persist/.snapshots" = { };
"/jimbo" = {
mountpoint = "/persist/home/jimbo";
mountOptions = [ "compress=zstd" "noatime" ];
};
"/jimbo/.snapshots" = { };
};
};
};
swap = {
size = "8G";
content = {
type = "swap";
discardPolicy = "both";
};
};
};
};
};
};
# Needed for impermanence
fileSystems = {
"/persist".neededForBoot = true;
"/persist/home/jimbo".neededForBoot = true;
};
}

View file

@ -0,0 +1,29 @@
{ config, lib, pkgs, modulesPath, ... }:
{
boot = {
kernelModules = [ "kvm-amd" ];
initrd = {
availableKernelModules = [
"xhci_pci"
"ahci"
"ehci_pci"
"sd_mod"
"sr_mod"
"sdhci_pci"
"rtsx_usb_sdmmc"
];
};
};
fileSystems = {
"/home/jimbo/JimboNFS" = {
device = "${config.ips.wgSpan}.1:/export/JimboNFS";
fsType = "nfs4";
options = ["x-systemd.automount" "_netdev" "nofail" "noauto"];
};
};
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG9uITpyw5WgxT7UnswueFtyWxAqQCZv4h9DfcDkr+kn

View file

@ -1,4 +1,4 @@
{ pkgs, config, ... }: { { pkgs, ... }: {
home.file = { home.file = {
".face" = { ".face" = {
source = ./assets/pfp.png; source = ./assets/pfp.png;

View file

@ -1,7 +1,6 @@
{ ... }: { ... }:
{ {
imports = [ imports = [
./extlinux
./lanzaboote ./lanzaboote
./systemd ./systemd
]; ];

View file

@ -1,18 +0,0 @@
{ lib, config, ... }:
{
options.system.extlinux = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable Lanzaboote and force disable Systemd-boot";
};
};
config = lib.mkIf config.system.extlinux.enable {
boot.loader = {
generic-extlinux-compatible.enable = true;
systemd-boot.enable = lib.mkForce false;
grub.enable = lib.mkForce false;
};
};
}

View file

@ -3,6 +3,7 @@
imports = [ imports = [
./btrfs ./btrfs
./filesystems ./filesystems
./immutable
./impermanence ./impermanence
./snapper ./snapper
]; ];

View file

@ -0,0 +1,4 @@
{ ... }:
{
system.etc.overlay.mutable = false;
}

View file

@ -10,5 +10,6 @@
./ssh ./ssh
./sunshine ./sunshine
./tlp ./tlp
./userborn
]; ];
} }

View file

@ -33,7 +33,7 @@
"9" = "f9"; "9" = "f9";
"0" = "f10"; "0" = "f10";
"-" = "f11"; "-" = "f11";
"=" = "f12"; #"=" = "f12";
}; };
}; };
}; };

View file

@ -0,0 +1,5 @@
{ ... }:
{
# Enable this when 24.11 drops
#services.userborn.enable = true;
}

View file

@ -3,6 +3,7 @@
imports = [ imports = [
./documentation ./documentation
./fonts ./fonts
./minimal
./nix ./nix
]; ];
} }

View file

@ -1,7 +1,10 @@
{ ... }: { ... }:
{ {
documentation = { documentation = {
nixos.enable = false; doc.enable = false;
info.enable = false; info.enable = false;
nixos.enable = false;
}; };
programs.command-not-found.enable = true;
} }

View file

@ -0,0 +1,10 @@
{ ... }:
{
environment = {
defaultPackages = [ ];
stub-ld.enable = false;
};
programs.less.lessopen = null;
services.logrotate.enable = false;
}