refactor: dedup several modules by breaking them out into feature modules

This commit is contained in:
2026-10-20 14:37:49 -04:00
parent 22d426001e
commit a6c7d32231
14 changed files with 243 additions and 325 deletions
+8
View File
@@ -0,0 +1,8 @@
{ _, ... }:
{
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
}
+22
View File
@@ -0,0 +1,22 @@
{ pkgs, ... }:
{
imports = [
./starship.nix
];
programs.bash = {
enable = true;
interactiveShellInit = ''
eval "$(devenv hook bash)"
eval "$(jump shell)"
clear;fastfetch
'';
};
environment.systemPackages = with pkgs; [
jump
devenv
fastfetch
];
}
+4
View File
@@ -0,0 +1,4 @@
{ _, ... }:
{
virtualisation.docker.enable = true;
}
+24
View File
@@ -0,0 +1,24 @@
{ _, ... }:
{
time.timeZone = "America/New_York";
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocales = [
"ja_JP.UTF-8/UTF-8"
];
extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
};
}
+16
View File
@@ -0,0 +1,16 @@
{ pkgs, ... }:
{
virtualisation = {
spiceUSBRedirection.enable = true;
libvirtd = {
enable = true;
qemu = {
package = pkgs.qemu_kvm;
runAsRoot = true;
swtpm.enable = true;
};
};
};
}
+35
View File
@@ -0,0 +1,35 @@
{ pkgs, ... }:
{
programs.nix-ld = {
enable = true;
libraries = with pkgs; [
stdenv.cc.cc.lib
openssl
zlib
icu
curl
libxcrypt-legacy
gcc
pkg-config
busybox
libdrm
mesa
libxkbcommon
fontconfig
libglvnd
freetype
libxcb
libx11
libice
libsm
libxcursor
libxrandr
libxft
skia
dotnet-sdk
dotnet-runtime
dotnet-runtime_8
dotnet-runtime_10
];
};
}
+13
View File
@@ -0,0 +1,13 @@
{ _, ... }:
{
programs.starship = {
enable = true;
settings = {
character = {
success_symbol = "[λ](bold green)";
error_symbol = "[λ](bold red)";
};
};
};
}
+9
View File
@@ -0,0 +1,9 @@
{ _, ... }:
{
boot.loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
systemd-boot.configurationLimit = 10;
timeout = 0;
};
}
+27
View File
@@ -0,0 +1,27 @@
{ pkgs, ... }:
{
programs.neovim = {
enable = true;
defaultEditor = true;
vimAlias = true;
configure = {
customRC = ''
set nocompatible
set backspace=indent,eol,start
set tabstop=2
set shiftwidth=2
set expandtab
'';
packages.myPlugins = with pkgs.vimPlugins; {
start = [
vim-lastplace
vim-nix
];
opt = [ ];
};
};
};
}
+1 -11
View File
@@ -5,6 +5,7 @@ in
{ {
imports = [ imports = [
inputs.lazyvim.homeManagerModules.default inputs.lazyvim.homeManagerModules.default
../features/starship.nix
]; ];
home.shellAliases = import ../features/aliases.nix { inherit pkgs; }; home.shellAliases = import ../features/aliases.nix { inherit pkgs; };
@@ -76,17 +77,6 @@ in
else else
{ }; { };
starship = {
enable = true;
settings = {
character = {
success_symbol = "[λ](bold green)";
error_symbol = "[λ](bold red)";
};
};
};
fastfetch = { fastfetch = {
enable = true; enable = true;
+10 -34
View File
@@ -1,37 +1,11 @@
{ self, pkgs, ... }: { self, pkgs, ... }:
{ {
# Only use homebrew for casks. imports = [
homebrew.enable = true; ./nix-package-manager.nix
nix = {
gc = {
automatic = true;
interval = {
Hour = 3;
Minute = 15;
Weekday = 7;
};
options = "--delete-older-than 30d";
};
optimise = {
automatic = true;
interval = {
Hour = 3;
Minute = 15;
Weekday = 7;
};
};
settings = {
experimental-features = [
"nix-command"
"flakes"
]; ];
use-xdg-base-directories = true; # Only use homebrew for casks.
}; homebrew.enable = true;
};
# Enables Touch ID for sudo prompts. # Enables Touch ID for sudo prompts.
security.pam.services.sudo_local.touchIdAuth = true; security.pam.services.sudo_local.touchIdAuth = true;
@@ -45,21 +19,23 @@
interactiveShellInit = '' interactiveShellInit = ''
eval "$(jump shell)" eval "$(jump shell)"
eval "$(devenv hook zsh)"
clear;fastfetch
''; '';
}; };
}; };
environment = { environment = {
shellAliases = import ../../features/aliases.nix { inherit pkgs; }; shellAliases = import ../../features/aliases.nix { };
variables = import ../../features/xdg.nix { inherit pkgs; }; variables = import ../../features/xdg.nix { };
systemPackages = with pkgs; [ systemPackages = with pkgs; [
wget wget
fastfetch
btop btop
nerd-fonts.hack nerd-fonts.hack
jump devenv
ripgrep ripgrep
fastfetch
]; ];
}; };
+47
View File
@@ -0,0 +1,47 @@
{ lib, pkgs, ... }:
let
launchd-time = {
Hour = 3;
Minute = 15;
Weekday = 7;
};
systemd-time = "weekly";
isDarwin = pkgs.stdenv.hostPlatform.isDarwin;
in
{
nixpkgs.config.allowUnfree = true;
nix = {
gc = {
automatic = true;
options = "--delete-older-than 30d";
}
// lib.optionalAttrs isDarwin {
interval = launchd-time;
}
// lib.optionalAttrs (!isDarwin) {
dates = systemd-time;
};
optimise = {
automatic = true;
}
// lib.optionalAttrs isDarwin {
interval = launchd-time;
}
// lib.optionalAttrs (!isDarwin) {
dates = systemd-time;
};
settings = {
use-xdg-base-directories = true;
experimental-features = [
"nix-command"
"flakes"
];
};
};
}
+15 -154
View File
@@ -5,14 +5,18 @@
... ...
}: }:
{ {
boot = { imports = [
loader = { ../../features/bash.nix
systemd-boot.enable = true; ../../features/nix-ld.nix
efi.canTouchEfiVariables = true; ../../features/docker.nix
systemd-boot.configurationLimit = 10; ../../features/vim.nix
timeout = 0; ../../features/avahi.nix
}; ../../features/systemd-boot.nix
../../features/i18n.nix
./nix-package-manager.nix
];
boot = {
consoleLogLevel = 3; consoleLogLevel = 3;
kernelParams = [ kernelParams = [
@@ -116,13 +120,6 @@
openssh.enable = true; openssh.enable = true;
affinity-thumbnailer.enable = true; affinity-thumbnailer.enable = true;
# Enables m(ulticast)DNS (a.k.a. Bonjour) support.
avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
}; };
networking = { networking = {
@@ -131,10 +128,7 @@
networkmanager.plugins = with pkgs; [ networkmanager-openvpn ]; networkmanager.plugins = with pkgs; [ networkmanager-openvpn ];
firewall = { firewall = {
trustedInterfaces = [ allowedTCPPorts = [ 22 ];
"virbr0"
"br0"
];
allowedTCPPortRanges = [ allowedTCPPortRanges = [
{ {
@@ -149,132 +143,24 @@
to = 1764; to = 1764;
} # KDE Connect } # KDE Connect
]; ];
allowedTCPPorts = [ 22 ];
};
};
time.timeZone = "America/New_York";
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocales = [
"ja_JP.UTF-8/UTF-8"
];
extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
}; };
}; };
security.rtkit.enable = true; security.rtkit.enable = true;
programs = { programs = {
ssh.startAgent = true;
firefox.enable = true;
gnupg.agent = { gnupg.agent = {
enable = true; enable = true;
pinentryPackage = pkgs.pinentry-qt; pinentryPackage = pkgs.pinentry-qt;
}; };
nix-ld = {
enable = true;
libraries = with pkgs; [
stdenv.cc.cc.lib
openssl
zlib
icu
curl
libxcrypt-legacy
gcc
pkg-config
busybox
libdrm
mesa
libxkbcommon
fontconfig
libglvnd
freetype
libxcb
libx11
libice
libsm
libxcursor
libxrandr
libxft
skia
dotnet-sdk
dotnet-runtime
dotnet-runtime_8
dotnet-runtime_10
];
};
bash = {
enable = true;
interactiveShellInit = ''
eval "$(jump shell)"
bind -x '"\eOQ": clear;fastfetch'
'';
};
starship = {
enable = true;
settings = {
character = {
success_symbol = "[λ](bold green)";
error_symbol = "[λ](bold red)";
};
};
};
ssh.startAgent = true;
firefox.enable = true;
thunderbird.enable = true;
appimage = { appimage = {
enable = true; enable = true;
binfmt = true; binfmt = true;
}; };
neovim = {
enable = true;
defaultEditor = true;
vimAlias = true;
configure = {
customRC = ''
set nocompatible
set backspace=indent,eol,start
set tabstop=2
set shiftwidth=2
set expandtab
'';
packages.myPlugins = with pkgs.vimPlugins; {
start = [
vim-lastplace
vim-nix
];
opt = [ ];
};
};
};
};
virtualisation = {
docker.enable = true;
}; };
users.users.frank = { users.users.frank = {
@@ -293,8 +179,6 @@
}; };
nixpkgs = { nixpkgs = {
config.allowUnfree = true;
# Fix msitools compiling and failing it's test-suite. # Fix msitools compiling and failing it's test-suite.
overlays = [ overlays = [
(final: prev: { (final: prev: {
@@ -307,28 +191,6 @@
]; ];
}; };
nix = {
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
optimise = {
automatic = true;
dates = "weekly";
};
settings = {
experimental-features = [
"nix-command"
"flakes"
];
use-xdg-base-directories = true;
};
};
environment = { environment = {
systemPackages = with pkgs; [ systemPackages = with pkgs; [
wget wget
@@ -355,7 +217,6 @@
affinity-v3 affinity-v3
libreoffice-qt libreoffice-qt
qimgv qimgv
fastfetch
vorta vorta
distrobox distrobox
devenv devenv
+12 -126
View File
@@ -1,25 +1,20 @@
{ {
pkgs, pkgs,
inputs,
... ...
}: }:
{ {
boot.loader = { imports = [
systemd-boot.enable = true; ../../features/bash.nix
systemd-boot.configurationLimit = 10; ../../features/vim.nix
efi.canTouchEfiVariables = true; ../../features/docker.nix
timeout = 0; ../../features/libvirt.nix
}; ../../features/avahi.nix
../../features/systemd-boot.nix
../../features/i18n.nix
./nix-package-manager.nix
];
services = { services.openssh.enable = true;
avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
openssh.enable = true;
};
networking = { networking = {
useNetworkd = true; useNetworkd = true;
@@ -68,91 +63,7 @@
}; };
}; };
time.timeZone = "America/New_York"; programs.ssh.startAgent = true;
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocales = [
"ja_JP.UTF-8/UTF-8"
];
extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
};
programs = {
bash = {
enable = true;
interactiveShellInit = ''
eval "$(jump shell)"
bind -x '"\eOQ": clear;fastfetch'
'';
};
starship = {
enable = true;
settings = {
character = {
success_symbol = "[λ](bold green)";
error_symbol = "[λ](bold red)";
};
};
};
neovim = {
enable = true;
defaultEditor = true;
vimAlias = true;
configure = {
customRC = ''
set nocompatible
set backspace=indent,eol,start
set tabstop=2
set shiftwidth=2
set expandtab
'';
packages.myPlugins = with pkgs.vimPlugins; {
start = [
vim-lastplace
vim-nix
];
opt = [ ];
};
};
};
ssh.startAgent = true;
};
virtualisation = {
docker.enable = true;
spiceUSBRedirection.enable = true;
libvirtd = {
enable = true;
qemu = {
package = pkgs.qemu_kvm;
runAsRoot = true;
swtpm.enable = true;
};
};
};
users.users.frank = { users.users.frank = {
isNormalUser = true; isNormalUser = true;
@@ -174,14 +85,12 @@
nil nil
bash-language-server bash-language-server
devenv devenv
jump
weather weather
borgbackup borgbackup
openjdk openjdk
openjdk17 openjdk17
openjdk25 openjdk25
tmux tmux
fastfetch
ripgrep ripgrep
(python3.withPackages ( (python3.withPackages (
@@ -196,28 +105,5 @@
sessionVariables = import ../../features/xdg.nix { inherit pkgs; }; sessionVariables = import ../../features/xdg.nix { inherit pkgs; };
}; };
nix = {
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
optimise = {
automatic = true;
dates = "weekly";
};
settings = {
experimental-features = [
"nix-command"
"flakes"
];
use-xdg-base-directories = true;
};
};
nixpkgs.config.allowUnfree = true;
system.stateVersion = "26.05"; system.stateVersion = "26.05";
} }