diff options
author | Michael Peyton Jones <me@michaelpj.com> | 2018-08-15 09:55:35 +0100 |
---|---|---|
committer | Michael Peyton Jones <me@michaelpj.com> | 2018-08-16 21:23:34 +0100 |
commit | 13e2e19158bcd2b4d53e452d82f62817194100ef (patch) | |
tree | 71a13eecf2ba743d8df7a57c3dc577dd4ae9d630 /nixos/modules/config | |
parent | 52e7817aa2c33b8569b6fdc884f98a34fbf6f61e (diff) | |
download | nixlib-13e2e19158bcd2b4d53e452d82f62817194100ef.tar nixlib-13e2e19158bcd2b4d53e452d82f62817194100ef.tar.gz nixlib-13e2e19158bcd2b4d53e452d82f62817194100ef.tar.bz2 nixlib-13e2e19158bcd2b4d53e452d82f62817194100ef.tar.lz nixlib-13e2e19158bcd2b4d53e452d82f62817194100ef.tar.xz nixlib-13e2e19158bcd2b4d53e452d82f62817194100ef.tar.zst nixlib-13e2e19158bcd2b4d53e452d82f62817194100ef.zip |
xdg: add modules for supporting various XDG specs
Diffstat (limited to 'nixos/modules/config')
-rw-r--r-- | nixos/modules/config/system-path.nix | 17 | ||||
-rw-r--r-- | nixos/modules/config/xdg/autostart.nix | 22 | ||||
-rw-r--r-- | nixos/modules/config/xdg/icons.nix | 27 | ||||
-rw-r--r-- | nixos/modules/config/xdg/menus.nix | 25 | ||||
-rw-r--r-- | nixos/modules/config/xdg/mime.nix | 26 |
5 files changed, 104 insertions, 13 deletions
diff --git a/nixos/modules/config/system-path.nix b/nixos/modules/config/system-path.nix index 361151665018..a07a40e86bd1 100644 --- a/nixos/modules/config/system-path.nix +++ b/nixos/modules/config/system-path.nix @@ -107,12 +107,7 @@ in "/etc/gtk-3.0" "/lib" # FIXME: remove and update debug-info.nix "/sbin" - "/share/applications" - "/share/desktop-directories" "/share/emacs" - "/share/icons" - "/share/menus" - "/share/mime" "/share/nano" "/share/org" "/share/themes" @@ -132,10 +127,6 @@ in # outputs TODO: note that the tools will often not be linked by default postBuild = '' - if [ -x $out/bin/update-mime-database -a -w $out/share/mime ]; then - XDG_DATA_DIRS=$out/share $out/bin/update-mime-database -V $out/share/mime > /dev/null - fi - if [ -x $out/bin/gtk-update-icon-cache -a -f $out/share/icons/hicolor/index.theme ]; then $out/bin/gtk-update-icon-cache $out/share/icons/hicolor fi @@ -144,16 +135,16 @@ in $out/bin/glib-compile-schemas $out/share/glib-2.0/schemas fi - if [ -x $out/bin/update-desktop-database -a -w $out/share/applications ]; then - $out/bin/update-desktop-database $out/share/applications - fi - if [ -x $out/bin/install-info -a -w $out/share/info ]; then shopt -s nullglob for i in $out/share/info/*.info $out/share/info/*.info.gz; do $out/bin/install-info $i $out/share/info/dir done fi + '' ++ optionalString config.xdg.mime.enable '' + XDG_DATA_DIRS=$out/share ${pkgs.shared-mime-info}/bin/update-mime-database -V $out/share/mime > /dev/null + + ${pkgs.desktop-file-utils}/bin/update-desktop-database $out/share/applications ''; }; diff --git a/nixos/modules/config/xdg/autostart.nix b/nixos/modules/config/xdg/autostart.nix new file mode 100644 index 000000000000..0ee94fed818b --- /dev/null +++ b/nixos/modules/config/xdg/autostart.nix @@ -0,0 +1,22 @@ +{ config, lib, ... }: + +with lib; +{ + options = { + xdg.autostart.enable = mkOption { + type = types.bool; + default = true; + description = '' + Whether to install files to support the + <link xlink:href="https://specifications.freedesktop.org/autostart-spec/autostart-spec-latest.html">XDG Autostart specification</link>. + ''; + }; + }; + + config = mkIf config.xdg.autostart.enable { + environment.pathsToLink = [ + "/etc/xdg/autostart" + ]; + }; + +} diff --git a/nixos/modules/config/xdg/icons.nix b/nixos/modules/config/xdg/icons.nix new file mode 100644 index 000000000000..8268a3771a0e --- /dev/null +++ b/nixos/modules/config/xdg/icons.nix @@ -0,0 +1,27 @@ +{ config, lib, ... }: + +with lib; +{ + options = { + xdg.icons.enable = mkOption { + type = types.bool; + default = true; + description = '' + Whether to install files to support the + <link xlink:href="https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html">XDG Icon Theme specification</link>. + ''; + }; + }; + + config = mkIf config.xdg.icons.enable { + environment.pathsToLink = [ + "/share/icons" + "/share/pixmaps" + ]; + + environment.profileRelativeEnvVars = { + XCURSOR_PATH = [ "/share/icons" ]; + }; + }; + +} diff --git a/nixos/modules/config/xdg/menus.nix b/nixos/modules/config/xdg/menus.nix new file mode 100644 index 000000000000..c172692df5d7 --- /dev/null +++ b/nixos/modules/config/xdg/menus.nix @@ -0,0 +1,25 @@ +{ config, lib, ... }: + +with lib; +{ + options = { + xdg.menus.enable = mkOption { + type = types.bool; + default = true; + description = '' + Whether to install files to support the + <link xlink:href="https://specifications.freedesktop.org/menu-spec/menu-spec-latest.html">XDG Desktop Menu specification</link>. + ''; + }; + }; + + config = mkIf config.xdg.menus.enable { + environment.pathsToLink = [ + "/share/applications" + "/share/desktop-directories" + "/etc/xdg/menus" + "/etc/xdg/menus/applications-merged" + ]; + }; + +} diff --git a/nixos/modules/config/xdg/mime.nix b/nixos/modules/config/xdg/mime.nix new file mode 100644 index 000000000000..db3e7c6d4c53 --- /dev/null +++ b/nixos/modules/config/xdg/mime.nix @@ -0,0 +1,26 @@ +{ config, lib, pkgs, ... }: + +with lib; +{ + options = { + xdg.mime.enable = mkOption { + type = types.bool; + default = true; + description = '' + Whether to install files to support the + <link xlink:href="https://specifications.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html">XDG Shared MIME-info specification</link> and the + <link xlink:href="https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-latest.html">XDG MIME Applications specification</link>. + ''; + }; + }; + + config = mkIf config.xdg.mime.enable { + environment.pathsToLink = [ "/share/mime" ]; + + environment.systemPackages = [ + # this package also installs some useful data, as well as its utilities + pkgs.shared-mime-info + ]; + }; + +} |