-
-
Save Softsapiens/ad8888b8e093018ab74af095962ad6b0 to your computer and use it in GitHub Desktop.
Draft nix expression to wrap debian packages.
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
source $stdenv/setup | |
PATH=$dpkg/bin:$PATH | |
dpkg -x $src unpacked | |
cp -r unpacked/* $out/ |
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
{ self, derive }: with self; { | |
hello = derive { name="hello-traditional"; version="2.9-2"; script="hello"; md5="f5f3c28b65221dae44dda6f242c23316"; }; | |
} |
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
with import <nixpkgs> {}; | |
# Draft nix expression to wrap debian packages. | |
# Written by Jeff Johnson based on r-modules.nix and this blog post: | |
# http://anderspapitto.com/posts/2015-02-28-deb-installation-nixos.html | |
# TODO: how to infer the "main/h" part of the url? | |
# TODO: sha256 instead of md5 | |
# TODO: make deb2nix? | |
# TODO: multiple architectures | |
# TODO: can the script name be inferred? can you have more than one? | |
# TODO: include a list of dependencies in the packages desc | |
let | |
self = import ./debian-packages.nix { inherit self; derive = mkDebianPackage; }; | |
mkDebianPackage = desc: let | |
deb = mkPkg desc; | |
mkUrl = { name, version}: | |
"http://ftp.us.debian.org/debian/pool/main/h/${name}/${name}_${version}_amd64.deb"; | |
mkPkg = pkg: stdenv.mkDerivation (pkg // { | |
inherit dpkg; | |
builder = ./builder.sh; | |
runScript = "${pkg.script} $@"; | |
src = fetchurl { | |
url = mkUrl { inherit (desc) name version; }; | |
inherit (desc) md5; | |
}; | |
}); | |
in buildFHSUserEnv { | |
inherit (deb) name runScript; | |
targetPkgs = pkgs: [ deb ]; | |
multiPkgs = pkgs: [ pkgs.dpkg ]; | |
}; | |
in self |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment