Last active
December 19, 2018 02:38
-
-
Save lucabrunox/97fae227329b442267bc to your computer and use it in GitHub Desktop.
Nix pill 10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pkgs: attrs: | |
| with pkgs; | |
| let defaultAttrs = { | |
| builder = "${bash}/bin/bash"; | |
| args = [ ./builder.sh ]; | |
| setup = ./setup.sh; | |
| baseInputs = [ gnutar gzip gnumake gcc binutils coreutils gawk gnused gnugrep patchelf findutils ]; | |
| buildInputs = []; | |
| system = builtins.currentSystem; | |
| }; | |
| in | |
| derivation (defaultAttrs // attrs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set -e | |
| source $setup | |
| genericBuild |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let | |
| pkgs = import <nixpkgs> {}; | |
| mkDerivation = import ./autotools.nix pkgs; | |
| in mkDerivation { | |
| name = "hello"; | |
| src = ./hello-2.9.tar.gz; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| unset PATH | |
| for p in $baseInputs $buildInputs; do | |
| export PATH=$p/bin${PATH:+:}$PATH | |
| done | |
| function unpackPhase() { | |
| tar -xzf $src | |
| for d in *; do | |
| if [ -d "$d" ]; then | |
| cd "$d" | |
| break | |
| fi | |
| done | |
| } | |
| function configurePhase() { | |
| ./configure --prefix=$out | |
| } | |
| function buildPhase() { | |
| make | |
| } | |
| function installPhase() { | |
| make install | |
| } | |
| function fixupPhase() { | |
| find $out -type f -exec patchelf --shrink-rpath '{}' \; -exec strip '{}' \; 2>/dev/null | |
| } | |
| function genericBuild() { | |
| unpackPhase | |
| configurePhase | |
| buildPhase | |
| installPhase | |
| fixupPhase | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I got the error message
/bin/bash: ar: command not found. I fixed this by changingbinutilstobinutils-unwrappedat line 7 inautotools.nix.