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

188 lines
5.2 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
2023-04-08 05:54:26 +00:00
vscode = with pkgs; if stdenv.isAarch64 then unstable.vscode else unstable.vscode-fhs;
2023-04-04 18:27:00 +00:00
alwaysStartup = with pkgs; [ ];
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";
default = [ ];
};
2023-08-30 21:53:14 +00:00
defaults.webBrowser = mkOption {
type = types.str;
default = "firefox.desktop";
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
firefox
2023-07-03 17:34:06 +00:00
librewolf
2023-04-04 18:27:00 +00:00
cinnamon.nemo # File manager
2023-06-10 14:18:46 +00:00
thunderbird # Email
2023-07-09 15:00:21 +00:00
sublime-music # For navidrome
2023-09-03 18:30:47 +00:00
# Note taking
obsidian
(logseq.override { electron = pkgs.electron_24; })
2023-02-27 15:10:45 +00:00
zotero
2023-05-07 15:04:11 +00:00
libreoffice
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
] ++ (if pkgs.stdenv.isAarch64 then [ ] else [
2023-06-06 20:36:45 +00:00
gnome.cheese # Webcam check, expensive
mailspring
2023-04-04 18:27:00 +00:00
# Chat stuff
2022-10-17 12:10:58 +00:00
unstable.slack
]));
2022-04-20 17:05:02 +00:00
2022-11-08 17:59:53 +00:00
nki.programs.discord.enable = pkgs.stdenv.isx86_64;
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 = {
2022-04-20 17:05:02 +00:00
package = pkgs.numix-cursor-theme;
2022-05-04 14:23:09 +00:00
name = "Numix-Cursor";
size = 24;
2022-04-20 17:05:02 +00:00
};
# MIME set ups
xdg.enable = true;
xdg.mimeApps.enable = true;
xdg.mimeApps.associations.added = {
2023-04-04 18:27:00 +00:00
"x-scheme-handler/mailto" = [ "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" ];
};
2022-04-20 17:05:02 +00:00
xdg.mimeApps.defaultApplications = {
2023-04-04 18:27:00 +00:00
# Email
"x-scheme-handler/mailto" = [ "org.gnome.Evolution.desktop" ];
# 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-04-04 18:27:00 +00:00
# Torrent
"application/x-bittorrent" = [ "deluge.desktop" ];
"x-scheme-handler/magnet" = [ "deluge.desktop" ];
# Text
"text/plain" = [ "kakoune.desktop" ];
2023-05-07 15:04:11 +00:00
"application/pdf" = [ "org.gnome.Evince.desktop" ];
2023-04-04 18:27:00 +00:00
# Files
"inode/directory" = [ "nemo.desktop" ];
};
# 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; };
gtk.font.name = "system-ui";
gtk.font.size = 10;
gtk.iconTheme = {
package = pkgs.numix-icon-theme;
name = "Numix";
};
gtk.theme = {
package = pkgs.numix-gtk-theme;
name = "Numix";
};
## Qt
qt.enable = true;
qt.platformTheme = "gnome";
qt.style.package = pkgs.adwaita-qt;
qt.style.name = "adwaita";
2022-04-20 17:05:02 +00:00
home.sessionVariables = {
# Set up Java font style
_JAVA_OPTIONS = "-Dawt.useSystemAAFontSettings=lcd";
};
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" { } ''
2023-04-04 18:27:00 +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";
};
};
in
listToAttrs (map f (cfg.startup ++ alwaysStartup));
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