nixos/jaci/desktop-configuration.nix

233 lines
6.3 KiB
Nix

{
config,
lib,
inputs,
outputs,
pkgs,
timeZone,
system,
...
}:
let
supportedDesktops = [ "niri" ];
supportedDesktopsStr = lib.strings.concatStringsSep ", " supportedDesktops;
deskCfg = config.deskCfg;
in
{
options.deskCfg = {
de = lib.mkOption {
default = "niri";
type = lib.types.str;
description = "Desktop Environment";
};
userName = lib.mkOption {
type = lib.types.str;
description = "Main username for system";
};
hostName = lib.mkOption {
type = lib.types.str;
description = "Hostname for system";
};
fullName = lib.mkOption {
type = lib.types.str;
default = "User";
description = "Full display name for the user";
};
installGaming = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Whether to install gaming software or not";
};
flakePath = lib.mkOption {
type = lib.types.str;
description = "Absolute path to the NixOS flake configuration directory";
};
};
imports = [
../shared/modules/user/main_user.nix
modules/niri/niri_conf.nix
../shared/modules/system/power_manager.nix
../shared/modules/system/noctalia-system.nix
];
config = {
assertions = [
{
assertion = builtins.elem deskCfg.de supportedDesktops;
message = "Unsupported desktop environment: ${deskCfg.de}\nSupported DE's: ${supportedDesktopsStr}";
}
];
# Stylix theming - auto-generated light theme from wallpaper
stylix = {
enable = true;
# image = ./kiki_background.jpg;
base16Scheme = "${pkgs.base16-schemes}/share/themes/rose-pine-dawn.yaml";
polarity = "light";
# System-wide cursor
cursor = {
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Classic";
size = 32;
};
# Fonts
fonts = {
serif = {
package = pkgs.lato;
name = "Lato";
};
sansSerif = {
package = pkgs.lato;
name = "Lato";
};
monospace = {
package = pkgs.maple-mono.NF;
name = "Maple Mono NF";
};
emoji = {
package = pkgs.noto-fonts-color-emoji;
name = "Noto Color Emoji";
};
sizes = {
applications = 14;
desktop = 14;
popups = 14;
terminal = 14;
};
};
# Icon theme for tray applets (nm-applet, etc.)
# Note: "Reversal-dark" has dark icons (for light backgrounds)
# "Reversal" has light icons (for dark backgrounds)
iconTheme = {
enable = true;
package = pkgs.reversal-icon-theme;
light = "Reversal-dark";
dark = "Reversal";
};
targets = {
# Disable plymouth styling (use custom)
plymouth.enable = false;
};
};
nixpkgs.overlays = [
inputs.nur.overlays.default
];
# Intel graphics acceleration (Framework 12)
hardware.graphics.enable = true;
hardware.enableRedistributableFirmware = true;
# Enable flakes feature
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
nixpkgs.config.allowUnfree = true;
boot = {
plymouth = {
enable = true;
theme = "kiki-pixel"; # Options: "kiki" or "kiki-pixel" (pixel art)
themePackages = [
(pkgs.runCommand "plymouth-kiki-theme" { } ''
mkdir -p $out/share/plymouth/themes/kiki
cp -r ${./kiki-plymouth-theme/kiki}/* $out/share/plymouth/themes/kiki/
substituteInPlace $out/share/plymouth/themes/kiki/kiki.plymouth \
--replace-fail "@IMAGEDIR@" "$out/share/plymouth/themes/kiki"
# substituteInPlace $out/share/plymouth/themes/kiki/kiki.script \
# --replace-fail "@IMAGEDIR@" "$out/share/plymouth/themes/kiki"
'')
(pkgs.runCommand "plymouth-kiki-pixel-theme" { } ''
mkdir -p $out/share/plymouth/themes/kiki-pixel
cp -r ${./kiki-plymouth-theme/kiki-pixel}/* $out/share/plymouth/themes/kiki-pixel/
substituteInPlace $out/share/plymouth/themes/kiki-pixel/kiki-pixel.plymouth \
--replace-fail "@IMAGEDIR@" "$out/share/plymouth/themes/kiki-pixel"
# substituteInPlace $out/share/plymouth/themes/kiki-pixel/kiki-pixel.script \
# --replace-fail "@IMAGEDIR@" "$out/share/plymouth/themes/kiki-pixel"
'')
];
};
# Enable systemd in initrd for better LUKS unlocking with Plymouth
initrd.systemd.enable = true;
# Enable "Silent Boot"
consoleLogLevel = 0;
initrd.verbose = false;
kernelParams = [
"quiet"
"splash"
"boot.shell_on_fail"
"loglevel=3"
"rd.systemd.show_status=false"
"rd.udev.log_level=3"
"udev.log_priority=3"
];
# Hide the OS choice for bootloaders.
loader.timeout = 1;
# Use the systemd-boot EFI boot loader.
loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true;
# Use latest kernel packages
kernelPackages = pkgs.linuxPackages_latest;
};
networking.hostName = deskCfg.hostName;
networking.networkmanager.enable = true;
networking.wireless.iwd.enable = true;
time.timeZone = timeZone;
main_user = {
enable = true;
userName = deskCfg.userName;
fullName = deskCfg.fullName;
isDesktopUser = true;
extraGroups = [ "corectrl" ];
};
power_manager = {
enable = true;
backend = "power-profiles-daemon"; # Required for Noctalia power profile widget
};
# Enable Noctalia shell system services
noctaliaSystem.enable = true;
niriwm = {
enable = true;
useNonFree = true;
user = deskCfg.userName;
installGaming = deskCfg.installGaming;
systemPackages = with pkgs; [
libreoffice
];
};
environment.systemPackages = with pkgs; [
cryptsetup
];
programs.niri.enable = true;
# For electron apps in wayland
environment.sessionVariables.NIXOS_OZONE_WL = "1";
services.greetd = {
enable = true;
settings = rec {
initial_session = {
command = "${pkgs.niri}/bin/niri-session";
user = deskCfg.userName;
};
default_session = initial_session;
};
};
system.stateVersion = "23.11";
};
}