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

pass: refactor extension packaging #39121

Merged
merged 1 commit into from May 4, 2018

Conversation

tadfisher
Copy link
Contributor

@tadfisher tadfisher commented Apr 18, 2018

Motivation for this change

It was pointed out in a pass-otp PR that the pass-otp derivation doesn't actually work, because it's not included in the pass environment. For context, pass requires extension scripts to live in ${pass}/lib/password-store/extensions, and those scripts can have external dependencies of their own.

I looked at adding pass-otp to the existing pass derivation but it was looking a bit nasty to hack in there, as the derivation built a set of extensions unconditionally and included them in the pass output.

So I refactored the derivation to clean up some things:

  • Build a pass-extensions-env environment and link that output to ${pass}/lib/password-store/extensions/.
  • Split extension derivations into extensions/*.nix, which can include their own dependencies independently of the generic pass derivation.
  • Add a pass.withExtensions passthru function which builds pass with a configurable extensions environment, as in
pass.withExtensions (ext: with ext; [ pass-otp pass-tomb pass-import pass-update ])
  • Add a top-level passExtensions attribute to facilitate discovering extensions.
  • Support the pass-otp attribute and the tombPluginSupport ? false argument for backwards-compatibility.
  • Fix pass-import, as it doesn't work currently without a python.withPackages python environment.
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-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.

@tadfisher
Copy link
Contributor Author

cc maintainers: @lovek323 @the-kenny @fpletz @jwiegley

@tadfisher
Copy link
Contributor Author

@GrahamcOfBorg build pass pass-otp

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: pass, pass-otp

Partial log (click to expand)

shrinking RPATHs of ELF executables and libraries in /nix/store/p292w09kssjlrl4mnx649n7ckw70l4yh-password-store-1.7.1
gzipping man pages under /nix/store/p292w09kssjlrl4mnx649n7ckw70l4yh-password-store-1.7.1/share/man/
strip is /nix/store/j7d4mr0ikv974ig7yzhknpsq288js4bs-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/p292w09kssjlrl4mnx649n7ckw70l4yh-password-store-1.7.1/lib  /nix/store/p292w09kssjlrl4mnx649n7ckw70l4yh-password-store-1.7.1/bin
patching script interpreter paths in /nix/store/p292w09kssjlrl4mnx649n7ckw70l4yh-password-store-1.7.1
/nix/store/p292w09kssjlrl4mnx649n7ckw70l4yh-password-store-1.7.1/bin/passmenu: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/adw9jx59wnrh5659wz43nbjya3m4b3gl-bash-4.4-p19/bin/bash"
/nix/store/p292w09kssjlrl4mnx649n7ckw70l4yh-password-store-1.7.1/bin/pass: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/adw9jx59wnrh5659wz43nbjya3m4b3gl-bash-4.4-p19/bin/bash"
checking for references to /build in /nix/store/p292w09kssjlrl4mnx649n7ckw70l4yh-password-store-1.7.1...
/nix/store/hwd485yq0pzqyhpnd7551jccxivd1rd7-password-store-1.7.1
/nix/store/p292w09kssjlrl4mnx649n7ckw70l4yh-password-store-1.7.1

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: pass

Partial log (click to expand)

/nix/store/hwd485yq0pzqyhpnd7551jccxivd1rd7-password-store-1.7.1

@tadfisher
Copy link
Contributor Author

@GrahamcOfBorg build passExtensions.import passExtensions.otp passExtensions.tomb passExtensions.update

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: passExtensions.import, passExtensions.otp, passExtensions.tomb, passExtensions.update

Partial log (click to expand)

stripping (with command strip and flags -S) in /nix/store/bv8basiz9finrg4hjvz4hlvrvbbxjkzx-pass-tomb-1.1/lib
patching script interpreter paths in /nix/store/bv8basiz9finrg4hjvz4hlvrvbbxjkzx-pass-tomb-1.1
/nix/store/bv8basiz9finrg4hjvz4hlvrvbbxjkzx-pass-tomb-1.1/lib/password-store/extensions/close.bash: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/adw9jx59wnrh5659wz43nbjya3m4b3gl-bash-4.4-p19/bin/bash"
/nix/store/bv8basiz9finrg4hjvz4hlvrvbbxjkzx-pass-tomb-1.1/lib/password-store/extensions/open.bash: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/adw9jx59wnrh5659wz43nbjya3m4b3gl-bash-4.4-p19/bin/bash"
/nix/store/bv8basiz9finrg4hjvz4hlvrvbbxjkzx-pass-tomb-1.1/lib/password-store/extensions/tomb.bash: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/adw9jx59wnrh5659wz43nbjya3m4b3gl-bash-4.4-p19/bin/bash"
checking for references to /build in /nix/store/bv8basiz9finrg4hjvz4hlvrvbbxjkzx-pass-tomb-1.1...
/nix/store/gyy8qh1184wbm6jz1kynv0r236aj54ks-pass-import-2.2
/nix/store/1y8x4f9wzmgj69mkj7mmcs3r8bcxd0bk-pass-otp-1.1.0
/nix/store/bv8basiz9finrg4hjvz4hlvrvbbxjkzx-pass-tomb-1.1
/nix/store/mv7kp05ngy8wm4f9apy27vip59cwdj0q-pass-update-2.0

@peterhoeg
Copy link
Member

As the person who added the previous plugins, thank you for doing this properly. 👍

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: pass, pass-otp

Partial log (click to expand)

shrinking RPATHs of ELF executables and libraries in /nix/store/njzkkgii26azm84h942mvk1h2r2ax2as-password-store-1.7.1
gzipping man pages under /nix/store/njzkkgii26azm84h942mvk1h2r2ax2as-password-store-1.7.1/share/man/
strip is /nix/store/j75dgadrff2d1fyc4fczmcgqkid2imdx-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/njzkkgii26azm84h942mvk1h2r2ax2as-password-store-1.7.1/lib  /nix/store/njzkkgii26azm84h942mvk1h2r2ax2as-password-store-1.7.1/bin
patching script interpreter paths in /nix/store/njzkkgii26azm84h942mvk1h2r2ax2as-password-store-1.7.1
/nix/store/njzkkgii26azm84h942mvk1h2r2ax2as-password-store-1.7.1/bin/pass: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/xn5gv3lpfy91yvfy9b0i7klfcxh9xskz-bash-4.4-p19/bin/bash"
/nix/store/njzkkgii26azm84h942mvk1h2r2ax2as-password-store-1.7.1/bin/passmenu: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/xn5gv3lpfy91yvfy9b0i7klfcxh9xskz-bash-4.4-p19/bin/bash"
checking for references to /build in /nix/store/njzkkgii26azm84h942mvk1h2r2ax2as-password-store-1.7.1...
/nix/store/ljpsyxf3lnpfw1av0c4sb7b004ddf0n9-password-store-1.7.1
/nix/store/njzkkgii26azm84h942mvk1h2r2ax2as-password-store-1.7.1

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: pass

Partial log (click to expand)

/nix/store/ljpsyxf3lnpfw1av0c4sb7b004ddf0n9-password-store-1.7.1

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: passExtensions.import, passExtensions.otp, passExtensions.tomb, passExtensions.update

Partial log (click to expand)

gzipping man pages under /nix/store/xfr9vcna20232l230dk9q7bzch5zr6s1-pass-update-2.0/share/man/
strip is /nix/store/j75dgadrff2d1fyc4fczmcgqkid2imdx-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/xfr9vcna20232l230dk9q7bzch5zr6s1-pass-update-2.0/lib
patching script interpreter paths in /nix/store/xfr9vcna20232l230dk9q7bzch5zr6s1-pass-update-2.0
/nix/store/xfr9vcna20232l230dk9q7bzch5zr6s1-pass-update-2.0/lib/password-store/extensions/update.bash: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/xn5gv3lpfy91yvfy9b0i7klfcxh9xskz-bash-4.4-p19/bin/bash"
checking for references to /build in /nix/store/xfr9vcna20232l230dk9q7bzch5zr6s1-pass-update-2.0...
/nix/store/f3jq07ypd133awrr43gc7kj4y5q0a0dz-pass-import-2.2
/nix/store/pbxyy18sab62q5wcalgg7r1rahns16is-pass-otp-1.1.0
/nix/store/pw26y9x3pwkgsvqc7kvwmv6hbjj6j1lp-pass-tomb-1.1
/nix/store/xfr9vcna20232l230dk9q7bzch5zr6s1-pass-update-2.0

@Mic92
Copy link
Member

Mic92 commented Apr 22, 2018

When I try to build this:

(pass.withExtensions (ext: with ext; [ otp tomb import update ]))

I get:

error: value is a partially applied built-in function while a set was expected, at /home/joerg/git/nixpkgs/.review/pr-39121/pkgs/tools/security/pass/default.nix:28:35
(use '--show-trace' to show detailed location information)

@tadfisher
Copy link
Contributor Author

Ah, that would be the import extension :)

@Mic92 Any suggestions for an alternative name?

@Mic92
Copy link
Member

Mic92 commented Apr 22, 2018

@tadfisher pass-import?

@etu
Copy link
Contributor

etu commented Apr 23, 2018

If switching import to pass-import, it may be worth to have pass- as prefix on all extensions just to be consistent?

@tadfisher
Copy link
Contributor Author

@Mic92 @etu Renamed packages, and moved pkgs.pass-otp to aliases.nix.

@tadfisher
Copy link
Contributor Author

@GrahamcOfBorg build pass pass-otp passExtensions.pass-import passExtensions.pass-otp passExtensions.pass-tomb passExtensions.pass-update

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: pass, pass-otp, passExtensions.pass-import, passExtensions.pass-otp, passExtensions.pass-tomb, passExtensions.pass-update

Partial log (click to expand)

patching script interpreter paths in /nix/store/82djcml88v2x42w18qqikpsphbyfwcg4-pass-import-2.2
/nix/store/82djcml88v2x42w18qqikpsphbyfwcg4-pass-import-2.2/lib/password-store/import/import.py: interpreter directive changed from "/usr/bin/env python3" to "/nix/store/4k2i0dr9a9pr8j396sf9bs4x2hhfq6wy-python3-3.6.5-env/bin/python3"
/nix/store/82djcml88v2x42w18qqikpsphbyfwcg4-pass-import-2.2/lib/password-store/extensions/import.bash: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/a4qslf0yfs44mhnbagarn232sjnckhy0-bash-4.4-p19/bin/bash"
checking for references to /build in /nix/store/82djcml88v2x42w18qqikpsphbyfwcg4-pass-import-2.2...
/nix/store/qdyljj105nfmckryb52ypjl3qgnz8f68-password-store-1.7.1
/nix/store/l1p8gdzwk4kz9r9s8xc6gjcdc23v0q9v-password-store-1.7.1
/nix/store/82djcml88v2x42w18qqikpsphbyfwcg4-pass-import-2.2
/nix/store/rfcymyf77carizqlgh566kri5cb2902d-pass-otp-1.1.0
/nix/store/b3h13yqy4gcjinq43qi0kdpb8kdn25s7-pass-tomb-1.1
/nix/store/n81bwn834ff2q5yljjkr5z1djv42p6a4-pass-update-2.0

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: pass, pass-otp, passExtensions.pass-import, passExtensions.pass-otp, passExtensions.pass-tomb, passExtensions.pass-update

Partial log (click to expand)

/nix/store/5mkmwr0mq0vp5ix1qcqz1mn1qsrgrj5c-pass-tomb-1.1/lib/password-store/extensions/tomb.bash: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/xn5gv3lpfy91yvfy9b0i7klfcxh9xskz-bash-4.4-p19/bin/bash"
/nix/store/5mkmwr0mq0vp5ix1qcqz1mn1qsrgrj5c-pass-tomb-1.1/lib/password-store/extensions/open.bash: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/xn5gv3lpfy91yvfy9b0i7klfcxh9xskz-bash-4.4-p19/bin/bash"
/nix/store/5mkmwr0mq0vp5ix1qcqz1mn1qsrgrj5c-pass-tomb-1.1/lib/password-store/extensions/close.bash: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/xn5gv3lpfy91yvfy9b0i7klfcxh9xskz-bash-4.4-p19/bin/bash"
checking for references to /build in /nix/store/5mkmwr0mq0vp5ix1qcqz1mn1qsrgrj5c-pass-tomb-1.1...
/nix/store/xmfzd9wszlcwmyh3wp79lwn42h6fc4nb-password-store-1.7.1
/nix/store/cs2256793azv60184ydxkczlwy4da1sn-password-store-1.7.1
/nix/store/f3jq07ypd133awrr43gc7kj4y5q0a0dz-pass-import-2.2
/nix/store/pbxyy18sab62q5wcalgg7r1rahns16is-pass-otp-1.1.0
/nix/store/5mkmwr0mq0vp5ix1qcqz1mn1qsrgrj5c-pass-tomb-1.1
/nix/store/xfr9vcna20232l230dk9q7bzch5zr6s1-pass-update-2.0

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: pass

Partial log (click to expand)

post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/xmfzd9wszlcwmyh3wp79lwn42h6fc4nb-password-store-1.7.1
gzipping man pages under /nix/store/xmfzd9wszlcwmyh3wp79lwn42h6fc4nb-password-store-1.7.1/share/man/
strip is /nix/store/j75dgadrff2d1fyc4fczmcgqkid2imdx-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/xmfzd9wszlcwmyh3wp79lwn42h6fc4nb-password-store-1.7.1/lib  /nix/store/xmfzd9wszlcwmyh3wp79lwn42h6fc4nb-password-store-1.7.1/bin
patching script interpreter paths in /nix/store/xmfzd9wszlcwmyh3wp79lwn42h6fc4nb-password-store-1.7.1
/nix/store/xmfzd9wszlcwmyh3wp79lwn42h6fc4nb-password-store-1.7.1/bin/passmenu: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/xn5gv3lpfy91yvfy9b0i7klfcxh9xskz-bash-4.4-p19/bin/bash"
/nix/store/xmfzd9wszlcwmyh3wp79lwn42h6fc4nb-password-store-1.7.1/bin/pass: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/xn5gv3lpfy91yvfy9b0i7klfcxh9xskz-bash-4.4-p19/bin/bash"
checking for references to /build in /nix/store/xmfzd9wszlcwmyh3wp79lwn42h6fc4nb-password-store-1.7.1...
/nix/store/xmfzd9wszlcwmyh3wp79lwn42h6fc4nb-password-store-1.7.1

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: pass

Partial log (click to expand)

/nix/store/qdyljj105nfmckryb52ypjl3qgnz8f68-password-store-1.7.1

@Mic92 Mic92 merged commit 230fe4a into NixOS:master May 4, 2018
@Mic92
Copy link
Member

Mic92 commented May 4, 2018

Thanks!

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