refactor: modulization

This commit is contained in:
DACHXY 2025-04-09 13:24:02 +08:00
parent a29782681a
commit f6acb92ad0
63 changed files with 680 additions and 1959 deletions

View file

@ -0,0 +1,16 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
# USB auto mount
usbutils
udiskie
udisks
];
services = {
# USB auto mount
gvfs.enable = true;
udisks2.enable = true;
devmon.enable = true;
};
}

View file

@ -0,0 +1,25 @@
{
services = {
blueman.enable = true;
};
hardware = {
bluetooth = {
enable = true;
powerOnBoot = true;
settings.General = {
experimental = true;
Privacy = "device";
JustWorksRepairing = "always";
Class = "0x000100";
FastConnectable = true;
};
};
};
boot = {
extraModprobeConfig = ''
options bluetooth disable_ertm=Y
'';
};
}

View file

@ -1,28 +0,0 @@
{ ... }:
{
imports = [
./plymouth.nix # Boot splash
./fonts.nix
./hardware.nix
./hyprland.nix
./internationalisation.nix
./misc.nix
./networking.nix
./nixsettings.nix
./packages.nix
./programs.nix
./security.nix
./services.nix
./sound.nix
./time.nix
./theme.nix
./users.nix
./environment.nix
./virtualization.nix
./display-manager.nix
./gc.nix
./polkit.nix
./lsp.nix
./tmux.nix
];
}

View file

@ -16,4 +16,16 @@ in
}}";
};
};
environment.systemPackages = with pkgs; [
# SDDM
libsForQt5.qt5.qtmultimedia
libsForQt5.qt5.qtquickcontrols2
libsForQt5.qt5.qtgraphicaleffects
libsForQt5.qt5.qtsvg
libsForQt5.qt5.qtwayland
pkgs.gst_all_1.gst-libav
pkgs.gst_all_1.gstreamer
pkgs.gst_all_1.gst-plugins-good
];
}

View file

@ -1,20 +0,0 @@
{ ... }:
{
# This is my CA root cerificate, you shall delete it
security.pki.certificates = [
''
-----BEGIN CERTIFICATE-----
MIIBhzCCAS2gAwIBAgIQUwzjgrU4LTTmE7FTvaCHlzAKBggqhkjOPQQDAjAiMQsw
CQYDVQQKEwJETjETMBEGA1UEAxMKRE4gUm9vdCBDQTAeFw0yNDExMTAwMjE5MzRa
Fw0zNDExMDgwMjE5MzRaMCIxCzAJBgNVBAoTAkROMRMwEQYDVQQDEwpETiBSb290
IENBMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEhjokYiCE96DzqXb0pXgV7/DW
ns8BTBq67KGeLaH77Ywv15PzR1ydwaJ1NvvwNbyZh5TwpkMtXIEG7Cr44w/Ip6NF
MEMwDgYDVR0PAQH/BAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8CAQEwHQYDVR0OBBYE
FBgyUYt4st+TkVu4WWEfOhuVjbzqMAoGCCqGSM49BAMCA0gAMEUCIGUdeDfQJ+m0
tdlSDJgnIXbJyU0u4cSvi8faJa7OtVovAiEAxvEteXU7f4+5U1yyk0NxJ7jg8B6P
K5hP1e2clgjFv/k=
-----END CERTIFICATE-----
''
];
}

View file

@ -0,0 +1,14 @@
{ pkgs, ... }:
{
systemd.services.flatpak-repo = {
wantedBy = [ "multi-user.target" ];
path = [ pkgs.flatpak ];
script = ''
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
'';
};
services = {
flatpak.enable = true;
};
}

View file

@ -1,18 +1,13 @@
{
lib,
config,
pkgs,
lib,
...
}:
{
nix = {
settings = {
warn-dirty = false;
experimental-features = [
"nix-command"
"flakes"
];
auto-optimise-store = true;
substituters = [ "https://nix-gaming.cachix.org" ];
trusted-public-keys = [
"nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="
@ -35,17 +30,20 @@
gamescope
];
};
gamemode = {
enable = true;
settings.general.inhibit_screensaver = 0;
};
};
hardware.steam-hardware.enable = true;
hardware = {
steam-hardware.enable = true;
# Xbox controller
xpadneo.enable = true;
};
nixpkgs.config.allowUnfree = true;
nixpkgs.config.allowUnfreePredicate =
pkg:
builtins.elem (lib.getName pkg) [
"steam"
"steam-original"
"steam-unwrapped"
"steam-run"
];
boot.extraModulePackages = with config.boot.kernelPackages; [
xpadneo
];
}

View file

@ -6,11 +6,13 @@
# `nix-store --optimize` for finding and eliminating redundant copies of identical store paths
# `nix-store --gc` for optimizing the nix store and removing unreferenced and obsolete store paths
# `nix-collect-garbage -d` for deleting old generations of user profiles
nix.settings.auto-optimise-store = true;
nix.optimise.automatic = true;
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
nix = {
settings.auto-optimise-store = true;
optimise.automatic = true;
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
};
}

View file

@ -1,5 +1,4 @@
{
config,
pkgs,
inputs,
system,
@ -11,21 +10,6 @@ let
in
{
hardware = {
bluetooth = {
enable = true;
powerOnBoot = true;
settings.General = {
experimental = true;
Privacy = "device";
JustWorksRepairing = "always";
Class = "0x000100";
FastConnectable = true;
};
};
# Xbox controller
xpadneo.enable = true;
graphics = {
enable = true;
enable32Bit = true;
@ -44,17 +28,5 @@ in
enableRedistributableFirmware = true;
};
# Enable bluetooth
boot = {
extraModulePackages = with config.boot.kernelPackages; [
xpadneo
v4l2loopback # OBS Virtual Camera
];
extraModprobeConfig = ''
options bluetooth disable_ertm=Y
options v4l2loopback devices=1 video_nr=1 card_label="OBS Cam" exclusive_caps=1
'';
};
security.polkit.enable = true;
}

View file

@ -48,14 +48,7 @@
nix = {
settings = {
warn-dirty = false;
experimental-features = [
"nix-command"
"flakes"
];
auto-optimise-store = true;
substituters = [ "https://hyprland.cachix.org" ];
trusted-public-keys = [
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
];

View file

@ -1,29 +0,0 @@
{ pkgs, inputs, ... }:
{
environment.systemPackages = with pkgs; [
ripgrep
fd
lua-language-server
nodejs_22
nixfmt-rfc-style
markdownlint-cli2
shfmt
nixd
marksman
nginx-language-server
bash-language-server
tailwindcss-language-server
vscode-langservers-extracted
gopls
pyright
yaml-language-server
marksman
# formatter
prettierd
black
];
nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
}

View file

@ -1,19 +1,9 @@
{ config, pkgs, ... }:
{
networking = {
networkmanager.enable = true;
enableIPv6 = false;
firewall = {
enable = true;
allowedTCPPorts = [
22
20088
];
allowedUDPPorts = [
51820
20088
];
};
};
}

View file

@ -1,6 +1,15 @@
{ ... }:
{ inputs, ... }:
{
documentation.nixos.enable = false;
nixpkgs.config.allowUnfree = true;
nixpkgs.config.rcomSupport = true;
nix = {
settings = {
warn-dirty = false;
experimental-features = [
"nix-command"
"flakes"
];
auto-optimise-store = true;
};
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
};
}

View file

@ -54,7 +54,7 @@ lib.checkListOfEnum "Nvidia Prime Mode" validModes [ nvidia-mode ] {
nvidia.nvidiaSettings = true;
nvidia.dynamicBoost.enable = true;
nvidia.package = config.boot.kernelPackages.nvidiaPackages.beta;
nvidia.package = config.boot.kernelPackages.nvidiaPackages.latest;
nvidia.prime =
(

View file

@ -0,0 +1,14 @@
{ pkgs, ... }:
{
programs = {
obs-studio = {
enable = true;
enableVirtualCamera = true;
plugins = with pkgs.obs-studio-plugins; [
wlrobs
obs-backgroundremoval
obs-pipewire-audio-capture
];
};
};
}

View file

@ -1,25 +1,16 @@
{
pkgs,
inputs,
system,
...
}:
{
environment.systemPackages =
(with pkgs; [
neovim
environment.systemPackages = (
with pkgs;
[
file
# Binary cache platform
cachix
# gtk theme
gtk3
adwaita-icon-theme
# File Manager
nemo
# Utils
upower
jq
@ -48,63 +39,15 @@
gh # Github cli tool
gnumake
lm_sensors
temurin-jre-bin
openssl
openssl.dev
pkg-config # Include Lib
pkg-config
nodejs
yarn-berry
dotnetCorePackages.sdk_8_0_3xx
dotnetCorePackages.dotnet_9.sdk
dotnetCorePackages.dotnet_9.runtime
dotnetCorePackages.dotnet_9.aspnetcore
rustup
gcc
zig
# Editor
vim
stylua
lazygit
luajitPackages.lua
lua51Packages.lua
luajitPackages.luarocks
luajitPackages.magick
imagemagick
# Shell
fishPlugins.done
fishPlugins.fzf-fish
fishPlugins.forgit
fishPlugins.hydro
fishPlugins.grc
grc # Colorize
zoxide # Dir jumper
starship # Shell theme
carapace # Autocomplete
# USB auto mount
usbutils
udiskie
udisks
# Media
vlc
# Thumbnail
ffmpegthumbnailer
# SDDM
libsForQt5.qt5.qtmultimedia
libsForQt5.qt5.qtquickcontrols2
libsForQt5.qt5.qtgraphicaleffects
libsForQt5.qt5.qtsvg
libsForQt5.qt5.qtwayland
pkgs.gst_all_1.gst-libav
pkgs.gst_all_1.gstreamer
pkgs.gst_all_1.gst-plugins-good
])
++ [
inputs.ghostty.packages.${system}.default
];
]
);
}

View file

@ -0,0 +1,29 @@
{ ... }:
{
imports = [
../auto-mount.nix
../bluetooth.nix
../display-manager.nix
../environment.nix
../flatpak.nix
../fonts.nix
../gc.nix
../hardware.nix
../hyprland.nix
../internationalisation.nix
../misc.nix
../networking.nix
../nixsettings.nix
../obs-studio.nix
../packages.nix
../plymouth.nix
../polkit.nix
../programs.nix
../security.nix
../services.nix
../sound.nix
../time.nix
../tmux.nix
../users.nix
];
}

View file

@ -0,0 +1,18 @@
{ ... }:
{
imports = [
../environment.nix
../fonts.nix
../hardware.nix
../internationalisation.nix
../misc.nix
../networking.nix
../nixsettings.nix
../packages.nix
../programs.nix
../services.nix
../sound.nix
../time.nix
../users.nix
];
}

View file

@ -1,6 +1,16 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
# neovim
luajitPackages.lua
lua51Packages.lua
luajitPackages.luarocks
luajitPackages.magick
imagemagick
];
programs = {
gnupg = {
agent = {

View file

@ -4,9 +4,11 @@
sbctl
];
boot.loader.systemd-boot.enable = lib.mkForce false;
boot.lanzaboote = {
enable = true;
pkiBundle = "/var/lib/sbctl/";
boot = {
loader.systemd-boot.enable = lib.mkForce false;
lanzaboote = {
enable = true;
pkiBundle = "/var/lib/sbctl/";
};
};
}

View file

@ -2,15 +2,18 @@
{
services.udev.packages = [ pkgs.yubikey-personalization ];
security.pam.services.hyprlock = { };
security.pam.u2f = {
enable = true;
settings.cue = true;
control = "sufficient";
};
security.pam.services = {
sudo.u2fAuth = true;
security.pam = {
services.hyprlock = { };
services = {
sudo.u2fAuth = true;
};
u2f = {
enable = true;
settings.cue = true;
control = "sufficient";
};
};
environment.systemPackages = with pkgs; [

View file

@ -1,19 +0,0 @@
{ ... }:
{
imports = [
./fonts.nix
./hardware.nix
./internationalisation.nix
./misc.nix
./nixsettings.nix
./programs.nix
./security.nix
./sound.nix
./time.nix
./users.nix
./gc.nix
./polkit.nix
./lsp.nix
./tmux.nix
];
}

View file

@ -1,26 +1,23 @@
{ username, pkgs, ... }:
{ settings, ... }:
{
systemd.services.flatpak-repo = {
wantedBy = [ "multi-user.target" ];
path = [ pkgs.flatpak ];
script = ''
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
'';
networking = {
firewall = {
allowedTCPPorts = [
22 # SSH
];
};
};
services = {
dbus.enable = true;
blueman.enable = true;
openssh = {
enable = true;
ports = [ 22 ];
settings = {
PasswordAuthentication = false;
AllowUsers = [ username ];
UseDns = false;
AllowUsers = [ settings.personal.username ];
UseDns = true;
PermitRootLogin = "no";
};
};
@ -32,15 +29,5 @@
options = "caps:swapescape";
};
};
# USB auto mount
gvfs.enable = true;
udisks2.enable = true;
devmon.enable = true;
flatpak.enable = true;
# Thuner plugin
tumbler.enable = true; # Thumbnail
};
}

View file

@ -2,20 +2,22 @@
{
security.rtkit.enable = true; # Pipewire real-time access
services.pulseaudio.enable = false;
services = {
pulseaudio.enable = false;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
wireplumber.enable = true;
audio.enable = true;
pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
wireplumber.enable = true;
audio.enable = true;
};
playerctld.enable = true;
};
services.playerctld.enable = true;
environment.systemPackages = with pkgs; [
pavucontrol
playerctl

View file

@ -1,9 +0,0 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
adwaita-icon-theme # default gnome cursors
glib
gsettings-desktop-schemas
];
}

View file

@ -18,7 +18,9 @@ in
};
};
environment.systemPackages = with pkgs; [ tmuxinator ];
environment.systemPackages = with pkgs; [
tmuxinator
];
programs = {
tmux = {

View file

@ -1,7 +1,7 @@
{ username, pkgs, ... }:
{ settings, pkgs, ... }:
{
users.users.${username} = {
users.users.${settings.personal.username} = {
isNormalUser = true;
shell = pkgs.bash; # Actually fish
extraGroups = [

View file

@ -1,5 +1,5 @@
{
username,
settings,
pkgs,
config,
...
@ -7,7 +7,7 @@
{
programs.virt-manager.enable = true;
users.groups.libvirtd.members = [ username ];
users.groups.libvirtd.members = [ settings.personal.username ];
virtualisation = {
docker.enable = true;

View file

@ -1,6 +1,6 @@
# Work pretty good on ONE monitor
{
offload ? false,
config,
...
}:
{ lib, ... }:
@ -15,7 +15,7 @@ in
enable = true;
assetsDir = assetsDir;
contentDir = contentDir;
extraPrefix = lib.mkIf offload "nvidia-offload";
extraPrefix = lib.mkIf config.hardware.nvidia.prime.offload.enableOffloadCmd "nvidia-offload";
fps = 30;
monitors = {
"DP-3" = {