initial tunyon config
This commit is contained in:
parent
e774e9b9cd
commit
7bb5c421f6
7 changed files with 187 additions and 5 deletions
108
devices/tunyon/default.nix
Normal file
108
devices/tunyon/default.nix
Normal file
|
@ -0,0 +1,108 @@
|
|||
{ lib, pkgs, ... }: let
|
||||
disks = {
|
||||
boot = "";
|
||||
crypt = "";
|
||||
root = "";
|
||||
};
|
||||
in{
|
||||
imports = [
|
||||
./options.nix
|
||||
./impermanece
|
||||
];
|
||||
|
||||
nixpkgs = {
|
||||
hostPlatform = "x86_64-linux";
|
||||
};
|
||||
|
||||
networking = {
|
||||
hostName = "tunyon";
|
||||
};
|
||||
|
||||
boot = {
|
||||
initrd = {
|
||||
availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" ];
|
||||
luks.devices.root.device = "/dev/disk/by-uuid/${disks.crypt}";
|
||||
postDeviceCommands = lib.mkAfter ''
|
||||
mkdir /btrfs_tmp
|
||||
mount /dev/disk/by-uuid/${disks.root} /btrfs_tmp
|
||||
if [[ -e /btrfs_tmp/root ]]; then
|
||||
mkdir -p /btrfs_tmp/old_roots
|
||||
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
|
||||
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
|
||||
fi
|
||||
|
||||
delete_subvolume_recursively() {
|
||||
IFS=$'\n'
|
||||
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
||||
delete_subvolume_recursively "/btrfs_tmp/$i"
|
||||
done
|
||||
btrfs subvolume delete "$1"
|
||||
}
|
||||
|
||||
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
|
||||
delete_subvolume_recursively "$i"
|
||||
done
|
||||
|
||||
btrfs subvolume create /btrfs_tmp/root
|
||||
umount /btrfs_tmp
|
||||
'';
|
||||
};
|
||||
|
||||
kernelModules = [ "kvm-amd" ];
|
||||
kernelPackages = pkgs.linuxPackages_zen;
|
||||
|
||||
loader = {
|
||||
systemd-boot = {
|
||||
enable = true;
|
||||
};
|
||||
efi.canTouchEfiVariables = true;
|
||||
};
|
||||
};
|
||||
|
||||
fileSystems = {
|
||||
"/boot" = {
|
||||
device = "/dev/disk/by-uuid/${disks.boot}";
|
||||
fsType = "vfat";
|
||||
};
|
||||
"/" = {
|
||||
device = "/dev/disk/by-uuid/${disks.root}";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=root" "compress=zstd" "noatime" ];
|
||||
};
|
||||
"/nix" = {
|
||||
device = "/dev/disk/by-uuid/${disks.root}";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=nix" "compress=zstd" "noatime" ];
|
||||
neededForBoot = true;
|
||||
};
|
||||
"/persist" = {
|
||||
device = "/dev/disk/by-uuid/${disks.root}";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=persist" "compress=zstd" "noatime" ];
|
||||
neededForBoot = true;
|
||||
};
|
||||
"/swap" = {
|
||||
device = "/dev/disk/by-uuid/${disks.root}";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=swap" "noatime" ];
|
||||
};
|
||||
};
|
||||
swapDevices = [ { device = "/swap/swapfile"; } ];
|
||||
|
||||
services = {
|
||||
upower.enable = true;
|
||||
fwupd.enable = true;
|
||||
power-profiles-daemon.enable = true;
|
||||
};
|
||||
|
||||
hardware = {
|
||||
enableRedistributableFirmware = true;
|
||||
enableAllFirmware = true;
|
||||
cpu.amd.updateMicrocode = true;
|
||||
|
||||
graphics = {
|
||||
enable = true;
|
||||
enable32Bit = true;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue