some refactoring and modularizing locale

This commit is contained in:
cnst
2024-10-23 20:11:01 +02:00
parent 86046c6414
commit b7784f9b15
58 changed files with 256 additions and 165 deletions

View File

@@ -0,0 +1,74 @@
{
pkgs,
lib,
config,
...
}: let
inherit (lib) mkOption;
cfg = config.nixos.boot.kernel;
in {
options = {
nixos.boot.kernel = {
variant = mkOption {
type = lib.types.enum ["stable" "latest" "cachyos"];
default = "latest";
description = "Kernel variant to use.";
};
hardware = mkOption {
type = lib.types.enum ["amd" "nvidia"];
default = "amd";
description = "Hardware type (GPU) configuration.";
};
extraKernelParams = mkOption {
type = lib.types.listOf lib.types.str;
default = [];
description = "Additional kernel parameters.";
};
extraBlacklistedModules = mkOption {
type = lib.types.listOf lib.types.str;
default = [];
description = "Additional kernel nixos.to blacklist.";
};
};
};
config = {
boot = {
consoleLogLevel = 3;
kernelPackages = let
variant = cfg.variant or "latest"; # Ensure a default value
in
if variant == "stable"
then pkgs.linuxPackages
else if variant == "latest"
then pkgs.linuxPackages_latest
else if variant == "cachyos"
then pkgs.linuxPackages_cachyos
else throw "Unknown kernel variant: ${variant}";
kernelParams =
[
"quiet"
"splash"
]
++ (
if cfg.hardware == "amd"
then ["amd_pstate=active"]
else []
)
++ cfg.extraKernelParams;
blacklistedKernelModules =
(
if cfg.hardware == "nvidia"
then ["nouveau"]
else []
)
++ cfg.extraBlacklistedModules;
};
};
}

View File

@@ -0,0 +1,60 @@
{
pkgs,
lib,
config,
inputs,
...
}: let
inherit (lib) mkIf mkEnableOption mkMerge mkForce;
cfg = config.nixos.boot.loader;
in {
options = {
nixos.boot.loader = {
default = {
enable = mkEnableOption "Enable default boot loader configuration.";
};
lanzaboote = {
enable = mkEnableOption "Enable Lanzaboote boot loader configuration.";
};
};
};
imports = [
inputs.lanzaboote.nixosModules.lanzaboote
];
config = mkMerge [
{
assertions = [
{
assertion = !(cfg.default.enable && cfg.lanzaboote.enable);
message = "Only one of nixos.boot.loader.default.enable and nixos.boot.loader.lanzaboote.enable can be set to true.";
}
];
}
(mkIf cfg.default.enable {
# Default boot loader configuration
boot.loader = {
systemd-boot.enable = true;
systemd-boot.graceful = true;
efi.canTouchEfiVariables = false;
};
})
(mkIf cfg.lanzaboote.enable {
# Lanzaboote boot loader configuration
boot = {
lanzaboote = {
enable = true;
pkiBundle = "/etc/secureboot";
};
# We let Lanzaboote install systemd-boot
loader.systemd-boot.enable = mkForce false;
};
environment.systemPackages = [pkgs.sbctl];
})
];
}

View File

@@ -0,0 +1,48 @@
{
config,
lib,
pkgs,
inputs,
...
}: let
inherit (lib) mkIf mkEnableOption mkOption;
cfg = config.nixos.gaming.gamemode;
pipewireLowLatencyModule = inputs.nix-gaming.nixosModules.pipewireLowLatency;
in {
imports = [
pipewireLowLatencyModule
];
options = {
nixos.gaming.gamemode = {
enable = mkEnableOption "Enables gamemode";
optimizeGpu.enable = mkOption {
type = lib.types.bool;
default = false;
description = "Whether to apply GPU optimizations.";
};
};
};
config = mkIf cfg.enable {
programs.gamemode = {
enable = true;
settings = {
general = {
inhibit_screensaver = 1;
softrealtime = "auto";
# renice = 15;
};
gpu = mkIf cfg.optimizeGpu.enable {
apply_gpu_optimisations = "accept-responsibility";
gpu_device = 0;
amd_performance_level = "high";
};
custom = {
start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'";
end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'";
};
};
};
# see https://github.com/fufexan/nix-gaming/#pipewire-low-latency
services.pipewire.lowLatency.enable = true;
};
}

View File

@@ -0,0 +1,22 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.gaming.gamescope;
in {
options = {
nixos.gaming.gamescope.enable = mkEnableOption "Enables gamescope";
};
config = mkIf cfg.enable {
programs.gamescope = {
enable = true;
capSysNice = true;
args = [
"--rt"
"--expose-wayland"
];
};
};
}

View File

@@ -0,0 +1,18 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.gaming.lutris;
in {
options = {
nixos.gaming.lutris.enable = mkEnableOption "Enables lutris";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
lutris
];
};
}

View File

@@ -0,0 +1,20 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.gaming.steam;
in {
options = {
nixos.gaming.steam.enable = mkEnableOption "Enables steam";
};
config = mkIf cfg.enable {
programs = {
steam = {
enable = true;
gamescopeSession.enable = true;
};
};
};
}

View File

@@ -0,0 +1,22 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.gui.gnome;
in {
options = {
nixos.gui.gnome.enable = mkEnableOption "Enables gnome";
};
config = mkIf cfg.enable {
services = {
xserver = {
desktopManager.gnome = {
enable = true;
};
};
gnome.games.enable = true;
};
};
}

View File

@@ -0,0 +1,23 @@
{
pkgs,
inputs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.gui.hyprland;
in {
options = {
nixos.gui.hyprland.enable = mkEnableOption "Enables hyprland";
};
config = mkIf cfg.enable {
programs.hyprland = {
enable = true;
xwayland.enable = true;
package = inputs.hyprland.packages.${pkgs.system}.default;
portalPackage = inputs.hyprland.packages.${pkgs.system}.xdg-desktop-portal-hyprland;
};
environment.variables.NIXOS_OZONE_WL = "1";
};
}

View File

@@ -0,0 +1,20 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.hardware.bluetooth;
in {
options = {
nixos.hardware.bluetooth.enable = mkEnableOption "Enables bluetooth";
};
config = mkIf cfg.enable {
hardware = {
bluetooth = {
enable = true;
powerOnBoot = false;
};
};
};
}

View File

@@ -0,0 +1,32 @@
{
# pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.hardware.graphics.amd;
in {
options = {
nixos.hardware.graphics.amd.enable = mkEnableOption "Enables AMD graphics";
};
config = mkIf cfg.enable {
hardware = {
graphics = {
enable = true;
enable32Bit = true;
# extraPackages = with pkgs; [
# libva
# vaapiVdpau
# libvdpau-va-gl
# amdvlk
# vulkan-tools
# ];
# extraPackages32 = with pkgs.pkgsi686Linux; [
# vaapiVdpau
# libvdpau-va-gl
# ];
};
};
};
}

View File

@@ -0,0 +1,72 @@
{
pkgs,
config,
lib,
...
}: let
nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" ''
export LIBVA_DRIVER_NAME=nvidia
export GBM_BACKEND=nvidia-drm
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __GL_VRR_ALLOWED=1
export XDG_SESSION_TYPE=wayland
export NVD_BACKEND=direct
export ELECTRON_OZONE_PLATFORM_HINT=auto
exec "$@"
'';
inherit (lib) types mkIf mkEnableOption mkOption;
cfg = config.nixos.hardware.graphics.nvidia;
in {
options = {
nixos.hardware.graphics.nvidia = {
enable = mkEnableOption "Enables NVidia graphics";
package = mkOption {
type = types.enum ["stable" "beta" "production" "latest"];
default = "stable";
description = "Choose between the stable, beta, latest, or production NVidia driver package";
};
};
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
egl-wayland
];
hardware = {
graphics = {
enable = true;
enable32Bit = true;
extraPackages = with pkgs; [
nvidia-offload
libva
vaapiVdpau
libvdpau-va-gl
intel-media-driver
nvidia-vaapi-driver
vulkan-tools
];
extraPackages32 = with pkgs.pkgsi686Linux; [
vaapiVdpau
libvdpau-va-gl
];
};
nvidia = {
package =
if cfg.package == "beta"
then config.boot.kernelPackages.nvidiaPackages.beta
else if cfg.package == "latest"
then config.boot.kernelPackages.nvidiaPackages.latest
else if cfg.package == "production"
then config.boot.kernelPackages.nvidiaPackages.prodution
else config.boot.kernelPackages.nvidiaPackages.stable;
modesetting.enable = true;
powerManagement = {
enable = false;
finegrained = false;
};
open = true;
nvidiaSettings = true;
};
};
};
}

View File

@@ -0,0 +1,20 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.hardware.logitech;
in {
options = {
nixos.hardware.logitech.enable = mkEnableOption "Enables logitech";
};
config = mkIf cfg.enable {
hardware = {
logitech.wireless = {
enable = true;
enableGraphical = true;
};
};
};
}

View File

@@ -0,0 +1,62 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption mkOption types;
cfg = config.nixos.hardware.network;
in {
options = {
nixos = {
hardware = {
network = {
enable = mkEnableOption "Enable the custom networking module";
hostName = mkOption {
type = types.str;
default = "default-hostname";
description = "Hostname for the nixos.";
};
interfaces = mkOption {
type = types.attrsOf (types.submodule {
options = {
allowedTCPPorts = mkOption {
type = types.listOf types.int;
default = [];
description = "List of allowed TCP ports for this interface.";
};
};
});
default = {};
description = "Network interface configurations.";
};
nm-applet = {
enable = mkEnableOption "Enables the nm-applet service.";
indicator = mkOption {
type = types.bool;
default = false;
description = "Enables the nm-applet indicator.";
};
};
};
};
};
};
config = mkIf cfg.enable {
networking = {
networkmanager.enable = true;
inherit (cfg) hostName;
nftables.enable = true;
firewall = {
enable = true;
inherit (cfg) interfaces;
};
};
programs.nm-applet = {
enable = cfg.nm-applet.enable;
indicator = cfg.nm-applet.indicator;
};
};
}

View File

@@ -0,0 +1,17 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.network.blueman;
in {
options = {
nixos.services.network.blueman.enable = mkEnableOption "Enables blueman";
};
config = mkIf cfg.enable {
services = {
blueman.enable = true;
};
};
}

View File

@@ -0,0 +1,19 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.network.mullvad;
in {
options = {
nixos.services.network.mullvad.enable = mkEnableOption "Enables mullvad";
};
config = mkIf cfg.enable {
services.mullvad-vpn = {
enable = true;
package = pkgs.mullvad-vpn;
};
};
}

View File

@@ -0,0 +1,17 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.network.openssh;
in {
options = {
nixos.services.network.openssh.enable = mkEnableOption "Enables openssh";
};
config = mkIf cfg.enable {
services.openssh = {
enable = true;
};
};
}

View File

@@ -0,0 +1,32 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.network.samba;
in {
options = {
nixos.services.network.samba.enable = mkEnableOption "Enables samba";
};
config = mkIf cfg.enable {
services = {
samba = {
enable = true;
package = pkgs.samba4Full;
openFirewall = true;
};
avahi = {
publish.enable = true;
publish.userServices = true;
enable = true;
openFirewall = true;
};
samba-wsdd = {
enable = true;
openFirewall = true;
};
};
};
}

View File

@@ -0,0 +1,63 @@
{
config,
lib,
inputs,
pkgs,
self,
...
}: let
inherit (lib) mkIf mkEnableOption mkOption mkMerge;
cfg = config.nixos.services.security.agenix;
in {
options = {
nixos.services.security.agenix = {
enable = mkEnableOption "Enables agenix system environment";
cnix.enable = mkOption {
type = lib.types.bool;
default = false;
description = "Apply cnix agenix settings";
};
toothpc.enable = mkOption {
type = lib.types.bool;
default = false;
description = "Apply toothpc agenix settings";
};
cnixpad.enable = mkOption {
type = lib.types.bool;
default = false;
description = "Apply cnixpad agenix settings";
};
};
};
config = mkIf cfg.enable {
age = mkMerge [
(mkIf cfg.cnix.enable {
secrets = {
cnstssh.file = "${self}/secrets/cnstssh.age";
cnixssh.file = "${self}/secrets/cnixssh.age";
helix-gpt = {
file = "${self}/secrets/helix-gpt.age";
owner = "cnst";
group = "users";
};
};
})
(mkIf cfg.toothpc.enable {
secrets = {
# Add toothpc specific secrets here
};
})
(mkIf cfg.cnixpad.enable {
secrets = {
# Add adampad specific secrets here
};
})
];
environment.systemPackages = [
inputs.agenix.packages.x86_64-linux.default
pkgs.age
];
};
}

View File

@@ -0,0 +1,15 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.security.gnome-keyring;
in {
options = {
nixos.services.security.gnome-keyring.enable = mkEnableOption "Enables gnome-keyring";
};
config = mkIf cfg.enable {
services.gnome.gnome-keyring.enable = true;
};
}

View File

@@ -0,0 +1,21 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.session.dbus;
in {
options = {
nixos.services.session.dbus.enable = mkEnableOption "Enables dbus";
};
config = mkIf cfg.enable {
services.dbus = {
enable = true;
packages = with pkgs; [
gcr
];
};
};
}

View File

@@ -0,0 +1,15 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.session.dconf;
in {
options = {
nixos.services.session.dconf.enable = mkEnableOption "Enables dconf";
};
config = mkIf cfg.enable {
programs.dconf.enable = true;
};
}

View File

@@ -0,0 +1,29 @@
{
config,
lib,
...
}: let
inherit (lib) mkOption types;
cfg = config.nixos.services.session.xserver;
in {
options = {
nixos.services.session.xserver = {
videoDrivers = mkOption {
type = types.listOf (types.enum ["amdgpu" "nvidia"]);
default = ["amdgpu"];
description = "The names of the video drivers the configuration supports";
};
xkbLayout = mkOption {
type = types.str;
default = "se";
description = "X keyboard layout, or multiple keyboard layouts separated by commas.";
};
};
};
config = {
services.xserver = {
videoDrivers = cfg.videoDrivers;
xkb.layout = cfg.xkbLayout;
};
};
}

View File

@@ -0,0 +1,15 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.system.fwupd;
in {
options = {
nixos.services.system.fwupd.enable = mkEnableOption "Enables fwupd";
};
config = mkIf cfg.enable {
services.fwupd.enable = true;
};
}

View File

@@ -0,0 +1,58 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption mkMerge mkOption types;
cfg = config.nixos.services.system.greetd;
in {
options = {
nixos.services.system.greetd = {
enable = mkEnableOption {
type = types.bool;
default = false;
description = "Enables the greetd service.";
};
gnomeKeyring.enable = mkEnableOption {
type = types.bool;
default = false;
description = "Enables GnomeKeyring PAM service for greetd.";
};
autologin.enable = mkEnableOption {
type = types.bool;
default = false;
description = "Enables autologin for a specified user.";
};
autologin.user = mkOption {
type = types.str;
default = "cnst";
description = "The username to auto-login when autologin is enabled.";
};
};
};
config = mkIf cfg.enable {
services.greetd = {
enable = true;
settings = mkMerge [
# Conditionally include initial_session if autologin is enabled
(mkIf cfg.autologin.enable {
initial_session = {
command = "${pkgs.hyprland}/bin/Hyprland";
user = cfg.autologin.user;
};
})
{
default_session = {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet -r --remember-session --asterisks";
user = "greeter";
};
}
];
};
# Apply GnomeKeyring PAM Service based on user configuration
security.pam.services.greetd.enableGnomeKeyring = cfg.gnomeKeyring.enable;
};
}

View File

@@ -0,0 +1,15 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.system.gvfs;
in {
options = {
nixos.services.system.gvfs.enable = mkEnableOption "Enables gvfs";
};
config = mkIf cfg.enable {
services.gvfs.enable = true;
};
}

View File

@@ -0,0 +1,23 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.system.kanata;
in {
options = {
nixos.services.system.kanata.enable = mkEnableOption "Enables kanata keyboard remapping";
};
config = mkIf cfg.enable {
services.kanata = {
enable = true;
package = pkgs.kanata-with-cmd;
keyboards.hhkbse = {
devices = ["/dev/input/by-id/usb-PFU_Limited_HHKB-Hybrid-event-kbd"];
config = builtins.readFile (./. + "/hhkbse.kbd");
};
};
};
}

View File

@@ -0,0 +1,52 @@
(deflocalkeys-linux
§ 41
+ 12
´ 13
å 26
¨ 27
ö 39
ä 40
' 43
< 86
> 100
, 51
. 52
- 53
)
(defsrc
esc 1 2 3 4 5 6 7 8 9 0 + ´ ' §
tab q w e r t y u i o p å ¨ bspc
lctl a s d f g h j k l ö ä ret
lsft z x c v b n m , . - rsft
lalt lmet spc rmet ralt
)
(deflayer default
esc 1 2 3 4 5 6 7 8 9 0 + pgdn pgup del
tab q w e r t y u i o p å ' bspc
lctl a s d f g h j k l ö ä ret
@shift z x c v b n m , . - rsft
lalt lmet spc @level3 ralt
)
(deflayer shift
esc S-1 S-2 S-3 RA-4 S-5 S-6 S-7 S-8 S-9 S-0 S-+ RA-7 RA-0 RA-<
tab S-q S-w S-e S-r S-t S-y S-u S-i S-o S-p S-å S-¨ bspc
lctl S-a S-s S-d S-f S-g S-h S-j S-k S-l S-ö S-ä S-ret
@shift S-z S-x S-c S-v S-b S-n S-m S-, S-. S-- rsft
lalt lmet spc @level3 ralt
)
(deflayer level3
esc 1 RA-2 RA-3 S-4 RA-5 RA-6 RA-7 RA-8 RA-9 RA-0 RA-+ ⇤ ⇥ S-'
tab q w RA-5 r t y u i o ▲ å RA-¨ bspc
lctl a s d f g h j k ◀ ▼ ▶ ret
@shift RA-S-z RA-S-x c v b n m , . - rsft
lalt lmet spc @level3 ralt
)
(defalias
shift (layer-toggle shift)
level3 (layer-toggle level3)
)

View File

@@ -0,0 +1,20 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.system.locate;
in {
options = {
nixos.services.system.locate.enable = mkEnableOption "Enables plocate";
};
config = mkIf cfg.enable {
services.locate = {
enable = true;
package = pkgs.plocate;
localuser = null;
};
};
}

View File

@@ -0,0 +1,103 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.system.nix-ld;
in {
options = {
nixos.services.system.nix-ld.enable = mkEnableOption "Enables nix-ld";
};
config = mkIf cfg.enable {
programs.nix-ld = {
enable = true;
# Sets up all the libraries to load
libraries = with pkgs; [
stdenv.cc.cc
openssl
xorg.libXcomposite
xorg.libXtst
xorg.libXrandr
xorg.libXext
xorg.libX11
xorg.libXfixes
libGL
libva
xorg.libxcb
xorg.libXdamage
xorg.libxshmfence
xorg.libXxf86vm
libelf
glib
gtk3
bzip2
xorg.libXinerama
xorg.libXcursor
xorg.libXrender
xorg.libXScrnSaver
xorg.libXi
xorg.libSM
xorg.libICE
gnome2.GConf
nspr
nss
cups
libcap
SDL2
libusb1
dbus-glib
ffmpeg
libudev0-shim
xorg.libXt
xorg.libXmu
libogg
libvorbis
SDL
SDL2_image
glew110
libidn
tbb
flac
freeglut
libjpeg
libpng
libpng12
libsamplerate
libmikmod
libtheora
libtiff
pixman
speex
SDL_image
SDL_ttf
SDL_mixer
SDL2_ttf
SDL2_mixer
libappindicator-gtk2
libdbusmenu-gtk2
libindicator-gtk2
libcaca
libcanberra
libgcrypt
libvpx
librsvg
xorg.libXft
libvdpau
gnome2.pango
cairo
atk
gdk-pixbuf
fontconfig
freetype
dbus
alsaLib
expat
libdrm
mesa
libxkbcommon
];
};
};
}

View File

@@ -0,0 +1,15 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.system.pcscd;
in {
options = {
nixos.services.system.pcscd.enable = mkEnableOption "Enables pcscd";
};
config = mkIf cfg.enable {
services.pcscd.enable = true;
};
}

View File

@@ -0,0 +1,24 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.system.pipewire;
in {
options = {
nixos.services.system.pipewire.enable = mkEnableOption "Enables pipewire";
};
config = mkIf cfg.enable {
hardware.pulseaudio.enable = false;
services.pipewire = {
enable = true;
alsa = {
enable = true;
support32Bit = true;
};
pulse.enable = true;
jack.enable = true;
};
};
}

View File

@@ -0,0 +1,18 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.system.powerd;
in {
options = {
nixos.services.system.powerd.enable = mkEnableOption "Enables power-profiles-daemon";
};
config = mkIf cfg.enable {
services = {
power-profiles-daemon.enable = true;
upower.enable = true;
};
};
}

View File

@@ -0,0 +1,15 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.system.udisks;
in {
options = {
nixos.services.system.udisks.enable = mkEnableOption "Enables udisks";
};
config = mkIf cfg.enable {
services.udisks2.enable = true;
};
}

View File

@@ -0,0 +1,15 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.services.system.zram;
in {
options = {
nixos.services.system.zram.enable = mkEnableOption "Enables zram";
};
config = mkIf cfg.enable {
zramSwap.enable = true;
};
}

View File

@@ -0,0 +1,18 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.studio.beekeeper;
in {
options = {
nixos.studio.beekeeper.enable = mkEnableOption "Enables Beekeeper Studio";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
beekeeper-studio
];
};
}

View File

@@ -0,0 +1,29 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption mkOption;
cfg = config.nixos.studio.blender;
in {
options = {
nixos.studio.blender = {
enable = mkEnableOption "Enables Blender";
hip.enable = mkOption {
type = lib.types.bool;
default = false;
description = "Use the HIP-enabled version of Blender (for AMD GPUs).";
};
};
};
config = mkIf cfg.enable {
environment.systemPackages = [
(
if cfg.hip.enable
then pkgs.blender-hip
else pkgs.blender
)
];
};
}

View File

@@ -0,0 +1,18 @@
{
config,
pkgs,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.studio.gimp;
in {
options = {
nixos.studio.gimp.enable = mkEnableOption "Enables gimp";
};
config = mkIf cfg.enable {
environment.systemPackages = [
pkgs.gimp-with-plugins
];
};
}

View File

@@ -0,0 +1,18 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.studio.inkscape;
in {
options = {
nixos.studio.inkscape.enable = mkEnableOption "Enables inkscape";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
inkscape-with-extensions
];
};
}

View File

@@ -0,0 +1,18 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.studio.mysql-workbench;
in {
options = {
nixos.studio.mysql-workbench.enable = mkEnableOption "Enables MySQL Workbench";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
mysql-workbench
];
};
}

View File

@@ -0,0 +1,64 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkOption mkDefault;
cfg = config.nixos.system.locale;
defaultCategories = [
"LC_ADDRESS"
"LC_IDENTIFICATION"
"LC_MEASUREMENT"
"LC_MONETARY"
"LC_NAME"
"LC_NUMERIC"
"LC_PAPER"
"LC_TELEPHONE"
"LC_TIME"
];
in {
options = {
nixos.system.locale = {
enable = mkOption {
type = lib.types.bool;
default = true;
description = "Enable locale configuration.";
};
timeZone = mkOption {
type = lib.types.str;
default = null;
description = "The system time zone (e.g., \"Europe/Stockholm\").";
};
defaultLocale = mkOption {
type = lib.types.str;
default = null;
description = "The default locale for the system (e.g., \"en_US.UTF-8\").";
};
extraLocale = mkOption {
type = lib.types.str;
default = null;
description = ''
The locale to use for specific LC_* categories.
If set, it will override the categories specified in `locale.categories`.
Example: "sv_SE.UTF-8".
'';
};
categories = mkOption {
type = lib.types.listOf lib.types.str;
default = defaultCategories;
description = ''
List of LC_* categories to override with `locale.extraLocale`.
Defaults to common locale categories.
'';
};
};
};
config = mkIf cfg.enable {
time.timeZone = mkDefault cfg.timeZone;
i18n.defaultLocale = mkDefault cfg.defaultLocale;
i18n.extraLocaleSettings = mkIf (cfg.extraLocale != null) (
lib.foldl' (attrs: lc: attrs // {"${lc}" = cfg.extraLocale;}) {} cfg.categories
);
};
}

View File

@@ -0,0 +1,15 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.utils.android;
in {
options = {
nixos.utils.android.enable = mkEnableOption "Enables android tools";
};
config = mkIf cfg.enable {
programs.adb.enable = true;
};
}

View File

@@ -0,0 +1,18 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.utils.anyrun;
in {
options = {
nixos.utils.anyrun.enable = mkEnableOption "Enables anyrun";
};
config = mkIf cfg.enable {
environment.systemPackages = [
pkgs.anyrun
];
};
}

View File

@@ -0,0 +1,18 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.utils.brightnessctl;
in {
options = {
nixos.utils.brightnessctl.enable = mkEnableOption "Enables brigthnessctl";
};
config = mkIf cfg.enable {
environment.systemPackages = [
pkgs.brightnessctl
];
};
}

View File

@@ -0,0 +1,64 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption mkOption mkMerge;
cfg = config.nixos.utils.chaotic;
in {
options = {
nixos.utils.chaotic = {
enable = mkEnableOption "Enables Chaotic AUR packages";
amd.enable = mkOption {
type = lib.types.bool;
default = false;
description = "Whether to install AMD-specific settings.";
};
};
};
config = mkIf cfg.enable (mkMerge [
{
chaotic.scx.enable = true;
}
(mkIf cfg.amd.enable {
# AMD-specific configuration
chaotic = {
scx.scheduler = "scx_lavd";
mesa-git = {
enable = true;
extraPackages = with pkgs; [
libva
libvdpau-va-gl
vaapiVdpau
libdrm_git
latencyflex-vulkan
mesa_git
mesa_git.opencl
vulkanPackages_latest.gfxreconstruct
vulkanPackages_latest.spirv-cross
vulkanPackages_latest.spirv-headers
vulkanPackages_latest.spirv-tools
vulkanPackages_latest.vulkan-extension-layer
vulkanPackages_latest.vulkan-headers
vulkanPackages_latest.vulkan-loader
vulkanPackages_latest.vulkan-tools
vulkanPackages_latest.vulkan-tools-lunarg
vulkanPackages_latest.vulkan-utility-libraries
vulkanPackages_latest.vulkan-validation-layers
vulkanPackages_latest.vulkan-volk
];
extraPackages32 = with pkgs.pkgsi686Linux; [
pkgs.mesa32_git
pkgs.mesa32_git.opencl
libdrm32_git
libva
libvdpau-va-gl
vaapiVdpau
];
};
};
})
]);
}

View File

@@ -0,0 +1,21 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.utils.corectrl;
in {
options = {
nixos.utils.corectrl.enable = mkEnableOption "Enables CoreCtrl";
};
config = mkIf cfg.enable {
programs.corectrl = {
enable = true;
gpuOverclock = {
enable = true;
ppfeaturemask = "0xffffffff";
};
};
};
}

View File

@@ -0,0 +1,16 @@
{
config,
lib,
inputs,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.utils.microfetch;
in {
options = {
nixos.utils.microfetch.enable = mkEnableOption "Enables microfetch";
};
config = mkIf cfg.enable {
environment.systemPackages = [inputs.microfetch.packages.x86_64-linux.default];
};
}

View File

@@ -0,0 +1,33 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption mkOption mkMerge;
cfg = config.nixos.utils.misc;
in {
options = {
nixos.utils.misc = {
enable = mkEnableOption "Enables miscellaneous packages";
desktop.enable = mkOption {
type = lib.types.bool;
default = false;
description = "Whether to install desktop-specific packages.";
};
};
};
config = mkIf cfg.enable {
environment.systemPackages = mkMerge [
[
pkgs.nodejs_22
pkgs.tree
]
(mkIf cfg.desktop.enable [
pkgs.protonup
pkgs.winetricks
])
];
};
}

View File

@@ -0,0 +1,33 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption mkOption;
cfg = config.nixos.utils.nh;
in {
options = {
nixos.utils.nh = {
enable = mkEnableOption "Enables nix helper";
clean = {
enable = mkEnableOption "Enables nix helper cleaning";
extraArgs = mkOption {
type = lib.types.str;
description = "Extra arguments for the clean command";
default = "";
};
};
};
};
config = mkIf cfg.enable {
programs = {
nh = {
enable = cfg.enable;
clean = {
enable = cfg.clean.enable;
extraArgs = cfg.clean.extraArgs;
};
};
};
};
}

View File

@@ -0,0 +1,17 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.utils.npm;
in {
options = {
nixos.utils.npm.enable = mkEnableOption "Enables npm";
};
config = mkIf cfg.enable {
programs.npm = {
enable = true;
};
};
}

View File

@@ -0,0 +1,18 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.utils.obsidian;
in {
options = {
nixos.utils.obsidian.enable = mkEnableOption "Enables obsidian";
};
config = mkIf cfg.enable {
environment.systemPackages = [
pkgs.obsidian
];
};
}

View File

@@ -0,0 +1,22 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.utils.yubikey;
in {
options = {
nixos.utils.yubikey.enable = mkEnableOption "Enables yubikey utilities";
};
config = mkIf cfg.enable {
environment.systemPackages = [
pkgs.yubioath-flutter
pkgs.yubikey-manager
pkgs.yubikey-personalization
pkgs.yubikey-personalization-gui
pkgs.pcsc-tools
];
};
}

View File

@@ -0,0 +1,15 @@
{
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption;
cfg = config.nixos.utils.zsh;
in {
options = {
nixos.utils.zsh.enable = mkEnableOption "Enables zsh shell";
};
config = mkIf cfg.enable {
programs.zsh.enable = cfg.enable;
};
}