Created
December 5, 2016 12:46
-
-
Save Profpatsch/41e92f2ae829ad5753e366906e583ddc to your computer and use it in GitHub Desktop.
help with packaging go packages in nix
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
#!/usr/bin/env nix-shell | |
#!nix-shell -i bash -p go go2nix | |
# little script to help with the stupid go packaging | |
# cd into the dir where you want to have the `default.nix` | |
# go package name (e.g. github.com/go/is-stupid) | |
PACKAGE="$1" | |
# git upstream link | |
GIT="$2" | |
# doesn’t fucking work, because go2nix ignores the checked out rev | |
REV="$3" | |
ORIGPWD="$PWD" | |
TMPD=$(mktemp -d) | |
GOPATH=$TMPD/go | |
PKGDIR="$GOPATH/src/$PACKAGE" | |
mkdir -p "$PKGDIR" | |
git clone "$GIT" "$PKGDIR" | |
pushd "$PKGDIR" | |
go get | |
go2nix save --output="$ORIGPWD/default.nix" --deps-file="$ORIGPWD/deps.nix" | |
popd | |
# GO SUCKS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment