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

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

View File

@@ -1,28 +1,67 @@
{ config, options, lib, self, ... }:
{
config,
options,
lib,
self,
...
}:
with lib;
{
options = with types; {
user = mkOption { type = attrs; default = { }; };
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"; };
user = mkOption {
type = attrs;
default = { };
};
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 {
type = attrsOf (oneOf [ str path (listOf (either str path)) ]);
apply = mapAttrs (n: v:
if isList v then
concatMapStringsSep ":" (x: toString x) v
else
(toString v));
type = attrsOf (oneOf [
str
path
(listOf (either str path))
]);
apply = mapAttrs (
n: v: if isList v then concatMapStringsSep ":" (x: toString x) v else (toString v)
);
default = { };
description = "";
};
@@ -31,12 +70,27 @@ with lib;
config = {
age.secrets."passwords/users/jordan".file = "${self.inputs.secrets}/passwords/users/jordan.age";
user =
let user = builtins.getEnv "USER";
name = if elem user [ "" "root" ] then "jordan" else user;
in {
let
user = builtins.getEnv "USER";
name =
if
elem user [
""
"root"
]
then
"jordan"
else
user;
in
{
inherit name;
isNormalUser = true;
extraGroups = [ "networkmanager" "wheel" "lxd" ];
extraGroups = [
"networkmanager"
"wheel"
"lxd"
];
description = "Jordan Holt";
useDefaultShell = true;
openssh.authorizedKeys.keys = [
@@ -57,12 +111,12 @@ with lib;
file = mkAliasDefinitions options.home.file;
stateVersion = config.system.stateVersion;
};
programs = mkAliasDefinitions options.home.programs;
services = mkAliasDefinitions options.home.services;
programs = mkAliasDefinitions options.home.programs;
services = mkAliasDefinitions options.home.services;
xdg = {
enable = true;
configFile = mkAliasDefinitions options.home.configFile;
dataFile = mkAliasDefinitions options.home.dataFile;
enable = true;
configFile = mkAliasDefinitions options.home.configFile;
dataFile = mkAliasDefinitions options.home.dataFile;
};
dconf.settings = mkAliasDefinitions options.dconf.settings;
};
@@ -75,8 +129,8 @@ with lib;
users.users.${config.user.name} = mkAliasDefinitions options.user;
environment.extraInit =
concatStringsSep "\n"
(mapAttrsToList (n: v: "export ${n}=\"${v}\"") config.env);
environment.extraInit = concatStringsSep "\n" (
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;
in {
let
cfg = config.modules.programs.brave;
in
{
options.modules.programs.brave = {
enable = lib.mkOption {
default = false;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,16 +1,24 @@
{ config, lib, self, ... }:
{
config,
lib,
self,
...
}:
let cfg = config.modules.programs.thunderbird;
in {
let
cfg = config.modules.programs.thunderbird;
in
{
options.modules.programs.thunderbird = {
enable = lib.mkOption {
default = false;
example = true;
};
};
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 = {
enable = true;

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.modules.hardware.presonus-studio;
snd-usb-audio-module = pkgs.callPackage ./snd-usb-audio.nix {
@@ -13,7 +18,8 @@ let
"channelmix.upmix-method" = "psd";
};
};
in {
in
{
options.modules.hardware.presonus-studio = {
enable = lib.mkOption {
default = false;
@@ -67,11 +73,23 @@ in {
"capture.props" = {
"node.name" = "Genelec_Speakers";
"media.class" = "Audio/Sink";
"audio.position" = [ "FL" "FR" "SL" "SR" "LFE" ];
"audio.position" = [
"FL"
"FR"
"SL"
"SR"
"LFE"
];
};
"playback.props" = {
"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";
"stream.dont-remix" = true;
"node.passive" = true;
@@ -85,4 +103,4 @@ in {
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 {
pname = "snd-usb-audio";
inherit (kernel) src version postPatch nativeBuildInputs;
inherit (kernel)
src
version
postPatch
nativeBuildInputs
;
kernel_dev = kernel.dev;
kernelVersion = kernel.modDirVersion;
@@ -33,4 +42,3 @@ pkgs.stdenv.mkDerivation {
license = lib.licenses.gpl2;
};
}

View File

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

View File

@@ -1,9 +1,15 @@
{ config, lib, self, ... }:
{
config,
lib,
self,
...
}:
let
cfg = config.modules.services.borgmatic;
hostname = config.networking.hostName;
in {
in
{
options.modules.services.borgmatic = {
enable = lib.mkOption {
default = false;
@@ -12,7 +18,7 @@ in {
};
directories = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [];
default = [ ];
example = [
"/home/jordan/Documents"
];
@@ -35,9 +41,14 @@ in {
settings = {
source_directories = cfg.directories;
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";
keep_daily = 7;
keep_weekly = 4;

View File

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

View File

@@ -1,8 +1,14 @@
{ config, lib, self, ... }:
{
config,
lib,
self,
...
}:
let
cfg = config.modules.services.coturn;
in {
in
{
options.modules.services.coturn = {
enable = lib.mkOption {
default = false;
@@ -21,24 +27,28 @@ in {
};
config = lib.mkIf cfg.enable {
networking.firewall = let
range = with config.services.coturn; lib.singleton {
from = min-port;
to = max-port;
networking.firewall =
let
range =
with config.services.coturn;
lib.singleton {
from = min-port;
to = max-port;
};
in
{
allowedTCPPorts = [
3478 # TURN listener
5349 # STUN TLS
5350 # STUN TLS alt
];
allowedUDPPorts = [
3478 # TURN listener
5349 # TLS
5350 # TLS alt
];
allowedUDPPortRanges = range; # TURN peer relays
};
in {
allowedTCPPorts = [
3478 # TURN listener
5349 # STUN TLS
5350 # STUN TLS alt
];
allowedUDPPorts = [
3478 # TURN listener
5349 # TLS
5350 # TLS alt
];
allowedUDPPortRanges = range; # TURN peer relays
};
security.acme.certs = {
"${config.services.coturn.realm}" = {
@@ -47,19 +57,26 @@ in {
};
};
age.secrets = {
"passwords/services/coturn/static-auth-secret" = {
file = "${self.inputs.secrets}/passwords/services/coturn/static-auth-secret.age";
owner = "turnserver";
group = "turnserver";
};
} // (if cfg.matrixIntegration then {
"passwords/services/coturn/matrix-turn-config.yml" = {
file = "${self.inputs.secrets}/passwords/services/coturn/matrix-turn-config.yml.age";
owner = "matrix-synapse";
group = "matrix-synapse";
};
} else {});
age.secrets =
{
"passwords/services/coturn/static-auth-secret" = {
file = "${self.inputs.secrets}/passwords/services/coturn/static-auth-secret.age";
owner = "turnserver";
group = "turnserver";
};
}
// (
if cfg.matrixIntegration then
{
"passwords/services/coturn/matrix-turn-config.yml" = {
file = "${self.inputs.secrets}/passwords/services/coturn/matrix-turn-config.yml.age";
owner = "matrix-synapse";
group = "matrix-synapse";
};
}
else
{ }
);
services.coturn = rec {
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
@@ -52,7 +58,12 @@ in
wantedBy = [ "multi-user.target" ];
after = [ "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 = ''
set -eux -o pipefail
mkdir -p etc/nix
@@ -142,7 +153,12 @@ in
"~setdomainname"
"~sethostname"
];
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" "AF_UNIX" "AF_NETLINK" ];
RestrictAddressFamilies = [
"AF_INET"
"AF_INET6"
"AF_UNIX"
"AF_NETLINK"
];
# Needs network access
PrivateNetwork = false;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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