mirror of
https://github.com/tweag/gomod2nix.git
synced 2024-11-09 12:09:08 +00:00
Format with nixpkgs-fmt
This commit is contained in:
parent
bb2553fa3e
commit
929d740884
3 changed files with 53 additions and 42 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -29,4 +29,4 @@ jobs:
|
|||
steps:
|
||||
- uses: cachix/install-nix-action@v12
|
||||
- uses: actions/checkout@v1
|
||||
- run: make
|
||||
- run: nix-shell --run 'make'
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
, removeReferencesTo
|
||||
, pkgs
|
||||
}:
|
||||
|
||||
let
|
||||
# Patch go to lift restrictions on
|
||||
# This patch should be upstreamed in Nixpkgs & in Go proper
|
||||
|
@ -17,8 +16,7 @@ let
|
|||
removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}'';
|
||||
|
||||
buildGoApplication =
|
||||
{
|
||||
modules
|
||||
{ modules
|
||||
, src
|
||||
, CGO_ENABLED ? "0"
|
||||
, nativeBuildInputs ? [ ]
|
||||
|
@ -26,23 +24,31 @@ let
|
|||
, meta ? { }
|
||||
, passthru ? { }
|
||||
, ...
|
||||
}@attrs: let
|
||||
}@attrs:
|
||||
let
|
||||
modulesStruct = builtins.fromTOML (builtins.readFile modules);
|
||||
|
||||
vendorEnv = runCommand "vendor-env" {
|
||||
vendorEnv = runCommand "vendor-env"
|
||||
{
|
||||
nativeBuildInputs = [ go ];
|
||||
json = builtins.toJSON modulesStruct;
|
||||
|
||||
sources = builtins.toJSON (lib.mapAttrs (goPackagePath: meta: let
|
||||
sources = builtins.toJSON (lib.mapAttrs
|
||||
(goPackagePath: meta:
|
||||
let
|
||||
src = fetchgit {
|
||||
inherit (meta.fetch) url sha256 rev;
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
srcPath = "${src}/${meta.relPath or ""}";
|
||||
in srcPath) modulesStruct);
|
||||
in
|
||||
srcPath)
|
||||
modulesStruct);
|
||||
|
||||
passAsFile = [ "json" "sources" ];
|
||||
} (''
|
||||
}
|
||||
(
|
||||
''
|
||||
mkdir vendor
|
||||
|
||||
export GOCACHE=$TMPDIR/go-cache
|
||||
|
@ -51,7 +57,8 @@ let
|
|||
go run ${./symlink.go}
|
||||
|
||||
mv vendor $out
|
||||
'');
|
||||
''
|
||||
);
|
||||
|
||||
removeReferences = [ ] ++ lib.optional (!allowGoReference) go;
|
||||
|
||||
|
@ -180,6 +187,8 @@ let
|
|||
meta = { platforms = go.meta.platforms or lib.platforms.all; } // meta;
|
||||
});
|
||||
|
||||
in package;
|
||||
in
|
||||
package;
|
||||
|
||||
in buildGoApplication
|
||||
in
|
||||
buildGoApplication
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
|
||||
inputs.utils.url = "github:numtide/flake-utils";
|
||||
|
||||
outputs = { self, nixpkgs, utils }: utils.lib.eachDefaultSystem (system: let
|
||||
outputs = { self, nixpkgs, utils }: utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
in {
|
||||
in
|
||||
{
|
||||
overlay = final: prev: {
|
||||
buildGoApplication = final.callPackage ./builder { };
|
||||
gomod2nix = final.callPackage ./default.nix { };
|
||||
|
|
Loading…
Reference in a new issue