Reformat all Nix files

This commit is contained in:
Geoffrey Frogeye 2024-12-15 00:29:51 +01:00
parent 9e0c1102a9
commit 355b63cf73
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
81 changed files with 2293 additions and 1153 deletions

View file

@ -2,13 +2,25 @@
# MANU Snapper is not able to create the snapshot directory, so you'll need to do this after eventually running the backup script:
# sudo btrfs subvol create /mnt/razmo/$subvolume/.snapshots
let
backup_subvolumes = [ "nixos" "home.rapido" "home.nixos" ];
backup_subvolumes = [
"nixos"
"home.rapido"
"home.nixos"
];
backup_app = pkgs.writeShellApplication {
name = "backup-subvolume";
runtimeInputs = with pkgs; [ coreutils btrfs-progs ];
runtimeInputs = with pkgs; [
coreutils
btrfs-progs
];
text = builtins.readFile ./backup.sh;
};
snapper_subvolumes = [ "nixos" "home.rapido" "home.razmo" "home.nixos" ];
snapper_subvolumes = [
"nixos"
"home.rapido"
"home.razmo"
"home.nixos"
];
in
{
services =
@ -39,10 +51,15 @@ in
};
in
{
snapper.configs = lib.attrsets.mergeAttrsList (map (s: { "${s}" = default // { SUBVOLUME = "/mnt/razmo/${s}"; }; }) snapper_subvolumes);
snapper.configs = lib.attrsets.mergeAttrsList (
map (s: {
"${s}" = default // {
SUBVOLUME = "/mnt/razmo/${s}";
};
}) snapper_subvolumes
);
};
systemd = {
services.bkp_rapido = {
description = "Make a snapshot of the SSD to the HDD";

View file

@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
let
zytemp_mqtt_src = pkgs.fetchFromGitHub {
# owner = "patrislav1";
@ -7,12 +12,15 @@ let
rev = "push-nurpouorqoyr"; # Humidity + availability support
sha256 = "sha256-nOhyBAgvjeQh9ys3cBJOVR67SDs96zBzxIRGpaq4yoA=";
};
zytemp_mqtt = pkgs.python3Packages.buildPythonPackage
rec {
name = "zytemp_mqtt";
src = zytemp_mqtt_src;
propagatedBuildInputs = with pkgs.python3Packages; [ hidapi paho-mqtt pyaml ];
};
zytemp_mqtt = pkgs.python3Packages.buildPythonPackage rec {
name = "zytemp_mqtt";
src = zytemp_mqtt_src;
propagatedBuildInputs = with pkgs.python3Packages; [
hidapi
paho-mqtt
pyaml
];
};
usb_zytemp_udev = pkgs.stdenv.mkDerivation {
pname = "usb-zytemp-udev-rules";
version = "unstable-2023-05-24";
@ -63,7 +71,11 @@ in
RestrictRealtime = true;
RestrictSUIDSGID = true;
SystemCallArchitectures = "native";
SystemCallFilter = [ "@system-service" "~@privileged" "~@resouces" ];
SystemCallFilter = [
"@system-service"
"~@privileged"
"~@resouces"
];
UMask = "0077";
};
};

View file

@ -1,16 +1,27 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
{
config = {
services.beesd.filesystems = {
razmo = {
spec = "/mnt/razmo";
hashTableSizeMB = 512; # Recommended for 1 TiB, ×2 for compression, x2 for time
extraOptions = [ "--loadavg-target" "7.5" ];
extraOptions = [
"--loadavg-target"
"7.5"
];
};
rapido = {
spec = "/mnt/rapido";
hashTableSizeMB = 128; # 4 times smaller disk, 4 times smaller hashtable?
extraOptions = [ "--loadavg-target" "5" ];
extraOptions = [
"--loadavg-target"
"5"
];
};
};
};

View file

@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
{
config = {
frogeye.name = "curacao";

View file

@ -1,10 +1,16 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
let
desk_mqtt = pkgs.writers.writePython3 "desk_mqtt"
{
libraries = with pkgs.python3Packages; [ pyusb ha-mqtt-discoverable ];
}
(builtins.readFile ./desk_mqtt.py);
desk_mqtt = pkgs.writers.writePython3 "desk_mqtt" {
libraries = with pkgs.python3Packages; [
pyusb
ha-mqtt-discoverable
];
} (builtins.readFile ./desk_mqtt.py);
usb2lin06_udev = pkgs.writeTextFile {
name = "usb2lin06-udev-rules";
text = ''
@ -44,7 +50,11 @@ in
RestrictRealtime = true;
RestrictSUIDSGID = true;
SystemCallArchitectures = "native";
SystemCallFilter = [ "@system-service" "~@privileged" "~@resouces" ];
SystemCallFilter = [
"@system-service"
"~@privileged"
"~@resouces"
];
UMask = "0077";
};
};

View file

@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
# TODO Find a way to use keys in filesystem
# TODO Not relatime everywhere, thank you
# TODO Default options
@ -62,11 +67,17 @@ in
subvolumes = {
"home.razmo" = {
mountpoint = "/home.heavy";
mountOptions = [ "compress=zstd" "relatime" ];
mountOptions = [
"compress=zstd"
"relatime"
];
};
"steam" = {
mountpoint = "/opt/steam.razmo";
mountOptions = [ "compress=zstd" "noatime" ];
mountOptions = [
"compress=zstd"
"noatime"
];
};
};
};
@ -145,7 +156,10 @@ in
};
services.btrfs.autoScrub = {
enable = true;
fileSystems = [ "/mnt/razmo" "/mnt/rapido" ];
fileSystems = [
"/mnt/razmo"
"/mnt/rapido"
];
# TODO Should be generable from disko config, right?
};
}

View file

@ -1,4 +1,9 @@
{ pkgs, lib, nixos-hardware, ... }:
{
pkgs,
lib,
nixos-hardware,
...
}:
let
displays = {
embedded = {
@ -19,7 +24,14 @@ in
config = {
boot = {
# From nixos-generate-config
initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" "rtsx_usb_sdmmc" ];
initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"nvme"
"usbhid"
"sd_mod"
"rtsx_usb_sdmmc"
];
kernelModules = [ "kvm-intel" ];
# UEFI works here, and variables can be touched
@ -95,7 +107,10 @@ in
};
};
# Needs prefetched binary blobs, see https://nixos.wiki/wiki/Displaylink
xserver.videoDrivers = [ "displaylink" "modesetting" ];
xserver.videoDrivers = [
"displaylink"
"modesetting"
];
# TODO See if nvidia and DL can work together.
};
};

View file

@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
{
config = {
networking = {

View file

@ -1,8 +1,14 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
{
config = {
boot.loader.efi.canTouchEfiVariables = false;
disko.devices.disk."${config.frogeye.name}".device = "/dev/disk/by-id/usb-Kingston_DataTraveler_3.0_E0D55EA57414F510489F0F1A-0:0";
disko.devices.disk."${config.frogeye.name
}".device = "/dev/disk/by-id/usb-Kingston_DataTraveler_3.0_E0D55EA57414F510489F0F1A-0:0";
frogeye.name = "curacao-usb";
};
imports = [

View file

@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
{
config = {
# TODO This should install cameractrls, but it seems like it's not easy to install.