From 6a9de226ef13c7637435b0ad25c3752a02077772 Mon Sep 17 00:00:00 2001 From: gytic <149968794+gytic@users.noreply.github.com> Date: Fri, 25 Jul 2025 18:04:18 +0200 Subject: [PATCH] feat(nixos-95): extract DE themining into nixosModule the desktop environment can be included via `self.nixosModules.nixos95` this will expose two options (for now): nixos95.enable -> enable the desktop environment nixos95.wallpaper -> path to the wallpaper to use currently the setup is closy coupled to this configuration, which will change in the future, so it can be used with any configuration --- .../Hosts/Default/configuration.nix | 36 ++------- Configurations/Hosts/Default/home/home.nix | 3 - Modules/Desktops/XFCE-retro/default.nix | 79 ------------------- README.md | 12 ++- flake.nix | 3 + nixos95/core.nix | 22 ++++++ nixos95/default.nix | 24 ++++++ nixos95/desktop.nix | 35 ++++++++ .../dotfiles}/launcher-13/brave.desktop | 0 .../dotfiles}/launcher-14/signal.desktop | 0 .../dotfiles}/launcher-15/obsidian.desktop | 0 .../dotfiles}/launcher-16/spotify.desktop | 0 .../dotfiles}/xfce4-desktop.xml | 4 +- .../dotfiles}/xfce4-keyboard-shortcuts.xml | 0 .../dotfiles}/xfce4-panel.xml | 0 .../dotfiles}/xfce4-sessions.xml | 0 .../Dotfiles => nixos95/dotfiles}/xfwm4.xml | 0 .../dotfiles}/xsettings.xml | 0 nixos95/keybinds.nix | 20 +++++ nixos95/taskbar.nix | 30 +++++++ nixos95/theme.nix | 35 ++++++++ 21 files changed, 185 insertions(+), 118 deletions(-) delete mode 100644 Modules/Desktops/XFCE-retro/default.nix create mode 100644 nixos95/core.nix create mode 100644 nixos95/default.nix create mode 100644 nixos95/desktop.nix rename {Modules/Desktops/XFCE-retro/Dotfiles => nixos95/dotfiles}/launcher-13/brave.desktop (100%) rename {Modules/Desktops/XFCE-retro/Dotfiles => nixos95/dotfiles}/launcher-14/signal.desktop (100%) rename {Modules/Desktops/XFCE-retro/Dotfiles => nixos95/dotfiles}/launcher-15/obsidian.desktop (100%) rename {Modules/Desktops/XFCE-retro/Dotfiles => nixos95/dotfiles}/launcher-16/spotify.desktop (100%) rename {Modules/Desktops/XFCE-retro/Dotfiles => nixos95/dotfiles}/xfce4-desktop.xml (85%) rename {Modules/Desktops/XFCE-retro/Dotfiles => nixos95/dotfiles}/xfce4-keyboard-shortcuts.xml (100%) rename {Modules/Desktops/XFCE-retro/Dotfiles => nixos95/dotfiles}/xfce4-panel.xml (100%) rename {Modules/Desktops/XFCE-retro/Dotfiles => nixos95/dotfiles}/xfce4-sessions.xml (100%) rename {Modules/Desktops/XFCE-retro/Dotfiles => nixos95/dotfiles}/xfwm4.xml (100%) rename {Modules/Desktops/XFCE-retro/Dotfiles => nixos95/dotfiles}/xsettings.xml (100%) create mode 100644 nixos95/keybinds.nix create mode 100644 nixos95/taskbar.nix create mode 100644 nixos95/theme.nix diff --git a/Configurations/Hosts/Default/configuration.nix b/Configurations/Hosts/Default/configuration.nix index 8df8f3e..197a190 100644 --- a/Configurations/Hosts/Default/configuration.nix +++ b/Configurations/Hosts/Default/configuration.nix @@ -23,48 +23,24 @@ in { # Home Manager integration inputs.home-manager.nixosModules.home-manager + # nixos95 + inputs.self.nixosModules.nixos95 + ]; ################################################################ # Display & Desktop Environment ################################################################ - services.xserver = { + nixos95 = { enable = true; - desktopManager.xfce.enable = true; - xkb = { - layout = "de"; - variant = ""; - }; + user = username; }; - services.xserver.displayManager.lightdm.enable = false; - - services.displayManager.sddm = { - enable = true; - package = pkgs.qt6Packages.sddm; - }; - - xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; - ################################################################ # System Packages (XFCE & Utilities) ################################################################ environment.systemPackages = with pkgs; [ - xdg-desktop-portal-gtk - - # XFCE Core - xfce.xfwm4 - xfce.xfce4-panel - xfce.xfce4-session - xfce.xfce4-settings - xfce.thunar - xfce.mousepad - xfce.xfce4-terminal - xfce.xfce4-appfinder - xfce.xfce4-power-manager - xfce.xfce4-notifyd - xfce.xfce4-whiskermenu-plugin # Optional Extras xfce.gigolo @@ -136,4 +112,4 @@ in { ################################################################ system.stateVersion = "25.05"; -} \ No newline at end of file +} diff --git a/Configurations/Hosts/Default/home/home.nix b/Configurations/Hosts/Default/home/home.nix index 7c4a2a1..c81b378 100644 --- a/Configurations/Hosts/Default/home/home.nix +++ b/Configurations/Hosts/Default/home/home.nix @@ -24,9 +24,6 @@ in { # All Home Manager Modules ../../../../Modules/Applications - # Extended Retro theme - ../../../../Modules/Desktops/XFCE-retro - # Desktop applications ./desktop.nix ]; diff --git a/Modules/Desktops/XFCE-retro/default.nix b/Modules/Desktops/XFCE-retro/default.nix deleted file mode 100644 index c561c3a..0000000 --- a/Modules/Desktops/XFCE-retro/default.nix +++ /dev/null @@ -1,79 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: let - - chicago95 = pkgs.callPackage ../../../Ressources/Themes/Chicago95/chicago95.nix {}; - dotfilesPath = ./Dotfiles; - resourcesPath = ../../../Ressources; - wallpaperFile = "Wallpaper/NixOS-95-wallpaper.png"; - wallpaperPath = "${config.home.homeDirectory}/${wallpaperFile}"; - wallpaperOrigin = "${resourcesPath}/Images/Wallpapers/Wallpaper-1.png"; - dotfiles = "${dotfilesPath}"; -in { - gtk = { - enable = true; - theme = { - name = "Chicago95"; - package = chicago95; - }; - iconTheme = { - name = "Win95_plus"; - package = pkgs.callPackage ../../../Ressources/Themes/Win95_plus/win95_plus.nix {}; - }; - cursorTheme = { - name = "Chicago95"; - package = chicago95; - }; - font = { - name = "Sans"; - size = 12; - }; - }; - - home.pointerCursor = { - name = "Chicago95"; - package = chicago95; - size = 24; - gtk.enable = true; - x11.enable = true; - }; - - home.packages = with pkgs; [ - xfce.xfce4-panel - xfce.xfconf - xfce.xfdesktop - xfce.xfce4-whiskermenu-plugin - xfce.xfce4-docklike-plugin - xorg.xrandr - ]; - - home.file = { - "${wallpaperFile}" = { - source = wallpaperOrigin; - }; - }; - - xdg.configFile = { - "xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml".source = "${dotfiles}/xfce4-desktop.xml"; - "xfce4/xfconf/xfce-perchannel-xml/xfce4-sessions.xml".source = "${dotfiles}/xfce4-sessions.xml"; - "xfce4/xfconf/xfce-perchannel-xml/xsettings.xml".source = "${dotfiles}/xsettings.xml"; - "xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml".source = "${dotfiles}/xfwm4.xml"; - "xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml".source = "${dotfiles}/xfce4-keyboard-shortcuts.xml"; - - # Panel: - "xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml".source = "${dotfiles}/xfce4-panel.xml"; - "xfce4/panel/launcher-13/brave.desktop".source = "${dotfiles}/launcher-13/brave.desktop"; - "xfce4/panel/launcher-14/signal.desktop".source = "${dotfiles}/launcher-14/signal.desktop"; - "xfce4/panel/launcher-15/obsidian.desktop".source = "${dotfiles}/launcher-15/obsidian.desktop"; - "xfce4/panel/launcher-16/spotify.desktop".source = "${dotfiles}/launcher-16/spotify.desktop"; - - - }; - - home.activation.applyXfceTweaks = lib.hm.dag.entryAfter ["writeBoundary"] '' - ${pkgs.xfce.xfdesktop}/bin/xfdesktop --reload - ''; -} diff --git a/README.md b/README.md index cf8f3ad..e6f3eda 100644 --- a/README.md +++ b/README.md @@ -40,11 +40,15 @@ NixOS-95/ │ └── user-vars.nix ├── Modules/ │ ├── Applications/ -│ ├── Desktops/ -│ │ └── XFCE-retro/ -│ │ ├── default.nix -│ │ └── Dotfiles/ │ └── System/ +├── nixos95 +│   ├── dotfiles/ +│   ├── core.nix +│   ├── default.nix +│   ├── desktop.nix +│   ├── keybinds.nix +│   ├── taskbar.nix +│   └── theme.nix ├── Ressources/ │ ├── Icons/ │ ├── Images/ diff --git a/flake.nix b/flake.nix index 8e08c98..2950a72 100644 --- a/flake.nix +++ b/flake.nix @@ -23,6 +23,9 @@ home-manager, ... }: { + + nixosModules.nixos95 = import ./nixos95; + nixosConfigurations = { ############################################################ # 💻 Default Host diff --git a/nixos95/core.nix b/nixos95/core.nix new file mode 100644 index 0000000..5695274 --- /dev/null +++ b/nixos95/core.nix @@ -0,0 +1,22 @@ +{ config, lib, pkgs, ... }: let + cfg = config.nixos95; +in lib.mkIf cfg.enable { + + services.xserver = { + enable = true; + desktopManager.xfce.enable = true; + xkb = { + layout = "de"; + variant = ""; + }; + }; + services.xserver.displayManager.lightdm.enable = false; + + services.displayManager.sddm = { + enable = true; + package = pkgs.qt6Packages.sddm; + }; + + xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + +} diff --git a/nixos95/default.nix b/nixos95/default.nix new file mode 100644 index 0000000..744b77b --- /dev/null +++ b/nixos95/default.nix @@ -0,0 +1,24 @@ +{ config, lib, ...}: let + cfg = config.nixos95; +in { + + options.nixos95 = { + enable = lib.mkEnableOption "NixOS-95 Desktop environment"; + user = lib.mkOption { + description = '' + Username of the home-manager user. + ''; + type = lib.types.str; + example = "user"; + }; + }; + + imports = [ + ./core.nix + ./desktop.nix + ./keybinds.nix + ./taskbar.nix + ./theme.nix + ]; + +} diff --git a/nixos95/desktop.nix b/nixos95/desktop.nix new file mode 100644 index 0000000..9cfd47e --- /dev/null +++ b/nixos95/desktop.nix @@ -0,0 +1,35 @@ +{ inputs, config, lib, pkgs, ... }: let + cfg = config.nixos95; +in { + + options.nixos95 = { + + wallpaper = lib.mkOption { + description = "The wallpaper to use"; + type = lib.types.path; + default = "${inputs.self}/Ressources/Images/Wallpapers/Wallpaper-1.png"; + }; + + }; + + config = lib.mkIf cfg.enable { + + home-manager.users.${cfg.user} = { + + xdg.configFile = { + "xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml" = let + sed = lib.getExe pkgs.gnused; + desktop = pkgs.runCommand "desktop.xml" { } '' + ${sed} -e "s|NIXOS-95_WALLPAPER|${cfg.wallpaper}|g" ${./dotfiles/xfce4-desktop.xml} > $out + ''; + in { + force = true; + source = desktop; + }; + }; + + }; + + }; + +} diff --git a/Modules/Desktops/XFCE-retro/Dotfiles/launcher-13/brave.desktop b/nixos95/dotfiles/launcher-13/brave.desktop similarity index 100% rename from Modules/Desktops/XFCE-retro/Dotfiles/launcher-13/brave.desktop rename to nixos95/dotfiles/launcher-13/brave.desktop diff --git a/Modules/Desktops/XFCE-retro/Dotfiles/launcher-14/signal.desktop b/nixos95/dotfiles/launcher-14/signal.desktop similarity index 100% rename from Modules/Desktops/XFCE-retro/Dotfiles/launcher-14/signal.desktop rename to nixos95/dotfiles/launcher-14/signal.desktop diff --git a/Modules/Desktops/XFCE-retro/Dotfiles/launcher-15/obsidian.desktop b/nixos95/dotfiles/launcher-15/obsidian.desktop similarity index 100% rename from Modules/Desktops/XFCE-retro/Dotfiles/launcher-15/obsidian.desktop rename to nixos95/dotfiles/launcher-15/obsidian.desktop diff --git a/Modules/Desktops/XFCE-retro/Dotfiles/launcher-16/spotify.desktop b/nixos95/dotfiles/launcher-16/spotify.desktop similarity index 100% rename from Modules/Desktops/XFCE-retro/Dotfiles/launcher-16/spotify.desktop rename to nixos95/dotfiles/launcher-16/spotify.desktop diff --git a/Modules/Desktops/XFCE-retro/Dotfiles/xfce4-desktop.xml b/nixos95/dotfiles/xfce4-desktop.xml similarity index 85% rename from Modules/Desktops/XFCE-retro/Dotfiles/xfce4-desktop.xml rename to nixos95/dotfiles/xfce4-desktop.xml index 8c8d4cb..f74c768 100644 --- a/Modules/Desktops/XFCE-retro/Dotfiles/xfce4-desktop.xml +++ b/nixos95/dotfiles/xfce4-desktop.xml @@ -5,13 +5,13 @@ - + - + diff --git a/Modules/Desktops/XFCE-retro/Dotfiles/xfce4-keyboard-shortcuts.xml b/nixos95/dotfiles/xfce4-keyboard-shortcuts.xml similarity index 100% rename from Modules/Desktops/XFCE-retro/Dotfiles/xfce4-keyboard-shortcuts.xml rename to nixos95/dotfiles/xfce4-keyboard-shortcuts.xml diff --git a/Modules/Desktops/XFCE-retro/Dotfiles/xfce4-panel.xml b/nixos95/dotfiles/xfce4-panel.xml similarity index 100% rename from Modules/Desktops/XFCE-retro/Dotfiles/xfce4-panel.xml rename to nixos95/dotfiles/xfce4-panel.xml diff --git a/Modules/Desktops/XFCE-retro/Dotfiles/xfce4-sessions.xml b/nixos95/dotfiles/xfce4-sessions.xml similarity index 100% rename from Modules/Desktops/XFCE-retro/Dotfiles/xfce4-sessions.xml rename to nixos95/dotfiles/xfce4-sessions.xml diff --git a/Modules/Desktops/XFCE-retro/Dotfiles/xfwm4.xml b/nixos95/dotfiles/xfwm4.xml similarity index 100% rename from Modules/Desktops/XFCE-retro/Dotfiles/xfwm4.xml rename to nixos95/dotfiles/xfwm4.xml diff --git a/Modules/Desktops/XFCE-retro/Dotfiles/xsettings.xml b/nixos95/dotfiles/xsettings.xml similarity index 100% rename from Modules/Desktops/XFCE-retro/Dotfiles/xsettings.xml rename to nixos95/dotfiles/xsettings.xml diff --git a/nixos95/keybinds.nix b/nixos95/keybinds.nix new file mode 100644 index 0000000..06b92ed --- /dev/null +++ b/nixos95/keybinds.nix @@ -0,0 +1,20 @@ +/** +* For now this just hard copies the config file. +* This can be improved by allowing users to define there own keybinds +*/ +{ config, lib, ... }: let + cfg = config.nixos95; +in lib.mkIf cfg.enable { + + home-manager.users.${cfg.user} = { + + xdg.configFile = { + "xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml" = { + force = true; + source = ./dotfiles/xfce4-keyboard-shortcuts.xml; + }; + }; + + }; + +} diff --git a/nixos95/taskbar.nix b/nixos95/taskbar.nix new file mode 100644 index 0000000..1c74c8b --- /dev/null +++ b/nixos95/taskbar.nix @@ -0,0 +1,30 @@ +/** +* For now this just hard copies the config file. +* This can be improved by allowing users to define there own task bar config +*/ +{ config, lib, pkgs, ... }: let + cfg = config.nixos95; +in lib.mkIf cfg.enable { + + environment.systemPackages = [ + pkgs.xfce.xfce4-whiskermenu-plugin + ]; + + home-manager.users.${cfg.user} = { + + xdg.configFile = { + "xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml" = { + force = true; + source = ./dotfiles/xfce4-panel.xml; + }; + + # Panel: + "xfce4/panel/launcher-13/brave.desktop".source = ./dotfiles/launcher-13/brave.desktop; + "xfce4/panel/launcher-14/signal.desktop".source = ./dotfiles/launcher-14/signal.desktop; + "xfce4/panel/launcher-15/obsidian.desktop".source = ./dotfiles/launcher-15/obsidian.desktop; + "xfce4/panel/launcher-16/spotify.desktop".source = ./dotfiles/launcher-16/spotify.desktop; + }; + + }; + +} diff --git a/nixos95/theme.nix b/nixos95/theme.nix new file mode 100644 index 0000000..e0436a9 --- /dev/null +++ b/nixos95/theme.nix @@ -0,0 +1,35 @@ +{ inputs, config, lib, pkgs, ... }: let + cfg = config.nixos95; + + theme_dir = "${inputs.self}/Ressources/Themes"; + baseTheme = { + name = "Chicago95"; + package = pkgs.callPackage "${theme_dir}/Chicago95/chicago95.nix" { }; + }; + iconTheme = { + name = "Win95_plus"; + package = pkgs.callPackage "${theme_dir}/Win95_plus/win95_plus.nix" { }; + }; +in lib.mkIf cfg.enable { + + home-manager.users.${cfg.user} = { + gtk = { + enable = true; + theme = baseTheme; + iconTheme = iconTheme; + cursorTheme = baseTheme; + font = { + name = "Sans"; + size = 12; + }; + }; + + home.pointerCursor = { + size = 24; + gtk.enable = true; + x11.enable = true; + } // baseTheme; + }; + +} + -- 2.51.2