Skip to content

Commit

Permalink
not working yet
Browse files Browse the repository at this point in the history
  • Loading branch information
kalbasit authored and srhb committed May 3, 2021
1 parent 809bede commit d28dcd1
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 215 deletions.
66 changes: 0 additions & 66 deletions Gopkg.lock

This file was deleted.

42 changes: 0 additions & 42 deletions Gopkg.toml

This file was deleted.

14 changes: 7 additions & 7 deletions nix-packaging/default.nix
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
{ stdenv, fetchgit, buildGoPackage, go-bindata, lib,
version ? "dev"
{ stdenv, fetchgit, buildGoModule, go-bindata, lib
, version ? "dev"
}:

with builtins; with lib;
let
blacklistedDirs = [ "nix-packaging" "vendor" "^\\..+$" ];
whitelistedFiles = [ "^.+\\.nix$" "^.+\\.go$" ];
whitelistedFiles = [ "^.+\\.nix$" "^.+\\.go$" "^.+\\.mod$" "^.+\\.sum$"];
filterList = file: list: elem true (map (pattern: isList (match pattern file)) list);
srcFilter = path: type: (
if type == "regular" then filterList (baseNameOf path) whitelistedFiles
else if type == "directory" then !filterList (baseNameOf path) blacklistedDirs
else false);

in
buildGoPackage rec {
buildGoModule rec {
name = "morph-unstable-${version}";
inherit version;

goPackagePath = "github.com/DBCDK/morph";

nativeBuildInputs = [ go-bindata ];

src = filterSource srcFilter ./..;
goDeps = ./deps.nix;

buildFlagsArray = ''
-ldflags=
-X
main.version=${version}
'';

modSha256 = "0kwwvd979zhdml3shw96cwyh84qn7k7p4yy0qsjiwi9ncnjb1ca6";

postPatch = ''
go-bindata -pkg assets -o assets/assets.go data/
'';
Expand Down
22 changes: 0 additions & 22 deletions nix-packaging/dep2nix/default.nix

This file was deleted.

66 changes: 0 additions & 66 deletions nix-packaging/deps.nix

This file was deleted.

20 changes: 8 additions & 12 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

with pkgs;
let
dep2nix = callPackage ./nix-packaging/dep2nix {};
packagingOut = "./nix-packaging";

shellHook = ''
Expand All @@ -23,22 +22,19 @@ let
# Populate /vendor-dir (for convenience in local dev)
if [ "$1" == "update" ]; then
${dep}/bin/dep ensure -v -update
${go}/bin/go get -u
# compute the sha256 of the dependencies
GO111MODULE=on GOPATH="$TMPDIR/gopath" ${go}/bin/go mod download
sha256="$(${nix}/bin/nix hash-path --base32 "$TMPDIR/gopath/pkg/mod/cache/download" | tr -d '\n')"
sed -e "s#modSha256.*#modSha256 = \"$sha256\";#" -i ${packagingOut}/default.nix
else
${dep}/bin/dep ensure -v -vendor-only
${go}/bin/go mod vendor
fi
# Write /nix-packaging/deps.nix (for use in distribution)
outpath=$(readlink -f ${packagingOut})
outpath="$outpath/deps.nix"
${dep2nix}/bin/dep2nix -i Gopkg.lock -o $outpath
'';
makeBuild = writeShellScriptBin "make-build" ''
makeBuild = writeShellScriptBin "make-build" ''
set -e
outpath="$(readlink -f ${packagingOut})/deps.nix"
${nix}/bin/nix-build -E 'with import ${nixpkgs} {};
callPackage ./nix-packaging/default.nix {}' -A out $@
Expand Down

0 comments on commit d28dcd1

Please sign in to comment.