Skip to content

Instantly share code, notes, and snippets.

@matejc
Last active July 16, 2016 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matejc/bcbec1650aadf4b4d9d85f08df9df129 to your computer and use it in GitHub Desktop.
Save matejc/bcbec1650aadf4b4d9d85f08df9df129 to your computer and use it in GitHub Desktop.
enlightenment and nixos
{ callPackage, pkgs }:
rec {
#### CORE EFL
efl = callPackage ./efl.nix { openjpeg = pkgs.openjpeg_1; };
evas_generic_loaders = callPackage ./evas_generic_loaders.nix { };
emotion = callPackage ./emotion.nix { };
elementary = callPackage ./elementary.nix { };
#### WINDOW MANAGER
enlightenment = callPackage ./enlightenment.nix { };
#### APPLICATIONS
econnman = callPackage ./econnman.nix { };
terminology = callPackage ./terminology.nix { };
rage = callPackage ./rage.nix { };
with_efl = package: callPackage ./with2.nix {
inherit package;
withPackage = with_evas efl;
originalWithPackage = efl;
};
with_evas = package: callPackage ./with2.nix {
inherit package;
withPackage = evas_generic_loaders;
originalWithPackage = evas_generic_loaders;
};
terminology_evas = with_efl terminology;
}
`nix-build '<nixpkgs>' -A pkgs.enlightenment.terminology_evas`/bin/terminology -e "tyls -m ~/Pictures && zsh"
{ runCommand, makeWrapper, package, withPackage, extra }:
let
name = "${package.name}-with-${withPackage.name}";
in
runCommand "${name}" { nativeBuildInputs = [ makeWrapper ]; } ''
for executable in ${package}/bin/*
do
makeWrapper $executable $out/bin/`basename $executable` \
--prefix LD_LIBRARY_PATH : ${withPackage}/lib
done
for executable in ${toString extra}
do
makeWrapper ${package}/$executable $out/$executable \
--prefix LD_LIBRARY_PATH : ${withPackage}/lib
done
for file in `find ${package}`
do
new_path=$out''${file#${package}}
test -d $file && mkdir -p $new_path || ln -s $file $new_path || true
done
''
{ runCommand, makeWrapper, package, withPackage, originalWithPackage }:
let
name = "${package.name}-with-${withPackage.name}";
in
runCommand "${name}" { nativeBuildInputs = [ makeWrapper ]; } ''
find ${package} -exec sh -c '
file="$1"
new_path=$out''${file#${package}}
test -d $file && mkdir -p $new_path && exit 1
case "$(head -n 1 "$file")" in
?ELF*)
cp $file $new_path && chmod ugo+w "$new_path"
old_rpath=`patchelf --print-rpath "$new_path"`
new_rpath=''${old_rpath//"${originalWithPackage}"/"${withPackage}"}
patchelf --remove-rpath "$new_path"
patchelf --set-rpath "$new_rpath" "$new_path"
echo $new_rpath
echo $new_path
exit 0
;;
esac
cp $file $new_path
sed -ie "s|${originalWithPackage}|${withPackage}|g" $new_path
exit 1
' sh "{}" \;
''
{ runCommand, makeWrapper, package, withPackage }:
let
name = "${package.name}-with-${withPackage.name}";
in
runCommand "${name}" { nativeBuildInputs = [ makeWrapper ]; } ''
find ${withPackage} -exec sh -c '
file="$1"
new_path=$out''${file#${withPackage}}
test -d $file && mkdir -p $new_path && exit 1
cp $file $new_path
exit 0
' sh "{}" \;
find ${package} -exec sh -c '
file="$1"
new_path=$out''${file#${package}}
test -d $file && mkdir -p $new_path && exit 1
cp -f $file $new_path
exit 0
' sh "{}" \;
''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment