242 lines
6.1 KiB
Nix
242 lines
6.1 KiB
Nix
#
|
||
# Hardware settings for Teclast F5 10" Laptop
|
||
# NixOS @ sda2
|
||
#
|
||
# flake.nix
|
||
# └─ ./hosts
|
||
# └─ ./laptop
|
||
# └─ hardware-configuration.nix *
|
||
#
|
||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||
# and may be overwritten by future invocations. Please make changes
|
||
# to /etc/nixos/configuration.nix instead.
|
||
{
|
||
config,
|
||
lib,
|
||
pkgs,
|
||
modulesPath,
|
||
...
|
||
}: {
|
||
imports =
|
||
[(modulesPath + "/profiles/qemu-guest.nix")]
|
||
++ [(import ../../modules/hardware/backup.nix)];
|
||
|
||
boot.initrd.availableKernelModules = ["uhci_hcd" "ehci_pci" "ahci" "virtio_pci" "virtio_scsi" "sr_mod" "virtio_blk"];
|
||
boot.initrd.kernelModules = [];
|
||
boot.initrd.secrets = {
|
||
"/root/NASKeyfile" =
|
||
/root/NASKeyfile;
|
||
};
|
||
boot.initrd.luks.devices = {
|
||
NAS-RAID1 = {
|
||
device = "/dev/disk/by-uuid/78c74410-c840-49b0-8a29-456d60c38217";
|
||
keyFile = "/root/NASKeyfile";
|
||
};
|
||
NAS-RAID1_2 = {
|
||
device = "/dev/disk/by-uuid/dda6e698-4f0a-4d71-a06c-656b87374ed7";
|
||
keyFile = "/root/NASKeyfile";
|
||
};
|
||
};
|
||
boot.kernelModules = [];
|
||
boot.extraModulePackages = [];
|
||
boot.tmp.useTmpfs = false;
|
||
boot.tmp.cleanOnBoot = true;
|
||
zramSwap.enable = true;
|
||
|
||
services.btrfs.autoScrub = {
|
||
enable = true;
|
||
interval = "monthly";
|
||
fileSystems = [
|
||
"/"
|
||
"/mnt/Mars"
|
||
"/mnt/Pluto"
|
||
];
|
||
};
|
||
|
||
services.btrbk = {
|
||
extraPackages = [pkgs.lz4 pkgs.mbuffer];
|
||
instances = {
|
||
hf = {
|
||
onCalendar = "hourly";
|
||
settings = {
|
||
incremental = "yes";
|
||
snapshot_create = "ondemand";
|
||
snapshot_dir = "@snapshots";
|
||
timestamp_format = "long";
|
||
|
||
snapshot_preserve = "2w 5d 5h";
|
||
snapshot_preserve_min = "latest";
|
||
|
||
volume = {
|
||
"/mnt/snapshots/root" = {
|
||
snapshot_create = "always";
|
||
subvolume = {
|
||
"@" = {};
|
||
"@home" = {};
|
||
};
|
||
};
|
||
};
|
||
volume = {
|
||
"/mnt/snapshots/Mars" = {
|
||
snapshot_create = "always";
|
||
subvolume = {
|
||
"@nas" = {};
|
||
};
|
||
};
|
||
};
|
||
};
|
||
};
|
||
lf = {
|
||
onCalendar = "daily";
|
||
settings = {
|
||
incremental = "yes";
|
||
snapshot_create = "ondemand";
|
||
snapshot_dir = "@snapshots";
|
||
timestamp_format = "long";
|
||
|
||
snapshot_preserve = "2m 2w 5d";
|
||
snapshot_preserve_min = "latest";
|
||
|
||
volume = {
|
||
"/mnt/snapshots/Pluto" = {
|
||
snapshot_create = "always";
|
||
subvolume = {
|
||
"@" = {};
|
||
"@/Backups" = {};
|
||
"@/Games" = {};
|
||
"@/IT" = {};
|
||
"@/Media" = {};
|
||
"@/Pictures" = {};
|
||
"@/Rest" = {};
|
||
};
|
||
};
|
||
};
|
||
};
|
||
};
|
||
};
|
||
};
|
||
|
||
fileSystems."/" = {
|
||
device = "/dev/disk/by-label/NIXROOT";
|
||
fsType = "btrfs";
|
||
options = ["compress=zstd,space_cache=v2,ssd,noatime,subvol=@,discard=async"];
|
||
};
|
||
|
||
fileSystems."/home" = {
|
||
device = "/dev/disk/by-label/NIXROOT";
|
||
fsType = "btrfs";
|
||
options = ["compress=zstd,space_cache=v2,ssd,noatime,subvol=@home,discard=async"];
|
||
};
|
||
|
||
fileSystems."/srv" = {
|
||
device = "/dev/disk/by-label/NIXROOT";
|
||
fsType = "btrfs";
|
||
options = ["compress=zstd,space_cache=v2,ssd,noatime,subvol=@srv,discard=async"];
|
||
};
|
||
|
||
fileSystems."/nix" = {
|
||
device = "/dev/disk/by-label/NIXROOT";
|
||
fsType = "btrfs";
|
||
options = ["compress=zstd,space_cache=v2,ssd,noatime,subvol=@nix,discard=async"];
|
||
};
|
||
|
||
fileSystems."/swap" = {
|
||
device = "/dev/disk/by-label/NIXROOT";
|
||
fsType = "btrfs";
|
||
options = ["compress=zstd,space_cache=v2,ssd,noatime,subvol=@swap,discard=async"];
|
||
};
|
||
|
||
fileSystems."/mnt/snapshots/root" = {
|
||
device = "/dev/disk/by-label/NIXROOT";
|
||
fsType = "btrfs";
|
||
options = ["compress=zstd,space_cache=v2,ssd,noatime,subvolid=5,discard=async"];
|
||
};
|
||
|
||
fileSystems."/mnt/snapshots/Mars" = {
|
||
device = "/dev/disk/by-label/MARS";
|
||
fsType = "btrfs";
|
||
options = ["compress=zstd,space_cache=v2,ssd,noatime,subvolid=5,discard=async"];
|
||
};
|
||
|
||
fileSystems."/mnt/snapshots/Pluto" = {
|
||
device = "/dev/disk/by-label/NAS-RAID";
|
||
fsType = "btrfs";
|
||
options = ["compress=zstd:8,noatime,subvolid=5"];
|
||
};
|
||
|
||
fileSystems."/mnt/Pluto" = {
|
||
device = "/dev/disk/by-label/NAS-RAID";
|
||
fsType = "btrfs";
|
||
options = ["compress=zstd:8,noatime,subvol=@"];
|
||
};
|
||
|
||
fileSystems."/mnt/Mars" = {
|
||
device = "/dev/disk/by-label/MARS";
|
||
fsType = "btrfs";
|
||
options = ["compress=zstd,space_cache=v2,ssd,noatime,subvol=@nas,discard=async"];
|
||
};
|
||
|
||
fileSystems."/boot" = {
|
||
device = "/dev/disk/by-label/NIXBOOT";
|
||
fsType = "vfat";
|
||
};
|
||
|
||
fileSystems."/export/Pluto" = {
|
||
device = "/mnt/Pluto";
|
||
options = ["bind"];
|
||
};
|
||
|
||
fileSystems."/export/Mars" = {
|
||
device = "/mnt/Mars";
|
||
options = ["bind"];
|
||
};
|
||
|
||
swapDevices = [{device = "/swap/swapfile";}];
|
||
|
||
systemd.network = {
|
||
enable = true;
|
||
networks = {
|
||
"10-lan" = {
|
||
matchConfig.Name = "ens18";
|
||
ntp = ["192.168.2.1"];
|
||
domains = ["home.opel-online.de"];
|
||
networkConfig = {
|
||
DHCP = "yes";
|
||
IPv6AcceptRA = true;
|
||
IPv6PrivacyExtensions = false;
|
||
};
|
||
ipv6AcceptRAConfig = {
|
||
DHCPv6Client = "always";
|
||
UseDNS = true;
|
||
};
|
||
dhcpV4Config = {
|
||
UseDNS = true;
|
||
};
|
||
dhcpV6Config = {
|
||
UseDNS = true;
|
||
};
|
||
};
|
||
};
|
||
};
|
||
networking = {
|
||
hostName = "jupiter";
|
||
domain = "home.opel-online.de";
|
||
useDHCP = false; # For versatility sake, manually edit IP on nm-applet.
|
||
#firewall = {
|
||
# enable = false;
|
||
# #allowedUDPPorts = [ 53 67 ];
|
||
# #allowedTCPPorts = [ 53 80 443 9443 ];
|
||
#};
|
||
};
|
||
|
||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||
powerManagement = {
|
||
cpuFreqGovernor = lib.mkDefault "powersave";
|
||
powertop.enable = true;
|
||
#scsiLinkPolicy = "med_power_with_dipm";
|
||
powerUpCommands = ''
|
||
${pkgs.hdparm}/sbin/hdparm -S 150 /dev/disk/by-uuid/57e6446d-faca-4b67-9063-e8d9afb80088
|
||
'';
|
||
};
|
||
}
|