···81 description = "List of additional package outputs to be symlinked into <filename>/run/current-system/sw</filename>.";
82 };
8300000084 };
8586 system = {
···134 if [ -x $out/bin/glib-compile-schemas -a -w $out/share/glib-2.0/schemas ]; then
135 $out/bin/glib-compile-schemas $out/share/glib-2.0/schemas
136 fi
137-138- if [ -x $out/bin/install-info -a -w $out/share/info ]; then
139- shopt -s nullglob
140- for i in $out/share/info/*.info $out/share/info/*.info.gz; do
141- $out/bin/install-info $i $out/share/info/dir
142- done
143- fi
144- '' ++ optionalString config.xdg.mime.enable ''
145- XDG_DATA_DIRS=$out/share ${pkgs.shared-mime-info}/bin/update-mime-database -V $out/share/mime > /dev/null
146-147- ${pkgs.desktop-file-utils}/bin/update-desktop-database $out/share/applications
148 '';
149 };
150
···81 description = "List of additional package outputs to be symlinked into <filename>/run/current-system/sw</filename>.";
82 };
8384+ extraSetup = mkOption {
85+ type = types.lines;
86+ default = [ ];
87+ description = "Shell fragments to be run after the system environment has been created. This should only be used for things that need to modify the internals of the environment, e.g. generating MIME caches. The environment being built can be accessed at $out.";
88+ };
89+90 };
9192 system = {
···140 if [ -x $out/bin/glib-compile-schemas -a -w $out/share/glib-2.0/schemas ]; then
141 $out/bin/glib-compile-schemas $out/share/glib-2.0/schemas
142 fi
143+144+ ${config.environment.extraSetup}
000000000145 '';
146 };
147
+10
nixos/modules/config/xdg/mime.nix
···21 # this package also installs some useful data, as well as its utilities
22 pkgs.shared-mime-info
23 ];
000000000024 };
2526}
···21 # this package also installs some useful data, as well as its utilities
22 pkgs.shared-mime-info
23 ];
24+25+ environment.extraSetup = ''
26+ if [ -w $out/share/mime ]; then
27+ XDG_DATA_DIRS=$out/share ${pkgs.shared-mime-info}/bin/update-mime-database -V $out/share/mime > /dev/null
28+ fi
29+30+ if [ -w $out/share/applications ]; then
31+ ${pkgs.desktop-file-utils}/bin/update-desktop-database $out/share/applications
32+ fi
33+ '';
34 };
3536}