Improve MIME defaults and Home Manager backups
This commit is contained in:
@@ -1,4 +1,11 @@
|
||||
{ inputs, config, pkgs, lib, makeEnable, ... }:
|
||||
{
|
||||
inputs,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
makeEnable,
|
||||
...
|
||||
}:
|
||||
makeEnable config "myModules.desktop" true {
|
||||
services.greenclip.enable = true;
|
||||
imports = [
|
||||
@@ -42,7 +49,7 @@ makeEnable config "myModules.desktop" true {
|
||||
|
||||
home-manager.sharedModules = [
|
||||
{
|
||||
imports = [ ./dunst.nix ];
|
||||
imports = [./dunst.nix];
|
||||
|
||||
xdg.desktopEntries."com.mitchellh.ghostty" = {
|
||||
name = "Ghostty";
|
||||
@@ -50,7 +57,7 @@ makeEnable config "myModules.desktop" true {
|
||||
icon = "com.mitchellh.ghostty";
|
||||
terminal = false;
|
||||
type = "Application";
|
||||
categories = [ "System" "TerminalEmulator" ];
|
||||
categories = ["System" "TerminalEmulator"];
|
||||
startupNotify = true;
|
||||
exec = "${pkgs.ghostty}/bin/ghostty --gtk-single-instance=false";
|
||||
settings = {
|
||||
@@ -72,7 +79,8 @@ makeEnable config "myModules.desktop" true {
|
||||
}
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
environment.systemPackages = with pkgs;
|
||||
[
|
||||
# Appearance
|
||||
adwaita-icon-theme
|
||||
hicolor-icon-theme
|
||||
@@ -100,12 +108,14 @@ makeEnable config "myModules.desktop" true {
|
||||
kdePackages.dolphin
|
||||
|
||||
feh
|
||||
file-roller
|
||||
gthumb
|
||||
firefox
|
||||
cheese
|
||||
kdePackages.kleopatra
|
||||
libnotify
|
||||
libreoffice
|
||||
loupe
|
||||
lxappearance
|
||||
lxqt.lxqt-powermanagement
|
||||
networkmanagerapplet
|
||||
@@ -137,7 +147,11 @@ makeEnable config "myModules.desktop" true {
|
||||
# Visualization
|
||||
graphviz
|
||||
mermaid-cli
|
||||
] ++ (if pkgs.stdenv.hostPlatform.system == "x86_64-linux" then with pkgs; [
|
||||
]
|
||||
++ (
|
||||
if pkgs.stdenv.hostPlatform.system == "x86_64-linux"
|
||||
then
|
||||
with pkgs; [
|
||||
google-chrome
|
||||
pommed_light
|
||||
slack
|
||||
@@ -146,5 +160,7 @@ makeEnable config "myModules.desktop" true {
|
||||
tor-browser
|
||||
vscode
|
||||
zulip
|
||||
] else []);
|
||||
]
|
||||
else []
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
{ config, pkgs, lib, nixos, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
nixos,
|
||||
...
|
||||
}: let
|
||||
mimeMap = desktopId: mimeTypes: lib.genAttrs mimeTypes (_: [desktopId]);
|
||||
in {
|
||||
# Automatic garbage collection of old home-manager generations
|
||||
nix.gc = {
|
||||
automatic = true;
|
||||
@@ -20,42 +27,152 @@
|
||||
static_history = []
|
||||
'';
|
||||
|
||||
xdg.mimeApps = lib.mkIf nixos.config.myModules.desktop.enable {
|
||||
xdg.mimeApps = lib.mkIf nixos.config.myModules.desktop.enable (
|
||||
let
|
||||
browser = "google-chrome.desktop";
|
||||
imageViewer = "org.gnome.Loupe.desktop";
|
||||
fallbackImageViewer = "okularApplication_kimgio.desktop";
|
||||
pdfViewer = "okularApplication_pdf.desktop";
|
||||
comicViewer = "okularApplication_comicbook.desktop";
|
||||
djvuViewer = "okularApplication_djvu.desktop";
|
||||
ebookViewer = "okularApplication_epub.desktop";
|
||||
mobiViewer = "okularApplication_mobi.desktop";
|
||||
xpsViewer = "okularApplication_xps.desktop";
|
||||
mediaPlayer = "vlc.desktop";
|
||||
archiveManager = "org.gnome.FileRoller.desktop";
|
||||
fileManager = "thunar.desktop";
|
||||
wordProcessor = "writer.desktop";
|
||||
spreadsheet = "calc.desktop";
|
||||
presentation = "impress.desktop";
|
||||
|
||||
defaultApplications =
|
||||
(mimeMap imageViewer [
|
||||
"image/avif"
|
||||
"image/bmp"
|
||||
"image/gif"
|
||||
"image/heic"
|
||||
"image/jpeg"
|
||||
"image/jxl"
|
||||
"image/png"
|
||||
"image/svg+xml"
|
||||
"image/svg+xml-compressed"
|
||||
"image/tiff"
|
||||
"image/vnd.microsoft.icon"
|
||||
"image/webp"
|
||||
])
|
||||
// (mimeMap fallbackImageViewer [
|
||||
"image/heif"
|
||||
])
|
||||
// (mimeMap pdfViewer [
|
||||
"application/pdf"
|
||||
"application/x-bzpdf"
|
||||
"application/x-gzpdf"
|
||||
])
|
||||
// (mimeMap comicViewer [
|
||||
"application/x-cb7"
|
||||
"application/x-cbr"
|
||||
"application/x-cbt"
|
||||
"application/x-cbz"
|
||||
])
|
||||
// (mimeMap djvuViewer [
|
||||
"image/vnd.djvu"
|
||||
])
|
||||
// (mimeMap ebookViewer [
|
||||
"application/epub+zip"
|
||||
])
|
||||
// (mimeMap mobiViewer [
|
||||
"application/x-mobipocket-ebook"
|
||||
])
|
||||
// (mimeMap xpsViewer [
|
||||
"application/oxps"
|
||||
"application/vnd.ms-xpsdocument"
|
||||
])
|
||||
// (mimeMap mediaPlayer [
|
||||
"application/ogg"
|
||||
"audio/flac"
|
||||
"audio/mp4"
|
||||
"audio/mpeg"
|
||||
"audio/ogg"
|
||||
"audio/opus"
|
||||
"audio/webm"
|
||||
"audio/wav"
|
||||
"audio/x-flac"
|
||||
"audio/x-wav"
|
||||
"video/mp4"
|
||||
"video/ogg"
|
||||
"video/quicktime"
|
||||
"video/webm"
|
||||
"video/x-matroska"
|
||||
"video/x-msvideo"
|
||||
])
|
||||
// (mimeMap archiveManager [
|
||||
"application/bzip2"
|
||||
"application/gzip"
|
||||
"application/vnd.rar"
|
||||
"application/x-7z-compressed"
|
||||
"application/x-bzip"
|
||||
"application/x-compressed-tar"
|
||||
"application/x-gzip"
|
||||
"application/x-rar"
|
||||
"application/x-rar-compressed"
|
||||
"application/x-tar"
|
||||
"application/x-xz"
|
||||
"application/x-zip-compressed"
|
||||
"application/zip"
|
||||
"application/zstd"
|
||||
])
|
||||
// (mimeMap wordProcessor [
|
||||
"application/msword"
|
||||
"application/rtf"
|
||||
"application/vnd.ms-word"
|
||||
"application/vnd.oasis.opendocument.text"
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
||||
])
|
||||
// (mimeMap spreadsheet [
|
||||
"application/vnd.ms-excel"
|
||||
"application/vnd.oasis.opendocument.spreadsheet"
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
||||
"text/csv"
|
||||
"text/tab-separated-values"
|
||||
])
|
||||
// (mimeMap presentation [
|
||||
"application/mspowerpoint"
|
||||
"application/vnd.ms-powerpoint"
|
||||
"application/vnd.oasis.opendocument.presentation"
|
||||
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
||||
"application/vnd.openxmlformats-officedocument.presentationml.slideshow"
|
||||
])
|
||||
// (mimeMap fileManager [
|
||||
"inode/directory"
|
||||
])
|
||||
// (mimeMap browser [
|
||||
"application/rdf+xml"
|
||||
"application/rss+xml"
|
||||
"application/xhtml+xml"
|
||||
"application/xhtml_xml"
|
||||
"application/xml"
|
||||
"text/html"
|
||||
"text/xml"
|
||||
"x-scheme-handler/about"
|
||||
"x-scheme-handler/http"
|
||||
"x-scheme-handler/https"
|
||||
"x-scheme-handler/unknown"
|
||||
])
|
||||
// {
|
||||
"x-scheme-handler/element" = ["element-desktop.desktop"];
|
||||
"x-scheme-handler/magnet" = ["transmission-gtk.desktop"];
|
||||
};
|
||||
in {
|
||||
enable = true;
|
||||
|
||||
associations.added = {
|
||||
"video/x-matroska" = "vlc.desktop";
|
||||
"audio/flac" = "vlc.desktop";
|
||||
"image/jpeg" = "feh.desktop";
|
||||
"video/x-msvideo" = "vlc.desktop";
|
||||
"text/vnd.trolltech.linguist" = "vlc.desktop";
|
||||
"audio/mpeg" = "vlc.desktop";
|
||||
"application/pdf" = "okularApplication_pdf.desktop";
|
||||
"image/png" = "okularApplication_kimgio.desktop";
|
||||
"video/mp4" = [ "vlc.desktop" "org.gnome.Totem.desktop" ];
|
||||
"x-scheme-handler/magnet" = "userapp-transmission-gtk-24GQLZ.desktop";
|
||||
"element" = "element-desktop.desktop";
|
||||
};
|
||||
|
||||
defaultApplications = {
|
||||
"text/html" = "google-chrome.desktop";
|
||||
"x-scheme-handler/http" = "google-chrome.desktop";
|
||||
"x-scheme-handler/https" = "google-chrome.desktop";
|
||||
"x-scheme-handler/about" = "google-chrome.desktop";
|
||||
"x-scheme-handler/unknown" = "google-chrome.desktop";
|
||||
"x-scheme-handler/magnet" = "userapp-transmission-gtk-24GQLZ.desktop";
|
||||
"x-scheme-handler/element" = "element-desktop.desktop";
|
||||
};
|
||||
|
||||
defaultApplicationPackages = [
|
||||
pkgs.gthumb
|
||||
];
|
||||
};
|
||||
associations.added = defaultApplications;
|
||||
inherit defaultApplications;
|
||||
}
|
||||
);
|
||||
|
||||
xsession = {
|
||||
enable = true;
|
||||
preferStatusNotifierItems = true;
|
||||
importedVariables = [ "GDK_PIXBUF_ICON_LOADER" ];
|
||||
importedVariables = ["GDK_PIXBUF_ICON_LOADER"];
|
||||
profileExtra = ''
|
||||
systemctl --user set-environment IMALISON_SESSION_TYPE=x11
|
||||
'';
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
{ inputs, specialArgs, config, lib, realUsers, ... }:
|
||||
{
|
||||
inputs,
|
||||
specialArgs,
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
realUsers,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
];
|
||||
@@ -19,8 +26,31 @@
|
||||
};
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.backupCommand = pkgs.writeShellScript "home-manager-backup-command" ''
|
||||
set -eu
|
||||
|
||||
target_path="$1"
|
||||
backup_ext="''${HOME_MANAGER_BACKUP_EXT:-hm-backup}"
|
||||
backup_path="''${target_path}.''${backup_ext}"
|
||||
|
||||
if [[ ! -e "$backup_path" ]]; then
|
||||
mv -- "$target_path" "$backup_path"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
timestamp="$(date +%Y%m%d-%H%M%S)"
|
||||
candidate="''${backup_path}.''${timestamp}"
|
||||
counter=0
|
||||
|
||||
while [[ -e "$candidate" ]]; do
|
||||
counter=$((counter + 1))
|
||||
candidate="''${backup_path}.''${timestamp}-''${counter}"
|
||||
done
|
||||
|
||||
mv -- "$target_path" "$candidate"
|
||||
'';
|
||||
home-manager.backupFileExtension = "hm-backup";
|
||||
home-manager.sharedModules = [ ./home-manager.nix ];
|
||||
home-manager.sharedModules = [./home-manager.nix];
|
||||
|
||||
nix = rec {
|
||||
extraOptions = ''
|
||||
@@ -55,7 +85,8 @@
|
||||
];
|
||||
};
|
||||
|
||||
nixpkgs.overlays = [
|
||||
nixpkgs.overlays =
|
||||
[
|
||||
# (import ./nvidia-container-toolkit-overlay.nix)
|
||||
(import ./runc-overlay.nix)
|
||||
(import ./emacs-overlay.nix)
|
||||
@@ -66,16 +97,22 @@
|
||||
claude-code = inputs.claude-code-nix.packages.${prev.stdenv.hostPlatform.system}.default;
|
||||
git-sync-rs = let
|
||||
base = inputs.git-sync-rs.packages.${prev.stdenv.hostPlatform.system}.default;
|
||||
in prev.symlinkJoin {
|
||||
in
|
||||
prev.symlinkJoin {
|
||||
name = "${base.name}-wrapped";
|
||||
paths = [ base ];
|
||||
paths = [base];
|
||||
postBuild = ''
|
||||
ln -s $out/bin/git-sync-rs $out/bin/git-sync-on-inotify
|
||||
ln -s $out/bin/git-sync-rs $out/bin/git-sync
|
||||
'';
|
||||
};
|
||||
})
|
||||
] ++ (if config.imalison.nixOverlay.enable then [ inputs.nix.overlays.default ] else []);
|
||||
]
|
||||
++ (
|
||||
if config.imalison.nixOverlay.enable
|
||||
then [inputs.nix.overlays.default]
|
||||
else []
|
||||
);
|
||||
|
||||
# Allow all the things
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
Reference in New Issue
Block a user