2023-01-07 16:13:39 +01: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" ];
|
2023-02-26 10:21:26 +01:00
|
|
|
|
boot.initrd.kernelModules = [ "vfio_pci" "vfio" "vfio_iommu_type1" ];
|
2023-01-08 12:19:10 +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";
|
|
|
|
|
};
|
|
|
|
|
NAS-RAID2 = {
|
|
|
|
|
device = "/dev/disk/by-uuid/b9edc489-ac37-4b28-981d-442722df7ae2";
|
|
|
|
|
keyFile = "/root/NASKeyfile";
|
|
|
|
|
};
|
|
|
|
|
};
|
2023-01-07 16:13:39 +01:00
|
|
|
|
boot.kernelModules = [ "kvm-intel" ];
|
|
|
|
|
boot.extraModulePackages = [ ];
|
2023-09-23 09:19:56 +02:00
|
|
|
|
boot.tmp.useTmpfs = false;
|
|
|
|
|
boot.tmp.cleanOnBoot = true;
|
2023-01-07 16:13:39 +01:00
|
|
|
|
zramSwap.enable = true;
|
|
|
|
|
|
2023-01-13 17:21:18 +01:00
|
|
|
|
services.btrfs.autoScrub = {
|
|
|
|
|
enable = true;
|
|
|
|
|
interval = "monthly";
|
|
|
|
|
fileSystems = [
|
|
|
|
|
"/"
|
|
|
|
|
"/mnt/Pluto"
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
|
2023-01-14 20:12:30 +01:00
|
|
|
|
services.btrbk = {
|
|
|
|
|
instances = {
|
|
|
|
|
hf = {
|
2023-01-14 20:53:40 +01:00
|
|
|
|
onCalendar = "hourly";
|
2023-01-14 20:12:30 +01:00
|
|
|
|
settings = {
|
2023-01-14 20:24:06 +01:00
|
|
|
|
incremental = "yes";
|
2023-01-14 20:12:30 +01:00
|
|
|
|
snapshot_create = "ondemand";
|
2023-01-14 20:24:06 +01:00
|
|
|
|
snapshot_dir = "@snapshots";
|
2023-01-14 20:53:40 +01:00
|
|
|
|
timestamp_format = "long";
|
2023-01-14 20:12:30 +01:00
|
|
|
|
|
|
|
|
|
snapshot_preserve = "2m 2w 5d 5h";
|
|
|
|
|
snapshot_preserve_min = "latest";
|
|
|
|
|
|
|
|
|
|
volume = {
|
2023-01-14 20:24:06 +01:00
|
|
|
|
"/mnt/snapshots/root" = {
|
2023-01-14 20:12:30 +01:00
|
|
|
|
snapshot_create = "always";
|
2023-01-14 21:15:26 +01:00
|
|
|
|
subvolume = {
|
2023-01-29 11:22:34 +01:00
|
|
|
|
"@" = {};
|
2023-01-14 21:15:26 +01:00
|
|
|
|
"@home" = {};
|
2023-09-10 08:47:37 +02:00
|
|
|
|
"@nas/Home" = {};
|
2023-01-14 21:15:26 +01:00
|
|
|
|
};
|
2023-01-14 21:06:21 +01:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
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";
|
2023-01-14 21:15:26 +01:00
|
|
|
|
subvolume = {
|
|
|
|
|
"@" = {};
|
|
|
|
|
"@/Backups" = {};
|
|
|
|
|
"@/Games" = {};
|
|
|
|
|
"@/IT" = {};
|
|
|
|
|
"@/Media" = {};
|
|
|
|
|
"@/Pictures" = {};
|
|
|
|
|
"@/Rest" = {};
|
|
|
|
|
};
|
2023-01-14 20:12:30 +01:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
2023-01-13 17:21:18 +01:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2023-01-07 16:13:39 +01: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" ];
|
|
|
|
|
};
|
|
|
|
|
|
2023-09-23 09:19:56 +02:00
|
|
|
|
fileSystems."/swap" =
|
|
|
|
|
{ device = "/dev/disk/by-label/NIXROOT";
|
|
|
|
|
fsType = "btrfs";
|
|
|
|
|
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@swap,discard=async" ];
|
|
|
|
|
};
|
|
|
|
|
|
2023-01-14 20:12:30 +01:00
|
|
|
|
fileSystems."/mnt/snapshots/root" =
|
|
|
|
|
{ device = "/dev/disk/by-label/NIXROOT";
|
2023-01-13 17:21:18 +01:00
|
|
|
|
fsType = "btrfs";
|
2023-01-14 20:24:06 +01:00
|
|
|
|
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvolid=5,discard=async" ];
|
2023-01-13 17:21:18 +01:00
|
|
|
|
};
|
|
|
|
|
|
2023-01-14 20:12:30 +01:00
|
|
|
|
fileSystems."/mnt/snapshots/Mars" =
|
|
|
|
|
{ device = "/dev/disk/by-label/NIXROOT";
|
2023-01-13 17:21:18 +01:00
|
|
|
|
fsType = "btrfs";
|
2023-01-14 20:53:40 +01:00
|
|
|
|
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvolid=5,discard=async" ];
|
2023-01-13 17:21:18 +01:00
|
|
|
|
};
|
|
|
|
|
|
2023-01-14 20:12:30 +01:00
|
|
|
|
fileSystems."/mnt/snapshots/Pluto" =
|
2023-01-13 17:21:18 +01:00
|
|
|
|
{ device = "/dev/disk/by-label/NAS-RAID";
|
|
|
|
|
fsType = "btrfs";
|
2023-01-14 20:53:40 +01:00
|
|
|
|
options = [ "compress=zstd,space_cache=v2,noatime,subvolid=5" ];
|
2023-01-13 17:21:18 +01:00
|
|
|
|
};
|
|
|
|
|
|
2023-01-14 20:12:30 +01:00
|
|
|
|
fileSystems."/mnt/Pluto" =
|
2023-01-13 17:21:18 +01:00
|
|
|
|
{ device = "/dev/disk/by-label/NAS-RAID";
|
|
|
|
|
fsType = "btrfs";
|
2023-01-14 20:12:30 +01:00
|
|
|
|
options = [ "compress=zstd,space_cache=v2,noatime,subvol=@" ];
|
2023-01-13 17:21:18 +01:00
|
|
|
|
};
|
|
|
|
|
|
2023-01-07 19:43:12 +01:00
|
|
|
|
fileSystems."/mnt/Mars" =
|
|
|
|
|
{ device = "/dev/disk/by-label/NIXROOT";
|
|
|
|
|
fsType = "btrfs";
|
|
|
|
|
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@nas,discard=async" ];
|
|
|
|
|
};
|
|
|
|
|
|
2023-01-07 16:13:39 +01:00
|
|
|
|
fileSystems."/boot" =
|
|
|
|
|
{ device = "/dev/disk/by-label/NIXBOOT";
|
|
|
|
|
fsType = "vfat";
|
|
|
|
|
};
|
|
|
|
|
|
2023-01-07 19:43:12 +01:00
|
|
|
|
fileSystems."/export/Pluto" =
|
|
|
|
|
{ device = "/mnt/Pluto";
|
|
|
|
|
options = [ "bind" ];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
fileSystems."/export/Mars" =
|
|
|
|
|
{ device = "/mnt/Mars";
|
|
|
|
|
options = [ "bind" ];
|
|
|
|
|
};
|
|
|
|
|
|
2023-09-23 09:19:56 +02:00
|
|
|
|
swapDevices = [ { device = "/swap/swapfile"; } ];
|
2023-01-07 16:13:39 +01:00
|
|
|
|
|
|
|
|
|
networking = {
|
2023-01-28 17:40:29 +01:00
|
|
|
|
vswitches = {
|
|
|
|
|
vs0 = {
|
|
|
|
|
interfaces = {
|
|
|
|
|
enp0s31f6 = { };
|
|
|
|
|
lo1 = {
|
|
|
|
|
type = "internal";
|
|
|
|
|
};
|
|
|
|
|
enp0s31f6iot = {
|
|
|
|
|
type = "internal";
|
|
|
|
|
vlan = 100;
|
|
|
|
|
};
|
|
|
|
|
};
|
2023-01-28 21:24:46 +01:00
|
|
|
|
};
|
|
|
|
|
};
|
2023-01-07 16:13:39 +01:00
|
|
|
|
useDHCP = false; # Deprecated
|
|
|
|
|
hostName = "nas";
|
2023-01-07 19:43:12 +01:00
|
|
|
|
domain = "home.opel-online.de";
|
2023-01-07 16:13:39 +01:00
|
|
|
|
networkmanager = {
|
|
|
|
|
enable = false;
|
|
|
|
|
};
|
2023-01-21 19:02:08 +01:00
|
|
|
|
timeServers = [
|
|
|
|
|
"192.168.2.1"
|
|
|
|
|
];
|
2023-01-07 16:13:39 +01:00
|
|
|
|
interfaces = {
|
2023-01-28 17:40:29 +01:00
|
|
|
|
# enp0s31f6 = {
|
|
|
|
|
# useDHCP = true; # For versatility sake, manually edit IP on nm-applet.
|
2023-01-07 16:13:39 +01:00
|
|
|
|
# ipv4.addresses = [ {
|
|
|
|
|
# address = "45.142.114.153";
|
|
|
|
|
# prefixLength = 24;
|
|
|
|
|
# } ];
|
|
|
|
|
# ipv6.addresses = [ {
|
|
|
|
|
# address = "2a00:ccc1:101:19D::2";
|
|
|
|
|
# prefixLength = 64;
|
|
|
|
|
# } ];
|
2023-01-28 21:29:41 +01:00
|
|
|
|
# };
|
2023-01-28 21:24:46 +01:00
|
|
|
|
lo1 = {
|
|
|
|
|
useDHCP = true;
|
2023-01-28 21:29:41 +01:00
|
|
|
|
macAddress = "f6:14:f3:7b:1f:f7";
|
2023-01-28 21:24:46 +01:00
|
|
|
|
};
|
2023-01-07 16:53:36 +01:00
|
|
|
|
};
|
2023-01-07 16:13:39 +01:00
|
|
|
|
# defaultGateway = "45.142.114.1";
|
2023-01-21 19:02:08 +01:00
|
|
|
|
defaultGateway6 = {
|
|
|
|
|
address = "fe80::1";
|
2023-01-28 17:40:29 +01:00
|
|
|
|
interface = "lo1";
|
2023-01-21 19:02:08 +01:00
|
|
|
|
};
|
2023-01-07 16:13:39 +01:00
|
|
|
|
# nameservers = [ "9.9.9.9" "2620:fe::fe" ];
|
2023-01-21 19:02:08 +01:00
|
|
|
|
#firewall = {
|
|
|
|
|
# enable = false;
|
|
|
|
|
# #allowedUDPPorts = [ 53 67 ];
|
|
|
|
|
# #allowedTCPPorts = [ 53 80 443 9443 ];
|
|
|
|
|
#};
|
|
|
|
|
};
|
2023-02-26 10:21:26 +01:00
|
|
|
|
|
|
|
|
|
systemd.services = {
|
2023-03-19 07:31:41 +01:00
|
|
|
|
"ovsdb".partOf = [ "network-setup.service" ];
|
|
|
|
|
"ovs-vswitchd".partOf = [ "network-setup.service" ];
|
|
|
|
|
"network-addresses-lo1" = {
|
|
|
|
|
requires = [ "network-setup.service" ];
|
2023-04-15 10:00:26 +02:00
|
|
|
|
};
|
2023-02-26 10:21:26 +01:00
|
|
|
|
};
|
|
|
|
|
|
2023-01-07 16:13:39 +01:00
|
|
|
|
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
2023-01-08 13:26:55 +01:00
|
|
|
|
powerManagement = {
|
|
|
|
|
cpuFreqGovernor = lib.mkDefault "powersave";
|
|
|
|
|
powertop.enable = true;
|
|
|
|
|
powerUpCommands = ''
|
2023-01-13 15:35:07 +01:00
|
|
|
|
${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
|
2023-01-08 13:26:55 +01:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2023-01-07 16:13:39 +01:00
|
|
|
|
}
|