Skip to content

Commit 7e7ca69

Browse files
committed
Improve MIME defaults and Home Manager backups
1 parent c64045f commit 7e7ca69

3 files changed

Lines changed: 297 additions & 127 deletions

File tree

nixos/desktop.nix

Lines changed: 88 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
{ inputs, config, pkgs, lib, makeEnable, ... }:
1+
{
2+
inputs,
3+
config,
4+
pkgs,
5+
lib,
6+
makeEnable,
7+
...
8+
}:
29
makeEnable config "myModules.desktop" true {
310
services.greenclip.enable = true;
411
imports = [
@@ -42,15 +49,15 @@ makeEnable config "myModules.desktop" true {
4249

4350
home-manager.sharedModules = [
4451
{
45-
imports = [ ./dunst.nix ];
52+
imports = [./dunst.nix];
4653

4754
xdg.desktopEntries."com.mitchellh.ghostty" = {
4855
name = "Ghostty";
4956
comment = "A terminal emulator";
5057
icon = "com.mitchellh.ghostty";
5158
terminal = false;
5259
type = "Application";
53-
categories = [ "System" "TerminalEmulator" ];
60+
categories = ["System" "TerminalEmulator"];
5461
startupNotify = true;
5562
exec = "${pkgs.ghostty}/bin/ghostty --gtk-single-instance=false";
5663
settings = {
@@ -72,79 +79,88 @@ makeEnable config "myModules.desktop" true {
7279
}
7380
];
7481

75-
environment.systemPackages = with pkgs; [
76-
# Appearance
77-
adwaita-icon-theme
78-
hicolor-icon-theme
79-
# libsForQt5.breeze-gtk
80-
# materia-theme
81-
numix-icon-theme-circle
82-
papirus-icon-theme
82+
environment.systemPackages = with pkgs;
83+
[
84+
# Appearance
85+
adwaita-icon-theme
86+
hicolor-icon-theme
87+
# libsForQt5.breeze-gtk
88+
# materia-theme
89+
numix-icon-theme-circle
90+
papirus-icon-theme
8391

84-
# XOrg
85-
autorandr
86-
keyd
87-
wmctrl
88-
xclip
89-
xdotool
90-
xev
91-
xwininfo
92-
xsettingsd
92+
# XOrg
93+
autorandr
94+
keyd
95+
wmctrl
96+
xclip
97+
xdotool
98+
xev
99+
xwininfo
100+
xsettingsd
93101

94-
# Desktop
95-
alacritty
96-
ghostty
97-
blueman
98-
# clipit
99-
d-spy
100-
kdePackages.dolphin
102+
# Desktop
103+
alacritty
104+
ghostty
105+
blueman
106+
# clipit
107+
d-spy
108+
kdePackages.dolphin
101109

102-
feh
103-
gthumb
104-
firefox
105-
cheese
106-
kdePackages.kleopatra
107-
libnotify
108-
libreoffice
109-
lxappearance
110-
lxqt.lxqt-powermanagement
111-
networkmanagerapplet
112-
kdePackages.okular
113-
pinentry-gnome3
114-
# mission-center
115-
quassel
116-
remmina
117-
rofi
118-
wofi
119-
rofi-pass
120-
rofi-systemd
121-
simplescreenrecorder
122-
skippy-xd
123-
transmission_4-gtk
124-
vlc
125-
thunar
110+
feh
111+
file-roller
112+
gthumb
113+
firefox
114+
cheese
115+
kdePackages.kleopatra
116+
libnotify
117+
libreoffice
118+
loupe
119+
lxappearance
120+
lxqt.lxqt-powermanagement
121+
networkmanagerapplet
122+
kdePackages.okular
123+
pinentry-gnome3
124+
# mission-center
125+
quassel
126+
remmina
127+
rofi
128+
wofi
129+
rofi-pass
130+
rofi-systemd
131+
simplescreenrecorder
132+
skippy-xd
133+
transmission_4-gtk
134+
vlc
135+
thunar
126136

127-
# Audio
128-
picard
129-
pavucontrol
130-
playerctl
131-
pulsemixer
132-
espeak
137+
# Audio
138+
picard
139+
pavucontrol
140+
playerctl
141+
pulsemixer
142+
espeak
133143

134-
#
135-
brightnessctl
144+
#
145+
brightnessctl
136146

137-
# Visualization
138-
graphviz
139-
mermaid-cli
140-
] ++ (if pkgs.stdenv.hostPlatform.system == "x86_64-linux" then with pkgs; [
141-
google-chrome
142-
pommed_light
143-
slack
144-
spicetify-cli
145-
spotify
146-
tor-browser
147-
vscode
148-
zulip
149-
] else []);
147+
# Visualization
148+
graphviz
149+
mermaid-cli
150+
]
151+
++ (
152+
if pkgs.stdenv.hostPlatform.system == "x86_64-linux"
153+
then
154+
with pkgs; [
155+
google-chrome
156+
pommed_light
157+
slack
158+
spicetify-cli
159+
spotify
160+
tor-browser
161+
vscode
162+
zulip
163+
]
164+
else []
165+
);
150166
}

nixos/home-manager.nix

Lines changed: 149 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
{ config, pkgs, lib, nixos, ... }:
21
{
2+
config,
3+
pkgs,
4+
lib,
5+
nixos,
6+
...
7+
}: let
8+
mimeMap = desktopId: mimeTypes: lib.genAttrs mimeTypes (_: [desktopId]);
9+
in {
310
# Automatic garbage collection of old home-manager generations
411
nix.gc = {
512
automatic = true;
@@ -20,42 +27,152 @@
2027
static_history = []
2128
'';
2229

23-
xdg.mimeApps = lib.mkIf nixos.config.myModules.desktop.enable {
24-
enable = true;
25-
26-
associations.added = {
27-
"video/x-matroska" = "vlc.desktop";
28-
"audio/flac" = "vlc.desktop";
29-
"image/jpeg" = "feh.desktop";
30-
"video/x-msvideo" = "vlc.desktop";
31-
"text/vnd.trolltech.linguist" = "vlc.desktop";
32-
"audio/mpeg" = "vlc.desktop";
33-
"application/pdf" = "okularApplication_pdf.desktop";
34-
"image/png" = "okularApplication_kimgio.desktop";
35-
"video/mp4" = [ "vlc.desktop" "org.gnome.Totem.desktop" ];
36-
"x-scheme-handler/magnet" = "userapp-transmission-gtk-24GQLZ.desktop";
37-
"element" = "element-desktop.desktop";
38-
};
30+
xdg.mimeApps = lib.mkIf nixos.config.myModules.desktop.enable (
31+
let
32+
browser = "google-chrome.desktop";
33+
imageViewer = "org.gnome.Loupe.desktop";
34+
fallbackImageViewer = "okularApplication_kimgio.desktop";
35+
pdfViewer = "okularApplication_pdf.desktop";
36+
comicViewer = "okularApplication_comicbook.desktop";
37+
djvuViewer = "okularApplication_djvu.desktop";
38+
ebookViewer = "okularApplication_epub.desktop";
39+
mobiViewer = "okularApplication_mobi.desktop";
40+
xpsViewer = "okularApplication_xps.desktop";
41+
mediaPlayer = "vlc.desktop";
42+
archiveManager = "org.gnome.FileRoller.desktop";
43+
fileManager = "thunar.desktop";
44+
wordProcessor = "writer.desktop";
45+
spreadsheet = "calc.desktop";
46+
presentation = "impress.desktop";
3947

40-
defaultApplications = {
41-
"text/html" = "google-chrome.desktop";
42-
"x-scheme-handler/http" = "google-chrome.desktop";
43-
"x-scheme-handler/https" = "google-chrome.desktop";
44-
"x-scheme-handler/about" = "google-chrome.desktop";
45-
"x-scheme-handler/unknown" = "google-chrome.desktop";
46-
"x-scheme-handler/magnet" = "userapp-transmission-gtk-24GQLZ.desktop";
47-
"x-scheme-handler/element" = "element-desktop.desktop";
48-
};
49-
50-
defaultApplicationPackages = [
51-
pkgs.gthumb
52-
];
53-
};
48+
defaultApplications =
49+
(mimeMap imageViewer [
50+
"image/avif"
51+
"image/bmp"
52+
"image/gif"
53+
"image/heic"
54+
"image/jpeg"
55+
"image/jxl"
56+
"image/png"
57+
"image/svg+xml"
58+
"image/svg+xml-compressed"
59+
"image/tiff"
60+
"image/vnd.microsoft.icon"
61+
"image/webp"
62+
])
63+
// (mimeMap fallbackImageViewer [
64+
"image/heif"
65+
])
66+
// (mimeMap pdfViewer [
67+
"application/pdf"
68+
"application/x-bzpdf"
69+
"application/x-gzpdf"
70+
])
71+
// (mimeMap comicViewer [
72+
"application/x-cb7"
73+
"application/x-cbr"
74+
"application/x-cbt"
75+
"application/x-cbz"
76+
])
77+
// (mimeMap djvuViewer [
78+
"image/vnd.djvu"
79+
])
80+
// (mimeMap ebookViewer [
81+
"application/epub+zip"
82+
])
83+
// (mimeMap mobiViewer [
84+
"application/x-mobipocket-ebook"
85+
])
86+
// (mimeMap xpsViewer [
87+
"application/oxps"
88+
"application/vnd.ms-xpsdocument"
89+
])
90+
// (mimeMap mediaPlayer [
91+
"application/ogg"
92+
"audio/flac"
93+
"audio/mp4"
94+
"audio/mpeg"
95+
"audio/ogg"
96+
"audio/opus"
97+
"audio/webm"
98+
"audio/wav"
99+
"audio/x-flac"
100+
"audio/x-wav"
101+
"video/mp4"
102+
"video/ogg"
103+
"video/quicktime"
104+
"video/webm"
105+
"video/x-matroska"
106+
"video/x-msvideo"
107+
])
108+
// (mimeMap archiveManager [
109+
"application/bzip2"
110+
"application/gzip"
111+
"application/vnd.rar"
112+
"application/x-7z-compressed"
113+
"application/x-bzip"
114+
"application/x-compressed-tar"
115+
"application/x-gzip"
116+
"application/x-rar"
117+
"application/x-rar-compressed"
118+
"application/x-tar"
119+
"application/x-xz"
120+
"application/x-zip-compressed"
121+
"application/zip"
122+
"application/zstd"
123+
])
124+
// (mimeMap wordProcessor [
125+
"application/msword"
126+
"application/rtf"
127+
"application/vnd.ms-word"
128+
"application/vnd.oasis.opendocument.text"
129+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
130+
])
131+
// (mimeMap spreadsheet [
132+
"application/vnd.ms-excel"
133+
"application/vnd.oasis.opendocument.spreadsheet"
134+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
135+
"text/csv"
136+
"text/tab-separated-values"
137+
])
138+
// (mimeMap presentation [
139+
"application/mspowerpoint"
140+
"application/vnd.ms-powerpoint"
141+
"application/vnd.oasis.opendocument.presentation"
142+
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
143+
"application/vnd.openxmlformats-officedocument.presentationml.slideshow"
144+
])
145+
// (mimeMap fileManager [
146+
"inode/directory"
147+
])
148+
// (mimeMap browser [
149+
"application/rdf+xml"
150+
"application/rss+xml"
151+
"application/xhtml+xml"
152+
"application/xhtml_xml"
153+
"application/xml"
154+
"text/html"
155+
"text/xml"
156+
"x-scheme-handler/about"
157+
"x-scheme-handler/http"
158+
"x-scheme-handler/https"
159+
"x-scheme-handler/unknown"
160+
])
161+
// {
162+
"x-scheme-handler/element" = ["element-desktop.desktop"];
163+
"x-scheme-handler/magnet" = ["transmission-gtk.desktop"];
164+
};
165+
in {
166+
enable = true;
167+
associations.added = defaultApplications;
168+
inherit defaultApplications;
169+
}
170+
);
54171

55172
xsession = {
56173
enable = true;
57174
preferStatusNotifierItems = true;
58-
importedVariables = [ "GDK_PIXBUF_ICON_LOADER" ];
175+
importedVariables = ["GDK_PIXBUF_ICON_LOADER"];
59176
profileExtra = ''
60177
systemctl --user set-environment IMALISON_SESSION_TYPE=x11
61178
'';

0 commit comments

Comments
 (0)