Created
November 6, 2015 03:07
-
-
Save sigma/3d77ed83da7868764333 to your computer and use it in GitHub Desktop.
#vtmate static #nix recipe
This file contains 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
{ system ? builtins.currentSystem }: | |
let | |
pkgs = import <nixpkgs> { inherit system; }; | |
inherit (pkgs) stdenv; | |
inherit (stdenv) lib; | |
inherit (lib) overrideDerivation; | |
inherit (pkgs) musl; | |
gcc = "${musl}/bin/musl-gcc"; | |
in | |
rec { | |
musl = pkgs.musl; | |
ncurses = overrideDerivation pkgs.ncurses (oldAttrs: { | |
src = pkgs.fetchurl { | |
url = "http://archive.ubuntu.com/ubuntu/pool/main/n/ncurses/ncurses_5.9+20150516.orig.tar.gz"; | |
sha256 = "77bdbc122d0215ffe72d89f52ca386036d2630eeac77845720159e06ab83643a"; | |
}; | |
patches = []; | |
buildInputs = [ pkgs.pkgconfig ]; | |
configureFlags = [ | |
"--without-ada" | |
"--without-cxx" | |
"--without-progs" | |
"--without-manpages" | |
"--disable-db-install" | |
"--without-tests" | |
"--with-default-terminfo-dir=$(out)/share/terminfo" | |
"--with-terminfo-dirs=/etc/terminfo:/lib/terminfo:/usr/share/terminfo" | |
"CC=${gcc}" | |
]; | |
postInstall = ""; | |
preFixup = ""; | |
}); | |
libevent = overrideDerivation pkgs.libevent (oldAttrs: { | |
configureFlags = [ | |
"--enable-static" | |
"--enable-shared" | |
"--disable-openssl" | |
"CC=${gcc}" | |
]; | |
}); | |
openssl = let name = "openssl-1.0.2d"; in overrideDerivation pkgs.openssl (oldAttrs: { | |
inherit name; | |
src = pkgs.fetchurl { | |
urls = [ | |
"http://www.openssl.org/source/${name}.tar.gz" | |
"http://openssl.linux-mirror.org/source/${name}.tar.gz" | |
]; | |
sha1 = "d01d17b44663e8ffa6a33a5a30053779d9593c3d"; | |
}; | |
buildInputs = oldAttrs.buildInputs ++ [ pkgs.xorg.makedepend musl ]; | |
configureFlags = [ | |
"os/compiler:musl-gcc" | |
"no-shared" | |
"--libdir=lib" | |
"--openssldir=etc/ssl" | |
"no-dea" | |
"no-mdc2" | |
"no-rc4" | |
"enable-tlsext" | |
"no-ssl2" | |
]; | |
postConfigure = ''make depend''; | |
makeFlags = [ | |
"CC=${gcc}" | |
"MANDIR=$(out)/share/man" | |
]; | |
}); | |
zlib = overrideDerivation pkgs.zlib (oldAttrs: { | |
configureFlags = [ | |
"--static" | |
]; | |
makeFlags = [ | |
"CC=${gcc}" | |
]; | |
}); | |
tmate = overrideDerivation pkgs.tmate (oldAttrs: { | |
buildInputs = [ | |
pkgs.autoconf pkgs.automake pkgs.pkgconfig pkgs.libtool pkgs.ruby pkgs.cmake | |
]; | |
dontDisableStatic = true; | |
dontAddDisableDepTrack = true; | |
preConfigure = let buildDeps = [musl zlib openssl libevent ncurses]; in oldAttrs.preConfigure + '' | |
configureFlagsArray=( --enable-static | |
CPPFLAGS="-fPIE ${lib.concatStringsSep " " (map (p: "-I${p}/include") buildDeps)}" | |
LDFLAGS="${lib.concatStringsSep " " (map (p: "-L${p}/lib") buildDeps)}" | |
CC="${gcc}" | |
) | |
''; | |
patches = let | |
fetchPatch = { file, sha256 }: | |
pkgs.fetchurl { | |
url = "https://gist.github.com/sigma/cd4567c9ed61a949ef8f/raw/8368670881ad6cffab88bd25c3fc04fe4f268b5a/${file}"; | |
inherit sha256; | |
}; | |
in map fetchPatch [ | |
{ file = "musl-headers.patch"; sha256 = "b1e13d310a2b34c788913562d8731d1a35eca7fbf221ebc75a1de335625dcf8a"; } | |
{ file = "fix-subdirs-objects-in-makefile.patch"; sha256 = "aec8151d03933c92f933228fde41a07fb613be8fe248fe2439533ea9e2bdf298"; } | |
{ file = "default-server.patch"; sha256 = "6fb73abd6aadbc0c7a8c68b1b2db6113136496aaed36a115203f59b6cca23f1d"; } | |
{ file = "gnulib.patch"; sha256 = "6b29cf8da4073971f6e2058b60c10184d02c38d1ec4dc79d123bdbbadac1d672"; } | |
{ file = "ssh-client.patch"; sha256 = "e6e0deb4e3c769db7843419ff55708d7fd758a695db78501685dc3a1bc11298d"; } | |
]; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment