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

crawl: add .desktop file and use high-res app icon #59915

Merged
merged 1 commit into from Apr 26, 2019

Conversation

lightbulbjim
Copy link
Contributor

Motivation for this change

The crawl source includes .desktop files but currently they are not
installed. This change installs them (with the executable path tweaked
for NixOS compatibility).

Also included in this change is a patch to use the included high-res app
icon instead of the default 32x32 icon. The default icon is very low res
and looks out of place beside other app icons.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@lightbulbjim
Copy link
Contributor Author

I've upstreamed the icon change but they only release every six months. Once the new version is released I'll remove the patch from nixpkgs, but in the meantime it would be nice to keep it.

Copy link
Contributor

@worldofpeace worldofpeace left a comment

Choose a reason for hiding this comment

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

Can you add the commit you upstreamed as a patch like?

patches = [
  (fetchpatch {
    url = "https://github.com/crawl/crawl/commit/2aa1166087e44e6585b26cedf1fe81b3f3ba547f.patch"
    sha256 = "0000000000000000000000000000000000000000000000000000";
  })
];

And remove it from the tree?

@lightbulbjim
Copy link
Contributor Author

Can you add the commit you upstreamed as a patch ... And remove it from the tree?

Good idea, it didn't even occur to me. Updated.

@worldofpeace
Copy link
Contributor

Hash mismatch

 wanted: sha256:09ip3ppb81szn85l32zh3xiyp9kblcz8d0ngw83ilyr7p796m402
  got:    sha256:1jqrdv4wy18shg1fdabdb421232hg5micphkixcyzxd1lrmvadg0

Note that fetchpatch normalizes the generated patch, so if you for example retrieved the hash from
nix-prefetch-url it won't be correct.

@lightbulbjim
Copy link
Contributor Author

Note that fetchpatch normalizes the generated patch, so if you for example retrieved the hash from
nix-prefetch-url it won't be correct.

I did use nix-prefetch-url to retrieve the hash.

The build succeeds for me with either 09ip3ppb81szn85l32zh3xiyp9kblcz8d0ngw83ilyr7p796m402 or 1jqrdv4wy18shg1fdabdb421232hg5micphkixcyzxd1lrmvadg0 set in fetchpatch. Not sure what's going on there. Other values do fail for me with a hash mismatch.

I guess I should use 1jqrdv4wy18shg1fdabdb421232hg5micphkixcyzxd1lrmvadg0? Not sure why you're getting different results (or why both hashes work for me).

The crawl source includes .desktop files but currently they are not
installed. This change installs them (with the executable path tweaked
for NixOS compatibility).

Also included in this change is an upstream patch to use the included
high-res app icon instead of the default 32x32 icon. The default icon
is very low res and looks out of place beside other app icons.
@lightbulbjim
Copy link
Contributor Author

Finally got a chance to look at this. The tl;dr is that I updated the hash to 1jqrdv4wy18shg1fdabdb421232hg5micphkixcyzxd1lrmvadg0 and nix-review is now happy.

More context:

nix-build was happy with either hash. In fact, I've been building my system packages from a local branch with the "bad" hash for the past few days and it's been working fine. nix-build does complain if I change the hash to some other value.

nix-review, on the other other hand, would only work with 1jqrdv4wy18shg1fdabdb421232hg5micphkixcyzxd1lrmvadg0. Not sure what it's doing differently to nix-build; I'll have to look into that.

Compounding my testing was the fact that nix-review wip would fail to build the package every time with a "patch failed to apply" error. The only way I could get it to build was to commit my changes and use nix-review rev. Again, something I need to figure out as it took a while for me to realise that the error had nothing to do with the patch.

@worldofpeace
Copy link
Contributor

For fixed-output derivations if the hash already matches a path in the store nix will skip the download and just use the existing path. Since you used nix-prefetch-url and used that hash I didn't get downloaded because the path already existed.

So changing the hash so that it no longer matches forces a rebuild, and then you get the mismatch because it wasn't correct.

I tend to do Trust on first use where you use a placeholder hash that for sure will be wrong

sha256 = "0000000000000000000000000000000000000000000000000000";

and then when the build fails with a hash mismatch you then substitute it with that hash
and assume it's correct.

I've done this locally and the hash used is correct

hash mismatch in fixed-output derivation '/nix/store/7spb1nsg7dj2bji2bgpai806vy4bmja4-2aa1166087e44e6585b26cedf1fe81b3f3ba547f.patch':
  wanted: sha256:0000000000000000000000000000000000000000000000000000
  got:    sha256:1jqrdv4wy18shg1fdabdb421232hg5micphkixcyzxd1lrmvadg0
more info at https://nixos.org/nixos/nix-pills/nix-store-paths.html

Copy link
Contributor

@worldofpeace worldofpeace left a comment

Choose a reason for hiding this comment

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

Desktop item and icons look good.

@worldofpeace worldofpeace merged commit bd89f7c into NixOS:master Apr 26, 2019
@worldofpeace
Copy link
Contributor

Thank you @lightbulbjim for fixing this.

If you have more questions about the hash issue, feel free to ask me.
There's also lots of people in #nixos (freenode) who'd also enjoy explaining this.

@lightbulbjim
Copy link
Contributor Author

Thanks for merging and especially for the help. I appreciate it!

@lightbulbjim lightbulbjim deleted the crawl-icon branch April 26, 2019 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants