Last active
January 3, 2021 10:18
-
-
Save ghasshee/9576bf290096a525dad067833ddda137 to your computer and use it in GitHub Desktop.
nix pills chat 12
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 = [ findutils patchelf gnutar gzip gnumake gcc binutils-unwrapped coreutils gawk gnused gnugrep ]; | |
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 = "graphviz"; | |
src = ./graphviz-2.38.0.tar.gz; | |
buildInputs = with pkgs; [ gd fontconfig libjpeg bzip2 ]; | |
} | |
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 | |
if [ -d $p/bin ]; then | |
export PATH="$p/bin${PATH:+:}$PATH" | |
fi | |
if [ -d $p/include ]; then | |
export NIX_CFLAGS_COMPILE="-I $p/include${NIX_CFLAGS_COMPILE:+ }$NIX_CFLAGS_COMPILE" | |
fi | |
if [ -d $p/lib ]; then | |
export NIX_LDFLAGS="-rpath $p/lib -L $p/lib${NIX_LDFLAGS:+ }$NIX_LDFLAGS" | |
fi | |
done | |
export PATH=$PATH | |
function unpackPhase() { | |
tar -xf $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