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

This commit is contained in:
Jordan Holt 2025-01-19 11:13:04 +00:00
parent c3283314b7
commit ccb57f954e
Signed by: jordan
GPG Key ID: B8CFFF61F1CCF520
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

@ -71,12 +71,14 @@
scrapeConfigs = [ scrapeConfigs = [
{ {
job_name = "node"; job_name = "node";
static_configs = [{ static_configs = [
{
targets = [ targets = [
"127.0.0.1:${toString config.services.prometheus.exporters.node.port}" "127.0.0.1:${toString config.services.prometheus.exporters.node.port}"
"127.0.0.1:${toString config.services.prometheus.exporters.zfs.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,13 +103,14 @@
-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 =
let
proxyConfig = '' proxyConfig = ''
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
@ -121,7 +124,8 @@
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; enable = true;
package = pkgs.openresty; package = pkgs.openresty;
recommendedGzipSettings = true; recommendedGzipSettings = 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 = [

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 #" ]; acl = [ "pattern readwrite #" ];
omitPasswordAuth = true; omitPasswordAuth = true;
port = 1883; port = 1883;
settings = { settings = {
allow_anonymous = true; 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"; address = "172.16.0.1";
prefixLength = 30; 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,11 +11,14 @@
]; ];
boot = { boot = {
kernelPackages = let kernelPackages =
let
version = "6.1.73"; version = "6.1.73";
tag = "stable_20240124"; tag = "stable_20240124";
srcHash = "sha256-P4ExzxWqZj+9FZr9U2tmh7rfs/3+iHEv0m74PCoXVuM="; srcHash = "sha256-P4ExzxWqZj+9FZr9U2tmh7rfs/3+iHEv0m74PCoXVuM=";
in pkgs.linuxPackagesFor (pkgs.linux_rpi4.override { in
pkgs.linuxPackagesFor (
pkgs.linux_rpi4.override {
argsOverride = { argsOverride = {
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "raspberrypi"; owner = "raspberrypi";
@ -20,7 +28,7 @@
}; };
version = version; version = version;
modDirVersion = version; modDirVersion = version;
structuredExtraConfig = {}; structuredExtraConfig = { };
kernelPatches = [ kernelPatches = [
{ {
name = "drm-rp1-depends-on-instead-of-select-MFD_RP1.patch"; name = "drm-rp1-depends-on-instead-of-select-MFD_RP1.patch";
@ -38,10 +46,20 @@
} }
]; ];
}; };
}); }
);
# 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 =
let
version = "1.20240529"; version = "1.20240529";
srcHash = "sha256-KsCo7ZG6vKstxRyFljZtbQvnDSqiAPdUza32xTY/tlA="; srcHash = "sha256-KsCo7ZG6vKstxRyFljZtbQvnDSqiAPdUza32xTY/tlA=";
in pkgs.raspberrypifw.override { 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,9 +27,18 @@
# 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 =
pkgs.runCommand "fix-dts"
{
nativeBuildInputs = with pkgs; [
dtc
gnused
];
}
''
mkdir "$out" mkdir "$out"
dtc -I dtb -O dts ${dtbo} | sed -e 's/bcm2835/bcm2711/' > $out/overlay.dts dtc -I dtb -O dts ${dtbo} | sed -e 's/bcm2835/bcm2711/' > $out/overlay.dts
''; '';
@ -83,7 +98,8 @@
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 = ''
${pkgs.libcamera}/bin/libcamerify ${pkgs.unstable.ustreamer}/bin/ustreamer \
--host=0.0.0.0 \ --host=0.0.0.0 \
--resolution=4608x2592 --resolution=4608x2592
''; '';

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 = [
@ -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,11 +55,13 @@
group = "acme"; group = "acme";
}; };
services.kanidm = let services.kanidm =
let
baseDomain = "vimium.com"; baseDomain = "vimium.com";
domain = "auth.${baseDomain}"; domain = "auth.${baseDomain}";
uri = "https://${domain}"; uri = "https://${domain}";
in { in
{
package = pkgs.unstable.kanidm; package = pkgs.unstable.kanidm;
enableClient = true; enableClient = true;
enableServer = true; enableServer = true;

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 = [
@ -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,7 +1,14 @@
{ 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;
@ -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,7 +1,14 @@
{ 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;

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;
(
if cfg.audio.enable then
[
ardour ardour
audacity audacity
] else []) ++ ]
(if cfg.video.enable then [ else
[ ]
)
++ (
if cfg.video.enable then
[
handbrake handbrake
mkvtoolnix mkvtoolnix
obs-studio obs-studio
] else []); ]
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,7 +1,14 @@
{ 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;
@ -10,7 +17,8 @@ in {
}; };
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;

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,12 +27,16 @@ in {
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
networking.firewall = let networking.firewall =
range = with config.services.coturn; lib.singleton { let
range =
with config.services.coturn;
lib.singleton {
from = min-port; from = min-port;
to = max-port; to = max-port;
}; };
in { in
{
allowedTCPPorts = [ allowedTCPPorts = [
3478 # TURN listener 3478 # TURN listener
5349 # STUN TLS 5349 # STUN TLS
@ -47,19 +57,26 @@ in {
}; };
}; };
age.secrets = { age.secrets =
{
"passwords/services/coturn/static-auth-secret" = { "passwords/services/coturn/static-auth-secret" = {
file = "${self.inputs.secrets}/passwords/services/coturn/static-auth-secret.age"; file = "${self.inputs.secrets}/passwords/services/coturn/static-auth-secret.age";
owner = "turnserver"; owner = "turnserver";
group = "turnserver"; group = "turnserver";
}; };
} // (if cfg.matrixIntegration then { }
// (
if cfg.matrixIntegration then
{
"passwords/services/coturn/matrix-turn-config.yml" = { "passwords/services/coturn/matrix-turn-config.yml" = {
file = "${self.inputs.secrets}/passwords/services/coturn/matrix-turn-config.yml.age"; file = "${self.inputs.secrets}/passwords/services/coturn/matrix-turn-config.yml.age";
owner = "matrix-synapse"; owner = "matrix-synapse";
group = "matrix-synapse"; group = "matrix-synapse";
}; };
} else {}); }
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 {

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,7 +38,8 @@ in {
usePostgresql = lib.mkEnableOption "postgresql"; usePostgresql = lib.mkEnableOption "postgresql";
}; };
config = let config =
let
matrixSubdomain = "matrix.${cfg.serverName}"; matrixSubdomain = "matrix.${cfg.serverName}";
elementSubdomain = "chat.${cfg.serverName}"; elementSubdomain = "chat.${cfg.serverName}";
matrixClientConfig = { matrixClientConfig = {
@ -70,7 +78,8 @@ in {
domain = cfg.serverName; domain = cfg.serverName;
}; };
}; };
in lib.mkIf cfg.enable { in
lib.mkIf cfg.enable {
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [
8448 # Matrix federation 8448 # Matrix federation
]; ];
@ -81,7 +90,8 @@ in {
}; };
}; };
services.nginx.virtualHosts = { services.nginx.virtualHosts =
{
"${matrixSubdomain}" = { "${matrixSubdomain}" = {
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;
@ -132,16 +142,21 @@ in {
"/_synapse/client".proxyPass = "http://localhost:8008"; "/_synapse/client".proxyPass = "http://localhost:8008";
}; };
}; };
"${cfg.serverName}" = let "${cfg.serverName}" =
let
mkWellKnown = data: '' mkWellKnown = data: ''
more_set_headers 'Content-Type: application/json'; more_set_headers 'Content-Type: application/json';
return 200 '${builtins.toJSON data}'; return 200 '${builtins.toJSON data}';
''; '';
in { in
{
locations."= /.well-known/matrix/server".extraConfig = (mkWellKnown matrixServerConfig); locations."= /.well-known/matrix/server".extraConfig = (mkWellKnown matrixServerConfig);
locations."= /.well-known/matrix/client".extraConfig = (mkWellKnown matrixClientConfig); locations."= /.well-known/matrix/client".extraConfig = (mkWellKnown matrixClientConfig);
}; };
} // (if cfg.element.enable then { }
// (
if cfg.element.enable then
{
"${elementSubdomain}" = { "${elementSubdomain}" = {
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;
@ -152,13 +167,19 @@ in {
branding = { branding = {
auth_header_logo_url = "https://vimium.com/images/logo.svg"; auth_header_logo_url = "https://vimium.com/images/logo.svg";
auth_footer_links = [ auth_footer_links = [
{ "text" = "Vimium.com"; "url" = "https://vimium.com"; } {
"text" = "Vimium.com";
"url" = "https://vimium.com";
}
]; ];
}; };
}; };
}; };
}; };
} else {}); }
else
{ }
);
nixpkgs.config.permittedInsecurePackages = [ nixpkgs.config.permittedInsecurePackages = [
"jitsi-meet-1.0.8043" "jitsi-meet-1.0.8043"
@ -177,32 +198,32 @@ in {
server_name = cfg.serverName; server_name = cfg.serverName;
}; };
}; };
systemd.services.matrix-synapse.serviceConfig.SupplementaryGroups = systemd.services.matrix-synapse.serviceConfig.SupplementaryGroups = (
(lib.optional cfg.bridges.whatsapp lib.optional cfg.bridges.whatsapp config.systemd.services.mautrix-whatsapp.serviceConfig.Group
config.systemd.services.mautrix-whatsapp.serviceConfig.Group); );
services.postgresql = lib.mkIf cfg.usePostgresql { services.postgresql = lib.mkIf cfg.usePostgresql {
ensureUsers = [ ensureUsers =
[
{ {
name = "matrix-synapse"; name = "matrix-synapse";
ensureDBOwnership = true; ensureDBOwnership = true;
} }
] ++ (lib.optional cfg.bridges.signal ]
{ ++ (lib.optional cfg.bridges.signal {
name = "mautrix-signal"; name = "mautrix-signal";
ensureDBOwnership = true; ensureDBOwnership = true;
}) })
++ (lib.optional cfg.bridges.whatsapp ++ (lib.optional cfg.bridges.whatsapp {
{
name = "mautrix-whatsapp"; name = "mautrix-whatsapp";
ensureDBOwnership = true; ensureDBOwnership = true;
}); });
ensureDatabases = [ ensureDatabases =
[
"matrix-synapse" "matrix-synapse"
] ++ (lib.optional cfg.bridges.signal ]
"mautrix-signal") ++ (lib.optional cfg.bridges.signal "mautrix-signal")
++ (lib.optional cfg.bridges.whatsapp ++ (lib.optional cfg.bridges.whatsapp "mautrix-whatsapp");
"mautrix-whatsapp");
}; };
services.mautrix-signal = lib.mkIf cfg.bridges.signal { services.mautrix-signal = lib.mkIf cfg.bridges.signal {

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;
@ -89,7 +95,8 @@ in {
maxSize = "100m"; maxSize = "100m";
}; };
}; };
virtualHosts = { virtualHosts =
{
## Static sites ## Static sites
"jellyfin.vimium.com" = { "jellyfin.vimium.com" = {
forceSSL = true; forceSSL = true;
@ -157,7 +164,11 @@ in {
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;
serverAliases = [ "www.vimium.com" ]; serverAliases = [ "www.vimium.com" ];
extraConfig = nginxErrorPages + nginxEdgeHeaders + nginxStrictHeaders + '' 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; 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."/" = { locations."/" = {

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,13 +216,15 @@ 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 =
with pkgs;
[
authenticator authenticator
# bottles # bottles
# bustle # bustle
@ -238,9 +248,15 @@ in {
# schemes # schemes
shortwave shortwave
sysprof sysprof
] ++ (if config.virtualisation.podman.enable then [ ]
++ (
if config.virtualisation.podman.enable then
[
pods pods
] else []); ]
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;

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 else if lib.hasAttrByPath [ name "extend" ] prev then
# Namespaced package sets created with `lib.makeExtensible`. # Namespaced package sets created with `lib.makeExtensible`.
prev.${name}.extend (final': prev': prev.${name}.extend (
lib.mapAttrs (name': value': final.callPackage value' { }) value) final': prev': lib.mapAttrs (name': value': final.callPackage value' { }) value
)
else else
# Namespaced package sets in regular attrsets. # Namespaced package sets in regular attrsets.
prev.${name} // value prev.${name} // value
else else
final.callPackage value { }) final.callPackage value { }
pkgs ) 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,7 +41,9 @@ final: prev:
./0001-Ignore-IPA-signing.patch ./0001-Ignore-IPA-signing.patch
]; ];
buildInputs = old.buildInputs ++ (with final; [ buildInputs =
old.buildInputs
++ (with final; [
libpisp libpisp
libglibutil libglibutil
]); ]);

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;
}; };
}) })