2023-10-28 14:24:22 +02:00
|
|
|
|
|
2023-10-28 11:39:27 +02:00
|
|
|
|
# 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")
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ];
|
|
|
|
|
boot.initrd.kernelModules = [ "vfio_pci" "vfio" "vfio_iommu_type1" ];
|
2024-02-25 20:36:58 +01:00
|
|
|
|
boot.initrd.secrets = {
|
|
|
|
|
"/root/NASKeyfile" =
|
|
|
|
|
/root/NASKeyfile;
|
|
|
|
|
};
|
|
|
|
|
boot.initrd.luks.devices = {
|
|
|
|
|
NAS-RAID1 = {
|
|
|
|
|
device = "/dev/disk/by-uuid/57e6446d-faca-4b67-9063-e8d9afb80088";
|
|
|
|
|
keyFile = "/root/NASKeyfile";
|
2024-05-02 09:46:49 +02:00
|
|
|
|
bypassWorkqueues = true;
|
2024-02-25 20:36:58 +01:00
|
|
|
|
};
|
|
|
|
|
NAS-RAID2 = {
|
|
|
|
|
device = "/dev/disk/by-uuid/b9edc489-ac37-4b28-981d-442722df7ae2";
|
|
|
|
|
keyFile = "/root/NASKeyfile";
|
2024-05-02 09:46:49 +02:00
|
|
|
|
bypassWorkqueues = true;
|
2024-02-25 20:36:58 +01:00
|
|
|
|
};
|
|
|
|
|
};
|
2023-10-28 11:39:27 +02:00
|
|
|
|
boot.kernelModules = [ "kvm-intel" ];
|
|
|
|
|
boot.extraModulePackages = [ ];
|
|
|
|
|
boot.tmp.useTmpfs = false;
|
|
|
|
|
boot.tmp.cleanOnBoot = true;
|
|
|
|
|
zramSwap.enable = true;
|
|
|
|
|
|
|
|
|
|
services.btrfs.autoScrub = {
|
|
|
|
|
enable = true;
|
|
|
|
|
interval = "monthly";
|
|
|
|
|
fileSystems = [
|
|
|
|
|
"/"
|
2023-10-29 11:08:50 +01:00
|
|
|
|
"/mnt/nas"
|
2023-10-28 11:39:27 +02:00
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
services.btrbk = {
|
2024-10-14 17:46:26 +02:00
|
|
|
|
extraPackages = [ pkgs.lz4 pkgs.mbuffer ];
|
2023-10-28 11:39:27 +02:00
|
|
|
|
instances = {
|
|
|
|
|
hf = {
|
|
|
|
|
onCalendar = "hourly";
|
|
|
|
|
settings = {
|
|
|
|
|
incremental = "yes";
|
|
|
|
|
snapshot_create = "ondemand";
|
|
|
|
|
snapshot_dir = "@snapshots";
|
|
|
|
|
timestamp_format = "long";
|
|
|
|
|
|
|
|
|
|
snapshot_preserve = "2m 2w 5d 5h";
|
|
|
|
|
snapshot_preserve_min = "latest";
|
|
|
|
|
|
|
|
|
|
volume = {
|
|
|
|
|
"/mnt/snapshots/root" = {
|
|
|
|
|
snapshot_create = "always";
|
|
|
|
|
subvolume = {
|
|
|
|
|
"@" = {};
|
|
|
|
|
"@home" = {};
|
|
|
|
|
};
|
|
|
|
|
};
|
2023-10-29 09:46:49 +01:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
bak = {
|
|
|
|
|
onCalendar = "weekly";
|
|
|
|
|
settings = {
|
2024-10-14 17:46:26 +02:00
|
|
|
|
stream_buffer = "265m";
|
2023-10-29 11:07:01 +01:00
|
|
|
|
stream_compress = "lz4";
|
2023-10-29 09:46:49 +01:00
|
|
|
|
incremental = "yes";
|
|
|
|
|
snapshot_create = "no";
|
|
|
|
|
snapshot_dir = "@snapshots";
|
|
|
|
|
timestamp_format = "long";
|
|
|
|
|
|
|
|
|
|
snapshot_preserve_min = "all";
|
|
|
|
|
target_preserve_min = "no";
|
|
|
|
|
target_preserve = "4w 2m";
|
2024-10-14 19:53:29 +02:00
|
|
|
|
archive_preserve_min = "no";
|
|
|
|
|
archive_preserve = "4w 2m";
|
2023-10-29 09:46:49 +01:00
|
|
|
|
|
2023-10-29 11:07:01 +01:00
|
|
|
|
ssh_identity = "/etc/btrbk/ssh/id_ed25519_btrbk";
|
|
|
|
|
ssh_user = "btrbk";
|
2023-10-29 09:46:49 +01:00
|
|
|
|
|
|
|
|
|
volume = {
|
2024-10-14 12:17:17 +02:00
|
|
|
|
"ssh://jupiter.home.opel-online.de:2220/mnt/snapshots/Mars" = {
|
2023-10-29 09:46:49 +01:00
|
|
|
|
subvolume = {
|
2024-10-14 19:53:29 +02:00
|
|
|
|
"@nas" = {
|
|
|
|
|
target = "/mnt/nas/Backups/Mars";
|
|
|
|
|
};
|
|
|
|
|
"@hades/@home" = {
|
|
|
|
|
target = "/mnt/nas/Backups/Hades";
|
|
|
|
|
snapshot_dir = "@snapshots/@hades";
|
|
|
|
|
};
|
2024-10-14 20:08:16 +02:00
|
|
|
|
"@lifebook/@home" = {
|
|
|
|
|
target = "/mnt/nas/Backups/Lifebook";
|
|
|
|
|
snapshot_dir = "@snapshots/@lifebook";
|
|
|
|
|
};
|
2024-10-20 11:00:40 +02:00
|
|
|
|
# "@steamdeck/@home" = {
|
|
|
|
|
# target = "/mnt/nas/Backups/Steamdeck";
|
|
|
|
|
# snapshot_dir = "@snapshots/@steamdeck";
|
|
|
|
|
# };
|
2023-10-29 09:46:49 +01:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
volume = {
|
2024-10-14 12:17:17 +02:00
|
|
|
|
"ssh://jupiter.home.opel-online.de:2220/mnt/snapshots/Pluto" = {
|
2024-02-29 12:54:30 +01:00
|
|
|
|
target = "/mnt/nas/Backups/Pluto";
|
2023-10-29 09:46:49 +01:00
|
|
|
|
subvolume = {
|
2023-10-29 11:07:01 +01:00
|
|
|
|
"@/Games" = {};
|
|
|
|
|
"@/IT" = {};
|
|
|
|
|
"@/Media" = {};
|
|
|
|
|
"@/Pictures" = {};
|
|
|
|
|
"@/Rest" = {};
|
2023-10-29 09:46:49 +01:00
|
|
|
|
};
|
|
|
|
|
};
|
2023-10-28 11:39:27 +02:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
2023-10-28 14:24:22 +02:00
|
|
|
|
};
|
|
|
|
|
};
|
2023-10-28 11:39:27 +02:00
|
|
|
|
|
2024-10-19 08:47:31 +02:00
|
|
|
|
systemd.services = {
|
|
|
|
|
btrbk-bak = {
|
2024-10-20 11:00:40 +02:00
|
|
|
|
requires = [ "network-online.target" ];
|
2024-10-19 08:47:31 +02:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2023-10-28 11:39:27 +02:00
|
|
|
|
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" ];
|
|
|
|
|
};
|
|
|
|
|
|
2023-10-28 14:24:22 +02:00
|
|
|
|
fileSystems."/mnt/snapshots/root" =
|
|
|
|
|
{ device = "/dev/disk/by-label/NIXROOT";
|
|
|
|
|
fsType = "btrfs";
|
|
|
|
|
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvolid=5,discard=async" ];
|
|
|
|
|
};
|
|
|
|
|
|
2023-10-28 11:39:27 +02:00
|
|
|
|
# fileSystems."/mnt/snapshots/Pluto" =
|
|
|
|
|
# { device = "/dev/disk/by-label/NAS-RAID";
|
|
|
|
|
# fsType = "btrfs";
|
|
|
|
|
# options = [ "compress=zstd,space_cache=v2,noatime,subvolid=5" ];
|
|
|
|
|
# };
|
|
|
|
|
#
|
2023-10-28 14:24:22 +02:00
|
|
|
|
fileSystems."/mnt/nas" =
|
2024-02-25 20:36:58 +01:00
|
|
|
|
{ device = "/dev/disk/by-uuid/70523c79-ef5c-40f2-8782-60fc86bb445b";
|
2023-10-28 14:24:22 +02:00
|
|
|
|
fsType = "btrfs";
|
2023-10-29 11:07:01 +01:00
|
|
|
|
options = [ "compress=zstd:9,space_cache=v2,noatime,subvol=@nasbak" ];
|
2023-10-28 14:24:22 +02:00
|
|
|
|
};
|
|
|
|
|
|
2023-10-28 11:39:27 +02:00
|
|
|
|
fileSystems."/boot" =
|
|
|
|
|
{ device = "/dev/disk/by-label/NIXBOOT";
|
|
|
|
|
fsType = "vfat";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
swapDevices = [ { device = "/swap/swapfile"; } ];
|
|
|
|
|
|
2024-08-22 19:42:25 +02:00
|
|
|
|
systemd.network = {
|
|
|
|
|
enable = true;
|
|
|
|
|
networks = {
|
|
|
|
|
"10-lan" = {
|
|
|
|
|
matchConfig.Name = "enp6s18";
|
|
|
|
|
ntp = [ "192.168.2.1" ];
|
|
|
|
|
#domains = [ "home.opel-online.de" ];
|
|
|
|
|
networkConfig = {
|
|
|
|
|
DHCP = "yes";
|
|
|
|
|
IPv6AcceptRA = true;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
2023-10-28 11:39:27 +02:00
|
|
|
|
networking = {
|
|
|
|
|
hostName = "nasbak";
|
|
|
|
|
domain = "home.opel-online.de";
|
2024-08-22 19:42:25 +02:00
|
|
|
|
useDHCP = false; # For versatility sake, manually edit IP on nm-applet.
|
2023-10-28 11:39:27 +02:00
|
|
|
|
#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;
|
|
|
|
|
# powerUpCommands = ''
|
|
|
|
|
# ${pkgs.hdparm}/sbin/hdparm -S 150 /dev/disk/by-uuid/57e6446d-faca-4b67-9063-e8d9afb80088
|
|
|
|
|
# ${pkgs.hdparm}/sbin/hdparm -S 150 /dev/disk/by-uuid/b9edc489-ac37-4b28-981d-442722df7ae2
|
|
|
|
|
# '';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|