-
Notifications
You must be signed in to change notification settings - Fork 6
/
flake.nix
57 lines (52 loc) · 1.77 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
{
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=";
};
tkgenerate = pkgs.writeScriptBin "generate" ''
#!/bin/sh
swagger generate client -f inputs/public_api.swagger.json -t pkg/api;
'';
tklint = pkgs.writeScriptBin "lint" ''
#!/bin/sh
${pkgs.gofumpt}/bin/gofumpt -w . ./examples/ ./pkg/*
${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 test -v ./...
'';
in
{
devShells.default = pkgs.mkShell {
packages = with pkgs; [
bashInteractive
envsubst
gci
gofumpt
golangci-lint
go
go-swagger
go-tools
tkgenerate
tklint
];
};
});
}