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

darwin.iproute2mac: init at 1.2.1 #41768

Merged
merged 2 commits into from Jun 9, 2018
Merged

darwin.iproute2mac: init at 1.2.1 #41768

merged 2 commits into from Jun 9, 2018

Conversation

flokli
Copy link
Contributor

@flokli flokli commented Jun 9, 2018

Motivation for this change

This adds iproute2mac, a CLI wrapper for basic network utilites on Mac OS X inspired with iproute2 on Linux.

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/)
  • Fits CONTRIBUTING.md.

cc @LnL7

@GrahamcOfBorg GrahamcOfBorg added the 6.topic: darwin Running or building packages on Darwin label Jun 9, 2018

buildInputs = [ python ];

__impureHostDeps = [
Copy link
Member

Choose a reason for hiding this comment

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

This is only necessary if you're actually calling these in the builder. You should be able to leave this out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, wasn't aware. will strip them out.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, and I'm not even sure if /usr/bin is allowed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@LnL7 from the builder? Don't know too, I just thought I should probably document impure usages somewhere. PR updated with __impureHostDeps removed.

Copy link
Member

Choose a reason for hiding this comment

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

For reference, these are the only prefixes that this works for unless this is overridden in nix.conf with allowed-impure-host-deps.
https://github.com/NixOS/nix/blob/e7cb2847ab1cec48eac6a86c56885b3f0df76275/src/libstore/globals.cc#L22

This is used to open up the build sandbox when sandboxing is enabled, allowing builds to open up arbitrary paths would be a security concern.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for the explanation!

buildInputs = [ python ];

postPatch = ''
substituteInPlace src/ip.py --replace /usr/bin/python ${python}/bin/python
Copy link
Member

Choose a reason for hiding this comment

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

Can you also wrap the other commands here? darwin.network_cmds should have them all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right. what about sudo?

Copy link
Member

Choose a reason for hiding this comment

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

It's probably okay to leave for now. I don't think it's packaged anywhere? /cc @LnL7

Copy link
Contributor Author

Choose a reason for hiding this comment

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

patched all network_cmds. I doubt pkgs/tools/security/sudo would easily be portable for darwin, so relying on /usr/bin/sudo being there might be ok

Copy link
Member

Choose a reason for hiding this comment

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

Sudo can't work, it needs a setuid bit.

@GrahamcOfBorg
Copy link

No attempt on aarch64-linux (full log)

The following builds were skipped because they don't evaluate on aarch64-linux: darwin.iproute2mac

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

No attempt on x86_64-linux (full log)

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

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-darwin (full log)

Attempted: darwin.iproute2mac

Partial log (click to expand)

configuring
no configure script, doing nothing
building
no Makefile, doing nothing
installing
post-installation fixup
strip is /nix/store/yyak5sjv68n9vdgnkd2cb5djk1l9sqj5-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/60jvgba0j6x9hq2q3m8q30c407v87jzd-iproute2mac-1.2.1/bin
patching script interpreter paths in /nix/store/60jvgba0j6x9hq2q3m8q30c407v87jzd-iproute2mac-1.2.1
/nix/store/60jvgba0j6x9hq2q3m8q30c407v87jzd-iproute2mac-1.2.1

@LnL7 LnL7 merged commit 253d781 into NixOS:master Jun 9, 2018
@flokli
Copy link
Contributor Author

flokli commented Jun 9, 2018

Thanks!

@flokli flokli deleted the iproute2mac branch June 9, 2018 21:17
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

4 participants