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

watchexec: darwin support #46313

Closed
wants to merge 4 commits into from
Closed

watchexec: darwin support #46313

wants to merge 4 commits into from

Conversation

nikitavoloboev
Copy link
Contributor

Motivation for this change

watchexec wasn't building correctly on macOS. With help of @LnL7 it does.

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 nox --run "nox-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)
  • Fits CONTRIBUTING.md.

pkgs/tools/misc/watchexec/default.nix Outdated Show resolved Hide resolved
pkgs/tools/misc/watchexec/default.nix Outdated Show resolved Hide resolved
pkgs/tools/misc/watchexec/default.nix Outdated Show resolved Hide resolved
pkgs/tools/misc/watchexec/default.nix Outdated Show resolved Hide resolved
pkgs/tools/misc/watchexec/default.nix Outdated Show resolved Hide resolved
pkgs/tools/misc/watchexec/default.nix Outdated Show resolved Hide resolved
@nikitavoloboev
Copy link
Contributor Author

Thanks for the review @xeji. I hope I fixed all. One of them I don't know how I can do.


src = fetchFromGitHub {
owner = "watchexec";
repo = "watchexec";
rev = version;
sha256 = "0zp5s2dy5zbar0virvy1izjpvvgwbz7rvjmcy6bph6rb5c4bhm70";
sha256 = "1jib51dbr6s1iq21inm2xfsjnz1730nyd3af1x977iqivmwdisax";
Copy link
Member

Choose a reason for hiding this comment

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

Is there something in the sources that results in a different hash on darwin because of case normalisation?

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like. When I try this locally on x86_64-linux (starting with an all-zeroes hash), I get the original hash "0zp5s...". So @LnL7 what do we do about it?

Copy link
Member

Choose a reason for hiding this comment

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

I can't reproduce this hash.

$ nix-build -A watchexec.src --check                                                                                                                                                                                                                                /src/nixpkgs
these paths will be fetched (0.02 MiB download, 0.11 MiB unpacked):
  /nix/store/gh84q49b42kmj94290sswvgcxd648whn-source
copying path '/nix/store/gh84q49b42kmj94290sswvgcxd648whn-source' from 'https://cache.nixos.org'...
checking outputs of '/nix/store/lg5sa2bwasp43vhdxw5kaqav148gf3y6-source.drv'...

trying https://github.com/watchexec/watchexec/archive/1.9.0.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   126    0   126    0     0    115      0 --:--:--  0:00:01 --:--:--   115
100 30620    0 30620    0     0  12267      0 --:--:--  0:00:02 --:--:-- 25537
unpacking source archive /private/tmp/nix-build-source.drv-0/1.9.0.tar.gz
warning: rewriting hashes in '/nix/store/gh84q49b42kmj94290sswvgcxd648whn-source'; cross fingers
fixed-output derivation produced path '/nix/store/7r3rf4dz5cx81qnaiybypbp9nwzcbp2n-source' with sha256 hash '0zp5s2dy5zbar0virvy1izjpvvgwbz7rvjmcy6bph6rb5c4bhm70' instead of the expected hash '1jib51dbr6s1iq21inm2xfsjnz1730nyd3af1x977iqivmwdisax'
error: build of '/nix/store/lg5sa2bwasp43vhdxw5kaqav148gf3y6-source.drv' failed

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, then let's keep the hash unchanged at 0zp5s2dy5zbar0virvy1izjpvvgwbz7rvjmcy6bph6rb5c4bhm70 because we both get that.

Copy link
Member

Choose a reason for hiding this comment

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

I propose we keep the hash as is, otherwise the linux build might start to fail.

@LnL7
Copy link
Member

LnL7 commented Sep 9, 2018

@GrahamcOfBorg build watchexec

@GrahamcOfBorg
Copy link

No attempt on x86_64-darwin (full log)

The following builds were skipped because they don't evaluate on x86_64-darwin: watchexec

Partial log (click to expand)


a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowUnsupportedSystem = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowUnsupportedSystem = true; }
to ~/.config/nixpkgs/config.nix.


@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: watchexec

Partial log (click to expand)


installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/5a9jh5d133drgkgllyb9brdy766mrg5a-watchexec-1.9.0
shrinking /nix/store/5a9jh5d133drgkgllyb9brdy766mrg5a-watchexec-1.9.0/bin/watchexec
strip is /nix/store/h0lbngpv6ln56hjj59i6l77vxq25flbz-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/5a9jh5d133drgkgllyb9brdy766mrg5a-watchexec-1.9.0/bin
patching script interpreter paths in /nix/store/5a9jh5d133drgkgllyb9brdy766mrg5a-watchexec-1.9.0
checking for references to /build in /nix/store/5a9jh5d133drgkgllyb9brdy766mrg5a-watchexec-1.9.0...
/nix/store/5a9jh5d133drgkgllyb9brdy766mrg5a-watchexec-1.9.0

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: watchexec

Partial log (click to expand)


installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/cfmdvyhd2gjyjddiya9hib7gb3k7q4qm-watchexec-1.9.0
shrinking /nix/store/cfmdvyhd2gjyjddiya9hib7gb3k7q4qm-watchexec-1.9.0/bin/watchexec
strip is /nix/store/y4ymnvgxygpq05h03kyzbj572zmh6zla-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/cfmdvyhd2gjyjddiya9hib7gb3k7q4qm-watchexec-1.9.0/bin
patching script interpreter paths in /nix/store/cfmdvyhd2gjyjddiya9hib7gb3k7q4qm-watchexec-1.9.0
checking for references to /build in /nix/store/cfmdvyhd2gjyjddiya9hib7gb3k7q4qm-watchexec-1.9.0...
/nix/store/cfmdvyhd2gjyjddiya9hib7gb3k7q4qm-watchexec-1.9.0

@xeji
Copy link
Contributor

xeji commented Sep 9, 2018

@nikitavoloboev somehow meta platforms is back to platforms.linuxnow, so this won't evaluate on darwin. please set platforms to platforms.unix again.

@nikitavoloboev
Copy link
Contributor Author

@xeji changed

@xeji
Copy link
Contributor

xeji commented Sep 9, 2018

@GrahamcOfBorg build watchexec

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: watchexec

Partial log (click to expand)

/nix/store/cfmdvyhd2gjyjddiya9hib7gb3k7q4qm-watchexec-1.9.0

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: watchexec

Partial log (click to expand)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

installing
post-installation fixup
strip is /nix/store/df6k4mgdjxciy0f637lryp7c9ln7n1m3-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/4r2mxg1f43c78b06q7xs7k66wjh9kvp8-watchexec-1.9.0/bin
patching script interpreter paths in /nix/store/4r2mxg1f43c78b06q7xs7k66wjh9kvp8-watchexec-1.9.0
/nix/store/4r2mxg1f43c78b06q7xs7k66wjh9kvp8-watchexec-1.9.0

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: watchexec

Partial log (click to expand)


installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/5a9jh5d133drgkgllyb9brdy766mrg5a-watchexec-1.9.0
shrinking /nix/store/5a9jh5d133drgkgllyb9brdy766mrg5a-watchexec-1.9.0/bin/watchexec
strip is /nix/store/h0lbngpv6ln56hjj59i6l77vxq25flbz-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/5a9jh5d133drgkgllyb9brdy766mrg5a-watchexec-1.9.0/bin
patching script interpreter paths in /nix/store/5a9jh5d133drgkgllyb9brdy766mrg5a-watchexec-1.9.0
checking for references to /build in /nix/store/5a9jh5d133drgkgllyb9brdy766mrg5a-watchexec-1.9.0...
/nix/store/5a9jh5d133drgkgllyb9brdy766mrg5a-watchexec-1.9.0

Copy link
Member

@LnL7 LnL7 left a comment

Choose a reason for hiding this comment

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

Could you run the same check command, I also get the original hash.

The rest should be good.

@nikitavoloboev
Copy link
Contributor Author

run the same check command

~/Documents/src/clones/nixpkgs watchexec
❯ nix-build -A watchexec.src --check
checking outputs of '/nix/store/lg5sa2bwasp43vhdxw5kaqav148gf3y6-source.drv'...

trying https://github.com/watchexec/watchexec/archive/1.9.0.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   126    0   126    0     0    142      0 --:--:-- --:--:-- --:--:--   142
100 30620    0 30620    0     0  20801      0 --:--:--  0:00:01 --:--:-- 20801
unpacking source archive /private/tmp/nix-build-source.drv-0/1.9.0.tar.gz
warning: rewriting hashes in '/nix/store/gh84q49b42kmj94290sswvgcxd648whn-source'; cross fingers
/nix/store/gh84q49b42kmj94290sswvgcxd648whn-source

Is that okay?

@LnL7
Copy link
Member

LnL7 commented Sep 11, 2018

Hmm, any idea what could be different about your setup? Like a case sensitive filesystem.

@nikitavoloboev
Copy link
Contributor Author

Like a case sensitive filesystem

macOS is case insensitive and I am running macOS 10.13.6

Not really sure what can be different.

@LnL7
Copy link
Member

LnL7 commented Sep 11, 2018

You can explicitly install with a case sensitive filesystem if you want. 10.13 means you're probably using APFS, but I tested both that and HFS+ so I have no idea.

@dywedir
Copy link
Member

dywedir commented May 29, 2019

Superseded by #49284

@dywedir dywedir closed this May 29, 2019
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

5 participants