Add back the PineBook for later and make etc immutable
This commit is contained in:
parent
6f09998656
commit
8bad6194bc
18 changed files with 245 additions and 43 deletions
40
hosts/axolotl/boot/default.nix
Normal file
40
hosts/axolotl/boot/default.nix
Normal 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
29
hosts/axolotl/default.nix
Normal 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" ];
|
||||
}
|
96
hosts/axolotl/disko/default.nix
Normal file
96
hosts/axolotl/disko/default.nix
Normal 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;
|
||||
};
|
||||
}
|
29
hosts/axolotl/hardware/default.nix
Normal file
29
hosts/axolotl/hardware/default.nix
Normal 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;
|
||||
}
|
1
hosts/axolotl/id_ed25519.pub
Normal file
1
hosts/axolotl/id_ed25519.pub
Normal file
|
@ -0,0 +1 @@
|
|||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG9uITpyw5WgxT7UnswueFtyWxAqQCZv4h9DfcDkr+kn
|
Loading…
Add table
Add a link
Reference in a new issue