Format with nixpkgs-fmt

This commit is contained in:
adisbladis 2020-12-03 16:16:08 +01:00
parent bb2553fa3e
commit 929d740884
No known key found for this signature in database
GPG key ID: 110BFAD44C6249B7
3 changed files with 53 additions and 42 deletions

View file

@ -29,4 +29,4 @@ jobs:
steps:
- uses: cachix/install-nix-action@v12
- uses: actions/checkout@v1
- run: make
- run: nix-shell --run 'make'

View file

@ -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

View file

@ -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 { };