summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorKleidi Bujari <mail@4kb.net>2026-10-24 22:52:35 -0700
committerKleidi Bujari <mail@4kb.net>2026-10-24 22:59:09 -0700
commit48c8a4145c5a73874797a6de3f05ce584b1d1798 (patch)
treebd4c627e8c8944fb7082b7a9982e8d3677c2a2c4 /modules
parent1a181be93f37a94b347b2f5f97a1fef57e11cf89 (diff)
parent27db59cac4f3c3e7a1e4187a5f56d4ec61895c5a (diff)
downloaddepot-48c8a4145c5a73874797a6de3f05ce584b1d1798.tar.gz
depot-48c8a4145c5a73874797a6de3f05ce584b1d1798.tar.bz2
depot-48c8a4145c5a73874797a6de3f05ce584b1d1798.zip
merge hakyllHEADmaster
Diffstat (limited to 'modules')
-rw-r--r--modules/desktop.nix487
-rw-r--r--modules/disk.nix2
-rw-r--r--modules/network.nix5
-rw-r--r--modules/sshd.nix20
-rw-r--r--modules/users.nix29
-rw-r--r--modules/xnet/default.nix18
-rw-r--r--modules/xnet/disk.nix34
-rw-r--r--modules/xnet/gitserver/default.nix7
-rw-r--r--modules/xnet/gitserver/gitweb.nix29
-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
13 files changed, 430 insertions, 335 deletions
diff --git a/modules/desktop.nix b/modules/desktop.nix
index 894a7db..b098020 100644
--- a/modules/desktop.nix
+++ b/modules/desktop.nix
@@ -1,283 +1,296 @@
-{ lib, pkgs, ... }:
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
let
- inherit (lib) mkDefault;
+ cfg = config.depot.desktop;
+
+ inherit (lib) mkIf mkDefault mkEnableOption;
inherit (builtins) listToAttrs;
in
{
- environment.systemPackages = with pkgs; [
- audacious
- brightnessctl
- foot
- fuzzel
- imv
- man-pages
- man-pages-posix
- mpv
- playerctl
- pop-icon-theme
- pwvucontrol
- swaybg
- swayidle
- swaylock
- tigervnc
- wl-clipboard
- xeyes
- xwayland-satellite
- zathura
+ options.depot.desktop.enable = mkEnableOption "depot desktop";
- # Spell checking
- aspell
- aspellDicts.en
- aspellDicts.en-science
- aspellDicts.en-computers
+ config = mkIf cfg.enable {
+ environment.systemPackages = with pkgs; [
+ audacious
+ brightnessctl
+ foot
+ fuzzel
+ imv
+ man-pages
+ man-pages-posix
+ mpv
+ playerctl
+ pop-icon-theme
+ pwvucontrol
+ swaybg
+ swayidle
+ swaylock
+ tigervnc
+ wl-clipboard
+ xeyes
+ xwayland-satellite
+ zathura
- hunspell
- hunspellDicts.en-us
- ];
+ # Spell checking
+ aspell
+ aspellDicts.en
- documentation = {
- dev.enable = true;
- doc.enable = true;
- info.enable = true;
- man.enable = true;
- };
+ hunspell
+ hunspellDicts.en-us
+ ];
- security.rtkit.enable = true;
- services.pipewire = {
- enable = true;
- pulse.enable = true;
- alsa.enable = true;
- };
+ documentation = {
+ dev.enable = true;
+ doc.enable = true;
+ info.enable = true;
+ man.enable = true;
+ };
- services.emacs = {
- enable = true;
- defaultEditor = true;
- package = with pkgs; (emacsPackagesFor emacs).emacsWithPackages
- (epkgs: [ epkgs.mu4e epkgs.treesit-grammars.with-all-grammars ]);
- };
+ security.rtkit.enable = true;
+ services.pipewire = {
+ enable = true;
+ pulse.enable = true;
+ alsa.enable = true;
+ };
- # Build nix derivations on disk rather than in /tmp which is mounted
- # in RAM, otherwise large closures fail to build due to lack of
- # space. Since desktops are used as dev machines, this option lives
- # here rather than on a more general module.
- systemd.services.nix-daemon.environment.TMPDIR = "/nix/tmp";
+ services.emacs = {
+ enable = true;
+ defaultEditor = true;
+ package =
+ with pkgs;
+ (emacsPackagesFor emacs).emacsWithPackages (epkgs: [
+ epkgs.mu4e
+ epkgs.treesit-grammars.with-all-grammars
+ ]);
+ };
- # Make sure the directory for evaluating large closures exists for
- # the nix daemon.
- systemd.tmpfiles.rules = [ "d /nix/tmp 755 root root - -" ];
+ # Build nix derivations on disk rather than in /tmp which is mounted
+ # in RAM, otherwise large closures fail to build due to lack of
+ # space. Since desktops are used as dev machines, this option lives
+ # here rather than on a more general module.
+ systemd.services.nix-daemon.environment.TMPDIR = "/nix/tmp";
- systemd.packages = with pkgs; [ mako ];
- systemd.user.services =
- let
- afterGraphical = ExecStart: {
- enable = true;
- after = [ "graphical-session.target" ];
- partOf = [ "graphical-session.target" ];
- wantedBy = [ "graphical-session.target" ];
- serviceConfig = {
- inherit ExecStart;
- Type = "simple";
+ # Make sure the directory for evaluating large closures exists for
+ # the nix daemon.
+ systemd.tmpfiles.rules = [ "d /nix/tmp 755 root root - -" ];
+
+ systemd.packages = with pkgs; [ mako ];
+ systemd.user.services =
+ let
+ afterGraphical = ExecStart: {
+ enable = true;
+ after = [ "graphical-session.target" ];
+ partOf = [ "graphical-session.target" ];
+ wantedBy = [ "graphical-session.target" ];
+ serviceConfig = {
+ inherit ExecStart;
+ Type = "simple";
+ };
};
- };
- in
- {
- udiskie = afterGraphical "${pkgs.udiskie}/bin/udiskie";
- swayidle =
- let
- swaylock = lib.concatStringsSep " " [
- "${pkgs.swaylock}/bin/swaylock"
- "--color 2b3328"
- "--indicator-caps-lock"
- "--ignore-empty-password"
- "--daemonize"
- ];
- in
- afterGraphical (
- pkgs.writeShellScript "start-swayidle" ''
- ${pkgs.swayidle}/bin/swayidle -w \
- timeout 601 '${pkgs.niri}/bin/niri msg action power-off-monitors' \
- timeout 600 '${swaylock}' \
- before-sleep '${swaylock}'
- ''
- );
+ in
+ {
+ udiskie = afterGraphical "${pkgs.udiskie}/bin/udiskie";
+ swayidle =
+ let
+ swaylock = lib.concatStringsSep " " [
+ "${pkgs.swaylock}/bin/swaylock"
+ "--color 2b3328"
+ "--indicator-caps-lock"
+ "--ignore-empty-password"
+ "--daemonize"
+ ];
+ in
+ afterGraphical (
+ pkgs.writeShellScript "start-swayidle" ''
+ ${pkgs.swayidle}/bin/swayidle -w \
+ timeout 601 '${pkgs.niri}/bin/niri msg action power-off-monitors' \
+ timeout 600 '${swaylock}' \
+ before-sleep '${swaylock}'
+ ''
+ );
- waybar = {
- partOf = [ "graphical-session.target" ];
- wantedBy = [ "graphical-session.target" ];
- after = [ "graphical-session.target" ];
+ waybar = {
+ partOf = [ "graphical-session.target" ];
+ wantedBy = [ "graphical-session.target" ];
+ after = [ "graphical-session.target" ];
- path = with pkgs; [
- pwvucontrol
- ];
+ path = with pkgs; [
+ pwvucontrol
+ ];
- serviceConfig = {
- Type = "exec";
- ExecStart = "${pkgs.waybar}/bin/waybar";
- ExecReload = "kill -SIGUSR2 $MAINPID";
- Restart = "on-failure";
+ serviceConfig = {
+ Type = "exec";
+ ExecStart = "${pkgs.waybar}/bin/waybar";
+ ExecReload = "kill -SIGUSR2 $MAINPID";
+ Restart = "on-failure";
+ };
};
};
- };
- qt = {
- enable = true;
- style = "adwaita-dark";
- platformTheme = "gnome";
- };
+ qt = {
+ enable = true;
+ style = "adwaita-dark";
+ platformTheme = "gnome";
+ };
- fonts = {
- # Expose system fonts in case something non-standard needs them
- fontDir.enable = true;
- packages = with pkgs; [
- ibm-plex
- iosevka
- nerd-fonts.symbols-only
- ];
+ fonts = {
+ # Expose system fonts in case something non-standard needs them
+ fontDir.enable = true;
+ packages = with pkgs; [
+ ibm-plex
+ iosevka
+ nerd-fonts.symbols-only
+ ];
- fontconfig.defaultFonts = {
- serif = [ "IBM Plex Serif" ];
- sansSerif = [ "IBM Plex Sans" ];
- monospace = [ "IBM Plex Mono" ];
+ fontconfig.defaultFonts = {
+ serif = [ "IBM Plex Serif" ];
+ sansSerif = [ "IBM Plex Sans" ];
+ monospace = [ "IBM Plex Mono" ];
+ };
};
- };
-
- environment.etc."xdg/user-dirs.defaults".text = ''
- DOWNLOAD=/tmp/downloads
- '';
- environment.sessionVariables = {
- MOZ_ENABLE_WAYLAND = 1;
- MOZ_USE_XINPUT2 = 1;
- MOZ_WEBRENDER = 1;
- QT_QPA_PLATFORM = "wayland;xcb";
- };
+ environment.etc."xdg/user-dirs.defaults".text = ''
+ DOWNLOAD=/tmp/downloads
+ '';
- programs = {
- niri.enable = true;
- direnv.enable = true;
- fish = {
- enable = true;
- interactiveShellInit = ''
- # disable greeting
- set fish_greeting
- '';
+ environment.sessionVariables = {
+ MOZ_ENABLE_WAYLAND = 1;
+ MOZ_USE_XINPUT2 = 1;
+ MOZ_WEBRENDER = 1;
+ QT_QPA_PLATFORM = "wayland;xcb";
};
- # GTK settings
- dconf = {
- enable = true;
- profiles.user.databases = [
- {
- lockAll = true;
- settings = {
- "org/gnome/desktop/interface" = {
- color-scheme = "prefer-dark";
- gtk-font-name = "Sans Serif 10";
- icon-theme = "Pop";
- theme-name = "Adwaita";
+ programs = {
+ niri.enable = true;
+ direnv.enable = true;
+ fish = {
+ enable = true;
+ interactiveShellInit = ''
+ # disable greeting
+ set fish_greeting
+ '';
+ };
+
+ # GTK settings
+ dconf = {
+ enable = true;
+ profiles.user.databases = [
+ {
+ lockAll = true;
+ settings = {
+ "org/gnome/desktop/interface" = {
+ color-scheme = "prefer-dark";
+ gtk-font-name = "Sans Serif 10";
+ icon-theme = "Pop";
+ theme-name = "Adwaita";
+ };
};
- };
- }
- ];
+ }
+ ];
+ };
};
- };
- hardware.bluetooth = {
- enable = true;
- powerOnBoot = true;
- settings = {
- General = {
- Experimental = true;
- };
- Policy = {
- AutoEnable = true;
+ hardware.bluetooth = {
+ enable = true;
+ powerOnBoot = true;
+ settings = {
+ General = {
+ Experimental = true;
+ };
+ Policy = {
+ AutoEnable = true;
+ };
};
};
- };
- services.blueman.enable = true;
+ services.blueman.enable = true;
- # Helper for managing dotfiles
- environment.shellAliases.dots = "git --git-dir=$HOME/.local/cfg/ --work-tree=$HOME";
+ # Helper for managing dotfiles
+ environment.shellAliases.dots = "git --git-dir=$HOME/.local/cfg/ --work-tree=$HOME";
- # Enable modifying keyboard firmware
- hardware.keyboard.qmk.enable = true;
+ # Enable modifying keyboard firmware
+ hardware.keyboard.qmk.enable = true;
- security.polkit.enable = true;
+ security.polkit.enable = true;
- services = {
- gnome.gnome-keyring.enable = true;
- upower.enable = true;
- pcscd.enable = true;
- udev.packages = with pkgs; [ yubikey-personalization ];
- udisks2 = {
- enable = true;
- mountOnMedia = true;
+ services = {
+ gnome.gnome-keyring.enable = true;
+ upower.enable = true;
+ pcscd.enable = true;
+ udev.packages = with pkgs; [ yubikey-personalization ];
+ udisks2 = {
+ enable = true;
+ mountOnMedia = true;
+ };
};
- };
- programs.firefox = {
- enable = true;
- preferences = {
- # Enable hardware transcoding
- "media.ffmpeg.vaapi.enabled" = true;
+ programs.firefox = {
+ enable = true;
+ preferences = {
+ # Enable hardware transcoding
+ "media.ffmpeg.vaapi.enabled" = true;
- # Disable controlling media with keyboard
- "media.hardwaremediakeys.enabled" = false;
- # Enable legacy compact mode
- "browser.compactmode.show" = true;
- "browser.uidensity" = 1;
+ # Disable controlling media with keyboard
+ "media.hardwaremediakeys.enabled" = false;
+ # Enable legacy compact mode
+ "browser.compactmode.show" = true;
+ "browser.uidensity" = 1;
- # Disable ctrl+q closing browser
- "browser.quitShortcut.disabled" = true;
+ # Disable ctrl+q closing browser
+ "browser.quitShortcut.disabled" = true;
- # Hardcode theme to dark mode
- "ui.systemUsesDarkTheme" = 1;
- };
- policies = {
- DefaultDownloadDirectory = "/tmp/firefox";
- DisableTelemetry = true;
- DisableFirefoxStudies = true;
- EnableTrackingProtection = {
- Value = true;
- Locked = true;
- Cryptomining = true;
- Fingerprinting = true;
+ # Hardcode theme to dark mode
+ "ui.systemUsesDarkTheme" = 1;
};
- DisableAccounts = true;
- DisableFirefoxAccounts = true;
- DisableFirefoxScreenshots = true;
- DisablePocket = true;
- DisplayBookmarksToolbar = "never";
- DisplayMenuBar = "default-off";
- DontCheckDefaultBrowser = true;
- Homepage = {
- URL = "about:blank";
- StartPage = "homepage";
- };
- HttpsOnlyMode = "enabled";
- DNSOverHTTPS = false;
- NewTabPage = false;
- OfferToSaveLogins = false;
- PasswordManagerEnabled = false;
- SearchBar = "unified";
- SearchEngines.Default = "DuckDuckGo";
- SearchSuggestEnabled = false;
- ExtensionSettings =
- let
- extension = shortId: uuid: {
- name = uuid;
- value = {
- install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi";
- installation_mode = "force_installed";
+ policies = {
+ DefaultDownloadDirectory = "/tmp/firefox";
+ DisableTelemetry = true;
+ DisableFirefoxStudies = true;
+ EnableTrackingProtection = {
+ Value = true;
+ Locked = true;
+ Cryptomining = true;
+ Fingerprinting = true;
+ };
+ DisableAccounts = true;
+ DisableFirefoxAccounts = true;
+ DisableFirefoxScreenshots = true;
+ DisablePocket = true;
+ DisplayBookmarksToolbar = "never";
+ DisplayMenuBar = "default-off";
+ DontCheckDefaultBrowser = true;
+ Homepage = {
+ URL = "about:blank";
+ StartPage = "homepage";
+ };
+ HttpsOnlyMode = "enabled";
+ DNSOverHTTPS = false;
+ NewTabPage = false;
+ OfferToSaveLogins = false;
+ PasswordManagerEnabled = false;
+ SearchBar = "unified";
+ SearchEngines.Default = "DuckDuckGo";
+ SearchSuggestEnabled = false;
+ ExtensionSettings =
+ let
+ extension = shortId: uuid: {
+ name = uuid;
+ value = {
+ install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi";
+ installation_mode = "force_installed";
+ };
};
- };
- in
- listToAttrs [
- (extension "ublock-origin" "uBlock0@raymondhill.net")
- (extension "bitwarden-password-manager" "{446900e4-71c2-419f-a6a7-df9c091e268b}")
- (extension "darkreader" "addon@darkreader.org")
- ];
+ in
+ listToAttrs [
+ (extension "ublock-origin" "uBlock0@raymondhill.net")
+ (extension "bitwarden-password-manager" "{446900e4-71c2-419f-a6a7-df9c091e268b}")
+ (extension "darkreader" "addon@darkreader.org")
+ ];
+ };
};
};
}
diff --git a/modules/disk.nix b/modules/disk.nix
index bf4a9a8..a8f7fbf 100644
--- a/modules/disk.nix
+++ b/modules/disk.nix
@@ -61,7 +61,6 @@ in
kernelParams = [
"nohibernate"
"elevator=none"
- "rd.systemd.unit=rescue.target"
];
supportedFilesystems = [
"vfat"
@@ -145,7 +144,6 @@ in
'';
};
- boot.initrd.systemd.emergencyAccess = true;
boot.initrd.systemd.initrdBin = [
pkgs.cloud-utils
pkgs.util-linux
diff --git a/modules/network.nix b/modules/network.nix
index 8264102..e9383c2 100644
--- a/modules/network.nix
+++ b/modules/network.nix
@@ -3,6 +3,8 @@ let
cfg = config.depot.net;
inherit (lib)
mkOption
+ mkEnableOption
+ mkIf
types
;
@@ -27,6 +29,7 @@ in
];
options.depot.net = {
+ enable = mkEnableOption "depot networking";
v6Token = mkOption {
type = types.str;
default = "eui64";
@@ -34,7 +37,7 @@ in
};
};
- config = {
+ config = mkIf cfg.enable {
# networkd handles this
networking.useDHCP = false;
diff --git a/modules/sshd.nix b/modules/sshd.nix
index 6afec3f..421ab7f 100644
--- a/modules/sshd.nix
+++ b/modules/sshd.nix
@@ -33,7 +33,7 @@ in
startWhenNeeded = true;
openFirewall = true;
hostKeys = lib.singleton {
- path = "/persist/certs/ssh/ssh_host_ed25519_key";
+ path = "/var/lib/sshd/ssh_host_ed25519_key";
type = "ed25519";
};
settings = {
@@ -41,6 +41,7 @@ in
X11Forwarding = false;
PermitRootLogin = "prohibit-password";
PasswordAuthentication = mkDefault false;
+ KbdInteractiveAuthentication = false;
# Ciphers = [ "chacha20-poly1305@openssh.com" ];
# Macs = [ "hmac-sha2-512-etm@openssh.com" ];
# KexAlgorithms = [ "curve25519-sha256@libssh.org" ];
@@ -50,15 +51,14 @@ in
"-f AUTHPRIV"
"-l INFO"
];
- # extraConfig =
- # let
- # pubkeyTypes = lib.strings.concatStringsSep "," [
- # "sk-ssh-ed25519-cert-v01@openssh.com"
- # "ssh-ed25519-cert-v01@openssh.com"
- # "ssh-ed25519"
- # ];
- # in
- # "PubkeyAcceptedKeyTypes ${pubkeyTypes}";
+ extraConfig =
+ let
+ pubkeyTypes = lib.strings.concatStringsSep "," [
+ "sk-ssh-ed25519@openssh.com"
+ "ssh-ed25519"
+ ];
+ in
+ "PubkeyAcceptedKeyTypes ${pubkeyTypes}";
};
users.users.root.openssh.authorizedKeys.keys = [
diff --git a/modules/users.nix b/modules/users.nix
index e21c085..d3e7cb4 100644
--- a/modules/users.nix
+++ b/modules/users.nix
@@ -1,7 +1,17 @@
-{ pkgs, ... }:
+{
+ config,
+ pkgs,
+ lib,
+ ...
+}:
let
+ cfg = config.depot.users;
+
inherit (builtins)
- attrValues;
+ attrValues
+ ;
+
+ inherit (lib) mkIf mkEnableOption;
keys = {
t480 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEOw8YEbHsKy38JHp9W1wcxxZgWCDgnabOXccZUN5ddd";
@@ -9,13 +19,23 @@ let
};
in
{
- kle = {
+ options.depot.users.kle.enable = mkEnableOption "kle user";
+
+ config.users.users.kle = mkIf cfg.kle.enable {
initialHashedPassword = "$6$R4dDhaftX.vapGMd$.An36hlp3DXfkIC7bPZ0MDPo6Zvpk8JRrhy2LES.lZZj6JDa74oJkcMW3DCsIySvLJxOPXSShos0TpgJ/w0fH/";
isNormalUser = true;
shell = pkgs.fish;
home = "/persist/usr/kle";
createHome = true;
- extraGroups = [ "wheel" "users" "networkmanager" "video" "kvm" "i2c" "dialout" ];
+ extraGroups = [
+ "wheel"
+ "users"
+ "networkmanager"
+ "video"
+ "kvm"
+ "i2c"
+ "dialout"
+ ];
packages = with pkgs; [
btop
curl
@@ -29,6 +49,7 @@ in
rsync
sshfs
tree
+ watchman
zip
# passwords
diff --git a/modules/xnet/default.nix b/modules/xnet/default.nix
index 28edf60..020accb 100644
--- a/modules/xnet/default.nix
+++ b/modules/xnet/default.nix
@@ -2,8 +2,6 @@
pkgs,
lib,
config,
- flake,
- inputs,
...
}:
let
@@ -47,14 +45,15 @@ in
time.timeZone = mkDefault "US/Pacific";
nix = {
- nixPath = mkForce [ "nixpkgs=${inputs.nixpkgs}" ];
settings = {
auto-optimise-store = true;
+ nix-path = mkForce [ "nixpkgs=${pkgs.path}" ];
experimental-features = [
"nix-command"
"flakes"
"pipe-operators"
];
+
warn-dirty = false;
# timeout fast from binary cache
@@ -64,10 +63,7 @@ in
automatic = true;
options = mkDefault "--delete-older-than 30d";
};
- registry = {
- nixpkgs.flake = inputs.nixpkgs;
- depot.flake = flake;
- };
+ registry.nixpkgs.flake.outPath = pkgs.path;
};
documentation = {
@@ -104,6 +100,9 @@ in
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFmWInQNT6EoU1NtUYzTs5jtpfbO/m6yvCckOiEGjvDc";
};
extraConfig = ''
+ Host *
+ SetEnv TERM=xterm-256color
+
Host github
HostName github.com
User git
@@ -122,6 +121,11 @@ in
Host ee
HostName pascal.ee.ryerson.ca
User kbujari
+
+ Host src
+ HostName src.web.4kb.net
+ User git
+ PreferredAuthentications publickey
'';
};
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 a9ed7d9..6473183 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;
@@ -38,16 +43,11 @@ in
mimetype.pdf=application/pdf
mimetype.png=image/png
mimetype.svg=image/svg+xml
- readme=:readme
- readme=:readme.md
- readme=:readme.txt
- readme=:README
- readme=:README.md
- readme=:README.txt
+ readme=master:README
'';
settings = {
- # about-filter = "${pkgs.cgit-pink}/lib/cgit/filters/about-formatting.sh";
- # source-filter = "${pkgs.cgit-pink}/lib/cgit/filters/syntax-highlighting.py";
+ about-filter = "${pkgs.cgit}/lib/cgit/filters/about-formatting.sh";
+ source-filter = "${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py";
clone-url = "https://${cfg.hostName}/$CGIT_REPO_URL git@${cfg.hostName}:$CGIT_REPO_URL";
enable-commit-graph = true;
enable-http-clone = false;
@@ -58,13 +58,16 @@ in
root-desc = "What I cannot create, I do not understand";
root-title = cfg.hostName;
section-from-path = true;
+ scan-hidden-path = true;
snapshots = "tar.gz tar.bz2 zip";
};
};
- # services.nginx.virtualHosts."${cfg.gitweb.hostName}" = {
- # useACMEHost = "4kb.net";
- # addSSL = true;
- # };
+ services.nginx.virtualHosts."${cfg.hostName}" = {
+ useACMEHost = "4kb.net";
+ forceSSL = true;
+
+ locations."/robots.txt".return = "200 \"User-agent: *\nDisallow: /\n\"";
+ };
};
}
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