Skip to content

Instantly share code, notes, and snippets.

@nat-418
Last active April 11, 2024 16:17
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nat-418/1101881371c9a7b419ba5f944a7118b0 to your computer and use it in GitHub Desktop.
Save nat-418/1101881371c9a7b419ba5f944a7118b0 to your computer and use it in GitHub Desktop.
A sensible NixOS Xfce configuration

A sensible NixOS Xfce Configuration

NixOS provides good support for the Xfce desktop environment out-of-the-box, but the defaults are minimal. The files in this Gist provide a more complete experience, including a suite of basic software and plugins as well as an optional home-manager configuration for theming.

The key additions to the default Xfce provided by NixOS are:

  • Complete bluetooth / audio support with panel indicators and apps
  • LightDM with theme
  • Extra Xfce apps for calendaring, disk partitioning, etc.
  • Various quality-of-life improving non-essentials
{ config, pkgs, lib, ... }:
{
imports = [
./hardware-configuration.nix
./xfce.nix
];
# the rest of your nixos configuration
}
{ config, pkgs, lib, ... }:
{
imports = [
./xfce-home.nix
];
# the rest of your home-manager configuration
}
{ config, pkgs, lib, ... }:
{
gtk = {
enable = true;
iconTheme = {
name = "elementary-Xfce-dark";
package = pkgs.elementary-xfce-icon-theme;
};
theme = {
name = "zukitre-dark";
package = pkgs.zuki-themes;
};
gtk3.extraConfig = {
Settings = ''
gtk-application-prefer-dark-theme=1
'';
};
gtk4.extraConfig = {
Settings = ''
gtk-application-prefer-dark-theme=1
'';
};
};
programs.gpg.enable = true;
services.gpg-agent.enable = true;
}
{ pkgs, ... }:
{
environment = {
systemPackages = with pkgs; [
blueman
chromium
deja-dup
drawing
elementary-xfce-icon-theme
evince
firefox
foliate
font-manager
gimp-with-plugins
gnome.file-roller
gnome.gnome-disk-utility
inkscape-with-extensions
libqalculate
libreoffice
orca
pavucontrol
qalculate-gtk
thunderbird
wmctrl
xclip
xcolor
xcolor
xdo
xdotool
xfce.catfish
xfce.gigolo
xfce.orage
xfce.xfburn
xfce.xfce4-appfinder
xfce.xfce4-clipman-plugin
xfce.xfce4-cpugraph-plugin
xfce.xfce4-dict
xfce.xfce4-fsguard-plugin
xfce.xfce4-genmon-plugin
xfce.xfce4-netload-plugin
xfce.xfce4-panel
xfce.xfce4-pulseaudio-plugin
xfce.xfce4-systemload-plugin
xfce.xfce4-weather-plugin
xfce.xfce4-whiskermenu-plugin
xfce.xfce4-xkb-plugin
xfce.xfdashboard
xorg.xev
xsel
xtitle
xwinmosaic
zuki-themes
];
};
hardware = {
bluetooth.enable = true;
};
programs = {
dconf.enable = true;
gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
thunar = {
enable = true;
plugins = with pkgs.xfce; [
thunar-archive-plugin
thunar-media-tags-plugin
thunar-volman
];
};
};
security.pam.services.gdm.enableGnomeKeyring = true;
services = {
blueman.enable = true;
gnome.gnome-keyring.enable = true;
pipewire = {
enable = true;
alsa = {
enable = true;
support32Bit = true;
};
pulse.enable = true;
};
xserver = {
enable = true;
excludePackages = with pkgs; [
xterm
];
displayManager = {
lightdm = {
enable = true;
greeters.slick = {
enable = true;
theme.name = "Zukitre-dark";
};
};
};
desktopManager.xfce.enable = true;
};
};
sound.enable = true;
}
@ScaredyCat
Copy link

Typo in the package list. Should be

inkscape-with-extensions

@coderofsalvation
Copy link

coderofsalvation commented Aug 3, 2023

Just wanted to say thanks.
I got my xfce nixos up an running within 30 mins:

https://www.youtube.com/watch?v=1nkitmgCHfA&feature=youtu.be

ps. for non-homemanager folks (like me), here's how to support the standard .xinitrc way to initialize stuff during X-server boot:

services.xserver.displayManager.sessionCommands = ''
  test -f ~/.xinitrc && . ~/.xinitrc
'';

For example, I use this ~/.xinitrc on one of my systems, to initialize multiple monitors and set the bg-pictures:

# use `arandr` to export the default.sh file (menu: Layout > Save-as)
test -f ~/.screenlayout/default.sh && . ~/.screenlayout/default.sh
xfconf-query -c xfce4-desktop -l | grep last-image | while read path; do xfconf-query -c xfce4-desktop -p $path -s ~/Pictures/wallpaper.jpg; 

@nat-418
Copy link
Author

nat-418 commented Aug 3, 2023

Just wanted to say thanks. I got my xfce nixos up an running within 30 mins:

https://www.youtube.com/watch?v=1nkitmgCHfA&feature=youtu.be

ps. for non-homemanager folks (like me), here's how to support the standard .xinitrc way to initialize stuff during X-server boot:

services.xserver.displayManager.sessionCommands = ''
  test -f ~/.xinitrc && . ~/.xinitrc
'';

For example, I use this ~/.xinitrc on one of my systems, to initialize multiple monitors and set the bg-pictures:

# use `arandr` to export the default.sh file (menu: Layout > Save-as)
test -f ~/.screenlayout/default.sh && . ~/.screenlayout/default.sh
xfconf-query -c xfce4-desktop -l | grep last-image | while read path; do xfconf-query -c xfce4-desktop -p $path -s ~/Pictures/wallpaper.jpg; 

You are welcome. Thanks for adding the non-Home Manager setup.

Quick note on the video: you can just do the normal GNOME or KDE GUI easy install and then edit your configuration from there. You install Nix, change config, nixos rebuild-switch see if you like it, and repeat iteratively. The old stuff will get removed. The hardware file is generated automatically for your machine, you should leave it alone. Have fun with NixOS!

@PhilT
Copy link

PhilT commented Sep 12, 2023

Thank you for making this available. It'll help me setup my wife's computer in no time!

One thing I noticed. Is sound.mediaKeys.enable = true; needed as the doc mentions that XFCE enables this by default.

You want to leave this disabled if you run a desktop environment like KDE, Gnome, Xfce, etc, as those handle such things

@PhilT
Copy link

PhilT commented Sep 12, 2023

Also, pulseaudio is not enabled by default so this can probably be left out too but I guess it won't do any harm.

@nat-418
Copy link
Author

nat-418 commented Feb 19, 2024

Thank you for making this available. It'll help me setup my wife's computer in no time!

One thing I noticed. Is sound.mediaKeys.enable = true; needed as the doc mentions that XFCE enables this by default.

You want to leave this disabled if you run a desktop environment like KDE, Gnome, Xfce, etc, as those handle such things

thanks, removed

@nat-418
Copy link
Author

nat-418 commented Feb 19, 2024

Also, pulseaudio is not enabled by default so this can probably be left out too but I guess it won't do any harm.

thanks, removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment