nixos/stube-pc/home-manager.nix

403 lines
13 KiB
Nix
Raw Normal View History

2024-08-28 11:39:24 +02:00
{ config, pkgs, lib, ... }:
let
# a custom qlcplus desktop file to launch in kiosk mode with the correct workspace
qlcplus_launcher_entry = pkgs.writeText "qlcplus.desktop" ''
[Desktop Entry]
Type=Application
Name=Q Light Controller Plus
GenericName=Lighting control
Keywords=qlc;light;controller;dmx;analog;midi;artnet;e131;osc;
2024-08-28 13:52:41 +02:00
Exec=${pkgs.qlcplus}/bin/qlcplus --kiosk --open /persist/qlc/stube.qxw
2024-08-28 11:39:24 +02:00
Icon=qlcplus
MimeType=application/x-qlc-workspace;
Categories=Qt;AudioVideo;
X-XFCE-Source=${pkgs.qlcplus}/share/applications/qlcplus.desktop
'';
2024-08-28 14:24:44 +02:00
# a script to start qlcplus as admin in current session
2024-08-28 13:52:41 +02:00
edit-qlc-workspace = pkgs.writeScriptBin "edit_qlc_workspace.sh" ''
su -c "${pkgs.qlcplus}/bin/qlcplus --open /persist/qlc/stube.qxw" - admin
'';
2024-08-28 14:24:44 +02:00
# custom menu(top-left) to remove unnecessary entries
2024-08-28 11:39:24 +02:00
custom-menu-file = pkgs.writeText "custom.menu" ''
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
"http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
<Menu>
<Name>Xfce</Name>
<DefaultAppDirs/>
<DefaultDirectoryDirs/>
<Include>
<Filename>xfce4-file-manager.desktop</Filename>
<Filename>xfce4-web-browser.desktop</Filename>
<Filename>shutdown.desktop</Filename>
<Filename>restart.desktop</Filename>
</Include>
<Layout>
<Filename>xfce4-file-manager.desktop</Filename>
<Filename>xfce4-web-browser.desktop</Filename>
<Separator/>
<Merge type="all"/>
<Separator/>
<Filename>shutdown.desktop</Filename>
<Filename>restart.desktop</Filename>
</Layout>
<Menu>
<Name>Development</Name>
<Directory>xfce-development.directory</Directory>
<Include>
<Category>Development</Category>
</Include>
</Menu>
<Menu>
<Name>Education</Name>
<Directory>xfce-education.directory</Directory>
<Include>
<Category>Education</Category>
</Include>
<Exclude>
<Filename>math.desktop</Filename>
</Exclude>
</Menu>
<Menu>
<Name>Games</Name>
<Directory>xfce-games.directory</Directory>
<Include>
<Category>Game</Category>
</Include>
</Menu>
<Menu>
<Name>Graphics</Name>
<Directory>xfce-graphics.directory</Directory>
<Include>
<Category>Graphics</Category>
</Include>
<Exclude>
<Filename>draw.desktop</Filename>
</Exclude>
</Menu>
<Menu>
<Name>Multimedia</Name>
<Directory>xfce-multimedia.directory</Directory>
<Include>
<Category>Audio</Category>
<Category>Video</Category>
<Category>AudioVideo</Category>
</Include>
<Exclude>
<Filename>qlcplus-fixtureeditor.desktop</Filename>
</Exclude>
</Menu>
<Menu>
<Name>Network</Name>
<Directory>xfce-network.directory</Directory>
<Include>
<Category>Network</Category>
</Include>
<Exclude>
<Or>
<Filename>xfce4-mail-reader.desktop</Filename>
<Filename>xfce4-web-browser.desktop</Filename>
<Filename>xfce4-web-browser.desktop</Filename>
<Filename>firefox.desktop</Filename>
</Or>
</Exclude>
</Menu>
<Menu>
<Name>Office</Name>
<Directory>xfce-office.directory</Directory>
<Include>
<Category>Office</Category>
</Include>
</Menu>
<Menu>
<Name>Science</Name>
<Directory>xfce-science.directory</Directory>
<Include>
<Category>Science</Category>
</Include>
<Exclude>
<Filename>math.desktop</Filename>
</Exclude>
</Menu>
<Menu>
<Name>System</Name>
<Directory>xfce-system.directory</Directory>
<Include>
<Or>
<Category>Emulator</Category>
<Category>System</Category>
</Or>
</Include>
<Exclude>
<Filename>xfce4-session-logout.desktop</Filename>
</Exclude>
<Menu>
<Name>Settings</Name>
<Directory>xfce-settings.directory</Directory>
<Include>
<Category>Settings</Category>
</Include>
<Layout>
<Filename>xfce-settings-manager.desktop</Filename>
<Separator/>
<Merge type="all"/>
</Layout>
<Menu>
<Name>Screensavers</Name>
<Directory>xfce-screensavers.directory</Directory>
<Include>
<Category>Screensaver</Category>
</Include>
</Menu>
</Menu>
<Menu>
<Name>Accessories</Name>
<Directory>xfce-accessories.directory</Directory>
<Include>
<Or>
<Category>Accessibility</Category>
<Category>Core</Category>
<Category>Legacy</Category>
<Category>Utility</Category>
<Filename>qlcplus-fixtureeditor.desktop</Filename>
</Or>
</Include>
<Exclude>
<Or>
<Filename>xfce4-file-manager.desktop</Filename>
<Filename>xfce4-terminal-emulator.desktop</Filename>
<Filename>xfce4-about.desktop</Filename>
<Filename>xfce4-run.desktop</Filename>
</Or>
</Exclude>
</Menu>
</Menu>
<Menu>
<Name>Other</Name>
<Directory>xfce-other.directory</Directory>
<OnlyUnallocated/>
<Include>
<All/>
</Include>
</Menu>
<DefaultMergeDirs/>
</Menu>
'';
in
{
home.persistence."/persist/home/stube" = {
2024-08-29 09:45:23 +02:00
files = [
# xfconf.settings needs an existing installation (not all values are specified below)
".config/xfce4/xfconf/xfce-perchannel-xml"
];
2024-08-28 11:39:24 +02:00
directories = [
2024-08-28 14:24:44 +02:00
# keep mixxx song database between reboots
2024-08-28 11:39:24 +02:00
".mixxx"
2024-08-29 09:45:23 +02:00
"Music"
"Videos"
2024-08-28 11:39:24 +02:00
];
allowOther = false;
};
2024-08-28 14:24:44 +02:00
# restart xfce4 panels on configuration change (ignore errors)
2024-08-28 11:39:24 +02:00
home.activation.restart-xfce4-panel = lib.hm.dag.entryAfter ["writeBoundary"] ''
run /bin/sh -c "${pkgs.xfce.xfce4-panel}/bin/xfce4-panel -r || true"
'';
2024-08-28 14:24:44 +02:00
# configure xfce4 desktop environment
2024-08-28 11:39:24 +02:00
xfconf.settings = {
xfwm4 = {
"general/workspace_count" = 1;
};
xfce4-power-manager = {
"xfce4-power-manager/presentation-mode" = true;
"xfce4-power-manager/lock-screen-suspend-hibernate" = false;
};
xfce4-notifyd."do-not-disturb" = true;
xfce4-panel = {
"plugins/plugin-100" = "applicationsmenu";
"plugins/plugin-100/custom-menu" = true;
"plugins/plugin-100/custom-menu-file" = "${custom-menu-file}";
"plugins/plugin-100/button-icon" = "org.xfce.panel.actions";
"plugins/plugin-100/button-title" = "Anwendungen";
"plugins/plugin-110" = "separator";
"plugins/plugin-110/style" = 0;
"plugins/plugin-101" = "tasklist";
"plugins/plugin-101/grouping" = "1";
"plugins/plugin-101/show-handle" = false;
"plugins/plugin-102" = "separator";
"plugins/plugin-102/expand" = true;
"plugins/plugin-102/style" = 0;
"plugins/plugin-103" = "systray";
"plugins/plugin-103/square-icons" = true;
"plugins/plugin-104" = "separator";
"plugins/plugin-104/style" = 0;
"plugins/plugin-105" = "pulseaudio";
"plugins/plugin-105/enable-keyboard-shortcuts" = true;
"plugins/plugin-106" = "separator";
"plugins/plugin-106/style" = 0;
"plugins/plugin-107" = "clock";
"plugins/plugin-107/digital-date-format" = "%d %b %Y";
"plugins/plugin-108" = "separator";
"plugins/plugin-108/style" = 0;
/*
"plugins/plugin-109" = "actions";
"plugins/plugin-109/items" = [
"-lock-screen"
"-switch-user"
"-separator"
"-suspend"
"-hibernate"
"-hybrid-sleep"
"-separator"
"+shutdown"
"-restart"
"-separator"
"-logout"
"-logout-dialog"
];
*/
"panels/panel-1/plugin-ids" = [ 100 110 101 102 103 104 105 106 107 108 ];
"plugins/plugin-200" = "showdesktop";
"plugins/plugin-201" = "launcher";
"plugins/plugin-201/items" = ["${pkgs.xfce.xfce4-settings}/share/applications/xfce4-file-manager.desktop"];
"plugins/plugin-210" = "separator";
"plugins/plugin-210/style" = 0;
"plugins/plugin-211" = "launcher";
"plugins/plugin-211/items" = ["${pkgs.firefox}/share/applications/firefox.desktop"];
"plugins/plugin-212" = "launcher";
"plugins/plugin-212/items" = ["${pkgs.spotify}/share/applications/spotify.desktop"];
"plugins/plugin-213" = "launcher";
"plugins/plugin-213/items" = ["${pkgs.mixxx}/share/applications/org.mixxx.Mixxx.desktop"];
"plugins/plugin-220" = "separator";
"plugins/plugin-220/style" = 0;
"plugins/plugin-221" = "launcher";
"plugins/plugin-221/items" = [ "${qlcplus_launcher_entry}" ];
"panels/panel-2/plugin-ids" = [ 200 201 210 211 212 213 220 221 ];
};
xfce4-desktop = {
2024-08-29 09:45:23 +02:00
# right monitor (no background image to save displaylink bandwidth)
"backdrop/screen0/monitorDP-1/workspace0/image-style" = 0;
"backdrop/screen0/monitorDP-1/workspace0/color-style" = 0;
"backdrop/screen0/monitorDP-1/workspace0/rgba1" = [0.369 0.361 0.392 1];
# left monitor
"backdrop/screen0/monitorVGA-1/workspace0/image-style" = 5;
"backdrop/screen0/monitorVGA-1/workspace0/last-image" = "${./background.jpg}";
# beamer
"backdrop/screen0/monitorHDMI-1/workspace0/image-style" = 5;
"backdrop/screen0/monitorHDMI-1/workspace0/last-image" = "${./background.jpg}";
# virtual machine screen
"backdrop/screen0/monitorVirtual-1/workspace0/image-style" = 5;
2024-08-28 11:39:24 +02:00
"backdrop/screen0/monitorVirtual-1/workspace0/last-image" = "${./background.jpg}";
2024-08-29 09:45:23 +02:00
2024-08-28 11:39:24 +02:00
"desktop-icons/file-icons/show-home" = false;
"desktop-icons/file-icons/show-filesystem" = false;
"desktop-icons/file-icons/show-trash" = false;
};
};
2024-08-28 14:24:44 +02:00
# desktop file for shutdown entry in menu
2024-08-28 11:39:24 +02:00
xdg.desktopEntries.shutdown = {
name = "Herunterfahren";
terminal = false;
icon = "xfsm-shutdown";
exec = "shutdown -h now";
};
2024-08-28 14:24:44 +02:00
# desktop file for reboot entry in menu
2024-08-28 11:39:24 +02:00
xdg.desktopEntries.restart = {
name = "Neustarten";
terminal = false;
icon = "xfsm-reboot";
exec = "reboot";
};
home.packages = with pkgs; [
2024-08-28 14:24:44 +02:00
qlcplus # dmx controller
spotify # audio player
mixxx # more professional audio player
vlc # media player
mpv # media player
libreoffice-still # office
edit-qlc-workspace # script defined earlier
2024-08-28 11:39:24 +02:00
];
2024-08-28 14:24:44 +02:00
# firefox without google, ads and anything unnecessary
2024-08-28 11:39:24 +02:00
programs.firefox = {
enable = true;
profiles.default = {
settings = {
"browser.startup.homepage" = "https://duckduckgo.com";
"general.useragent.locale" = "de-DE";
};
search = {
default = "DuckDuckGo";
force = true;
};
};
policies = {
DisableTelemetry = true;
DisableFirefoxStudies = true;
EnableTrackingProtection = {
Value = true;
Locked = true;
Cryptomining = true;
Fingerprinting = true;
};
DisablePocket = true;
DisableFirefoxAccounts = true;
DisableAccounts = true;
DisableFirefoxScreenshots = true;
OverrideFirstRunPage = "";
OverridePostUpdatePage = "";
DontCheckDefaultBrowser = true;
DisplayBookmarksToolbar = "never";
DisplayMenuBar = "default-off";
SearchBar = "unified";
ExtensionSettings = {
"*".installation_mode = "blocked";
"uBlock0@raymondhill.net" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
installation_mode = "force_installed";
};
};
};
};
home.stateVersion = "24.05";
}