-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
111 lines (91 loc) · 3.07 KB
/
flake.nix
File metadata and controls
111 lines (91 loc) · 3.07 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
{
description = "SUSE Observability CLI";
nixConfig.bash-prompt = "STS CLI 2 $ ";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; overlays = [ ]; };
pkgs-linux = import nixpkgs { system = "x86_64-linux"; overlays = [ ]; };
# Dependencies used for both development and CI/CD
sharedDeps = pkgs: (with pkgs; [
bash
go_1_19
gotools
diffutils # Required for golangci-lint
golangci-lint
openapi-generator-cli
]);
# Dependencies used only by CI/CD
ciDeps = pkgs: (with pkgs; [
git
cacert
gcc
coreutils-full
goreleaser
awscli
docker
]);
darwinDevShellExtraDeps = pkgs: pkgs.lib.optionals pkgs.stdenv.isDarwin (with pkgs.darwin.apple_sdk_11_0; [
Libsystem
IOKit
]);
in {
devShells = {
dev = pkgs.mkShell {
buildInputs = sharedDeps(pkgs) ++ darwinDevShellExtraDeps(pkgs);
};
ci = pkgs.mkShell {
buildInputs = sharedDeps(pkgs) ++ ciDeps(pkgs);
};
};
devShell = self.devShells."${system}".dev;
packages = {
sts = pkgs.buildGo119Module {
pname = "sts";
version = "2.0.0";
src = ./.;
# This hash locks the dependencies of this package.
# Change it to the provided when the go dependencies change.
# See https://www.tweag.io/blog/2021-03-04-gomod2nix/ for details.
#
# NOTE In case if your build fails due to incosistency in vendor modules
# Comment out the real hash and uncomment the fake one then on next `nix build .` run
# you will get a new real hash which can be used here.
#
# vendorSha256 = pkgs.lib.fakeSha256;
vendorSha256 = "sha256-aXTDHT1N+4Qpkuxb8vvBvP2VPyS5ofCgX6XFhJ5smUQ=";
postInstall = ''
mv $out/bin/stackstate-cli2 $out/bin/sts
'';
};
ci-image = pkgs.dockerTools.buildImage {
name = "stackstate-cli2-ci";
tag = "latest";
created = "now";
contents = sharedDeps(pkgs-linux) ++ ciDeps(pkgs-linux);
config = {
Env = [
"GIT_SSL_CAINFO=/etc/ssl/certs/ca-bundle.crt"
"SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt"
];
# Required to make golangci-lint work.
Volumes = {
"/tmp" = {};
};
};
};
default = self.packages."${system}".sts;
};
apps = {
sts = {
type = "app";
program = "${self.packages."${system}".sts}/bin/sts";
};
default = self.apps."${system}".sts;
};
});
}