summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKleidi Bujari <mail@4kb.net>2026-10-03 19:56:13 -0700
committerKleidi Bujari <mail@4kb.net>2026-10-03 20:59:26 -0700
commit0d15a4d19f7925be328c2d24214a11e5ac541c40 (patch)
treeff75c552989cec4651f941126628a3702f6c6bcf
parent16918d62b34b7e4d7817837057b88acb44e4f63c (diff)
downloaddepot-0d15a4d19f7925be328c2d24214a11e5ac541c40.tar.gz
depot-0d15a4d19f7925be328c2d24214a11e5ac541c40.tar.bz2
depot-0d15a4d19f7925be328c2d24214a11e5ac541c40.zip
nixfmt formatting pass
-rw-r--r--lib/depot-tools.nix68
-rw-r--r--machines/feneri.nix5
-rw-r--r--machines/iso.nix5
-rw-r--r--machines/natest.nix92
-rw-r--r--machines/radon/default.nix8
-rw-r--r--machines/radon/pxeboot.nix52
-rw-r--r--modules/xnet/disk.nix34
-rw-r--r--modules/xnet/gitserver/default.nix7
-rw-r--r--modules/xnet/gitserver/gitweb.nix7
-rw-r--r--modules/xnet/monitoring/default.nix37
-rw-r--r--modules/xnet/monitoring/grafana.nix33
-rw-r--r--modules/xnet/nginx.nix5
-rw-r--r--modules/xnet/persist.nix59
-rw-r--r--packages/randpass.nix3
14 files changed, 255 insertions, 160 deletions
diff --git a/lib/depot-tools.nix b/lib/depot-tools.nix
index 7c2fc6b..8e5a16e 100644
--- a/lib/depot-tools.nix
+++ b/lib/depot-tools.nix
@@ -1,7 +1,8 @@
-{ inputs
-, systems
-, nixpkgs ? inputs.nixpkgs
-, ...
+{
+ inputs,
+ systems,
+ nixpkgs ? inputs.nixpkgs,
+ ...
}:
let
@@ -27,30 +28,25 @@ let
# Get paths to directories
onlyDirs = filterAttrs (_name: type: type == "directory") entries;
- dirPaths = mapAttrs
- (name: type: {
- path = path + "/${name}";
- inherit type;
- })
- onlyDirs;
+ dirPaths = mapAttrs (name: type: {
+ path = path + "/${name}";
+ inherit type;
+ }) onlyDirs;
# Get paths to nix files, where the name is the basename of the file without the .nix extension
- nixPaths = removeAttrs
- (mapAttrs'
- (
- name: type:
- let
- nixName = match "(.*)\\.nix" name;
- in
- {
- name = if type == "directory" || nixName == null then "__junk" else (head nixName);
- value = {
- path = path + "/${name}";
- type = type;
- };
- }
- )
- entries) [ "__junk" ];
+ nixPaths = removeAttrs (mapAttrs' (
+ name: type:
+ let
+ nixName = match "(.*)\\.nix" name;
+ in
+ {
+ name = if type == "directory" || nixName == null then "__junk" else (head nixName);
+ value = {
+ path = path + "/${name}";
+ type = type;
+ };
+ }
+ ) entries) [ "__junk" ];
combined = dirPaths // nixPaths;
in
@@ -61,9 +57,9 @@ let
system:
let
# Resolve the packages for each input.
- perSystem = mapAttrs
- (_: flake: flake.legacyPackages.${system} or { } // flake.packages.${system} or { })
- inputs;
+ perSystem = mapAttrs (
+ _: flake: flake.legacyPackages.${system} or { } // flake.packages.${system} or { }
+ ) inputs;
# Handle nixpkgs specially.
pkgs =
@@ -78,7 +74,17 @@ let
flake = inputs.self;
in
- makeScope callPackageWith (_: { inherit inputs perSystem flake pkgs system; })
+ makeScope callPackageWith (_: {
+ inherit
+ inputs
+ perSystem
+ flake
+ pkgs
+ system
+ ;
+ })
);
in
-{ inherit importDir systemArgs; }
+{
+ inherit importDir systemArgs;
+}
diff --git a/machines/feneri.nix b/machines/feneri.nix
index a638642..e75738b 100644
--- a/machines/feneri.nix
+++ b/machines/feneri.nix
@@ -35,7 +35,10 @@
certs."4kb.net" = {
dnsProvider = "porkbun";
environmentFile = "/var/secrets/porkbun";
- extraDomainNames = [ "*.4kb.net" "*.web.4kb.net" ];
+ extraDomainNames = [
+ "*.4kb.net"
+ "*.web.4kb.net"
+ ];
group = "nginx";
reloadServices = [ "nginx.service" ];
};
diff --git a/machines/iso.nix b/machines/iso.nix
index d3ca992..5550841 100644
--- a/machines/iso.nix
+++ b/machines/iso.nix
@@ -6,7 +6,10 @@
nixpkgs.hostPlatform.system = "x86_64-linux";
nix.settings = {
- experimental-features = [ "nix-command" "flakes" ];
+ experimental-features = [
+ "nix-command"
+ "flakes"
+ ];
};
environment.systemPackages = with pkgs; [
diff --git a/machines/natest.nix b/machines/natest.nix
index fa8f1d5..c4937d6 100644
--- a/machines/natest.nix
+++ b/machines/natest.nix
@@ -1,4 +1,10 @@
-{ config, modulesPath, pkgs, lib, ... }:
+{
+ config,
+ modulesPath,
+ pkgs,
+ lib,
+ ...
+}:
{
imports = [
@@ -19,7 +25,11 @@
fileSystems = {
"/" = {
fsType = "tmpfs";
- options = [ "defaults" "mode=755" "size=2G" ];
+ options = [
+ "defaults"
+ "mode=755"
+ "size=2G"
+ ];
};
"/boot" = {
device = "/dev/disk/by-partlabel/boot";
@@ -43,54 +53,52 @@
let
inherit (pkgs.stdenv.hostPlatform) efiArch;
in
- {
- name = "image";
- partitions.esp = {
- repartConfig = {
- Format = "vfat";
- Label = "boot";
- SizeMinBytes = "256M";
- Type = "esp";
- };
- contents = {
- "/EFI/BOOT/BOOT${lib.toUpper efiArch}.EFI".source =
- "${pkgs.systemd}/lib/systemd/boot/efi/systemd-boot${efiArch}.efi";
+ {
+ name = "image";
+ partitions.esp = {
+ repartConfig = {
+ Format = "vfat";
+ Label = "boot";
+ SizeMinBytes = "256M";
+ Type = "esp";
+ };
+ contents = {
+ "/EFI/BOOT/BOOT${lib.toUpper efiArch}.EFI".source =
+ "${pkgs.systemd}/lib/systemd/boot/efi/systemd-boot${efiArch}.efi";
- # "/EFI/Linux/${config.system.boot.loader.ukiFile}".source =
- # "${config.system.build.uki}/${config.system.boot.loader.ukiFile}";
+ # "/EFI/Linux/${config.system.boot.loader.ukiFile}".source =
+ # "${config.system.build.uki}/${config.system.boot.loader.ukiFile}";
- "/EFI/nixos/${config.system.boot.loader.kernelFile}.efi".source =
- "${config.system.build.kernel}/${config.system.boot.loader.kernelFile}";
+ "/EFI/nixos/${config.system.boot.loader.kernelFile}.efi".source =
+ "${config.system.build.kernel}/${config.system.boot.loader.kernelFile}";
- "/EFI/nixos/${config.system.boot.loader.initrdFile}.efi".source =
- "${config.system.build.initialRamdisk}/${config.system.boot.loader.initrdFile}";
+ "/EFI/nixos/${config.system.boot.loader.initrdFile}.efi".source =
+ "${config.system.build.initialRamdisk}/${config.system.boot.loader.initrdFile}";
- "/loader/entries/nixos.conf".source =
- pkgs.writeText "default-entry.conf" ''
- title Coolio
- linux /EFI/nixos/${config.system.boot.loader.kernelFile}.efi
- initrd /EFI/nixos/${config.system.boot.loader.initrdFile}.efi
- options init=${config.system.build.toplevel}/init root=fstab loglevel=4
- '';
+ "/loader/entries/nixos.conf".source = pkgs.writeText "default-entry.conf" ''
+ title Coolio
+ linux /EFI/nixos/${config.system.boot.loader.kernelFile}.efi
+ initrd /EFI/nixos/${config.system.boot.loader.initrdFile}.efi
+ options init=${config.system.build.toplevel}/init root=fstab loglevel=4
+ '';
- "/loader/loader.conf".source =
- pkgs.writeText "loader.conf" ''
- timeout 5
- console-mode keep
- '';
- };
+ "/loader/loader.conf".source = pkgs.writeText "loader.conf" ''
+ timeout 5
+ console-mode keep
+ '';
};
- partitions.nix-store = {
- storePaths = [ config.system.build.toplevel ];
- nixStorePrefix = "/";
- repartConfig = {
- Format = "ext4";
- Label = "nix-store";
- SizeMinBytes = "4G";
- Type = "linux-generic";
- };
+ };
+ partitions.nix-store = {
+ storePaths = [ config.system.build.toplevel ];
+ nixStorePrefix = "/";
+ repartConfig = {
+ Format = "ext4";
+ Label = "nix-store";
+ SizeMinBytes = "4G";
+ Type = "linux-generic";
};
};
+ };
boot.loader.systemd-boot = {
enable = true;
diff --git a/machines/radon/default.nix b/machines/radon/default.nix
index c77db03..f3e4ff0 100644
--- a/machines/radon/default.nix
+++ b/machines/radon/default.nix
@@ -1,4 +1,10 @@
-{ inputs, flake, pkgs, config, ... }:
+{
+ inputs,
+ flake,
+ pkgs,
+ config,
+ ...
+}:
let
interfaces = {
bottom = "enp1s0";
diff --git a/machines/radon/pxeboot.nix b/machines/radon/pxeboot.nix
index 4655990..0b5df13 100644
--- a/machines/radon/pxeboot.nix
+++ b/machines/radon/pxeboot.nix
@@ -3,30 +3,42 @@ let
installer = lib.nixosSystem {
system = "x86_64-linux";
modules = [
- ({ config, pkgs, lib, modulesPath, ... }: {
- imports = [
- (modulesPath + "/installer/netboot/netboot-minimal.nix")
- (modulesPath + "/installer/cd-dvd/channel.nix")
- ];
+ (
+ {
+ config,
+ pkgs,
+ lib,
+ modulesPath,
+ ...
+ }:
+ {
+ imports = [
+ (modulesPath + "/installer/netboot/netboot-minimal.nix")
+ (modulesPath + "/installer/cd-dvd/channel.nix")
+ ];
- services.openssh = {
- enable = true;
- openFirewall = true;
- settings = {
- PasswordAuthentication = false;
- KbdInteractiveAuthentication = false;
+ services.openssh = {
+ enable = true;
+ openFirewall = true;
+ settings = {
+ PasswordAuthentication = false;
+ KbdInteractiveAuthentication = false;
+ };
};
- };
- nix.settings = {
- experimental-features = [ "nix-command" "flakes" ];
- };
+ nix.settings = {
+ experimental-features = [
+ "nix-command"
+ "flakes"
+ ];
+ };
- users.users.root.openssh.authorizedKeys.keys = [
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP7T2uWJFUu8aFZZgQusGKyEMocb2pKbHLDad2eIJus9"
- "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEOw8YEbHsKy38JHp9W1wcxxZgWCDgnabOXccZUN5ddd"
- ];
- })
+ users.users.root.openssh.authorizedKeys.keys = [
+ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP7T2uWJFUu8aFZZgQusGKyEMocb2pKbHLDad2eIJus9"
+ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEOw8YEbHsKy38JHp9W1wcxxZgWCDgnabOXccZUN5ddd"
+ ];
+ }
+ )
];
};
diff --git a/modules/xnet/disk.nix b/modules/xnet/disk.nix
index 82e9c87..e6835f4 100644
--- a/modules/xnet/disk.nix
+++ b/modules/xnet/disk.nix
@@ -1,4 +1,9 @@
-{ config, lib, modulesPath, inputs, ... }:
+{
+ config,
+ lib,
+ modulesPath,
+ ...
+}:
let
cfg = config.xnet.disk;
commonOpts = {
@@ -11,12 +16,16 @@ let
"com.sun:auto-snapshot" = "false";
};
- inherit (lib) mkOption mkDefault mkIf types;
+ inherit (lib)
+ mkOption
+ mkDefault
+ mkIf
+ types
+ ;
in
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
- inputs.disko.nixosModules.default
];
options.xnet.disk = {
@@ -33,8 +42,7 @@ in
};
config = mkIf cfg.enable {
- networking.hostId = builtins.substring 0 8
- (builtins.hashString "md5" config.networking.hostName);
+ networking.hostId = builtins.substring 0 8 (builtins.hashString "md5" config.networking.hostName);
services.zfs = {
autoScrub.enable = true;
@@ -46,8 +54,14 @@ in
zramSwap.enable = mkDefault true;
boot = {
- kernelParams = [ "nohibernate" "elevator=none" ];
- supportedFilesystems = [ "vfat" "zfs" ];
+ kernelParams = [
+ "nohibernate"
+ "elevator=none"
+ ];
+ supportedFilesystems = [
+ "vfat"
+ "zfs"
+ ];
zfs.devNodes = mkDefault "/dev/disk/by-partuuid";
loader = {
systemd-boot.enable = true;
@@ -94,7 +108,11 @@ in
disko.devices = {
nodev."/" = {
fsType = "tmpfs";
- mountOptions = [ "defaults" "size=2G" "mode=755" ];
+ mountOptions = [
+ "defaults"
+ "size=2G"
+ "mode=755"
+ ];
};
zpool.zroot = {
diff --git a/modules/xnet/gitserver/default.nix b/modules/xnet/gitserver/default.nix
index 2152ebd..2bd471a 100644
--- a/modules/xnet/gitserver/default.nix
+++ b/modules/xnet/gitserver/default.nix
@@ -1,4 +1,9 @@
-{ config, lib, pkgs, ... }:
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
let
cfg = config.xnet.gitServer;
inherit (lib) mkOption mkIf types;
diff --git a/modules/xnet/gitserver/gitweb.nix b/modules/xnet/gitserver/gitweb.nix
index 9b3435a..f7a8bc7 100644
--- a/modules/xnet/gitserver/gitweb.nix
+++ b/modules/xnet/gitserver/gitweb.nix
@@ -1,4 +1,9 @@
-{ config, lib, pkgs, ... }:
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
let
cfg = config.xnet.gitServer.gitweb;
inherit (lib) mkOption mkIf types;
diff --git a/modules/xnet/monitoring/default.nix b/modules/xnet/monitoring/default.nix
index eed4963..20566d3 100644
--- a/modules/xnet/monitoring/default.nix
+++ b/modules/xnet/monitoring/default.nix
@@ -9,7 +9,6 @@ in
{
imports = [ ./grafana.nix ];
-
config = {
services.prometheus = {
enable = config.xnet.monitoring.hostGrafana;
@@ -19,7 +18,10 @@ in
node = {
enable = true;
openFirewall = true;
- enabledCollectors = [ "processes" "systemd" ];
+ enabledCollectors = [
+ "processes"
+ "systemd"
+ ];
};
# systemd = {
@@ -39,20 +41,29 @@ in
scrapeConfigs =
let
- hosts = [ "iridium" "radon" ];
+ hosts = [
+ "iridium"
+ "radon"
+ ];
in
- [{
- job_name = "node";
- static_configs = [{
- targets = map (h: "${h}:${toString exporters.node.port}") hosts;
- }];
- }
+ [
+ {
+ job_name = "node";
+ static_configs = [
+ {
+ targets = map (h: "${h}:${toString exporters.node.port}") hosts;
+ }
+ ];
+ }
{
job_name = "smartctl";
- static_configs = [{
- targets = map (h: "${h}:${toString exporters.smartctl.port}") hosts;
- }];
- }];
+ static_configs = [
+ {
+ targets = map (h: "${h}:${toString exporters.smartctl.port}") hosts;
+ }
+ ];
+ }
+ ];
};
};
}
diff --git a/modules/xnet/monitoring/grafana.nix b/modules/xnet/monitoring/grafana.nix
index e95318d..a8712f0 100644
--- a/modules/xnet/monitoring/grafana.nix
+++ b/modules/xnet/monitoring/grafana.nix
@@ -1,4 +1,9 @@
-{ config, pkgs, lib, ... }:
+{
+ config,
+ pkgs,
+ lib,
+ ...
+}:
let
inherit (lib) mkOption mkIf types;
@@ -18,18 +23,22 @@ in
config = mkIf hostGrafana {
services.grafana.provision = {
enable = true;
- datasources.settings.datasources = [{
- name = "Prometheus";
- type = "prometheus";
- url = "http://localhost:9090";
- access = "proxy";
- editable = false;
- }];
+ datasources.settings.datasources = [
+ {
+ name = "Prometheus";
+ type = "prometheus";
+ url = "http://localhost:9090";
+ access = "proxy";
+ editable = false;
+ }
+ ];
- dashboards.settings.providers = [{
- name = "Fetched Dashboards";
- options.path = "/etc/grafana/dashboards";
- }];
+ dashboards.settings.providers = [
+ {
+ name = "Fetched Dashboards";
+ options.path = "/etc/grafana/dashboards";
+ }
+ ];
};
environment.etc = {
diff --git a/modules/xnet/nginx.nix b/modules/xnet/nginx.nix
index eadd794..3e6ca7c 100644
--- a/modules/xnet/nginx.nix
+++ b/modules/xnet/nginx.nix
@@ -14,7 +14,10 @@ in
};
config = mkIf cfg.enable {
- networking.firewall.allowedTCPPorts = [ 80 443 ];
+ networking.firewall.allowedTCPPorts = [
+ 80
+ 443
+ ];
services.nginx = {
enable = true;
diff --git a/modules/xnet/persist.nix b/modules/xnet/persist.nix
index 10eb883..5e69bae 100644
--- a/modules/xnet/persist.nix
+++ b/modules/xnet/persist.nix
@@ -10,39 +10,42 @@ let
in
{
options.xnet.persist = mkOption {
- type = types.listOf (types.either
- types.str
- (types.submodule {
- options = {
- path = mkOption {
- type = types.str;
- description = "Path to persist";
- };
- user = mkOption {
- type = types.nullOr types.str;
- default = null;
- description = "User ID to set on the persisted directory";
- };
- group = mkOption {
- type = types.nullOr types.str;
- default = null;
- description = "Group ID to set on the persisted directory";
- };
+ type = types.listOf (
+ types.either types.str (
+ types.submodule {
+ options = {
+ path = mkOption {
+ type = types.str;
+ description = "Path to persist";
+ };
+ user = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ description = "User ID to set on the persisted directory";
+ };
+ group = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ description = "Group ID to set on the persisted directory";
+ };
- mode = mkOption {
- type = types.nullOr types.str;
- default = null;
- description = "Permissions to set";
+ mode = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ description = "Permissions to set";
+ };
};
- };
- }));
+ }
+ )
+ );
default = [ ];
description = "Automatically persisted state.";
};
config.systemd.tmpfiles.rules =
let
- mkEntry = entry:
+ mkEntry =
+ entry:
let
path = if isString entry then entry else entry.path;
user = if isString entry then "-" else entry.user;
@@ -53,7 +56,11 @@ in
link = "L+ ${path} - - - - /persist${path}";
perm = "Z ${mode} ${user} ${group} - -";
in
- [ dent link perm ];
+ [
+ dent
+ link
+ perm
+ ];
entries = map mkEntry config.xnet.persist;
in
diff --git a/packages/randpass.nix b/packages/randpass.nix
index ef8fe91..4cb5128 100644
--- a/packages/randpass.nix
+++ b/packages/randpass.nix
@@ -4,5 +4,4 @@
{ writeShellScriptBin, ... }:
-writeShellScriptBin "randpass"
- ''tr -dc '[:alnum:]' </dev/urandom | head -c "''${1:-14}"''
+writeShellScriptBin "randpass" ''tr -dc '[:alnum:]' </dev/urandom | head -c "''${1:-14}"''