Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xdg-mime type package options #5920

Merged
merged 2 commits into from
Oct 7, 2024

Conversation

notalltim
Copy link
Contributor

Description

This PR adds package options for shared-mime-info and desktop-file-utils for the purpose of allowing users to override the version in nixpkgs. This with overridden version of shared-mime-info should resolve #4955, #5102, #4682, and possibly #4941. I also added a couple basic tests for the module. An example of using the override can be found at notalltim/home-manager-config#4. I did not see a maintainer let me know if I missed one.

Checklist

  • Change is backwards compatible.

  • Code formatted with ./format.

  • Code tested through nix-shell --pure tests -A run.all or nix develop --ignore-environment .#all using Flakes.

  • Test cases updated/added. See example.

  • Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • Added myself as module maintainer. See example.

Maintainer CC

The `xdg-mime` module now exposes packages to determine what will be run
for update-mime-database and update-desktop-database. This allows users
to select a different version of these packages if the are incompatible.
This should, in combination with an override to the version of
`shared-mime-info` (can be found here notalltim/home-manager-config#4),
resolve nix-community#4955, nix-community#5102, nix-community#4682, and possibly nix-community#4941. The problem seems to stem
from a mismatch in the version of `shared-mime-info` with the host.

I also switched from using `buildPackages` to `pkgs` to improve
cross-compilation compatibility.
The xdg-mime module was missing tests so I added basic test for all the
options and checked the basic behavior. It covers ensuring that the
proper files/folders are created and that the package overrides work.
@teto
Copy link
Collaborator

teto commented Oct 7, 2024

though it's possible to achieve that via an overlay, I can see how this could be easier to use.

@teto teto merged commit 0386303 into nix-community:master Oct 7, 2024
3 checks passed
@@ -46,12 +63,12 @@ in {
if [[ -w $out/share/mime && -w $out/share/mime/packages && -d $out/share/mime/packages ]]; then
XDG_DATA_DIRS=$out/share \
PKGSYSTEM_ENABLE_FSYNC=0 \
${pkgs.buildPackages.shared-mime-info}/bin/update-mime-database \
${getExe cfg.sharedMimeInfoPackage} \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are run during the build right?, so this breaks cross. Reported by @colemickens

Mikilio pushed a commit to Mikilio/home-manager that referenced this pull request Oct 11, 2024
* xdg-mime: allow overrides to shared-mime-info and desktop-file-utils

The `xdg-mime` module now exposes packages to determine what will be run
for update-mime-database and update-desktop-database. This allows users
to select a different version of these packages if the are incompatible.
This should, in combination with an override to the version of
`shared-mime-info` (can be found here notalltim/home-manager-config#4),
resolve nix-community#4955, nix-community#5102, nix-community#4682, and possibly nix-community#4941. The problem seems to stem
from a mismatch in the version of `shared-mime-info` with the host.

I also switched from using `buildPackages` to `pkgs` to improve
cross-compilation compatibility.

* xdg-mime: Add tests for xdg-mime module

The xdg-mime module was missing tests so I added basic test for all the
options and checked the basic behavior. It covers ensuring that the
proper files/folders are created and that the package overrides work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: xdg.mime.enabled = true causes crash when encountering a .json file
3 participants