NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor
git clone https://git.daemon-sec.xyz/NixDaemon.git
Log | Files | Refs | README

xfce.nix (3380B)


      1 # modules/features/desktop/xfce.nix — XFCE in Rosé Pine, for VMs without 3D.
      2 #
      3 # OFF unless the generic host sets `desktop = "xfce";` (_settings.nix). The
      4 # full desktop — panel, Whisker menu, Thunar, settings manager — on X11, which
      5 # runs in every hypervisor including VirtualBox and Hyper-V. The shared look
      6 # (greeter, GTK colours, icons, cursor) is x11.nix.
      7 #
      8 # The XFCE side is set through xfconf (home-manager's xfconf.settings), so it
      9 # is applied at login and can still be changed in the settings manager; a
     10 # rebuild puts these values back.
     11 { self, ... }:
     12 {
     13   flake.nixosModules.desktop-xfce =
     14     { pkgs, lib, user, ... }:
     15     let
     16       rp = self.lib.rosePine;
     17       # xfce4-terminal and xfconf both want "#rrggbb" strings.
     18       palette = lib.concatStringsSep ";" [
     19         rp.overlay rp.love rp.pine rp.gold rp.foam rp.iris rp.rose rp.text
     20         rp.muted rp.love rp.pine rp.gold rp.foam rp.iris rp.rose rp.text
     21       ];
     22       # The desktop background is per monitor, and the monitor's name depends
     23       # on the hypervisor's display adapter. These cover VMware, VirtualBox,
     24       # QEMU/virtio and Hyper-V; on real hardware set it once in Desktop
     25       # settings.
     26       monitors = [ "monitorVirtual-1" "monitorVirtual1" "monitorVGA-1" "monitorDP-1" "monitorHDMI-1" "monitor0" ];
     27       backdrop = lib.listToAttrs (lib.concatMap (m: [
     28         { name = "backdrop/screen0/${m}/workspace0/image-style"; value = 0; } # none: colour only
     29         { name = "backdrop/screen0/${m}/workspace0/color-style"; value = 0; } # solid
     30         { name = "backdrop/screen0/${m}/workspace0/rgba1"; value = [ 0.098 0.090 0.141 1.0 ]; } # base #191724
     31       ]) monitors);
     32     in
     33     {
     34       imports = [ self.nixosModules.desktop-x11 ];
     35 
     36       services.xserver.desktopManager.xfce.enable = true;
     37       services.displayManager.defaultSession = "xfce";
     38 
     39       environment.systemPackages = with pkgs; [
     40         xfce4-whiskermenu-plugin
     41         xfce4-pulseaudio-plugin
     42         xfce4-clipman-plugin
     43       ];
     44 
     45       home-manager.users.${user} = {
     46         xfconf.settings = {
     47           xsettings = {
     48             "Net/ThemeName" = "adw-gtk3-dark";
     49             "Net/IconThemeName" = "rose-pine";
     50             "Gtk/CursorThemeName" = "BreezeX-RosePine-Linux";
     51             "Gtk/FontName" = "Inter 10";
     52             "Gtk/MonospaceFontName" = "JetBrainsMono Nerd Font 10";
     53           };
     54           xfwm4 = {
     55             "general/theme" = "Default"; # draws its frame from the GTK colours above
     56             "general/title_font" = "Inter Bold 10";
     57             "general/use_compositing" = false; # cheaper, and VMs rarely accelerate it
     58             "general/workspace_count" = 4;
     59           };
     60           xfce4-desktop = backdrop // {
     61             "desktop-icons/style" = 0; # no icons on the desktop
     62           };
     63           xfce4-terminal = {
     64             "color-use-theme" = false;
     65             "color-foreground" = rp.text;
     66             "color-background" = rp.base;
     67             "color-cursor" = rp.rose;
     68             "color-selection" = rp.text;
     69             "color-selection-background" = rp.hlMed;
     70             "color-palette" = palette;
     71             "font-name" = "JetBrainsMono Nerd Font 11";
     72             "font-use-system" = false;
     73             "scrolling-unlimited" = true;
     74           };
     75           xfce4-session."general/SaveOnExit" = false; # the declared layout, every login
     76         };
     77       };
     78     };
     79 }