Conversation
|
it could be also enabled if a display manager is enabled. Afaik it also make sense in the context of window managers like awesome or i3. |
nixos/modules/config/xdg/menus.nix
Outdated
There was a problem hiding this comment.
Whoops, left over from when I did try having a base-directories module.
nixos/modules/config/system-path.nix
Outdated
There was a problem hiding this comment.
Why this? The rest of the share subdirectories in pathsToLink would be pointless then. I think we want to avoid "/share" (principle of least privilege or something).
There was a problem hiding this comment.
Hm, I think I was confused by the need for /etc/xdg but not /share - I think you're right that it will do the right thing because we typically include subdirectories of /share explicitly.
2a69ba0 to
d00f085
Compare
|
Hm, good point about non-DE environments. |
d00f085 to
1b3b81f
Compare
1b3b81f to
680bfb5
Compare
|
Okay, I've removed the settings in the DEs, relying on the xserver module to set the option. |
nixos/modules/config/xdg/mime.nix
Outdated
| environment.extraSetup = '' | ||
| 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 |
There was a problem hiding this comment.
This should be probably separate from mime module. After all, the applications dir is also used by desktop-entry-spec and menu-spec.
There was a problem hiding this comment.
Yes, but I believe that update-desktop-database only performs actions relevant to MIME lookup, so I think it belongs here.
nixos/modules/config/xdg/menus.nix
Outdated
| config = mkIf config.xdg.menus.enable { | ||
| environment.pathsToLink = [ | ||
| "/share/applications" | ||
| "/share/applications-merged" |
There was a problem hiding this comment.
It looks like it should be share/menus/applications-merged: https://specifications.freedesktop.org/menu-spec/menu-spec-latest.html#paths
There was a problem hiding this comment.
Ah yes, good spot.
|
The original code checked for existence of the directory used for generating the caches, can we make sure that the generators work even with the directory possibly missing? |
| @@ -0,0 +1,21 @@ | |||
| { config, lib, pkgs, ... }: | |||
| type = types.bool; | ||
| default = true; | ||
| description = '' | ||
| Whether to install files to support the XDG Autostart specification. |
There was a problem hiding this comment.
It would be nice to have a link to the specification <link xlink:href="https://specifications.freedesktop.org/autostart-spec/autostart-spec-latest.html">XDG Autostart specification</link>
nixos/modules/config/system-path.nix
Outdated
| extraSetup = mkOption { | ||
| type = types.lines; | ||
| default = [ ]; | ||
| 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."; |
There was a problem hiding this comment.
Maybe mention something about the $out thing.
| 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 |
There was a problem hiding this comment.
This should probably be moved to xdg.icons
There was a problem hiding this comment.
Hm, I wasn't sure about that - I thought maybe there should be a GTK module that does this?
There was a problem hiding this comment.
Right, that looks like GTK thing: https://developer.gnome.org/gtk3/stable/gtk-update-icon-cache.html
We should probably get a module later.
There was a problem hiding this comment.
Similarly for the glib schemas.
bde1594 to
e551e1b
Compare
|
Comments addressed. I put back the test that the target directory be writable in the fragments. I also fixed a mistake with the |
nixos/modules/config/xdg/menus.nix
Outdated
|
Hold off this for a bit while I do some more testing. |
|
Okay, it turns out that linking At this point, a diff of my system-path built with and without this reveals only the previously missing XDG menu dirs. |
|
(so I'm fairly confident in this now) |
nixos/modules/config/xdg/mime.nix
Outdated
There was a problem hiding this comment.
This module might also add shared-mime-info to environment.systemPackages to be linked into environment to fix bugs like #39493
There was a problem hiding this comment.
Aha, good catch. I had thought I could get away with removing them since the use of the binary is now encoded here, but it seems like it also has data to install.
Those applications are broken then. I intend to remove |
|
Also, similar to |
I think that's a good idea, but I think we can do it as future work.
Sure, but let's do follow-ups. As an aside, it looks like we install a bunch of stuff in |
Yeah, but I would leave it localized in the DE modules that need it, not move it up to xserver.
Sounds good. By the way, do we need to write docs for manual or release notes? |
|
I don't think we should leave the linking of I don't think we need a doc change, this should only make things work better. However, I forgot to ask: should we consider having the default for some of these modules be not enabled? That would mean that systems without X could get away with e.g. not having icons, which might shrink closures a bit. OTOH, then we would definitely need a release note, since some things might rely on it happening implicitly. |
|
For example, I noticed this because |
|
This is the diff between the profiles - as you can see, a lot of stuff goes missing. |
Moving it up in the chain would make the future granularization harder as more bugs would be obscured until then. I think status quo is good enough for now.
Hmm, $ nix path-info -f . -S shared-mime-info
/nix/store/g89z1wlss6dnhcvajxmn36nbayql80rh-shared-mime-info-1.10 48303016
$ nix path-info -f . -S desktop-file-utils
/nix/store/i6iglvwcq294nyam49h0q04aqzjzqf2c-desktop-file-utils-0.23 39642584But looks like it is mostly just
I would leave this as is and address this in further PR.
In my experience, most apps compile in the path. Only minority looks up their own data in |
|
Hm, I was thinking that we would save on closures by not linking |
ca0476f to
1b11fdd
Compare
|
I've returned the linking of |
|
In case it wasn't clear from my comment before: since there's unlikely to be a closure size improvement, I think we should leave these options enabled by default. |
jtojnar
left a comment
There was a problem hiding this comment.
Great job. Looks good to me, though I would still like another set of eyes to check this.
|
@vcunat could you have a look at the final state of this? |
nixos/modules/config/system-path.nix
Outdated
|
|
||
| extraSetup = mkOption { | ||
| type = types.lines; | ||
| default = [ ]; |
There was a problem hiding this comment.
Nit: I think using an empty string as the default value is strictly more correct.
|
ping |
|
It is still in some reviewers’ queues. Let’s leave it one more week. |
|
Wasn't intending to be pushy, just thought we'd got pretty close :) |
|
Don't hang the reviews and merging on this issue, but I'm wondering why the |
|
Enabling them in |
|
Ping - I think this would be a reasonable inclusion for 18.09. |
Motivation for this change
Follow-up to/supersedes #44866.
This adds some modules that handle various parts of the XDG specs. This allows us to move some of the logic out of
system-path.nix, and have a more sensible way to decide whether to update MIME caches.I then added an option to
system-pathto allow extra environment setup commands to be defined by other modules, so the MIME module can also have the setup code in it.Points I'm unsure about
/shareand/etc/xdg, which might have some value.extraSetupmechanism forsystem-pathOK? It's a bit ugly that clients use$outto be the output of another derivation.@jtojnar @vcunat
Things done
sandboxinnix.confon non-NixOS)nix-shell -p nox --run "nox-review wip"./result/bin/)nix path-info -Sbefore and after)