-
Notifications
You must be signed in to change notification settings - Fork 5
/
flake.nix
62 lines (57 loc) · 2.06 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{
description = "tkcli devshell";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
#nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; # localstack is broken right now (2023-01-25) in unstable, due to a missing dependency
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }@inputs:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
gci = pkgs.buildGoModule rec {
name = "gci";
src = pkgs.fetchFromGitHub {
owner = "daixiang0";
repo = "gci";
rev = "v0.10.1";
sha256 = "sha256-/YR61lovuYw+GEeXIgvyPbesz2epmQVmSLWjWwKT4Ag=";
};
# Switch to fake vendor sha for upgrades:
#vendorSha256 = pkgs.lib.fakeSha256;
vendorSha256 = "sha256-g7htGfU6C2rzfu8hAn6SGr0ZRwB8ZzSf9CgHYmdupE8=";
};
tkbuild = pkgs.writeScriptBin "build" ''
#!/bin/sh
pushd $(git rev-parse --show-toplevel)/src
${pkgs.go}/bin/go build -o $(go env GOPATH)/bin/turnkey
${pkgs.go}/bin/go build -o ../out/turnkey.linux-x86_64 # hack for local CLI go test
'';
tklint = pkgs.writeScriptBin "lint" ''
#!/bin/sh
pushd $(git rev-parse --show-toplevel)/src
${pkgs.go}/bin/go mod tidy
${pkgs.gofumpt}/bin/gofumpt -w *.go ./cmd/*
${gci}/bin/gci write --skip-generated -s standard -s default -s "Prefix(github.com/tkhq)" .
${pkgs.golangci-lint}/bin/golangci-lint run ./...
${pkgs.go}/bin/go build -o ../out/turnkey.linux-x86_64 # hack for local CLI go test
${pkgs.go}/bin/go test -v ./...
'';
in
{
devShells.default = pkgs.mkShell {
packages = with pkgs; [
bashInteractive
envsubst
gci
gofumpt
golangci-lint
go
go-swagger
go-tools
tkbuild
tklint
];
};
});
}