-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
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.installApplication + unpkg + unxar: init #147567
base: master
Are you sure you want to change the base?
Conversation
c835d68
to
0a8c91e
Compare
xar --dump-header -f "${curSrc}" | grep -q "^magic:\s\+[0-9a-z]\+\s\+(OK)$" | ||
[ $? -ne 0 ] && return 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't set -e be set in the stdenv and this cleanly fail?
xar --dump-header -f "${curSrc}" | grep -q "^magic:\s\+[0-9a-z]\+\s\+(OK)$" | |
[ $? -ne 0 ] && return 1 | |
xar --dump-header -f "${curSrc}" | grep -q "^magic:\s\+[0-9a-z]\+\s\+(OK)$" | |
ret=$? | |
[ $ret -ne 0 ] && return $ret |
I think we should preserve the exit code.
|
||
installPhase = '' | ||
mkdir -p $out/bin | ||
ln -s $(command -v xar) $out/bin/xar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ln -s $(command -v xar) $out/bin/xar | |
ln -s ${xar}/bin/xar $out/bin/xar |
dir="$(mktemp -d)" | ||
xar -xf "${curSrc}" -C "${dir}" | ||
zcat ${dir}/*/Payload | cpio -idm --no-absolute-filenames | ||
rm -rf --preserve-root "${dir}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rm -rf --preserve-root "${dir}" | |
rm -rf "$dir" |
This should be the default and also mktemp should never output /.
|
||
installPhase = '' | ||
mkdir -p $out/bin | ||
ln -s $(command -v xar) $out/bin/xar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ln -s $(command -v xar) $out/bin/xar | |
ln -s ${xar}/bin/xar $out/bin/xar |
description = description; | ||
homepage = homepage; | ||
license = licenses."${license}"; | ||
maintainers = forEach maintainers (x: maintainers."${maintainer}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not how this is normally done. Normally meta is just inherited as is or the inputs override some defaults.
phases = [ "unpackPhase" "installPhase" ]; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
phases = [ "unpackPhase" "installPhase" ]; |
Please disable unwanted phases with dontBuild = true;
.
Motivation for this change
Greatly improve ease-of-use for developing nix derivations on macOS, particularly with regards to desktop applications packaged in the typical conventions expected for non-store installation. This is intended to be an "easy path" that's as simple and minimal as possible - if someone wants to get fancy and deal with a nonstandard or more complex application, that is outside the scope of this.
This is intended to get used by as many packages as possible to rapidly increase the number of native macOS applications available under nix, perhaps even by nix newbies, so please be as critical as possible. Once merged, the interface and behavior should remain as static as possible, as later changes could require multiple packages to be refactored.
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notesExample of usage