Add tons of missing system, desktop and home modules

This commit is contained in:
Jo 2025-04-28 20:02:05 +02:00
parent 01367c4222
commit fa3bbb2f6f
15 changed files with 453 additions and 7 deletions

View file

@ -0,0 +1,27 @@
{
lib,
self,
config,
...
}: let
inherit (lib) mkEnableOption mkIf;
inherit (self) namespace;
cfg = config.${namespace}.system.audio;
in {
options.${namespace}.system.audio = {
enable = mkEnableOption "system audio support.";
};
config = mkIf cfg.enable {
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
};
}

View file

@ -0,0 +1,36 @@
{
lib,
pkgs,
self,
config,
...
}: let
inherit (lib) mkEnableOption mkIf;
inherit (self) namespace;
cfg = config.${namespace}.system.bluetooth;
in {
options.${namespace}.system.bluetooth = {
enable = mkEnableOption "bluetooth support.";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [bluez];
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
package = pkgs.bluez;
settings = {
General = {
ControllerMode = "dual";
FastConnectable = "true";
Experimental = "true";
KernelExperimental = "true";
Disable = "Handsfree";
};
};
};
};
}

View file

@ -0,0 +1,28 @@
{
lib,
pkgs,
self,
config,
...
}: let
inherit (lib) mkEnableOption mkIf mkOption;
inherit (self) namespace;
cfg = config.${namespace}.system.fonts;
in {
options.${namespace}.system.fonts = with lib.types; {
enable = mkEnableOption "system font management";
fonts = mkOption {
type = listOf package;
default = with pkgs; [noto-fonts noto-fonts-cjk-sans noto-fonts-cjk-serif noto-fonts-emoji nerd-fonts.bigblue-terminal nerd-fonts.zed-mono monocraft];
example = [noto-fonts noto-fonts-emoji];
description = "Install additional font packages";
};
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [font-manager];
fonts.packages = cfg.fonts;
};
}

View file

@ -0,0 +1,58 @@
{
lib,
self,
config,
...
}: let
inherit (lib) mkEnableOption mkIf mkOption;
inherit (self) namespace;
cfg = config.${namespace}.system.locale;
in {
options.${namespace}.system.locale = {
enable = mkEnableOption "system locale tweaks.";
language = mkOption {
type = lib.types.str;
default = "en_US";
example = "en_US";
description = "Sets the language for most text, doesn't include monetary or measurement settings";
};
country = mkOption {
type = lib.types.str;
default = "de_DE";
example = "de_DE";
description = "Sets the language used for monetary or measurement settings (USD vs Euro, etc...)";
};
keymap = mkOption {
type = lib.types.str;
default = "de";
example = "de";
description = "Sets the keymap to be used by the system";
};
};
config = mkIf cfg.enable {
# Internationalisation properties.
i18n.defaultLocale = "${cfg.language}.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "${cfg.country}.UTF-8";
LC_IDENTIFICATION = "${cfg.country}.UTF-8";
LC_MEASUREMENT = "${cfg.country}.UTF-8";
LC_MONETARY = "${cfg.country}.UTF-8";
LC_NAME = "${cfg.country}.UTF-8";
LC_NUMERIC = "${cfg.country}.UTF-8";
LC_PAPER = "${cfg.country}.UTF-8";
LC_TELEPHONE = "${cfg.country}.UTF-8";
LC_TIME = "${cfg.country}.UTF-8";
};
# Set console keymap.
console.keyMap = cfg.keymap;
services.xserver = {
xkb.layout = cfg.keymap;
};
};
}

View file

@ -0,0 +1,50 @@
{
lib,
pkgs,
self,
config,
...
}: let
inherit (lib) mkEnableOption mkIf;
inherit (self) namespace;
cfg = config.${namespace}.system.nix;
in {
options.${namespace}.system.nix = {
enable = mkEnableOption "Nix configuration overrides.";
use-lix = mkEnableOption "Lix as an alternative to CppNix.";
use-nixld = mkEnableOption "the use of dynamically linked executables on nix based systems.";
};
config = mkIf cfg.enable {
nix = {
settings = {
auto-optimise-store = true;
builders-use-substitutes = true;
experimental-features = ["nix-command" "flakes"];
keep-derivations = true;
keep-outputs = true;
max-jobs = "auto";
warn-dirty = false;
};
# Garbage collection configuration.
gc = {
automatic = true;
dates = "daily";
options = "--delete-older-than 3d";
};
package = mkIf cfg.use-lix pkgs.lix; # Enable LIX
};
# Dynamic libraries for unpackaged programs
programs.nix-ld = mkIf cfg.use-nixld {
enable = true;
libraries = with pkgs; [
glibc
libcxx
];
};
};
}

View file

@ -0,0 +1,25 @@
{
lib,
pkgs,
self,
config,
...
}: let
inherit (lib) mkEnableOption mkIf types;
inherit (self) namespace;
inherit (self.lib) mkOpt;
cfg = config.${namespace}.system.shell;
in {
options.${namespace}.system.shell = {
enable = mkEnableOption "custom user shells.";
installed = mkOpt types.listOf types.package [pkgs.fish] "List of shell packages to install";
default = mkOpt types.str "fish" "Set a custom shell as the default for all users.";
};
config = mkIf cfg.enable {
environment.shells = cfg.installed;
users.defaultUserShell = pkgs.${cfg.shell.type};
programs.${cfg.shell.type}.enable = true;
};
}