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,73 @@
{
lib,
pkgs,
self,
config,
osConfig,
...
}: let
inherit (lib) mkEnableOption mkIf;
inherit (self) namespace;
cfg = config.${namespace}.apps.zed;
in {
options.${namespace}.apps.zed = {
enable = mkEnableOption "zed, the graphical editor from the future";
};
config = mkIf cfg.enable {
sops.secrets.wakatime-cfg = {
format = "binary";
sopsFile = "${self.outPath}/${osConfig.networking.hostname}/secrets/wakatime.cfg";
path = "/home/${config.home.homeDirectory}/.wakatime.cfg";
};
home.packages = with pkgs; [
alejandra
];
programs.zed-editor = {
enable = true;
extensions = ["nix" "catppuccin" "wakatime" "discord_presence" "deno"];
userSettings = {
icon_theme = "Catppuccin Macchiato";
theme = {
dark = "Catppuccin Macchiato (blue)";
light = "Catppuccin Macchiato (blue)";
};
### Disable telemetry
telemetry = {
metrics = false;
};
### Disable certain AI features
features = {
copilot = false;
};
### Language specific configurations
languages = {
### Nix language
Nix = {
language_servers = ["nixd" "!nil"];
};
};
### LSP configurations
lsp = {
nixd = {
initialization_options = {
formatting = {
command = ["alejandra" "--quiet" "--"];
};
};
};
};
};
extraPackages = with pkgs; [nixd];
};
};
}

View file

@ -1,2 +0,0 @@
{...}: {
}

View file

@ -0,0 +1,91 @@
{
lib,
pkgs,
self,
config,
osConfig,
...
}: let
inherit (lib) mkIf mkOption;
inherit (self) namespace;
inherit (self.lib) mkOpt;
cfg = config.${namespace}.desktop.gnome;
in {
options.${namespace}.desktop.gnome = with lib.types; {
enabled-extensions = mkOption {
type = listOf package;
default = with pkgs.gnomeExtensions; [user-themes blur-my-shell appindicator unite color-picker clipboard-history];
example = [dash-to-dock blur-my-shell];
description = "Specify gnome extensions to install.";
};
favorite-apps = mkOption {
type = listOf str;
default = ["org.gnome.Nautilus.desktop" "obsidian.desktop" "firefox.desktop" "dev.zed.Zed.desktop"];
example = ["org.gnome.Nautilus.desktop" "obsidian.desktop"];
description = "Specify your favorite apps (sorted left to right).";
};
extensions = {
unite = {
show-window-buttons = mkOption {
type = str;
default = "never";
example = "never | maximized | tiled | both | always";
description = "Specify when Unite should display window buttons within the top panel.";
};
hide-window-titlebars = mkOption {
type = str;
default = "maximized";
example = "never | maximized | tiled | both | always";
description = "Specify when Unite should hide window titlebars.";
};
};
blur-my-shell = {
enable-blur = mkOpt bool false "Whether to enable blur-my-shell application blur.";
};
};
wallpaper = mkOpt str (builtins.toString ../wallpapers/mountain_tower_sunset.jpg) "Specify the path of your prefered Gnome wallpaper.";
};
config = mkIf osConfig.${namespace}.desktop.gnome.enable {
home.packages = cfg.enabled-extensions;
dconf.settings = {
"org/gnome/shell" = {
favorite-apps = cfg.favorite-apps;
enabled-extensions = lib.forEach cfg.enabled-extensions (x: x.extensionUuid);
disabled-extensions = []; # Make sure none of our extensions are disabled on system rebuild
};
"org/gnome/shell/extensions/unite" = mkIf (builtins.elem pkgs.gnomeExtensions.unite cfg.enabled-extensions) {
show-window-buttons = cfg.extensions.unite.show-window-buttons;
hide-window-titlebars = cfg.extensions.unite.hide-window-titlebars;
use-activities-text = false;
extend-left-box = false;
reduce-panel-spacing = false;
show-legacy-tray = false;
show-appmenu-button = false;
show-desktop-name = false;
enable-titlebar-actions = false;
restrict-to-primary-screen = false;
hide-activities-button = "never";
autofocus-windows = true;
notifications-position = "right";
};
"org/gnome/shell/extensions/blur-my-shell/applications" = mkIf cfg.extensions.blur-my-shell.enable-blur {
blur = true;
sigma = 30;
opacity = 230;
enable-all = true;
dynamic-opacity = false;
};
"org/gnome/desktop/background" = {
picture-uri = cfg.wallpaper;
picture-uri-dark = cfg.wallpaper;
};
"org/gnome/desktop/interface" = {
color-scheme = "prefer-dark";
};
};
};
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

View file

@ -0,0 +1,24 @@
{
lib,
self,
config,
...
}: let
inherit (lib) mkEnableOption mkIf;
inherit (self) namespace;
cfg = config.${namespace}.archetypes.laptop;
in {
options.${namespace}.archetypes.laptop = {
enable = mkEnableOption "the laptop archetype.";
};
config = mkIf cfg.enable {
${namespace} = {
# Inherit from workstation archetype
archetypes.workstation.enable = true;
};
hardware.sensor.iio.enable = true; # Enable iio-sensor for automatic screen rotation and similar features.
};
}

View file

@ -16,9 +16,20 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
${namespace} = { ${namespace} = {
# Basic system functionality # Basic system functionality
system.grub.enable = true; system = {
system.networking.enable = true; networking.enable = true;
system.kernel.enable = true; grub.enable = true;
shell.enable = true;
locale.enable = true;
fonts.enable = true;
bluetooth.enable = true;
audio.enable = true;
kernel.enable = true;
nix = {
enable = true;
use-lix = true;
};
};
# Services # Services
services.docker.enable = true; services.docker.enable = true;

View file

@ -1,7 +1,8 @@
{ {
lib, lib,
config, pkgs,
self, self,
config,
... ...
}: let }: let
inherit (lib) mkEnableOption mkIf; inherit (lib) mkEnableOption mkIf;
@ -17,5 +18,29 @@ in {
services.xserver.enable = true; services.xserver.enable = true;
services.xserver.displayManager.gdm.enable = true; services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true; services.xserver.desktopManager.gnome.enable = true;
environment.gnome.excludePackages = with pkgs; [
gnome-tour
gedit
cheese
geary
yelp # Help view
epiphany # Gnome web
gnome-console
gnome-terminal
gnome-music
hitori # Sudoku game
gnome-contacts
gnome-initial-setup
gnome-system-monitor
];
programs.dconf.enable = true;
services.gnome.gnome-keyring.enable = true;
environment.systemPackages = with pkgs; [
gnome-tweaks
resources
];
}; };
} }

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;
};
}

View file

@ -16,7 +16,7 @@
extraGroups = ["wheel"]; extraGroups = ["wheel"];
}; };
archetypes.workstation.enable = true; archetypes.laptop.enable = true;
}; };
# Configure 8GB SWAP partition # Configure 8GB SWAP partition