treewide: format
All checks were successful
Check flake / build-amd64-linux (push) Successful in 2m53s

This commit is contained in:
2025-01-19 11:13:04 +00:00
parent c3283314b7
commit ccb57f954e
77 changed files with 1487 additions and 808 deletions

View File

@ -55,7 +55,8 @@
}; };
}; };
outputs = inputs @ { self, nixpkgs, ... }: outputs =
inputs@{ self, nixpkgs, ... }:
let let
inherit (nixpkgs) lib; inherit (nixpkgs) lib;
@ -70,7 +71,11 @@
profiles.system = { profiles.system = {
user = "root"; user = "root";
path = inputs.deploy-rs.lib.${self.nixosConfigurations.${hostName}.config.system.build.toplevel.system}.activate.nixos self.nixosConfigurations.${hostName}; path =
inputs.deploy-rs.lib.${
self.nixosConfigurations.${hostName}.config.system.build.toplevel.system
}.activate.nixos
self.nixosConfigurations.${hostName};
}; };
}; };
in in
@ -80,16 +85,19 @@
directory = ./overlays; directory = ./overlays;
}; };
legacyPackages = forEachSystem (system: legacyPackages = forEachSystem (
system:
lib.packagesFromDirectoryRecursive { lib.packagesFromDirectoryRecursive {
callPackage = nixpkgs.legacyPackages.${system}.callPackage; callPackage = nixpkgs.legacyPackages.${system}.callPackage;
directory = ./pkgs; directory = ./pkgs;
}); }
);
nixosConfigurations = lib.pipe ./hosts [ nixosConfigurations = lib.pipe ./hosts [
builtins.readDir builtins.readDir
(lib.filterAttrs (name: value: value == "directory")) (lib.filterAttrs (name: value: value == "directory"))
(lib.mapAttrs (name: value: (lib.mapAttrs (
name: value:
lib.nixosSystem { lib.nixosSystem {
specialArgs = { inherit self; }; specialArgs = { inherit self; };
@ -102,7 +110,8 @@
} }
./hosts/${name} ./hosts/${name}
]; ];
})) }
))
]; ];
formatter = forEachSystem (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style); formatter = forEachSystem (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style);
@ -126,7 +135,8 @@
] mkDeployNode; ] mkDeployNode;
}; };
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib; checks = builtins.mapAttrs (
system: deployLib: deployLib.deployChecks self.deploy
) inputs.deploy-rs.lib;
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, lib, pkgs, modulesPath, ... }: {
config,
lib,
pkgs,
modulesPath,
...
}:
{ {
imports = [ imports = [
@ -6,7 +12,14 @@
]; ];
boot = { boot = {
initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; initrd.availableKernelModules = [
"xhci_pci"
"ehci_pci"
"ahci"
"usbhid"
"usb_storage"
"sd_mod"
];
initrd.kernelModules = [ ]; initrd.kernelModules = [ ];
initrd.supportedFilesystems = [ "zfs" ]; initrd.supportedFilesystems = [ "zfs" ];
kernelModules = [ "kvm-intel" ]; kernelModules = [ "kvm-intel" ];

View File

@ -1,4 +1,9 @@
{ config, pkgs, self, ... }: {
config,
pkgs,
self,
...
}:
{ {
imports = [ imports = [
@ -11,11 +16,9 @@
nixpkgs.overlays = [ nixpkgs.overlays = [
self.inputs.agenix.overlays.default self.inputs.agenix.overlays.default
(import ../overlays/default.nix) (import ../overlays/default.nix)
( (final: prev: {
final: prev: { unstable = import self.inputs.nixpkgs-unstable { system = final.system; };
unstable = import self.inputs.nixpkgs-unstable { system = final.system; }; })
}
)
]; ];
time.timeZone = "Europe/London"; time.timeZone = "Europe/London";
@ -66,7 +69,10 @@
system = "aarch64-linux"; system = "aarch64-linux";
maxJobs = 6; maxJobs = 6;
speedFactor = 1; speedFactor = 1;
supportedFeatures = [ "big-parallel" "benchmark" ]; supportedFeatures = [
"big-parallel"
"benchmark"
];
} }
]; ];
distributedBuilds = true; distributedBuilds = true;

View File

@ -48,7 +48,14 @@
fonts.packages = with pkgs; [ fonts.packages = with pkgs; [
noto-fonts noto-fonts
(nerdfonts.override { fonts = [ "BigBlueTerminal" "ComicShannsMono" "Terminus" "UbuntuMono" ]; }) (nerdfonts.override {
fonts = [
"BigBlueTerminal"
"ComicShannsMono"
"Terminus"
"UbuntuMono"
];
})
]; ];
modules = { modules = {

View File

@ -1,4 +1,10 @@
{ config, lib, pkgs, modulesPath, ... }: {
config,
lib,
pkgs,
modulesPath,
...
}:
{ {
imports = [ imports = [
@ -6,7 +12,13 @@
]; ];
boot = { boot = {
initrd.availableKernelModules = [ "ehci_pci" "ahci" "usb_storage" "sd_mod" "sdhci_pci" ]; initrd.availableKernelModules = [
"ehci_pci"
"ahci"
"usb_storage"
"sd_mod"
"sdhci_pci"
];
initrd.supportedFilesystems = [ "zfs" ]; initrd.supportedFilesystems = [ "zfs" ];
kernel.sysctl = { kernel.sysctl = {
"kernel.nmi_watchdog" = 0; "kernel.nmi_watchdog" = 0;

View File

@ -1,4 +1,10 @@
{ config, lib, pkgs, modulesPath, ... }: {
config,
lib,
pkgs,
modulesPath,
...
}:
{ {
imports = [ imports = [
@ -6,7 +12,15 @@
]; ];
boot = { boot = {
initrd.availableKernelModules = [ "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sr_mod" "zfs" ]; initrd.availableKernelModules = [
"ehci_pci"
"ahci"
"usbhid"
"usb_storage"
"sd_mod"
"sr_mod"
"zfs"
];
initrd.kernelModules = [ ]; initrd.kernelModules = [ ];
initrd.supportedFilesystems = [ "zfs" ]; initrd.supportedFilesystems = [ "zfs" ];
kernelModules = [ "kvm-intel" ]; kernelModules = [ "kvm-intel" ];

View File

@ -1,4 +1,9 @@
{ config, lib, self, ... }: {
config,
lib,
self,
...
}:
{ {
imports = [ imports = [

View File

@ -123,4 +123,3 @@
}; };
}; };
} }

View File

@ -1,4 +1,10 @@
{ config, lib, pkgs, modulesPath, ... }: {
config,
lib,
pkgs,
modulesPath,
...
}:
{ {
imports = [ imports = [
@ -6,12 +12,22 @@
]; ];
boot = { boot = {
initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"usbhid"
"usb_storage"
"sd_mod"
];
kernel.sysctl = { kernel.sysctl = {
"kernel.nmi_watchdog" = 0; "kernel.nmi_watchdog" = 0;
"vm.laptop_mode" = 5; "vm.laptop_mode" = 5;
}; };
kernelModules = [ "applesmc" "kvm-intel" "wl" ]; kernelModules = [
"applesmc"
"kvm-intel"
"wl"
];
extraModulePackages = [ extraModulePackages = [
config.boot.kernelPackages.broadcom_sta config.boot.kernelPackages.broadcom_sta
config.boot.kernelPackages.nvidiaPackages.legacy_470 config.boot.kernelPackages.nvidiaPackages.legacy_470
@ -38,4 +54,3 @@
}; };
}; };
} }

View File

@ -19,7 +19,7 @@
firewall = { firewall = {
enable = true; enable = true;
allowedTCPPorts = [ allowedTCPPorts = [
22 # SSH 22 # SSH
]; ];
}; };
}; };
@ -71,12 +71,14 @@
scrapeConfigs = [ scrapeConfigs = [
{ {
job_name = "node"; job_name = "node";
static_configs = [{ static_configs = [
targets = [ {
"127.0.0.1:${toString config.services.prometheus.exporters.node.port}" targets = [
"127.0.0.1:${toString config.services.prometheus.exporters.zfs.port}" "127.0.0.1:${toString config.services.prometheus.exporters.node.port}"
]; "127.0.0.1:${toString config.services.prometheus.exporters.zfs.port}"
}]; ];
}
];
} }
]; ];
}; };
@ -90,8 +92,8 @@
]; ];
wants = [ "network-online.target" ]; wants = [ "network-online.target" ];
serviceConfig = { serviceConfig = {
Type="simple"; Type = "simple";
ExecStart=pkgs.lib.mkForce '' ExecStart = pkgs.lib.mkForce ''
${pkgs.openssh}/bin/ssh \ ${pkgs.openssh}/bin/ssh \
-NT \ -NT \
-o ExitOnForwardFailure=yes \ -o ExitOnForwardFailure=yes \
@ -101,60 +103,62 @@
-R localhost:8000:localhost:8000 \ -R localhost:8000:localhost:8000 \
jellyfin@vps1.mesh.vimium.net jellyfin@vps1.mesh.vimium.net
''; '';
Restart="always"; Restart = "always";
RestartSec=20; RestartSec = 20;
}; };
wantedBy = [ "default.target" ]; wantedBy = [ "default.target" ];
}; };
services.nginx = let services.nginx =
proxyConfig = '' let
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxyConfig = ''
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header Range $http_range; proxy_set_header Range $http_range;
proxy_set_header If-Range $http_if_range; proxy_set_header If-Range $http_if_range;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
''; '';
in { in
enable = true; {
package = pkgs.openresty; enable = true;
recommendedGzipSettings = true; package = pkgs.openresty;
recommendedOptimisation = true; recommendedGzipSettings = true;
recommendedTlsSettings = true; recommendedOptimisation = true;
clientMaxBodySize = "2G"; recommendedTlsSettings = true;
virtualHosts = { clientMaxBodySize = "2G";
"library.mesh.vimium.net" = { virtualHosts = {
locations."/" = { "library.mesh.vimium.net" = {
root = "/mnt/library"; locations."/" = {
extraConfig = '' root = "/mnt/library";
autoindex on; extraConfig = ''
''; autoindex on;
'';
};
}; };
}; "jellyfin.vimium.com" = {
"jellyfin.vimium.com" = { default = true;
default = true; listen = [
listen = [ {
{ addr = "127.0.0.1";
addr = "127.0.0.1"; port = 8000;
port = 8000; }
} ];
]; locations."/" = {
locations."/" = { proxyPass = "http://localhost:8096";
proxyPass = "http://localhost:8096"; extraConfig = proxyConfig;
extraConfig = proxyConfig; };
}; locations."/metrics" = {
locations."/metrics" = { return = "404";
return = "404"; };
}; };
}; };
}; };
};
hardware.graphics = { hardware.graphics = {
enable = true; enable = true;
@ -162,7 +166,10 @@
vaapiVdpau vaapiVdpau
]; ];
}; };
users.users.jellyfin.extraGroups = [ "video" "render" ]; users.users.jellyfin.extraGroups = [
"video"
"render"
];
services.jellyfin = { services.jellyfin = {
enable = true; enable = true;
package = pkgs.unstable.jellyfin; package = pkgs.unstable.jellyfin;
@ -192,4 +199,3 @@
system.stateVersion = "22.11"; system.stateVersion = "22.11";
} }

View File

@ -1,4 +1,10 @@
{ config, lib, pkgs, modulesPath, ... }: {
config,
lib,
pkgs,
modulesPath,
...
}:
{ {
imports = [ imports = [
@ -6,7 +12,13 @@
]; ];
boot = { boot = {
initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" ]; initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"nvme"
"usb_storage"
"sd_mod"
];
initrd.kernelModules = [ ]; initrd.kernelModules = [ ];
kernelModules = [ "kvm-amd" ]; kernelModules = [ "kvm-amd" ];
extraModulePackages = [ ]; extraModulePackages = [ ];
@ -65,4 +77,3 @@
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
} }

View File

@ -1,4 +1,9 @@
{ config, lib, self, ... }: {
config,
lib,
self,
...
}:
{ {
imports = [ imports = [
@ -15,7 +20,7 @@
firewall = { firewall = {
enable = true; enable = true;
allowedTCPPorts = [ allowedTCPPorts = [
22 # SSH 22 # SSH
]; ];
}; };
}; };

View File

@ -1,4 +1,10 @@
{ config, lib, pkgs, modulesPath, ... }: {
config,
lib,
pkgs,
modulesPath,
...
}:
{ {
imports = [ imports = [
@ -7,7 +13,12 @@
boot = { boot = {
initrd = { initrd = {
availableKernelModules = [ "ata_piix" "uhci_hcd" "xen_blkfront" "vmw_pvscsi" ]; availableKernelModules = [
"ata_piix"
"uhci_hcd"
"xen_blkfront"
"vmw_pvscsi"
];
kernelModules = [ "nvme" ]; kernelModules = [ "nvme" ];
}; };
loader.grub = { loader.grub = {
@ -19,4 +30,3 @@
zramSwap.enable = true; zramSwap.enable = true;
} }

View File

@ -26,7 +26,10 @@
networking = { networking = {
hostId = "c5e68d78"; hostId = "c5e68d78";
networkmanager.enable = true; networkmanager.enable = true;
firewall.trustedInterfaces = [ "lxdbr0" "virbr0" ]; # Work around https://github.com/NixOS/nixpkgs/issues/263359 firewall.trustedInterfaces = [
"lxdbr0"
"virbr0"
]; # Work around https://github.com/NixOS/nixpkgs/issues/263359
}; };
virtualisation = { virtualisation = {
@ -44,7 +47,8 @@
recommendedProxySettings = true; recommendedProxySettings = true;
virtualHosts = { virtualHosts = {
"odyssey.mesh.vimium.net" = { "odyssey.mesh.vimium.net" = {
locations."/".proxyPass = "http://${config.services.nix-serve.bindAddress}:${toString config.services.nix-serve.port}"; locations."/".proxyPass =
"http://${config.services.nix-serve.bindAddress}:${toString config.services.nix-serve.port}";
}; };
}; };
}; };

View File

@ -1,4 +1,10 @@
{ config, lib, pkgs, modulesPath, ... }: {
config,
lib,
pkgs,
modulesPath,
...
}:
{ {
imports = [ imports = [
@ -6,7 +12,14 @@
]; ];
boot = { boot = {
initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; initrd.availableKernelModules = [
"xhci_pci"
"ehci_pci"
"nvme"
"usbhid"
"usb_storage"
"sd_mod"
];
initrd.kernelModules = [ ]; initrd.kernelModules = [ ];
initrd.supportedFilesystems = [ "zfs" ]; initrd.supportedFilesystems = [ "zfs" ];
kernelModules = [ "kvm-intel" ]; kernelModules = [ "kvm-intel" ];

View File

@ -1,4 +1,10 @@
{ config, lib, pkgs, self, ... }: {
config,
lib,
pkgs,
self,
...
}:
{ {
imports = [ imports = [
@ -140,8 +146,8 @@
"system_health" "system_health"
]; ];
config = { config = {
default_config = {}; default_config = { };
backup = {}; backup = { };
homeassistant = { homeassistant = {
name = "Home"; name = "Home";
latitude = "!secret latitude"; latitude = "!secret latitude";
@ -163,14 +169,16 @@
services.mosquitto = { services.mosquitto = {
enable = true; enable = true;
listeners = [{ listeners = [
acl = [ "pattern readwrite #" ]; {
omitPasswordAuth = true; acl = [ "pattern readwrite #" ];
port = 1883; omitPasswordAuth = true;
settings = { port = 1883;
allow_anonymous = true; settings = {
}; allow_anonymous = true;
}]; };
}
];
}; };
age.secrets."files/services/zigbee2mqtt/secret.yaml" = { age.secrets."files/services/zigbee2mqtt/secret.yaml" = {
@ -203,7 +211,16 @@
channel = 20; channel = 20;
network_key = "!secret.yaml network_key"; network_key = "!secret.yaml network_key";
pan_id = 13001; pan_id = 13001;
ext_pan_id = [ 79 1 73 47 250 136 124 222 ]; ext_pan_id = [
79
1
73
47
250
136
124
222
];
transmit_power = 20; transmit_power = 20;
}; };
mqtt = { mqtt = {
@ -234,10 +251,12 @@
# Connection to ONKYO HT-R990 # Connection to ONKYO HT-R990
networking.interfaces.end0 = { networking.interfaces.end0 = {
ipv4.addresses = [{ ipv4.addresses = [
address = "172.16.0.1"; {
prefixLength = 30; address = "172.16.0.1";
}]; prefixLength = 30;
}
];
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
@ -248,4 +267,3 @@
system.stateVersion = "22.11"; system.stateVersion = "22.11";
} }

View File

@ -1,4 +1,9 @@
{ lib, pkgs, modulesPath, ... }: {
lib,
pkgs,
modulesPath,
...
}:
{ {
imports = [ imports = [
@ -6,42 +11,55 @@
]; ];
boot = { boot = {
kernelPackages = let kernelPackages =
version = "6.1.73"; let
tag = "stable_20240124"; version = "6.1.73";
srcHash = "sha256-P4ExzxWqZj+9FZr9U2tmh7rfs/3+iHEv0m74PCoXVuM="; tag = "stable_20240124";
in pkgs.linuxPackagesFor (pkgs.linux_rpi4.override { srcHash = "sha256-P4ExzxWqZj+9FZr9U2tmh7rfs/3+iHEv0m74PCoXVuM=";
argsOverride = { in
src = pkgs.fetchFromGitHub { pkgs.linuxPackagesFor (
owner = "raspberrypi"; pkgs.linux_rpi4.override {
repo = "linux"; argsOverride = {
rev = tag; src = pkgs.fetchFromGitHub {
hash = srcHash; owner = "raspberrypi";
repo = "linux";
rev = tag;
hash = srcHash;
};
version = version;
modDirVersion = version;
structuredExtraConfig = { };
kernelPatches = [
{
name = "drm-rp1-depends-on-instead-of-select-MFD_RP1.patch";
patch = pkgs.fetchpatch {
url = "https://github.com/peat-psuwit/rpi-linux/commit/6de0bb51929cd3ad4fa27b2a421a2af12e6468f5.patch";
hash = "sha256-9pHcbgWTiztu48SBaLPVroUnxnXMKeCGt5vEo9V8WGw=";
};
}
{
name = "iommu-bcm2712-don-t-allow-building-as-module.patch";
patch = pkgs.fetchpatch {
url = "https://github.com/peat-psuwit/rpi-linux/commit/693a5e69bddbcbe1d1b796ebc7581c3597685b1b.patch";
hash = "sha256-8BYYQDM5By8cTk48ASYKJhGVQnZBIK4PXtV70UtfS+A=";
};
}
];
}; };
version = version; }
modDirVersion = version; );
structuredExtraConfig = {};
kernelPatches = [
{
name = "drm-rp1-depends-on-instead-of-select-MFD_RP1.patch";
patch = pkgs.fetchpatch {
url = "https://github.com/peat-psuwit/rpi-linux/commit/6de0bb51929cd3ad4fa27b2a421a2af12e6468f5.patch";
hash = "sha256-9pHcbgWTiztu48SBaLPVroUnxnXMKeCGt5vEo9V8WGw=";
};
}
{
name = "iommu-bcm2712-don-t-allow-building-as-module.patch";
patch = pkgs.fetchpatch {
url = "https://github.com/peat-psuwit/rpi-linux/commit/693a5e69bddbcbe1d1b796ebc7581c3597685b1b.patch";
hash = "sha256-8BYYQDM5By8cTk48ASYKJhGVQnZBIK4PXtV70UtfS+A=";
};
}
];
};
});
# Stop ZFS kernel being built # Stop ZFS kernel being built
supportedFilesystems = lib.mkForce [ "btrfs" "cifs" "f2fs" "jfs" "ntfs" "reiserfs" "vfat" "xfs" ]; supportedFilesystems = lib.mkForce [
"btrfs"
"cifs"
"f2fs"
"jfs"
"ntfs"
"reiserfs"
"vfat"
"xfs"
];
tmp.cleanOnBoot = true; tmp.cleanOnBoot = true;
}; };
@ -49,14 +67,15 @@
# https://github.com/NixOS/nixpkgs/issues/154163 # https://github.com/NixOS/nixpkgs/issues/154163
nixpkgs.overlays = [ nixpkgs.overlays = [
(final: prev: { (final: prev: {
makeModulesClosure = x: makeModulesClosure = x: prev.makeModulesClosure (x // { allowMissing = true; });
prev.makeModulesClosure (x // { allowMissing = true; });
}) })
(final: prev: { (final: prev: {
raspberrypifw = let raspberrypifw =
version = "1.20240529"; let
srcHash = "sha256-KsCo7ZG6vKstxRyFljZtbQvnDSqiAPdUza32xTY/tlA="; version = "1.20240529";
in pkgs.raspberrypifw.override { srcHash = "sha256-KsCo7ZG6vKstxRyFljZtbQvnDSqiAPdUza32xTY/tlA=";
in
pkgs.raspberrypifw.override {
argsOverride = { argsOverride = {
src = prev.fetchFromGitHub { src = prev.fetchFromGitHub {
owner = "raspberrypi"; owner = "raspberrypi";
@ -77,4 +96,3 @@
}; };
}; };
} }

View File

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

View File

@ -1,4 +1,10 @@
{ config, lib, pkgs, self, ... }: {
config,
lib,
pkgs,
self,
...
}:
{ {
imports = [ imports = [
@ -21,27 +27,36 @@
# From https://github.com/Electrostasy/dots/blob/3b81723feece67610a252ce754912f6769f0cd34/hosts/phobos/klipper.nix#L43-L65 # From https://github.com/Electrostasy/dots/blob/3b81723feece67610a252ce754912f6769f0cd34/hosts/phobos/klipper.nix#L43-L65
overlays = overlays =
let let
mkCompatibleDtsFile = dtbo: mkCompatibleDtsFile =
dtbo:
let let
drv = pkgs.runCommand "fix-dts" { nativeBuildInputs = with pkgs; [ dtc gnused ]; } '' drv =
mkdir "$out" pkgs.runCommand "fix-dts"
dtc -I dtb -O dts ${dtbo} | sed -e 's/bcm2835/bcm2711/' > $out/overlay.dts {
''; nativeBuildInputs = with pkgs; [
dtc
gnused
];
}
''
mkdir "$out"
dtc -I dtb -O dts ${dtbo} | sed -e 's/bcm2835/bcm2711/' > $out/overlay.dts
'';
in in
"${drv}/overlay.dts"; "${drv}/overlay.dts";
inherit (config.boot.kernelPackages) kernel; inherit (config.boot.kernelPackages) kernel;
in in
[ [
{ {
name = "imx708.dtbo"; name = "imx708.dtbo";
dtsFile = mkCompatibleDtsFile "${kernel}/dtbs/overlays/imx708.dtbo"; dtsFile = mkCompatibleDtsFile "${kernel}/dtbs/overlays/imx708.dtbo";
} }
{ {
name = "vc4-kms-v3d-pi4.dtbo"; name = "vc4-kms-v3d-pi4.dtbo";
dtsFile = mkCompatibleDtsFile "${kernel}/dtbs/overlays/vc4-kms-v3d-pi4.dtbo"; dtsFile = mkCompatibleDtsFile "${kernel}/dtbs/overlays/vc4-kms-v3d-pi4.dtbo";
} }
]; ];
}; };
firmware = with pkgs; [ firmware = with pkgs; [
firmwareLinuxNonfree firmwareLinuxNonfree
@ -83,9 +98,10 @@
ConditionPathExists = "/sys/bus/i2c/drivers/imx708/10-001a/video4linux"; ConditionPathExists = "/sys/bus/i2c/drivers/imx708/10-001a/video4linux";
}; };
serviceConfig = { serviceConfig = {
ExecStart = ''${pkgs.libcamera}/bin/libcamerify ${pkgs.unstable.ustreamer}/bin/ustreamer \ ExecStart = ''
--host=0.0.0.0 \ ${pkgs.libcamera}/bin/libcamerify ${pkgs.unstable.ustreamer}/bin/ustreamer \
--resolution=4608x2592 --host=0.0.0.0 \
--resolution=4608x2592
''; '';
DynamicUser = "yes"; DynamicUser = "yes";
SupplementaryGroups = [ "video" ]; SupplementaryGroups = [ "video" ];

View File

@ -1,4 +1,9 @@
{ config, lib, modulesPath, ... }: {
config,
lib,
modulesPath,
...
}:
{ {
imports = [ imports = [
@ -11,14 +16,17 @@
"cma=512M" "cma=512M"
"panic=0" "panic=0"
]; ];
supportedFilesystems = lib.mkForce [ "f2fs" "vfat" "xfs" ]; supportedFilesystems = lib.mkForce [
"f2fs"
"vfat"
"xfs"
];
tmp.cleanOnBoot = false; tmp.cleanOnBoot = false;
}; };
nixpkgs.overlays = [ nixpkgs.overlays = [
(final: super: { (final: super: {
makeModulesClosure = x: makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; });
super.makeModulesClosure (x // { allowMissing = true; });
}) })
]; ];
@ -30,4 +38,3 @@
}; };
}; };
} }

View File

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
{ {
imports = [ imports = [
@ -13,7 +18,7 @@
firewall = { firewall = {
enable = true; enable = true;
allowedTCPPorts = [ allowedTCPPorts = [
22 # SSH 22 # SSH
]; ];
}; };
}; };
@ -37,7 +42,10 @@
groups = { groups = {
jellyfin = { }; jellyfin = { };
}; };
extraGroups.acme.members = [ "kanidm" "nginx" ]; extraGroups.acme.members = [
"kanidm"
"nginx"
];
}; };
services.openssh.settings.PermitRootLogin = lib.mkForce "prohibit-password"; services.openssh.settings.PermitRootLogin = lib.mkForce "prohibit-password";
@ -47,26 +55,28 @@
group = "acme"; group = "acme";
}; };
services.kanidm = let services.kanidm =
baseDomain = "vimium.com"; let
domain = "auth.${baseDomain}"; baseDomain = "vimium.com";
uri = "https://${domain}"; domain = "auth.${baseDomain}";
in { uri = "https://${domain}";
package = pkgs.unstable.kanidm; in
enableClient = true; {
enableServer = true; package = pkgs.unstable.kanidm;
clientSettings = { enableClient = true;
inherit uri; enableServer = true;
clientSettings = {
inherit uri;
};
serverSettings = {
bindaddress = "[::1]:3013";
ldapbindaddress = "[::1]:636";
domain = baseDomain;
origin = uri;
tls_chain = "${config.security.acme.certs.${domain}.directory}/full.pem";
tls_key = "${config.security.acme.certs.${domain}.directory}/key.pem";
};
}; };
serverSettings = {
bindaddress = "[::1]:3013";
ldapbindaddress = "[::1]:636";
domain = baseDomain;
origin = uri;
tls_chain = "${config.security.acme.certs.${domain}.directory}/full.pem";
tls_key = "${config.security.acme.certs.${domain}.directory}/key.pem";
};
};
services.nginx.virtualHosts = { services.nginx.virtualHosts = {
"auth.vimium.com" = { "auth.vimium.com" = {

View File

@ -1,4 +1,10 @@
{ config, lib, pkgs, modulesPath, ... }: {
config,
lib,
pkgs,
modulesPath,
...
}:
{ {
imports = [ imports = [
@ -7,7 +13,12 @@
boot = { boot = {
initrd = { initrd = {
availableKernelModules = [ "ata_piix" "uhci_hcd" "xen_blkfront" "vmw_pvscsi" ]; availableKernelModules = [
"ata_piix"
"uhci_hcd"
"xen_blkfront"
"vmw_pvscsi"
];
kernelModules = [ "nvme" ]; kernelModules = [ "nvme" ];
}; };
loader.grub.device = "/dev/sda"; loader.grub.device = "/dev/sda";
@ -23,4 +34,3 @@
}; };
}; };
} }

View File

@ -1,28 +1,67 @@
{ config, options, lib, self, ... }: {
config,
options,
lib,
self,
...
}:
with lib; with lib;
{ {
options = with types; { options = with types; {
user = mkOption { type = attrs; default = { }; }; user = mkOption {
type = attrs;
home = { default = { };
configFile = mkOption { type = attrs; default = { }; description = "Files to place in $XDG_CONFIG_HOME"; };
dataFile = mkOption { type = attrs; default = { }; description = "Files to place in $XDG_DATA_HOME"; };
file = mkOption { type = attrs; default = { }; description = "Files to place directly in $HOME"; };
packages = mkOption { type = attrs; default = { }; description = "User-level installed packages"; };
programs = mkOption { type = attrs; default = { }; description = "Programs managed directly from home-manager"; };
services = mkOption { type = attrs; default = { }; description = "Services managed directly from home-manager"; };
}; };
dconf.settings = mkOption { type = attrs; default = { }; description = "dconf settings to enable"; }; home = {
configFile = mkOption {
type = attrs;
default = { };
description = "Files to place in $XDG_CONFIG_HOME";
};
dataFile = mkOption {
type = attrs;
default = { };
description = "Files to place in $XDG_DATA_HOME";
};
file = mkOption {
type = attrs;
default = { };
description = "Files to place directly in $HOME";
};
packages = mkOption {
type = attrs;
default = { };
description = "User-level installed packages";
};
programs = mkOption {
type = attrs;
default = { };
description = "Programs managed directly from home-manager";
};
services = mkOption {
type = attrs;
default = { };
description = "Services managed directly from home-manager";
};
};
dconf.settings = mkOption {
type = attrs;
default = { };
description = "dconf settings to enable";
};
env = mkOption { env = mkOption {
type = attrsOf (oneOf [ str path (listOf (either str path)) ]); type = attrsOf (oneOf [
apply = mapAttrs (n: v: str
if isList v then path
concatMapStringsSep ":" (x: toString x) v (listOf (either str path))
else ]);
(toString v)); apply = mapAttrs (
n: v: if isList v then concatMapStringsSep ":" (x: toString x) v else (toString v)
);
default = { }; default = { };
description = ""; description = "";
}; };
@ -31,12 +70,27 @@ with lib;
config = { config = {
age.secrets."passwords/users/jordan".file = "${self.inputs.secrets}/passwords/users/jordan.age"; age.secrets."passwords/users/jordan".file = "${self.inputs.secrets}/passwords/users/jordan.age";
user = user =
let user = builtins.getEnv "USER"; let
name = if elem user [ "" "root" ] then "jordan" else user; user = builtins.getEnv "USER";
in { name =
if
elem user [
""
"root"
]
then
"jordan"
else
user;
in
{
inherit name; inherit name;
isNormalUser = true; isNormalUser = true;
extraGroups = [ "networkmanager" "wheel" "lxd" ]; extraGroups = [
"networkmanager"
"wheel"
"lxd"
];
description = "Jordan Holt"; description = "Jordan Holt";
useDefaultShell = true; useDefaultShell = true;
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
@ -57,12 +111,12 @@ with lib;
file = mkAliasDefinitions options.home.file; file = mkAliasDefinitions options.home.file;
stateVersion = config.system.stateVersion; stateVersion = config.system.stateVersion;
}; };
programs = mkAliasDefinitions options.home.programs; programs = mkAliasDefinitions options.home.programs;
services = mkAliasDefinitions options.home.services; services = mkAliasDefinitions options.home.services;
xdg = { xdg = {
enable = true; enable = true;
configFile = mkAliasDefinitions options.home.configFile; configFile = mkAliasDefinitions options.home.configFile;
dataFile = mkAliasDefinitions options.home.dataFile; dataFile = mkAliasDefinitions options.home.dataFile;
}; };
dconf.settings = mkAliasDefinitions options.dconf.settings; dconf.settings = mkAliasDefinitions options.dconf.settings;
}; };
@ -75,8 +129,8 @@ with lib;
users.users.${config.user.name} = mkAliasDefinitions options.user; users.users.${config.user.name} = mkAliasDefinitions options.user;
environment.extraInit = environment.extraInit = concatStringsSep "\n" (
concatStringsSep "\n" mapAttrsToList (n: v: "export ${n}=\"${v}\"") config.env
(mapAttrsToList (n: v: "export ${n}=\"${v}\"") config.env); );
}; };
} }

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.programs.brave; let
in { cfg = config.modules.programs.brave;
in
{
options.modules.programs.brave = { options.modules.programs.brave = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.programs.dev.cc; let
in { cfg = config.modules.programs.dev.cc;
in
{
options.modules.programs.dev.cc = { options.modules.programs.dev.cc = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.programs.dev.java; let
in { cfg = config.modules.programs.dev.java;
in
{
options.modules.programs.dev.java = { options.modules.programs.dev.java = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.programs.dev.lua; let
in { cfg = config.modules.programs.dev.lua;
in
{
options.modules.programs.dev.lua = { options.modules.programs.dev.lua = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.programs.dev.node; let
in { cfg = config.modules.programs.dev.node;
in
{
options.modules.programs.dev.node = { options.modules.programs.dev.node = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.programs.dev.python; let
in { cfg = config.modules.programs.dev.python;
in
{
options.modules.programs.dev.python = { options.modules.programs.dev.python = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.programs.dev.rust; let
in { cfg = config.modules.programs.dev.rust;
in
{
options.modules.programs.dev.rust = { options.modules.programs.dev.rust = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.programs.dev.scala; let
in { cfg = config.modules.programs.dev.scala;
in
{
options.modules.programs.dev.scala = { options.modules.programs.dev.scala = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.programs.dev.shell; let
in { cfg = config.modules.programs.dev.shell;
in
{
options.modules.programs.dev.shell = { options.modules.programs.dev.shell = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.programs.dev.zig; let
in { cfg = config.modules.programs.dev.zig;
in
{
options.modules.programs.dev.zig = { options.modules.programs.dev.zig = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,17 +1,24 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.programs.emulators; let
in { cfg = config.modules.programs.emulators;
in
{
options.modules.programs.emulators = { options.modules.programs.emulators = {
ds.enable = lib.mkOption { ds.enable = lib.mkOption {
default = false; default = false;
example = true; example = true;
}; };
gb.enable = lib.mkOption { gb.enable = lib.mkOption {
default = false; default = false;
example = true; example = true;
}; };
gba.enable = lib.mkOption { gba.enable = lib.mkOption {
default = false; default = false;
example = true; example = true;
}; };
@ -19,35 +26,35 @@ in {
default = false; default = false;
example = true; example = true;
}; };
ps1.enable = lib.mkOption { ps1.enable = lib.mkOption {
default = false; default = false;
example = true; example = true;
}; };
ps2.enable = lib.mkOption { ps2.enable = lib.mkOption {
default = false; default = false;
example = true; example = true;
}; };
ps3.enable = lib.mkOption { ps3.enable = lib.mkOption {
default = false; default = false;
example = true; example = true;
}; };
psp.enable = lib.mkOption { psp.enable = lib.mkOption {
default = false; default = false;
example = true; example = true;
}; };
snes.enable = lib.mkOption { snes.enable = lib.mkOption {
default = false; default = false;
example = true; example = true;
}; };
switch.enable = lib.mkOption { switch.enable = lib.mkOption {
default = false; default = false;
example = true; example = true;
}; };
wii.enable = lib.mkOption { wii.enable = lib.mkOption {
default = false; default = false;
example = true; example = true;
}; };
xbox.enable = lib.mkOption { xbox.enable = lib.mkOption {
default = false; default = false;
example = true; example = true;
}; };
@ -60,14 +67,9 @@ in {
(lib.mkIf cfg.ps3.enable rpcs3) (lib.mkIf cfg.ps3.enable rpcs3)
(lib.mkIf cfg.psp.enable unstable.ppsspp) (lib.mkIf cfg.psp.enable unstable.ppsspp)
(lib.mkIf cfg.ds.enable desmume) (lib.mkIf cfg.ds.enable desmume)
(lib.mkIf (cfg.gba.enable || (lib.mkIf (cfg.gba.enable || cfg.gb.enable || cfg.snes.enable) higan)
cfg.gb.enable ||
cfg.snes.enable)
higan)
(lib.mkIf cfg.switch.enable yuzuPackages.mainline) (lib.mkIf cfg.switch.enable yuzuPackages.mainline)
(lib.mkIf (cfg.wii.enable || (lib.mkIf (cfg.wii.enable || cfg.gamecube.enable) dolphin-emu)
cfg.gamecube.enable)
dolphin-emu)
(lib.mkIf cfg.xbox.enable unstable.xemu) (lib.mkIf cfg.xbox.enable unstable.xemu)
]; ];
}; };

View File

@ -1,7 +1,14 @@
{ config, lib, self, ... }: {
config,
lib,
self,
...
}:
let cfg = config.modules.programs.firefox; let
in { cfg = config.modules.programs.firefox;
in
{
options.modules.programs.firefox = { options.modules.programs.firefox = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;
@ -10,7 +17,8 @@ in {
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.file.".mozilla/firefox/Default/chrome/firefox-gnome-theme".source = self.inputs.firefox-gnome-theme; home.file.".mozilla/firefox/Default/chrome/firefox-gnome-theme".source =
self.inputs.firefox-gnome-theme;
home.programs.firefox = { home.programs.firefox = {
enable = true; enable = true;

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.programs.forensics; let
in { cfg = config.modules.programs.forensics;
in
{
options.modules.programs.forensics = { options.modules.programs.forensics = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.programs.git; let
in { cfg = config.modules.programs.git;
in
{
options.modules.programs.git = { options.modules.programs.git = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.programs.gpg; let
in { cfg = config.modules.programs.gpg;
in
{
options.modules.programs.gpg = { options.modules.programs.gpg = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,17 +1,24 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.programs.graphics; let
in { cfg = config.modules.programs.graphics;
in
{
options.modules.programs.graphics = { options.modules.programs.graphics = {
modeling.enable = lib.mkOption { modeling.enable = lib.mkOption {
default = false; default = false;
example = true; example = true;
}; };
raster.enable = lib.mkOption { raster.enable = lib.mkOption {
default = false; default = false;
example = true; example = true;
}; };
vector.enable = lib.mkOption { vector.enable = lib.mkOption {
default = false; default = false;
example = true; example = true;
}; };

View File

@ -1,25 +1,31 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let let
cfg = config.modules.programs.libreoffice; cfg = config.modules.programs.libreoffice;
# libreoffice-gtk4 = pkgs.libreoffice.override { in
# extraMakeWrapperArgs = [ # libreoffice-gtk4 = pkgs.libreoffice.override {
# "--set SAL_USE_VCLPLUGIN gtk4" # extraMakeWrapperArgs = [
# ]; # "--set SAL_USE_VCLPLUGIN gtk4"
# unwrapped = pkgs.libreoffice-unwrapped.overrideAttrs (oldAttrs: { # ];
# buildInputs = oldAttrs.buildInputs ++ [ # unwrapped = pkgs.libreoffice-unwrapped.overrideAttrs (oldAttrs: {
# pkgs.gtk4 # buildInputs = oldAttrs.buildInputs ++ [
# ]; # pkgs.gtk4
# configureFlags = oldAttrs.configureFlags ++ [ # ];
# "--disable-werror" # configureFlags = oldAttrs.configureFlags ++ [
# "--enable-gtk4" # "--disable-werror"
# ]; # "--enable-gtk4"
# passthru = oldAttrs.passthru // { # ];
# inherit (pkgs) gtk4; # passthru = oldAttrs.passthru // {
# }; # inherit (pkgs) gtk4;
# }); # };
# }; # });
in { # };
{
options.modules.programs.libreoffice = { options.modules.programs.libreoffice = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.programs.lutris; let
in { cfg = config.modules.programs.lutris;
in
{
options.modules.programs.lutris = { options.modules.programs.lutris = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,8 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let let
cfg = config.modules.programs.neovim; cfg = config.modules.programs.neovim;
in { in
{
options.modules.programs.neovim = { options.modules.programs.neovim = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.programs.pass; let
in { cfg = config.modules.programs.pass;
in
{
options.modules.programs.pass = { options.modules.programs.pass = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.programs.qbittorrent; let
in { cfg = config.modules.programs.qbittorrent;
in
{
options.modules.programs.qbittorrent = { options.modules.programs.qbittorrent = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.programs.recording; let
in { cfg = config.modules.programs.recording;
in
{
options.modules.programs.recording = { options.modules.programs.recording = {
audio.enable = lib.mkOption { audio.enable = lib.mkOption {
default = false; default = false;
@ -14,15 +21,26 @@ in {
}; };
config = { config = {
user.packages = with pkgs; user.packages =
(if cfg.audio.enable then [ with pkgs;
ardour (
audacity if cfg.audio.enable then
] else []) ++ [
(if cfg.video.enable then [ ardour
handbrake audacity
mkvtoolnix ]
obs-studio else
] else []); [ ]
)
++ (
if cfg.video.enable then
[
handbrake
mkvtoolnix
obs-studio
]
else
[ ]
);
}; };
} }

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.programs.slack; let
in { cfg = config.modules.programs.slack;
in
{
options.modules.programs.slack = { options.modules.programs.slack = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.programs.steam; let
in { cfg = config.modules.programs.steam;
in
{
options.modules.programs.steam = { options.modules.programs.steam = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,16 +1,24 @@
{ config, lib, self, ... }: {
config,
lib,
self,
...
}:
let cfg = config.modules.programs.thunderbird; let
in { cfg = config.modules.programs.thunderbird;
in
{
options.modules.programs.thunderbird = { options.modules.programs.thunderbird = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;
example = true; example = true;
}; };
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.file.".thunderbird/Default/chrome/thunderbird-gnome-theme".source = self.inputs.thunderbird-gnome-theme; home.file.".thunderbird/Default/chrome/thunderbird-gnome-theme".source =
self.inputs.thunderbird-gnome-theme;
home.programs.thunderbird = { home.programs.thunderbird = {
enable = true; enable = true;

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.programs.vscode; let
in { cfg = config.modules.programs.vscode;
in
{
options.modules.programs.vscode = { options.modules.programs.vscode = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.programs.zoom; let
in { cfg = config.modules.programs.zoom;
in
{
options.modules.programs.zoom = { options.modules.programs.zoom = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.shell.zsh; let
in { cfg = config.modules.shell.zsh;
in
{
options.modules.shell.zsh = { options.modules.shell.zsh = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;
@ -30,9 +37,9 @@ in {
]; ];
env = { env = {
ZDOTDIR = "$XDG_CONFIG_HOME/zsh"; ZDOTDIR = "$XDG_CONFIG_HOME/zsh";
ZSH_CACHE = "$XDG_CACHE_HOME/zsh"; ZSH_CACHE = "$XDG_CACHE_HOME/zsh";
ZGEN_DIR = "$XDG_DATA_HOME/zgenom"; ZGEN_DIR = "$XDG_DATA_HOME/zgenom";
}; };
home.configFile = { home.configFile = {

View File

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let let
cfg = config.modules.hardware.presonus-studio; cfg = config.modules.hardware.presonus-studio;
snd-usb-audio-module = pkgs.callPackage ./snd-usb-audio.nix { snd-usb-audio-module = pkgs.callPackage ./snd-usb-audio.nix {
@ -13,7 +18,8 @@ let
"channelmix.upmix-method" = "psd"; "channelmix.upmix-method" = "psd";
}; };
}; };
in { in
{
options.modules.hardware.presonus-studio = { options.modules.hardware.presonus-studio = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;
@ -67,11 +73,23 @@ in {
"capture.props" = { "capture.props" = {
"node.name" = "Genelec_Speakers"; "node.name" = "Genelec_Speakers";
"media.class" = "Audio/Sink"; "media.class" = "Audio/Sink";
"audio.position" = [ "FL" "FR" "SL" "SR" "LFE" ]; "audio.position" = [
"FL"
"FR"
"SL"
"SR"
"LFE"
];
}; };
"playback.props" = { "playback.props" = {
"node.name" = "playback.Genelec_Speakers"; "node.name" = "playback.Genelec_Speakers";
"audio.position" = [ "AUX0" "AUX1" "AUX3" "AUX4" "AUX5" ]; "audio.position" = [
"AUX0"
"AUX1"
"AUX3"
"AUX4"
"AUX5"
];
"target.object" = "alsa_output.usb-PreSonus_Studio_1824c_SC4E21110775-00.multichannel-output"; "target.object" = "alsa_output.usb-PreSonus_Studio_1824c_SC4E21110775-00.multichannel-output";
"stream.dont-remix" = true; "stream.dont-remix" = true;
"node.passive" = true; "node.passive" = true;
@ -85,4 +103,4 @@ in {
client-rt."40-upmix" = upmixConfig; client-rt."40-upmix" = upmixConfig;
}; };
}; };
} }

View File

@ -1,8 +1,17 @@
{ pkgs, lib, kernel ? pkgs.linuxPackages_latest.kernel }: {
pkgs,
lib,
kernel ? pkgs.linuxPackages_latest.kernel,
}:
pkgs.stdenv.mkDerivation { pkgs.stdenv.mkDerivation {
pname = "snd-usb-audio"; pname = "snd-usb-audio";
inherit (kernel) src version postPatch nativeBuildInputs; inherit (kernel)
src
version
postPatch
nativeBuildInputs
;
kernel_dev = kernel.dev; kernel_dev = kernel.dev;
kernelVersion = kernel.modDirVersion; kernelVersion = kernel.modDirVersion;
@ -33,4 +42,3 @@ pkgs.stdenv.mkDerivation {
license = lib.licenses.gpl2; license = lib.licenses.gpl2;
}; };
} }

View File

@ -1,10 +1,16 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
with lib; with lib;
let let
cfg = config.modules.podman; cfg = config.modules.podman;
in { in
{
options.modules.podman = { options.modules.podman = {
enable = mkOption { enable = mkOption {
default = false; default = false;

View File

@ -1,9 +1,15 @@
{ config, lib, self, ... }: {
config,
lib,
self,
...
}:
let let
cfg = config.modules.services.borgmatic; cfg = config.modules.services.borgmatic;
hostname = config.networking.hostName; hostname = config.networking.hostName;
in { in
{
options.modules.services.borgmatic = { options.modules.services.borgmatic = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;
@ -12,7 +18,7 @@ in {
}; };
directories = lib.mkOption { directories = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;
default = []; default = [ ];
example = [ example = [
"/home/jordan/Documents" "/home/jordan/Documents"
]; ];
@ -35,9 +41,14 @@ in {
settings = { settings = {
source_directories = cfg.directories; source_directories = cfg.directories;
repositories = [ repositories = [
{ label = "borgbase"; path = cfg.repoPath; } {
label = "borgbase";
path = cfg.repoPath;
}
]; ];
encryption_passcommand = "cat ${config.age.secrets."passwords/services/borg/${hostname}-passphrase".path}"; encryption_passcommand = "cat ${
config.age.secrets."passwords/services/borg/${hostname}-passphrase".path
}";
ssh_command = "ssh -i /etc/ssh/ssh_host_ed25519_key"; ssh_command = "ssh -i /etc/ssh/ssh_host_ed25519_key";
keep_daily = 7; keep_daily = 7;
keep_weekly = 4; keep_weekly = 4;

View File

@ -1,10 +1,16 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
with lib; with lib;
let let
cfg = config.modules.services.chrony; cfg = config.modules.services.chrony;
in { in
{
options.modules.services.chrony = { options.modules.services.chrony = {
enable = mkOption { enable = mkOption {
default = false; default = false;

View File

@ -1,8 +1,14 @@
{ config, lib, self, ... }: {
config,
lib,
self,
...
}:
let let
cfg = config.modules.services.coturn; cfg = config.modules.services.coturn;
in { in
{
options.modules.services.coturn = { options.modules.services.coturn = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;
@ -21,24 +27,28 @@ in {
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
networking.firewall = let networking.firewall =
range = with config.services.coturn; lib.singleton { let
from = min-port; range =
to = max-port; with config.services.coturn;
lib.singleton {
from = min-port;
to = max-port;
};
in
{
allowedTCPPorts = [
3478 # TURN listener
5349 # STUN TLS
5350 # STUN TLS alt
];
allowedUDPPorts = [
3478 # TURN listener
5349 # TLS
5350 # TLS alt
];
allowedUDPPortRanges = range; # TURN peer relays
}; };
in {
allowedTCPPorts = [
3478 # TURN listener
5349 # STUN TLS
5350 # STUN TLS alt
];
allowedUDPPorts = [
3478 # TURN listener
5349 # TLS
5350 # TLS alt
];
allowedUDPPortRanges = range; # TURN peer relays
};
security.acme.certs = { security.acme.certs = {
"${config.services.coturn.realm}" = { "${config.services.coturn.realm}" = {
@ -47,19 +57,26 @@ in {
}; };
}; };
age.secrets = { age.secrets =
"passwords/services/coturn/static-auth-secret" = { {
file = "${self.inputs.secrets}/passwords/services/coturn/static-auth-secret.age"; "passwords/services/coturn/static-auth-secret" = {
owner = "turnserver"; file = "${self.inputs.secrets}/passwords/services/coturn/static-auth-secret.age";
group = "turnserver"; owner = "turnserver";
}; group = "turnserver";
} // (if cfg.matrixIntegration then { };
"passwords/services/coturn/matrix-turn-config.yml" = { }
file = "${self.inputs.secrets}/passwords/services/coturn/matrix-turn-config.yml.age"; // (
owner = "matrix-synapse"; if cfg.matrixIntegration then
group = "matrix-synapse"; {
}; "passwords/services/coturn/matrix-turn-config.yml" = {
} else {}); file = "${self.inputs.secrets}/passwords/services/coturn/matrix-turn-config.yml.age";
owner = "matrix-synapse";
group = "matrix-synapse";
};
}
else
{ }
);
services.coturn = rec { services.coturn = rec {
enable = true; enable = true;

View File

@ -1,4 +1,10 @@
{ pkgs, config, lib, self, ... }: {
pkgs,
config,
lib,
self,
...
}:
# Based on: https://git.clan.lol/clan/clan-infra/src/branch/main/modules/web01/gitea/actions-runner.nix # Based on: https://git.clan.lol/clan/clan-infra/src/branch/main/modules/web01/gitea/actions-runner.nix
@ -52,7 +58,12 @@ in
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
after = [ "podman.service" ]; after = [ "podman.service" ];
requires = [ "podman.service" ]; requires = [ "podman.service" ];
path = [ config.virtualisation.podman.package pkgs.gnutar pkgs.shadow pkgs.getent ]; path = [
config.virtualisation.podman.package
pkgs.gnutar
pkgs.shadow
pkgs.getent
];
script = '' script = ''
set -eux -o pipefail set -eux -o pipefail
mkdir -p etc/nix mkdir -p etc/nix
@ -142,7 +153,12 @@ in
"~setdomainname" "~setdomainname"
"~sethostname" "~sethostname"
]; ];
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" "AF_UNIX" "AF_NETLINK" ]; RestrictAddressFamilies = [
"AF_INET"
"AF_INET6"
"AF_UNIX"
"AF_NETLINK"
];
# Needs network access # Needs network access
PrivateNetwork = false; PrivateNetwork = false;

View File

@ -1,8 +1,15 @@
{ config, lib, pkgs, self, ... }: {
config,
lib,
pkgs,
self,
...
}:
let let
cfg = config.modules.services.gitea; cfg = config.modules.services.gitea;
in { in
{
options.modules.services.gitea = { options.modules.services.gitea = {
enable = lib.mkEnableOption "gitea"; enable = lib.mkEnableOption "gitea";
domain = lib.mkOption { domain = lib.mkOption {
@ -16,7 +23,7 @@ in {
users.git = { users.git = {
isSystemUser = true; isSystemUser = true;
useDefaultShell = true; useDefaultShell = true;
group = "git"; group = "git";
extraGroups = [ "gitea" ]; extraGroups = [ "gitea" ];
home = config.services.gitea.stateDir; home = config.services.gitea.stateDir;
}; };

View File

@ -1,9 +1,15 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let let
cfg = config.modules.services.headscale; cfg = config.modules.services.headscale;
fqdn = "headscale.vimium.net"; fqdn = "headscale.vimium.net";
in { in
{
options.modules.services.headscale = { options.modules.services.headscale = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,4 +1,9 @@
{ config, lib, self, ... }: {
config,
lib,
self,
...
}:
let let
cfg = config.modules.services.mail; cfg = config.modules.services.mail;
@ -14,7 +19,8 @@ let
"vimium.org" "vimium.org"
"vimium.xyz" "vimium.xyz"
]; ];
in { in
{
options.modules.services.mail = { options.modules.services.mail = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;
@ -40,7 +46,10 @@ in {
services.nginx.enable = true; services.nginx.enable = true;
networking.firewall.allowedTCPPorts = [ 80 443 ]; networking.firewall.allowedTCPPorts = [
80
443
];
mailserver = { mailserver = {
enable = true; enable = true;

View File

@ -1,8 +1,15 @@
{ config, lib, pkgs, self, ... }: {
config,
lib,
pkgs,
self,
...
}:
let let
cfg = config.modules.services.matrix; cfg = config.modules.services.matrix;
in { in
{
options.modules.services.matrix = { options.modules.services.matrix = {
enable = lib.mkEnableOption "matrix"; enable = lib.mkEnableOption "matrix";
element = { element = {
@ -31,198 +38,212 @@ in {
usePostgresql = lib.mkEnableOption "postgresql"; usePostgresql = lib.mkEnableOption "postgresql";
}; };
config = let config =
matrixSubdomain = "matrix.${cfg.serverName}"; let
elementSubdomain = "chat.${cfg.serverName}"; matrixSubdomain = "matrix.${cfg.serverName}";
matrixClientConfig = { elementSubdomain = "chat.${cfg.serverName}";
"m.homeserver" = { matrixClientConfig = {
base_url = "https://${matrixSubdomain}"; "m.homeserver" = {
server_name = cfg.serverName; base_url = "https://${matrixSubdomain}";
}; server_name = cfg.serverName;
"m.identity_server" = { };
"base_url" = "https://vector.im"; "m.identity_server" = {
}; "base_url" = "https://vector.im";
};
matrixServerConfig."m.server" = "${matrixSubdomain}:443";
commonBridgeSettings = bridge: {
appservice = {
database = lib.mkIf cfg.usePostgresql {
type = "postgres";
uri = "postgresql:///${bridge}?host=/run/postgresql";
}; };
}; };
bridge = { matrixServerConfig."m.server" = "${matrixSubdomain}:443";
encryption = { commonBridgeSettings = bridge: {
allow = true; appservice = {
default = true; database = lib.mkIf cfg.usePostgresql {
require = true; type = "postgres";
}; uri = "postgresql:///${bridge}?host=/run/postgresql";
permissions = {
"${cfg.serverName}" = "user";
"@jordan:${cfg.serverName}" = "admin";
};
provisioning = {
shared_secret = "disable";
};
};
homeserver = {
address = "https://${matrixSubdomain}";
domain = cfg.serverName;
};
};
in lib.mkIf cfg.enable {
networking.firewall.allowedTCPPorts = [
8448 # Matrix federation
];
security.acme.certs = {
"${matrixSubdomain}" = {
reloadServices = [ "matrix-synapse" ];
};
};
services.nginx.virtualHosts = {
"${matrixSubdomain}" = {
forceSSL = true;
enableACME = true;
listen = [
{
addr = "0.0.0.0";
port = 443;
ssl = true;
}
{
addr = "0.0.0.0";
port = 80;
}
{
addr = "0.0.0.0";
port = 8448;
ssl = true;
}
{
addr = "[::1]";
port = 443;
ssl = true;
}
{
addr = "[::1]";
port = 80;
}
{
addr = "[::1]";
port = 8448;
ssl = true;
}
];
locations = {
"/" = {
proxyPass = "http://localhost:8008";
extraConfig = ''
proxy_set_header X-Forwarded-For $remote_addr;
'';
}; };
"/_matrix" = { };
proxyPass = "http://localhost:8008"; bridge = {
extraConfig = '' encryption = {
proxy_set_header X-Forwarded-For $remote_addr; allow = true;
client_max_body_size 50M; default = true;
''; require = true;
}; };
"/_synapse/client".proxyPass = "http://localhost:8008"; permissions = {
"${cfg.serverName}" = "user";
"@jordan:${cfg.serverName}" = "admin";
};
provisioning = {
shared_secret = "disable";
};
};
homeserver = {
address = "https://${matrixSubdomain}";
domain = cfg.serverName;
}; };
}; };
"${cfg.serverName}" = let in
mkWellKnown = data: '' lib.mkIf cfg.enable {
more_set_headers 'Content-Type: application/json'; networking.firewall.allowedTCPPorts = [
return 200 '${builtins.toJSON data}'; 8448 # Matrix federation
''; ];
in {
locations."= /.well-known/matrix/server".extraConfig = (mkWellKnown matrixServerConfig); security.acme.certs = {
locations."= /.well-known/matrix/client".extraConfig = (mkWellKnown matrixClientConfig); "${matrixSubdomain}" = {
reloadServices = [ "matrix-synapse" ];
};
}; };
} // (if cfg.element.enable then {
"${elementSubdomain}" = { services.nginx.virtualHosts =
forceSSL = true; {
enableACME = true; "${matrixSubdomain}" = {
root = pkgs.unstable.element-web.override { forceSSL = true;
conf = { enableACME = true;
default_server_config = matrixClientConfig; listen = [
brand = "Vimium Chat"; {
branding = { addr = "0.0.0.0";
auth_header_logo_url = "https://vimium.com/images/logo.svg"; port = 443;
auth_footer_links = [ ssl = true;
{ "text" = "Vimium.com"; "url" = "https://vimium.com"; } }
]; {
addr = "0.0.0.0";
port = 80;
}
{
addr = "0.0.0.0";
port = 8448;
ssl = true;
}
{
addr = "[::1]";
port = 443;
ssl = true;
}
{
addr = "[::1]";
port = 80;
}
{
addr = "[::1]";
port = 8448;
ssl = true;
}
];
locations = {
"/" = {
proxyPass = "http://localhost:8008";
extraConfig = ''
proxy_set_header X-Forwarded-For $remote_addr;
'';
};
"/_matrix" = {
proxyPass = "http://localhost:8008";
extraConfig = ''
proxy_set_header X-Forwarded-For $remote_addr;
client_max_body_size 50M;
'';
};
"/_synapse/client".proxyPass = "http://localhost:8008";
}; };
}; };
}; "${cfg.serverName}" =
}; let
} else {}); mkWellKnown = data: ''
more_set_headers 'Content-Type: application/json';
nixpkgs.config.permittedInsecurePackages = [ return 200 '${builtins.toJSON data}';
"jitsi-meet-1.0.8043" '';
"olm-3.2.16" in
]; {
locations."= /.well-known/matrix/server".extraConfig = (mkWellKnown matrixServerConfig);
services.matrix-synapse = { locations."= /.well-known/matrix/client".extraConfig = (mkWellKnown matrixClientConfig);
enable = true; };
enableRegistrationScript = true;
settings = {
database.name = (if cfg.usePostgresql then "psycopg2" else "sqlite3");
enable_metrics = false;
enable_registration = false;
max_upload_size = "100M";
report_stats = false;
server_name = cfg.serverName;
};
};
systemd.services.matrix-synapse.serviceConfig.SupplementaryGroups =
(lib.optional cfg.bridges.whatsapp
config.systemd.services.mautrix-whatsapp.serviceConfig.Group);
services.postgresql = lib.mkIf cfg.usePostgresql {
ensureUsers = [
{
name = "matrix-synapse";
ensureDBOwnership = true;
} }
] ++ (lib.optional cfg.bridges.signal // (
{ if cfg.element.enable then
name = "mautrix-signal"; {
ensureDBOwnership = true; "${elementSubdomain}" = {
}) forceSSL = true;
++ (lib.optional cfg.bridges.whatsapp enableACME = true;
{ root = pkgs.unstable.element-web.override {
name = "mautrix-whatsapp"; conf = {
ensureDBOwnership = true; default_server_config = matrixClientConfig;
}); brand = "Vimium Chat";
ensureDatabases = [ branding = {
"matrix-synapse" auth_header_logo_url = "https://vimium.com/images/logo.svg";
] ++ (lib.optional cfg.bridges.signal auth_footer_links = [
"mautrix-signal") {
++ (lib.optional cfg.bridges.whatsapp "text" = "Vimium.com";
"mautrix-whatsapp"); "url" = "https://vimium.com";
}; }
];
};
};
};
};
}
else
{ }
);
services.mautrix-signal = lib.mkIf cfg.bridges.signal { nixpkgs.config.permittedInsecurePackages = [
enable = true; "jitsi-meet-1.0.8043"
settings = commonBridgeSettings "mautrix-signal"; "olm-3.2.16"
}; ];
services.mautrix-whatsapp = lib.mkIf cfg.bridges.whatsapp { services.matrix-synapse = {
enable = true; enable = true;
settings = { enableRegistrationScript = true;
bridge = { settings = {
history_sync = { database.name = (if cfg.usePostgresql then "psycopg2" else "sqlite3");
backfill = true; enable_metrics = false;
max_initial_conversations = -1; enable_registration = false;
message_count = 50; max_upload_size = "100M";
request_full_sync = true; report_stats = false;
}; server_name = cfg.serverName;
mute_bridging = true;
}; };
} // commonBridgeSettings "mautrix-whatsapp"; };
systemd.services.matrix-synapse.serviceConfig.SupplementaryGroups = (
lib.optional cfg.bridges.whatsapp config.systemd.services.mautrix-whatsapp.serviceConfig.Group
);
services.postgresql = lib.mkIf cfg.usePostgresql {
ensureUsers =
[
{
name = "matrix-synapse";
ensureDBOwnership = true;
}
]
++ (lib.optional cfg.bridges.signal {
name = "mautrix-signal";
ensureDBOwnership = true;
})
++ (lib.optional cfg.bridges.whatsapp {
name = "mautrix-whatsapp";
ensureDBOwnership = true;
});
ensureDatabases =
[
"matrix-synapse"
]
++ (lib.optional cfg.bridges.signal "mautrix-signal")
++ (lib.optional cfg.bridges.whatsapp "mautrix-whatsapp");
};
services.mautrix-signal = lib.mkIf cfg.bridges.signal {
enable = true;
settings = commonBridgeSettings "mautrix-signal";
};
services.mautrix-whatsapp = lib.mkIf cfg.bridges.whatsapp {
enable = true;
settings = {
bridge = {
history_sync = {
backfill = true;
max_initial_conversations = -1;
message_count = 50;
request_full_sync = true;
};
mute_bridging = true;
};
} // commonBridgeSettings "mautrix-whatsapp";
};
}; };
};
} }

View File

@ -1,9 +1,15 @@
{ config, lib, self, ... }: {
config,
lib,
self,
...
}:
let let
cfg = config.modules.services.netbird; cfg = config.modules.services.netbird;
hostname = config.networking.hostName; hostname = config.networking.hostName;
in { in
{
options.modules.services.netbird = { options.modules.services.netbird = {
enable = lib.mkEnableOption "netbird"; enable = lib.mkEnableOption "netbird";
coordinatorDomain = lib.mkOption { coordinatorDomain = lib.mkOption {
@ -43,7 +49,9 @@ in {
HttpConfig = { HttpConfig = {
AuthAudience = "netbird"; AuthAudience = "netbird";
}; };
StoreConfig = { Engine = "sqlite"; }; StoreConfig = {
Engine = "sqlite";
};
TURNConfig = { TURNConfig = {
Secret._secret = config.age.secrets."passwords/services/coturn/static-auth-secret".path; Secret._secret = config.age.secrets."passwords/services/coturn/static-auth-secret".path;
TimeBasedCredentials = true; TimeBasedCredentials = true;

View File

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
with lib; with lib;
@ -34,7 +39,8 @@ let
extraConfig = nginxErrorPages + nginxEdgeHeaders + nginxStrictHeaders; extraConfig = nginxErrorPages + nginxEdgeHeaders + nginxStrictHeaders;
}; };
}; };
in { in
{
options.modules.services.nginx = { options.modules.services.nginx = {
enable = mkOption { enable = mkOption {
default = false; default = false;
@ -44,8 +50,8 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [
80 # HTTP 80 # HTTP
443 # HTTPS 443 # HTTPS
]; ];
services.nginx = { services.nginx = {
@ -89,94 +95,99 @@ in {
maxSize = "100m"; maxSize = "100m";
}; };
}; };
virtualHosts = { virtualHosts =
## Static sites {
"jellyfin.vimium.com" = { ## Static sites
forceSSL = true; "jellyfin.vimium.com" = {
enableACME = true; forceSSL = true;
extraConfig = nginxErrorPages + nginxEdgeHeaders; enableACME = true;
locations."/" = { extraConfig = nginxErrorPages + nginxEdgeHeaders;
proxyPass = "http://localhost:8000"; locations."/" = {
proxyPass = "http://localhost:8000";
extraConfig = ''
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header Range $http_range;
proxy_set_header If-Range $http_if_range;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
'';
};
};
"jdholt.com" = {
forceSSL = true;
enableACME = true;
serverAliases = [ "www.jdholt.com" ];
extraConfig = nginxErrorPages + nginxEdgeHeaders + nginxStrictHeaders;
locations."/skycam/snapshot.jpg" = {
extraConfig = ''
set $backend "skycam.mesh.vimium.net:8080";
resolver 100.100.100.100;
proxy_pass http://$backend/snapshot;
proxy_cache skycam_cache;
proxy_cache_valid any 10s;
proxy_ignore_headers Cache-Control Expires Set-Cookie;
'';
};
locations."/".return = "301 https://vimium.com$request_uri";
};
"pki.vimium.com" = {
addSSL = true;
forceSSL = false;
enableACME = true;
extraConfig = '' extraConfig = ''
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; ${nginxErrorPages}
proxy_set_header X-Forwarded-Proto $scheme; more_set_headers 'Server: Vimium';
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header Range $http_range;
proxy_set_header If-Range $http_if_range;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
''; '';
locations."/" = {
root = "/var/www/pki.vimium.com";
};
}; };
}; "suhailhussain.com" = {
"jdholt.com" = { forceSSL = true;
forceSSL = true; enableACME = true;
enableACME = true; serverAliases = [ "www.suhailhussain.com" ];
serverAliases = [ "www.jdholt.com" ]; extraConfig = nginxErrorPages + nginxEdgeHeaders + nginxStrictHeaders;
extraConfig = nginxErrorPages + nginxEdgeHeaders + nginxStrictHeaders; locations."/" = {
locations."/skycam/snapshot.jpg" = { root = "/var/www/suhailhussain.com";
extraConfig = '' };
set $backend "skycam.mesh.vimium.net:8080";
resolver 100.100.100.100;
proxy_pass http://$backend/snapshot;
proxy_cache skycam_cache;
proxy_cache_valid any 10s;
proxy_ignore_headers Cache-Control Expires Set-Cookie;
'';
}; };
locations."/".return = "301 https://vimium.com$request_uri"; "vimium.com" = {
}; default = true;
"pki.vimium.com" = { forceSSL = true;
addSSL = true; enableACME = true;
forceSSL = false; serverAliases = [ "www.vimium.com" ];
enableACME = true; extraConfig =
extraConfig = '' nginxErrorPages
${nginxErrorPages} + nginxEdgeHeaders
more_set_headers 'Server: Vimium'; + nginxStrictHeaders
''; + ''
locations."/" = { add_header Content-Security-Policy "default-src 'self' https://vimium.com https://www.vimium.com; style-src 'unsafe-inline'; object-src 'none'; upgrade-insecure-requests" always;
root = "/var/www/pki.vimium.com"; '';
locations."/" = {
root = "/var/www/vimium.com";
};
}; };
}; }
"suhailhussain.com" = { ## Redirects
forceSSL = true; // (mkRedirect "h0lt.com" "jdholt.com")
enableACME = true; // (mkRedirect "jordanholt.xyz" "jdholt.com")
serverAliases = [ "www.suhailhussain.com" ]; // (mkRedirect "omnimagic.com" "vimium.com")
extraConfig = nginxErrorPages + nginxEdgeHeaders + nginxStrictHeaders; // (mkRedirect "omnimagic.net" "vimium.com")
locations."/" = { // (mkRedirect "thelostlegend.com" "suhailhussain.com")
root = "/var/www/suhailhussain.com"; // (mkRedirect "vimium.co" "vimium.com")
}; // (mkRedirect "vimium.co.uk" "vimium.com")
}; // (mkRedirect "vimium.info" "vimium.com")
"vimium.com" = { // (mkRedirect "vimium.net" "vimium.com")
default = true; // (mkRedirect "vimium.org" "vimium.com")
forceSSL = true; // (mkRedirect "vimium.xyz" "vimium.com");
enableACME = true;
serverAliases = [ "www.vimium.com" ];
extraConfig = nginxErrorPages + nginxEdgeHeaders + nginxStrictHeaders + ''
add_header Content-Security-Policy "default-src 'self' https://vimium.com https://www.vimium.com; style-src 'unsafe-inline'; object-src 'none'; upgrade-insecure-requests" always;
'';
locations."/" = {
root = "/var/www/vimium.com";
};
};
}
## Redirects
// (mkRedirect "h0lt.com" "jdholt.com")
// (mkRedirect "jordanholt.xyz" "jdholt.com")
// (mkRedirect "omnimagic.com" "vimium.com")
// (mkRedirect "omnimagic.net" "vimium.com")
// (mkRedirect "thelostlegend.com" "suhailhussain.com")
// (mkRedirect "vimium.co" "vimium.com")
// (mkRedirect "vimium.co.uk" "vimium.com")
// (mkRedirect "vimium.info" "vimium.com")
// (mkRedirect "vimium.net" "vimium.com")
// (mkRedirect "vimium.org" "vimium.com")
// (mkRedirect "vimium.xyz" "vimium.com");
}; };
}; };
} }

View File

@ -1,9 +1,17 @@
{ config, lib, pkgs, self, ... }: {
config,
lib,
pkgs,
self,
...
}:
with lib; with lib;
let cfg = config.modules.services.photoprism; let
in { cfg = config.modules.services.photoprism;
in
{
options.modules.services.photoprism = { options.modules.services.photoprism = {
enable = mkOption { enable = mkOption {
default = false; default = false;

View File

@ -6,7 +6,8 @@
let let
cfg = config.modules.services.postgresql; cfg = config.modules.services.postgresql;
in { in
{
options.modules.services.postgresql = { options.modules.services.postgresql = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,10 +1,17 @@
{ config, lib, pkgs, self, ... }: {
config,
lib,
pkgs,
self,
...
}:
let let
cfg = config.modules.services.tailscale; cfg = config.modules.services.tailscale;
headscale = "https://headscale.vimium.net"; headscale = "https://headscale.vimium.net";
hostname = config.networking.hostName; hostname = config.networking.hostName;
in { in
{
options.modules.services.tailscale = { options.modules.services.tailscale = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,7 +1,15 @@
{ config, lib, pkgs, self, ... }: {
config,
lib,
pkgs,
self,
...
}:
let cfg = config.modules.system.desktop.gnome; let
in { cfg = config.modules.system.desktop.gnome;
in
{
options.modules.system.desktop.gnome = { options.modules.system.desktop.gnome = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;
@ -208,39 +216,47 @@ in {
}; };
home.configFile = { home.configFile = {
"Kvantum/kvantum.kvconfig".text = lib.generators.toINI {} { "Kvantum/kvantum.kvconfig".text = lib.generators.toINI { } {
General.theme = "KvLibadwaitaDark"; General.theme = "KvLibadwaitaDark";
}; };
"Kvantum/KvLibadwaita".source = "${self.inputs.kvlibadwaita}/src/KvLibadwaita"; "Kvantum/KvLibadwaita".source = "${self.inputs.kvlibadwaita}/src/KvLibadwaita";
}; };
user.packages = with pkgs; [ user.packages =
authenticator with pkgs;
# bottles [
# bustle authenticator
celluloid # bottles
# d-spy # bustle
# drawing celluloid
# fragments # d-spy
dconf-editor # drawing
ghex # fragments
# gnome-builder dconf-editor
gnome-decoder ghex
gnome-firmware # gnome-builder
gnome-frog gnome-decoder
# gnome-obfuscate gnome-firmware
gnome-podcasts gnome-frog
identity # gnome-obfuscate
# mission-center gnome-podcasts
mousam identity
newsflash # mission-center
ptyxis mousam
# schemes newsflash
shortwave ptyxis
sysprof # schemes
] ++ (if config.virtualisation.podman.enable then [ shortwave
pods sysprof
] else []); ]
++ (
if config.virtualisation.podman.enable then
[
pods
]
else
[ ]
);
environment.systemPackages = with pkgs.unstable; [ environment.systemPackages = with pkgs.unstable; [
adw-gtk3 adw-gtk3

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.system.desktop.hyprland; let
in { cfg = config.modules.system.desktop.hyprland;
in
{
options.modules.system.desktop.hyprland = { options.modules.system.desktop.hyprland = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let cfg = config.modules.system.desktop.kde; let
in { cfg = config.modules.system.desktop.kde;
in
{
options.modules.system.desktop.kde = { options.modules.system.desktop.kde = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,10 +1,16 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let let
cfg = config.modules.system.desktop.mimeapps; cfg = config.modules.system.desktop.mimeapps;
avApp = "io.github.celluloid_player.Celluloid.desktop"; avApp = "io.github.celluloid_player.Celluloid.desktop";
imageApp = "org.gnome.eog.desktop"; imageApp = "org.gnome.eog.desktop";
in { in
{
options.modules.system.desktop.mimeapps = { options.modules.system.desktop.mimeapps = {
enable = lib.mkOption { enable = lib.mkOption {
default = false; default = false;

View File

@ -1,9 +1,17 @@
{ config, lib, pkgs, self, ... }: {
config,
lib,
pkgs,
self,
...
}:
with lib; with lib;
let cfg = config.modules.system.wireless; let
in { cfg = config.modules.system.wireless;
in
{
options.modules.system.wireless = { options.modules.system.wireless = {
enable = mkOption { enable = mkOption {
default = false; default = false;
@ -11,7 +19,7 @@ in {
description = mdDoc "Automatically connect to known networks"; description = mdDoc "Automatically connect to known networks";
}; };
interfaces = mkOption { interfaces = mkOption {
default = [ ]; # All interfaces default = [ ]; # All interfaces
example = [ "wlan0" ]; example = [ "wlan0" ];
description = mdDoc "Interfaces for `wpa_supplicant` to bind to"; description = mdDoc "Interfaces for `wpa_supplicant` to bind to";
}; };

View File

@ -15,21 +15,22 @@ let
directory = ../pkgs; directory = ../pkgs;
}; };
in in
lib.mapAttrs lib.mapAttrs (
(name: value: name: value:
if lib.isAttrs value then if lib.isAttrs value then
if lib.hasAttrByPath [ name "overrideScope" ] prev then if lib.hasAttrByPath [ name "overrideScope" ] prev then
# Namespaced package sets created with `lib.makeScope pkgs.newScope`. # Namespaced package sets created with `lib.makeScope pkgs.newScope`.
prev.${name}.overrideScope (final': prev': prev.${name}.overrideScope (
lib.mapAttrs (name': value': final'.callPackage value' { }) value) final': prev': lib.mapAttrs (name': value': final'.callPackage value' { }) value
else if lib.hasAttrByPath [ name "extend" ] prev then )
# Namespaced package sets created with `lib.makeExtensible`. else if lib.hasAttrByPath [ name "extend" ] prev then
prev.${name}.extend (final': prev': # Namespaced package sets created with `lib.makeExtensible`.
lib.mapAttrs (name': value': final.callPackage value' { }) value) prev.${name}.extend (
else final': prev': lib.mapAttrs (name': value': final.callPackage value' { }) value
# Namespaced package sets in regular attrsets. )
prev.${name} // value else
else # Namespaced package sets in regular attrsets.
final.callPackage value { }) prev.${name} // value
pkgs else
final.callPackage value { }
) pkgs

View File

@ -1,5 +1,4 @@
final: prev: final: prev: {
{
gvdb = prev.fetchgit { gvdb = prev.fetchgit {
url = "https://gitlab.gnome.org/GNOME/gvdb.git"; url = "https://gitlab.gnome.org/GNOME/gvdb.git";
rev = "b54bc5da25127ef416858a3ad92e57159ff565b3"; # From gvdb_wrap rev = "b54bc5da25127ef416858a3ad92e57159ff565b3"; # From gvdb_wrap

View File

@ -1,5 +1,4 @@
final: prev: final: prev: {
{
libpisp = final.stdenv.mkDerivation { libpisp = final.stdenv.mkDerivation {
name = "libpisp"; name = "libpisp";
version = "1.0.5"; version = "1.0.5";
@ -42,10 +41,12 @@ final: prev:
./0001-Ignore-IPA-signing.patch ./0001-Ignore-IPA-signing.patch
]; ];
buildInputs = old.buildInputs ++ (with final; [ buildInputs =
libpisp old.buildInputs
libglibutil ++ (with final; [
]); libpisp
libglibutil
]);
mesonFlags = old.mesonFlags ++ [ mesonFlags = old.mesonFlags ++ [
"--buildtype=release" "--buildtype=release"

View File

@ -1,23 +1,24 @@
{ stdenv {
, fetchFromGitHub stdenv,
fetchFromGitHub,
, cmake cmake,
, gnumake gnumake,
, pkg-config pkg-config,
, xxd xxd,
, v4l-utils v4l-utils,
, nlohmann_json nlohmann_json,
, ffmpegSupport ? true ffmpegSupport ? true,
, ffmpeg ffmpeg,
, libcameraSupport ? true libcameraSupport ? true,
, libcamera libcamera,
, rtspSupport ? false rtspSupport ? false,
, live555 live555,
, webrtcSupport ? false webrtcSupport ? false,
, openssl openssl,
, lib lib,
}: }:
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
@ -60,7 +61,11 @@ stdenv.mkDerivation (finalAttrs: {
dontUseCmakeConfigure = true; dontUseCmakeConfigure = true;
buildInputs = [ nlohmann_json v4l-utils ] buildInputs =
[
nlohmann_json
v4l-utils
]
++ (lib.optional ffmpegSupport ffmpeg) ++ (lib.optional ffmpegSupport ffmpeg)
++ (lib.optional libcameraSupport libcamera) ++ (lib.optional libcameraSupport libcamera)
++ (lib.optional rtspSupport live555) ++ (lib.optional rtspSupport live555)
@ -75,4 +80,3 @@ stdenv.mkDerivation (finalAttrs: {
license = licenses.gpl3Only; license = licenses.gpl3Only;
}; };
}) })

View File

@ -1,17 +1,18 @@
{ stdenv {
, fetchFromGitHub stdenv,
, meson fetchFromGitHub,
, ninja meson,
, pkg-config ninja,
, boost pkg-config,
, ffmpeg boost,
, libcamera ffmpeg,
, libdrm libcamera,
, libexif libdrm,
, libjpeg libexif,
, libpng libjpeg,
, libtiff libpng,
, lib libtiff,
lib,
}: }:
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
@ -55,4 +56,3 @@ stdenv.mkDerivation (finalAttrs: {
license = licenses.bsd2; license = licenses.bsd2;
}; };
}) })