forked from mirrors/gomod2nix
Factor out builder call
This commit is contained in:
parent
956903170b
commit
d331f4fd01
2 changed files with 10 additions and 24 deletions
|
@ -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";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue