nix-home/home/modules/linux/graphical/default.nix

259 lines
7.6 KiB
Nix
Raw Normal View History

2022-04-20 17:05:02 +00:00
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.linux.graphical;
2023-04-04 18:27:00 +00:00
2024-08-01 13:54:34 +00:00
thunderbird = pkgs.thunderbird-128;
2023-04-08 05:54:26 +00:00
vscode = with pkgs; if stdenv.isAarch64 then unstable.vscode else unstable.vscode-fhs;
2024-06-09 16:45:03 +00:00
wifi-indicator = pkgs.writeScriptBin "wifi-indicator" ''
#!/usr/bin/env fish
set wifi_output (${lib.getExe pkgs.iw} wlan0 link | rg "SSID: (.+)" --replace '🛜 $1' | string trim)
if test -z $wifi_output
echo " not connected"
else
echo $wifi_output
end
'';
2022-04-20 17:05:02 +00:00
in
{
imports = [ ./x11.nix ./wayland.nix ./alacritty.nix ];
options.linux.graphical = {
type = mkOption {
type = types.nullOr (types.enum [ "x11" "wayland" ]);
description = "Enable linux graphical configurations, with either 'x11' or 'wayland'";
default = null;
};
wallpaper = mkOption {
type = types.oneOf [ types.str types.path ];
description = "Path to the wallpaper file";
default = "";
};
2023-03-15 13:02:15 +00:00
startup = mkOption {
type = types.listOf types.package;
description = "List of packages to include in ~/.config/autostart";
2024-06-25 18:24:48 +00:00
default = with pkgs; [
librewolf
thunderbird
vesktop
premid
];
2023-03-15 13:02:15 +00:00
};
2023-08-30 21:53:14 +00:00
defaults.webBrowser = mkOption {
type = types.str;
2024-06-25 18:24:48 +00:00
default = "librewolf.desktop";
2023-08-30 21:53:14 +00:00
description = "Desktop file of the default web browser";
};
2022-04-20 17:05:02 +00:00
};
config = mkIf (cfg.type != null) {
# Packages
home.packages = (with pkgs; [
## GUI stuff
evince # PDF reader
gparted
2023-04-08 05:54:26 +00:00
vscode
2023-04-04 18:27:00 +00:00
feh # For images?
2022-04-20 17:05:02 +00:00
deluge # Torrent client
pavucontrol # PulseAudio control panel
2023-06-10 14:18:46 +00:00
thunderbird # Email
2023-07-09 15:00:21 +00:00
sublime-music # For navidrome
2024-08-15 16:11:33 +00:00
# cinny-desktop
gajim
2024-03-08 03:30:05 +00:00
vivaldi
2024-01-28 20:02:17 +00:00
# Audio
qpwgraph # Pipewire graph
2024-10-30 11:10:36 +00:00
unstable.zotero
2023-05-07 15:04:11 +00:00
libreoffice
2022-04-20 17:05:02 +00:00
2024-03-08 03:30:05 +00:00
mpv # for anki
anki-bin
2024-03-08 03:30:05 +00:00
2024-08-02 16:27:48 +00:00
# Chat stuff
2024-03-08 03:30:05 +00:00
tdesktop
whatsapp-for-linux
2024-08-02 16:27:48 +00:00
slack
2024-10-30 11:10:36 +00:00
zoom-us
2024-03-08 03:30:05 +00:00
2024-06-25 18:24:48 +00:00
librewolf
2024-06-01 15:25:45 +00:00
2022-04-20 17:05:02 +00:00
## CLI stuff
dex # .desktop file management, startup
2022-12-05 09:59:59 +00:00
# sct # Display color temperature
2022-05-31 16:39:14 +00:00
xdg-utils # Open stuff
2024-06-09 16:45:03 +00:00
wifi-indicator
2024-08-02 16:27:48 +00:00
]);
2022-04-20 17:05:02 +00:00
2022-11-08 17:59:53 +00:00
nki.programs.discord.enable = pkgs.stdenv.isx86_64;
2024-06-25 18:24:48 +00:00
nki.programs.discord.package = pkgs.vesktop;
2022-11-08 17:59:53 +00:00
2024-07-14 22:43:15 +00:00
# OBS
programs.obs-studio = {
enable = true;
plugins = with pkgs.obs-studio-plugins; [
wlrobs
input-overlay
obs-pipewire-audio-capture
];
};
2023-08-30 23:19:54 +00:00
# Yellow light!
services.wlsunset = {
2023-09-20 08:07:37 +00:00
enable = true;
2023-08-30 23:19:54 +00:00
# Lausanne
latitude = "46.31";
longitude = "6.38";
};
2023-06-06 20:36:45 +00:00
2022-04-20 17:05:02 +00:00
# Cursor
home.pointerCursor = {
2023-10-15 12:17:12 +00:00
package = pkgs.suwako-cursors;
gtk.enable = true;
name = "Suwako";
size = 32;
2022-04-20 17:05:02 +00:00
};
# MIME set ups
xdg.enable = true;
xdg.mimeApps.enable = true;
xdg.mimeApps.associations.added = {
2024-04-22 09:57:42 +00:00
"x-scheme-handler/mailto" = [ "thunderbird.desktop" "org.gnome.Evolution.desktop" ];
2023-05-07 15:04:11 +00:00
"application/pdf" = [ "org.gnome.Evince.desktop" ];
2023-04-04 18:27:00 +00:00
"text/plain" = [ "kakoune.desktop" ];
2024-04-22 09:57:42 +00:00
# Other Thunderbird stuff
"x-scheme-handler/mid" = [ "thunderbird.desktop" ];
"x-scheme-handler/news" = [ "thunderbird.desktop" ];
"x-scheme-handler/snews" = [ "thunderbird.desktop" ];
"x-scheme-handler/nntp" = [ "thunderbird.desktop" ];
"x-scheme-handler/feed" = [ "thunderbird.desktop" ];
"application/rss+xml" = [ "thunderbird.desktop" ];
"application/x-extension-rss" = [ "thunderbird.desktop" ];
};
2022-04-20 17:05:02 +00:00
xdg.mimeApps.defaultApplications = {
2023-04-04 18:27:00 +00:00
# Email
2024-04-22 09:57:42 +00:00
"x-scheme-handler/mailto" = [ "thunderbird.desktop" "org.gnome.Evolution.desktop" ];
"x-scheme-handler/webcal" = [ "thunderbird.desktop" ];
"x-scheme-handler/webcals" = [ "thunderbird.desktop" ];
# Other Thunderbird stuff
"x-scheme-handler/mid" = [ "thunderbird.desktop" ];
"x-scheme-handler/news" = [ "thunderbird.desktop" ];
"x-scheme-handler/snews" = [ "thunderbird.desktop" ];
"x-scheme-handler/nntp" = [ "thunderbird.desktop" ];
"x-scheme-handler/feed" = [ "thunderbird.desktop" ];
"application/rss+xml" = [ "thunderbird.desktop" ];
"application/x-extension-rss" = [ "thunderbird.desktop" ];
2023-04-04 18:27:00 +00:00
# Default web browser stuff
2023-08-30 21:53:14 +00:00
"text/html" = [ cfg.defaults.webBrowser ];
"x-scheme-handler/about" = [ cfg.defaults.webBrowser ];
"x-scheme-handler/unknown" = [ cfg.defaults.webBrowser ];
"x-scheme-handler/http" = [ cfg.defaults.webBrowser ];
"x-scheme-handler/https" = [ cfg.defaults.webBrowser ];
"x-scheme-handler/ftp" = [ cfg.defaults.webBrowser ];
"x-scheme-handler/ftps" = [ cfg.defaults.webBrowser ];
2023-11-07 22:23:31 +00:00
"x-scheme-handler/file" = [ cfg.defaults.webBrowser ];
2023-04-04 18:27:00 +00:00
# Torrent
"application/x-bittorrent" = [ "deluge.desktop" ];
"x-scheme-handler/magnet" = [ "deluge.desktop" ];
# Text
"text/plain" = [ "kakoune.desktop" ];
"application/pdf" = [ "okularApplication_pdf.desktop" ];
2023-04-04 18:27:00 +00:00
# Files
"inode/directory" = [ "dolphin.desktop" ];
2023-04-04 18:27:00 +00:00
};
# Add one for kakoune
xdg.desktopEntries."kakoune" = {
name = "Kakoune";
genericName = "Text Editor";
exec = ''kitty --class kitty-float -o initial_window_width=150c -o initial_window_height=40c ${pkgs.writeShellScript "editor.sh" ''
$EDITOR "$@"
''} %U'';
# exec = "kakoune %U";
terminal = false;
mimeType = [ "text/plain" ];
2022-04-20 17:05:02 +00:00
};
# Theming
## GTK
gtk.enable = true;
gtk.cursorTheme = { inherit (config.home.pointerCursor) package name size; };
2024-06-03 19:42:14 +00:00
gtk.font.name = "IBM Plex Sans JP";
gtk.font.size = 10;
gtk.iconTheme = {
2024-06-03 20:57:34 +00:00
package = pkgs.kdePackages.breeze-icons;
2024-06-17 17:33:51 +00:00
name = "breeze";
};
gtk.theme = {
2024-06-03 20:57:34 +00:00
package = pkgs.kdePackages.breeze-gtk;
name = "Breeze";
};
gtk.gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
gtk.gtk2.extraConfig = ''
2024-06-03 19:42:14 +00:00
gtk-enable-animations=1
gtk-im-module="fcitx"
2024-06-03 19:42:14 +00:00
gtk-theme-name="Numix"
gtk-primary-button-warps-slider=1
gtk-toolbar-style=3
gtk-menu-images=1
gtk-button-images=1
gtk-sound-theme-name="ocean"
gtk-icon-theme-name="breeze"
'';
gtk.gtk3.extraConfig.gtk-im-module = "fcitx";
gtk.gtk4.extraConfig.gtk-im-module = "fcitx";
## Qt
qt.enable = true;
2024-06-03 19:42:14 +00:00
qt.platformTheme.name = "kde";
2024-06-03 20:57:34 +00:00
qt.platformTheme.package = with pkgs.kdePackages; [ plasma-integration systemsettings ];
qt.style.package = [ pkgs.kdePackages.breeze ];
qt.style.name = "Breeze";
2024-04-18 12:56:52 +00:00
2023-03-15 13:02:15 +00:00
xdg.configFile =
let
f = pkg: {
name = "autostart/${pkg.name}.desktop";
value = {
source =
let
srcFile = pkgs.runCommand "${pkg.name}-startup" { } ''
2024-06-25 18:24:48 +00:00
mkdir -p $out
cp $(ls -d ${pkg}/share/applications/*.desktop | head -n 1) $out/${pkg.name}.desktop
2023-03-15 13:02:15 +00:00
'';
in
"${srcFile}/${pkg.name}.desktop";
};
};
autoStartup = listToAttrs (map f cfg.startup);
2023-03-15 13:02:15 +00:00
in
2024-04-18 12:56:52 +00:00
autoStartup // {
## Polkit UI
"autostart/polkit.desktop".text = ''
${builtins.readFile "${pkgs.pantheon.pantheon-agent-polkit}/etc/xdg/autostart/io.elementary.desktop.agent-polkit.desktop"}
OnlyShowIn=sway;
'';
};
2022-04-20 17:05:02 +00:00
# IBus configuration
2023-01-25 14:43:11 +00:00
# dconf.settings."desktop/ibus/general" = {
# engines-order = hm.gvariant.mkArray hm.gvariant.type.string [ "xkb:jp::jpn" "mozc-jp" "Bamboo" ];
# reload-engines = hm.gvariant.mkArray hm.gvariant.type.string [ "xkb:jp::jpn" "mozc-jp" "Bamboo" ];
# };
# dconf.settings."desktop/ibus/general/hotkey" = {
# triggers = hm.gvariant.mkArray hm.gvariant.type.string [ "<Super>z" ];
# };
2022-04-20 17:05:02 +00:00
};
}
2023-04-04 18:27:00 +00:00