system-path: allow other modules to provide setup fragments

+26 -11
+8 -11
nixos/modules/config/system-path.nix
··· 81 description = "List of additional package outputs to be symlinked into <filename>/run/current-system/sw</filename>."; 82 }; 83 84 }; 85 86 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 }; 83 84 + 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 }; 91 92 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} 145 ''; 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 ]; 24 }; 25 26 }
··· 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 }; 35 36 }
+8
nixos/modules/misc/documentation.nix
··· 82 environment.systemPackages = [ pkgs.texinfoInteractive ]; 83 environment.pathsToLink = [ "/share/info" ]; 84 environment.extraOutputsToInstall = [ "info" ] ++ optional cfg.dev.enable "devinfo"; 85 }) 86 87 (mkIf cfg.doc.enable {
··· 82 environment.systemPackages = [ pkgs.texinfoInteractive ]; 83 environment.pathsToLink = [ "/share/info" ]; 84 environment.extraOutputsToInstall = [ "info" ] ++ optional cfg.dev.enable "devinfo"; 85 + environment.extraSetup = '' 86 + if [ -w $out/share/info ]; then 87 + shopt -s nullglob 88 + for i in $out/share/info/*.info $out/share/info/*.info.gz; do 89 + ${pkgs.texinfo}/bin/install-info $i $out/share/info/dir 90 + done 91 + fi 92 + ''; 93 }) 94 95 (mkIf cfg.doc.enable {