Daidalos
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
nixosModules,
|
||||
...
|
||||
}:
|
||||
let
|
||||
userName = "root";
|
||||
hostName = "Daidalos";
|
||||
installDisk = "/dev/disk/by-id/REPLACE_ME";
|
||||
in
|
||||
{
|
||||
_module.args = {
|
||||
inherit
|
||||
userName
|
||||
hostName
|
||||
installDisk
|
||||
;
|
||||
};
|
||||
|
||||
imports = [
|
||||
./disko.nix
|
||||
./hardware.nix
|
||||
nixosModules.base
|
||||
nixosModules.binBashWrapper
|
||||
];
|
||||
|
||||
my.binBashWrapper.enable = true;
|
||||
|
||||
boot = {
|
||||
kernelPackages = pkgs.linuxPackages_rpi4;
|
||||
supportedFilesystems = [ "zfs" ];
|
||||
zfs.devNodes = "/dev/disk/by-id";
|
||||
extraModprobeConfig = ''
|
||||
options zfs zfs_arc_min=67108864
|
||||
options zfs zfs_arc_max=134217728
|
||||
'';
|
||||
loader = {
|
||||
grub.enable = lib.mkForce false;
|
||||
systemd-boot.enable = lib.mkForce false;
|
||||
generic-extlinux-compatible.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
services.zfs = {
|
||||
autoScrub.enable = true;
|
||||
trim.enable = false;
|
||||
autoSnapshot.enable = false;
|
||||
};
|
||||
|
||||
services.fstrim.enable = false;
|
||||
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
hardware.deviceTree = {
|
||||
enable = true;
|
||||
filter = "*rpi-4-*.dtb";
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
libraspberrypi
|
||||
raspberrypi-eeprom
|
||||
];
|
||||
|
||||
networking.hostName = hostName;
|
||||
networking.hostId = "69aaeea1";
|
||||
|
||||
systemd.network.networks."10-wired".matchConfig.Name = lib.mkForce [
|
||||
"en*"
|
||||
"eth*"
|
||||
"end0"
|
||||
];
|
||||
|
||||
zramSwap = {
|
||||
enable = true;
|
||||
memoryPercent = 50;
|
||||
algorithm = "zstd";
|
||||
};
|
||||
|
||||
system.stateVersion = "25.05";
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
inputs,
|
||||
mkHost,
|
||||
nixosModules,
|
||||
...
|
||||
}:
|
||||
let
|
||||
host = mkHost {
|
||||
nixpkgs = inputs.nixpkgs-stable;
|
||||
disko = inputs.disko-stable;
|
||||
lolcat = inputs."lolcat++-stable";
|
||||
system = "aarch64-linux";
|
||||
inherit nixosModules;
|
||||
hostModules = [ ./configuration.nix ];
|
||||
};
|
||||
in
|
||||
{
|
||||
Daidalos = host;
|
||||
daidalos = host;
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
{ installDisk, ... }:
|
||||
{
|
||||
disko.devices = {
|
||||
disk.main = {
|
||||
type = "disk";
|
||||
device = installDisk;
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
firmware = {
|
||||
label = "FIRMWARE";
|
||||
size = "1G";
|
||||
type = "0700";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot/firmware";
|
||||
mountOptions = [ "umask=0077" ];
|
||||
};
|
||||
};
|
||||
|
||||
zfs = {
|
||||
label = "zfs";
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "zfs";
|
||||
pool = "rpool";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
zpool.rpool = {
|
||||
type = "zpool";
|
||||
|
||||
options = {
|
||||
ashift = "12";
|
||||
autotrim = "on";
|
||||
};
|
||||
|
||||
rootFsOptions = {
|
||||
acltype = "posixacl";
|
||||
atime = "off";
|
||||
compression = "lz4";
|
||||
dnodesize = "auto";
|
||||
mountpoint = "none";
|
||||
xattr = "sa";
|
||||
};
|
||||
|
||||
datasets = {
|
||||
root = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "none";
|
||||
};
|
||||
|
||||
"root/nixos" = {
|
||||
type = "zfs_fs";
|
||||
mountpoint = "/";
|
||||
options = {
|
||||
canmount = "noauto";
|
||||
mountpoint = "legacy";
|
||||
};
|
||||
postCreateHook = ''
|
||||
zfs list -t snapshot -H -o name | grep -E '^rpool/root/nixos@blank$' \
|
||||
|| zfs snapshot rpool/root/nixos@blank
|
||||
'';
|
||||
};
|
||||
|
||||
home = {
|
||||
type = "zfs_fs";
|
||||
mountpoint = "/home";
|
||||
options.mountpoint = "legacy";
|
||||
};
|
||||
|
||||
nix = {
|
||||
type = "zfs_fs";
|
||||
mountpoint = "/nix";
|
||||
options = {
|
||||
mountpoint = "legacy";
|
||||
"com.sun:auto-snapshot" = "false";
|
||||
primarycache = "metadata";
|
||||
};
|
||||
};
|
||||
|
||||
persist = {
|
||||
type = "zfs_fs";
|
||||
mountpoint = "/persist";
|
||||
options.mountpoint = "legacy";
|
||||
};
|
||||
|
||||
var = {
|
||||
type = "zfs_fs";
|
||||
options.mountpoint = "none";
|
||||
};
|
||||
|
||||
"var/log" = {
|
||||
type = "zfs_fs";
|
||||
mountpoint = "/var/log";
|
||||
options.mountpoint = "legacy";
|
||||
};
|
||||
|
||||
"var/lib" = {
|
||||
type = "zfs_fs";
|
||||
mountpoint = "/var/lib";
|
||||
options.mountpoint = "legacy";
|
||||
};
|
||||
|
||||
reserved = {
|
||||
type = "zfs_volume";
|
||||
size = "1G";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{ lib, modulesPath, ... }:
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
"pcie_brcmstb"
|
||||
"reset-raspberrypi"
|
||||
"usbhid"
|
||||
"usb_storage"
|
||||
"vc4"
|
||||
"xhci_pci"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
|
||||
}
|
||||
Reference in New Issue
Block a user