use rfc-style formatter

This commit is contained in:
cy 2024-12-19 02:32:58 -05:00
parent 993b457e0b
commit f57ed53bc5
30 changed files with 324 additions and 176 deletions

View file

@ -13,12 +13,14 @@
}; };
}; };
outputs = { outputs =
{
self, self,
nixpkgs, nixpkgs,
home-manager, home-manager,
... ...
} @ inputs: let }@inputs:
let
lib = nixpkgs.lib; lib = nixpkgs.lib;
inherit (self) outputs; inherit (self) outputs;
@ -33,17 +35,20 @@
}; };
} }
); );
in { in
{
packages = forEachSystem (pkgs: import ./pkgs { inherit pkgs; }); packages = forEachSystem (pkgs: import ./pkgs { inherit pkgs; });
formatter = forEachSystem (pkgs: pkgs.alejandra); formatter = forEachSystem (pkgs: pkgs.nixfmt-rfc-style);
devShells = forEachSystem (pkgs: import ./shells { inherit pkgs; }); devShells = forEachSystem (pkgs: import ./shells { inherit pkgs; });
nixosModules = import ./modules/nixos; nixosModules = import ./modules/nixos;
homeManagerModules = import ./modules/home-manager; homeManagerModules = import ./modules/home-manager;
overlays = import ./overlays { inherit inputs outputs; }; overlays = import ./overlays { inherit inputs outputs; };
nixosConfigurations = let nixosConfigurations =
let
pkgs = pkgsFor.x86_64-linux; pkgs = pkgsFor.x86_64-linux;
in { in
{
ytnix = lib.nixosSystem { ytnix = lib.nixosSystem {
specialArgs = { inherit inputs outputs; }; specialArgs = { inherit inputs outputs; };
modules = [ modules = [

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
programs.foot = { programs.foot = {
enable = true; enable = true;
settings = { settings = {

View file

@ -1,4 +1,5 @@
{pkgs, ...}: { { pkgs, ... }:
{
programs.tmux = { programs.tmux = {
enable = true; enable = true;
baseIndex = 1; baseIndex = 1;

View file

@ -5,7 +5,8 @@
inputs, inputs,
outputs, outputs,
... ...
}: { }:
{
imports = [ imports = [
./common.nix ./common.nix
]; ];

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
imports = [ imports = [
../tmux.nix ../tmux.nix
../zsh ../zsh

View file

@ -2,7 +2,8 @@
pkgs, pkgs,
inputs, inputs,
... ...
}: { }:
{
imports = [ imports = [
./common.nix ./common.nix
../foot.nix ../foot.nix

View file

@ -1,9 +1,13 @@
{...}: { { ... }:
{
programs.zsh = { programs.zsh = {
enable = true; enable = true;
autosuggestion = { autosuggestion = {
enable = true; enable = true;
strategy = ["history" "completion"]; strategy = [
"history"
"completion"
];
}; };
syntaxHighlighting = { syntaxHighlighting = {
enable = true; enable = true;

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
services.adguardhome = { services.adguardhome = {
enable = true; enable = true;
host = "127.0.0.1"; host = "127.0.0.1";

View file

@ -2,11 +2,29 @@
pkgs, pkgs,
config, config,
... ...
}: { }:
{
services.borgbackup.jobs = { services.borgbackup.jobs = {
crashRsync = { crashRsync = {
paths = ["/root" "/home" "/var/backup" "/var/lib" "/var/log" "/opt" "/etc" "/vw-data"]; paths = [
exclude = ["**/.cache" "**/node_modules" "**/cache" "**/Cache" "/var/lib/docker" "/var/lib/containers/cache" "/var/lib/containers/overlay*"]; "/root"
"/home"
"/var/backup"
"/var/lib"
"/var/log"
"/opt"
"/etc"
"/vw-data"
];
exclude = [
"**/.cache"
"**/node_modules"
"**/cache"
"**/Cache"
"/var/lib/docker"
"/var/lib/containers/cache"
"/var/lib/containers/overlay*"
];
repo = "de3911@de3911.rsync.net:borg/crash"; repo = "de3911@de3911.rsync.net:borg/crash";
encryption = { encryption = {
mode = "repokey-blake2"; mode = "repokey-blake2";
@ -22,7 +40,9 @@
# warnings are often not that serious # warnings are often not that serious
failOnWarnings = false; failOnWarnings = false;
postHook = '' postHook = ''
${pkgs.curl}/bin/curl -u $(cat ${config.sops.secrets."services/ntfy".path}) -d "chunk: backup completed with exit code: $exitStatus ${pkgs.curl}/bin/curl -u $(cat ${
config.sops.secrets."services/ntfy".path
}) -d "chunk: backup completed with exit code: $exitStatus
$(journalctl -u borgbackup-job-crashRsync.service|tail -n 5)" \ $(journalctl -u borgbackup-job-crashRsync.service|tail -n 5)" \
https://ntfy.cything.io/chunk https://ntfy.cything.io/chunk
''; '';

View file

@ -2,7 +2,8 @@
pkgs, pkgs,
config, config,
... ...
}: { }:
{
virtualisation.oci-containers.containers.conduit = { virtualisation.oci-containers.containers.conduit = {
image = "matrixconduit/matrix-conduit:latest"; image = "matrixconduit/matrix-conduit:latest";
autoStart = true; autoStart = true;

View file

@ -3,7 +3,8 @@
lib, lib,
pkgs, pkgs,
... ...
}: { }:
{
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
../common.nix ../common.nix
@ -91,8 +92,19 @@
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
networking.firewall = { networking.firewall = {
enable = true; enable = true;
allowedTCPPorts = [22 80 443 53 853]; allowedTCPPorts = [
allowedUDPPorts = [443 51820 53 853]; # 51820 is wireguard 22
80
443
53
853
];
allowedUDPPorts = [
443
51820
53
853
]; # 51820 is wireguard
trustedInterfaces = [ "wg0" ]; trustedInterfaces = [ "wg0" ];
}; };
networking.interfaces.ens18 = { networking.interfaces.ens18 = {
@ -117,7 +129,10 @@
address = "31.59.129.1"; address = "31.59.129.1";
interface = "ens18"; interface = "ens18";
}; };
networking.nameservers = ["127.0.0.1" "::1"]; networking.nameservers = [
"127.0.0.1"
"::1"
];
time.timeZone = "America/Toronto"; time.timeZone = "America/Toronto";
@ -129,12 +144,20 @@
users.users.yt = { users.users.yt = {
isNormalUser = true; isNormalUser = true;
extraGroups = ["wheel" "networkmanager" "podman"]; extraGroups = [
openssh.authorizedKeys.keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPdhAQYy0+vS+QmyCd0MAbqbgzyMGcsuuFyf6kg2yKge yt@ytlinux"]; "wheel"
"networkmanager"
"podman"
];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPdhAQYy0+vS+QmyCd0MAbqbgzyMGcsuuFyf6kg2yKge yt@ytlinux"
];
shell = pkgs.zsh; shell = pkgs.zsh;
}; };
programs.zsh.enable = true; programs.zsh.enable = true;
users.users.root.openssh.authorizedKeys.keys = ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPdhAQYy0+vS+QmyCd0MAbqbgzyMGcsuuFyf6kg2yKge yt@ytlinux"]; users.users.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPdhAQYy0+vS+QmyCd0MAbqbgzyMGcsuuFyf6kg2yKge yt@ytlinux"
];
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
vim vim

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
services.deluge = { services.deluge = {
enable = true; enable = true;
web = { web = {

View file

@ -2,7 +2,8 @@
pkgs, pkgs,
config, config,
... ...
}: { }:
{
virtualisation.oci-containers.containers.ghost = { virtualisation.oci-containers.containers.ghost = {
image = "ghost:5-alpine"; image = "ghost:5-alpine";
autoStart = true; autoStart = true;

View file

@ -1,4 +1,5 @@
{config, ...}: { { config, ... }:
{
services.gitlab = { services.gitlab = {
enable = true; enable = true;
https = true; https = true;

View file

@ -1,4 +1,5 @@
{config, ...}: { { config, ... }:
{
services.grafana = { services.grafana = {
enable = true; enable = true;
settings.server = { settings.server = {

View file

@ -7,12 +7,19 @@
pkgs, pkgs,
modulesPath, modulesPath,
... ...
}: { }:
{
imports = [ imports = [
(modulesPath + "/profiles/qemu-guest.nix") (modulesPath + "/profiles/qemu-guest.nix")
]; ];
boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk"]; boot.initrd.availableKernelModules = [
"ata_piix"
"uhci_hcd"
"virtio_pci"
"sr_mod"
"virtio_blk"
];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];

View file

@ -1,4 +1,5 @@
{config, ...}: { { config, ... }:
{
services.hedgedoc = { services.hedgedoc = {
enable = true; enable = true;
environmentFile = config.sops.secrets."hedgedoc/env".path; environmentFile = config.sops.secrets."hedgedoc/env".path;

View file

@ -2,13 +2,15 @@
pkgs, pkgs,
config, config,
... ...
}: let }:
let
uploadLocation = "/mnt/photos/immich"; uploadLocation = "/mnt/photos/immich";
thumbsLocation = "/opt/immich/thumbs"; thumbsLocation = "/opt/immich/thumbs";
profileLocation = "/opt/immich/profile"; profileLocation = "/opt/immich/profile";
dbDataLocation = "/opt/immich/postgres"; dbDataLocation = "/opt/immich/postgres";
modelCache = "/opt/immich-ml"; modelCache = "/opt/immich-ml";
in { in
{
virtualisation.oci-containers.containers = { virtualisation.oci-containers.containers = {
immich-server = { immich-server = {
image = "ghcr.io/immich-app/immich-server:release"; image = "ghcr.io/immich-app/immich-server:release";
@ -25,7 +27,10 @@ in {
DB_HOSTNAME = "immich-db"; DB_HOSTNAME = "immich-db";
}; };
networks = [ "immich-net" ]; networks = [ "immich-net" ];
dependsOn = ["immich-db" "immich-redis"]; dependsOn = [
"immich-db"
"immich-redis"
];
}; };
immich-redis = { immich-redis = {
@ -48,12 +53,18 @@ in {
volumes = [ "${dbDataLocation}:/var/lib/postgresql/data" ]; volumes = [ "${dbDataLocation}:/var/lib/postgresql/data" ];
cmd = [ cmd = [
"postgres" "postgres"
"-c" "shared_preload_libraries=vectors.so" "-c"
"-c" ''search_path="$$user", public, vectors'' "shared_preload_libraries=vectors.so"
"-c" "logging_collector=on" "-c"
"-c" "max_wal_size=2GB" ''search_path="$$user", public, vectors''
"-c" "shared_buffers=512MB" "-c"
"-c" "wal_compression=on" "logging_collector=on"
"-c"
"max_wal_size=2GB"
"-c"
"shared_buffers=512MB"
"-c"
"wal_compression=on"
]; ];
networks = [ "immich-net" ]; networks = [ "immich-net" ];
}; };

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
services.jellyfin = { services.jellyfin = {
enable = true; enable = true;
dataDir = "/mnt/jellyfin"; dataDir = "/mnt/jellyfin";

View file

@ -1,4 +1,5 @@
{config, ...}: { { config, ... }:
{
services.miniflux = { services.miniflux = {
enable = true; enable = true;
adminCredentialsFile = config.sops.secrets."miniflux/env".path; adminCredentialsFile = config.sops.secrets."miniflux/env".path;

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
services.ntfy-sh = { services.ntfy-sh = {
enable = true; enable = true;
settings = { settings = {

View file

@ -2,7 +2,8 @@
pkgs, pkgs,
lib, lib,
... ...
}: { }:
{
services.postgresql = { services.postgresql = {
enable = true; enable = true;
settings.port = 5432; settings.port = 5432;

View file

@ -2,7 +2,8 @@
pkgs, pkgs,
config, config,
... ...
}: { }:
{
systemd.services.immich-mount = { systemd.services.immich-mount = {
enable = true; enable = true;
description = "Mount the immich data remote"; description = "Mount the immich data remote";

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
services.redlib = { services.redlib = {
enable = true; enable = true;
port = 8087; port = 8087;

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
services.tor = { services.tor = {
enable = true; enable = true;
openFirewall = true; openFirewall = true;

View file

@ -1,4 +1,5 @@
{config, ...}: { { config, ... }:
{
services.vaultwarden = { services.vaultwarden = {
enable = true; enable = true;
dbBackend = "postgresql"; dbBackend = "postgresql";

View file

@ -2,7 +2,8 @@
pkgs, pkgs,
config, config,
... ...
}: { }:
{
networking.nat = { networking.nat = {
enable = true; enable = true;
enableIPv6 = true; enableIPv6 = true;
@ -11,7 +12,10 @@
}; };
networking.wg-quick.interfaces.wg0 = { networking.wg-quick.interfaces.wg0 = {
address = ["10.0.0.1/24" "fdc9:281f:04d7:9ee9::1/64"]; address = [
"10.0.0.1/24"
"fdc9:281f:04d7:9ee9::1/64"
];
listenPort = 51820; listenPort = 51820;
privateKeyFile = config.sops.secrets."wireguard/private".path; privateKeyFile = config.sops.secrets."wireguard/private".path;
postUp = '' postUp = ''
@ -33,12 +37,18 @@
peers = [ peers = [
{ {
publicKey = "qUhWoTPVC7jJdDEJLYY92OeiwPkaf8I5pv5kkMcSW3g="; publicKey = "qUhWoTPVC7jJdDEJLYY92OeiwPkaf8I5pv5kkMcSW3g=";
allowedIPs = ["10.0.0.2/32" "fdc9:281f:04d7:9ee9::2/128"]; allowedIPs = [
"10.0.0.2/32"
"fdc9:281f:04d7:9ee9::2/128"
];
presharedKeyFile = config.sops.secrets."wireguard/psk-yt".path; presharedKeyFile = config.sops.secrets."wireguard/psk-yt".path;
} }
{ {
publicKey = "JIGi60wzLw717Cim1dSFoLCdJz5rePa5AIFfuisJI0k="; publicKey = "JIGi60wzLw717Cim1dSFoLCdJz5rePa5AIFfuisJI0k=";
allowedIPs = ["10.0.0.3/32" "fdc9:281f:04d7:9ee9::3/128"]; allowedIPs = [
"10.0.0.3/32"
"fdc9:281f:04d7:9ee9::3/128"
];
presharedKeyFile = config.sops.secrets."wireguard/psk-phone".path; presharedKeyFile = config.sops.secrets."wireguard/psk-phone".path;
} }
]; ];

View file

@ -1,4 +1,5 @@
{...}: { { ... }:
{
nix = { nix = {
settings = { settings = {
experimental-features = "nix-command flakes"; experimental-features = "nix-command flakes";

View file

@ -2,7 +2,8 @@
config, config,
pkgs, pkgs,
... ...
}: { }:
{
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
../common.nix ../common.nix
@ -53,7 +54,10 @@
dns = "none"; dns = "none";
wifi.backend = "iwd"; wifi.backend = "iwd";
}; };
nameservers = ["31.59.129.225" "2a0f:85c1:840:2bfb::1"]; nameservers = [
"31.59.129.225"
"2a0f:85c1:840:2bfb::1"
];
resolvconf.enable = true; resolvconf.enable = true;
firewall = { firewall = {
allowedUDPPorts = [ 51820 ]; # for wireguard allowedUDPPorts = [ 51820 ]; # for wireguard
@ -76,7 +80,10 @@
"bluez5.enable-sbc-xq" = true; "bluez5.enable-sbc-xq" = true;
"bluez5.enable-msbc" = true; "bluez5.enable-msbc" = true;
"bluez5.enable-hw-volume" = true; "bluez5.enable-hw-volume" = true;
"bluez5.roles" = ["a2dp_sink" "a2dp_source"]; "bluez5.roles" = [
"a2dp_sink"
"a2dp_source"
];
}; };
}; };
# https://wiki.archlinux.org/title/Bluetooth_headset#Connecting_works,_sound_plays_fine_until_headphones_become_idle,_then_stutters # https://wiki.archlinux.org/title/Bluetooth_headset#Connecting_works,_sound_plays_fine_until_headphones_become_idle,_then_stutters
@ -100,7 +107,11 @@
users.users.yt = { users.users.yt = {
isNormalUser = true; isNormalUser = true;
extraGroups = ["wheel" "libvirtd" "docker"]; extraGroups = [
"wheel"
"libvirtd"
"docker"
];
shell = pkgs.zsh; shell = pkgs.zsh;
}; };
programs.zsh.enable = true; programs.zsh.enable = true;
@ -168,7 +179,14 @@
programs.sway.enable = true; programs.sway.enable = true;
services.borgbackup.jobs.ytnixRsync = { services.borgbackup.jobs.ytnixRsync = {
paths = ["/root" "/home" "/var/lib" "/var/log" "/opt" "/etc"]; paths = [
"/root"
"/home"
"/var/lib"
"/var/log"
"/opt"
"/etc"
];
exclude = [ exclude = [
"**/.cache" "**/.cache"
"**/node_modules" "**/node_modules"
@ -198,7 +216,9 @@
# warnings are often not that serious # warnings are often not that serious
failOnWarnings = false; failOnWarnings = false;
postHook = '' postHook = ''
${pkgs.curl}/bin/curl -u $(cat ${config.sops.secrets."services/ntfy".path}) -d "ytnixRsync: backup completed with exit code: $exitStatus ${pkgs.curl}/bin/curl -u $(cat ${
config.sops.secrets."services/ntfy".path
}) -d "ytnixRsync: backup completed with exit code: $exitStatus
$(journalctl -u borgbackup-job-ytnixRsync.service|tail -n 5)" \ $(journalctl -u borgbackup-job-ytnixRsync.service|tail -n 5)" \
https://ntfy.cything.io/chunk https://ntfy.cything.io/chunk
''; '';
@ -286,12 +306,18 @@
# wireguard setup # wireguard setup
networking.wg-quick.interfaces.wg0 = { networking.wg-quick.interfaces.wg0 = {
address = ["10.0.0.2/24" "fdc9:281f:04d7:9ee9::2/64"]; address = [
"10.0.0.2/24"
"fdc9:281f:04d7:9ee9::2/64"
];
privateKeyFile = config.sops.secrets."wireguard/private".path; privateKeyFile = config.sops.secrets."wireguard/private".path;
peers = [ peers = [
{ {
publicKey = "a16/F/wP7HQIUtFywebqPSXQAktPsLgsMLH9ZfevMy0="; publicKey = "a16/F/wP7HQIUtFywebqPSXQAktPsLgsMLH9ZfevMy0=";
allowedIPs = ["0.0.0.0/0" "::/0"]; allowedIPs = [
"0.0.0.0/0"
"::/0"
];
endpoint = "31.59.129.225:51820"; endpoint = "31.59.129.225:51820";
persistentKeepalive = 25; persistentKeepalive = 25;
presharedKeyFile = config.sops.secrets."wireguard/psk".path; presharedKeyFile = config.sops.secrets."wireguard/psk".path;

View file

@ -7,8 +7,15 @@
pkgs, pkgs,
modulesPath, modulesPath,
... ...
}: { }:
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod"]; {
boot.initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"nvme"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
@ -16,21 +23,32 @@
fileSystems."/" = { fileSystems."/" = {
device = "/dev/disk/by-uuid/17870658-6118-46af-837f-70c9175e09c3"; device = "/dev/disk/by-uuid/17870658-6118-46af-837f-70c9175e09c3";
fsType = "btrfs"; fsType = "btrfs";
options = ["subvol=root" "compress=zstd"]; options = [
"subvol=root"
"compress=zstd"
];
}; };
boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/c6098a16-c8a6-4a97-8648-6f46ca919d13"; boot.initrd.luks.devices."cryptroot".device =
"/dev/disk/by-uuid/c6098a16-c8a6-4a97-8648-6f46ca919d13";
fileSystems."/home" = { fileSystems."/home" = {
device = "/dev/disk/by-uuid/17870658-6118-46af-837f-70c9175e09c3"; device = "/dev/disk/by-uuid/17870658-6118-46af-837f-70c9175e09c3";
fsType = "btrfs"; fsType = "btrfs";
options = ["subvol=home" "compress=zstd"]; options = [
"subvol=home"
"compress=zstd"
];
}; };
fileSystems."/nix" = { fileSystems."/nix" = {
device = "/dev/disk/by-uuid/17870658-6118-46af-837f-70c9175e09c3"; device = "/dev/disk/by-uuid/17870658-6118-46af-837f-70c9175e09c3";
fsType = "btrfs"; fsType = "btrfs";
options = ["subvol=nix" "compress=zstd" "noatime"]; options = [
"subvol=nix"
"compress=zstd"
"noatime"
];
}; };
fileSystems."/swap" = { fileSystems."/swap" = {
@ -42,7 +60,10 @@
fileSystems."/boot" = { fileSystems."/boot" = {
device = "/dev/disk/by-uuid/29B7-F46D"; device = "/dev/disk/by-uuid/29B7-F46D";
fsType = "vfat"; fsType = "vfat";
options = ["fmask=0022" "dmask=0022"]; options = [
"fmask=0022"
"dmask=0022"
];
}; };
swapDevices = [ swapDevices = [