Factor out builder call

This commit is contained in:
adisbladis 2020-07-23 11:28:54 +02:00
parent 956903170b
commit d331f4fd01
No known key found for this signature in database
GPG key ID: 110BFAD44C6249B7
2 changed files with 10 additions and 24 deletions

View file

@ -1,8 +1,13 @@
{ pkgs ? import <nixpkgs> {} }: { stdenv
, runCommand
, buildEnv
, lib
, fetchgit
, removeReferencesTo
, pkgs
}:
let let
inherit (pkgs) stdenv runCommand buildEnv lib fetchgit removeReferencesTo;
# Patch go to lift restrictions on # Patch go to lift restrictions on
# This patch should be upstreamed in Nixpkgs & in Go proper # This patch should be upstreamed in Nixpkgs & in Go proper
go = pkgs.go.overrideAttrs(old: { go = pkgs.go.overrideAttrs(old: {
@ -25,7 +30,7 @@ let
modulesStruct = builtins.fromTOML (builtins.readFile modules); modulesStruct = builtins.fromTOML (builtins.readFile modules);
vendorEnv = runCommand "vendor-env" { vendorEnv = runCommand "vendor-env" {
nativeBuildInputs = [ pkgs.go ]; nativeBuildInputs = [ go ];
json = builtins.toJSON modulesStruct; json = builtins.toJSON modulesStruct;
sources = builtins.toJSON (lib.mapAttrs (goPackagePath: meta: let sources = builtins.toJSON (lib.mapAttrs (goPackagePath: meta: let
@ -177,23 +182,4 @@ let
in package; in package;
in buildGoApplication { in buildGoApplication
pname = "dummyapp";
version = "0.1";
CGO_ENABLED = "1";
src = ./testdata/vuls;
modules = ./testdata/vuls/gomod2nix.toml;
# src = ./dummyapp;
# modules = ./dummyapp/gomod2nix.toml;
# Default modules is relative to src?
# modules = builtins.readFile ./gomod2nix.toml;
# I don't think we need this?
# goPackagePath = "github.com/mkchoi212/fac";
}