Skip to content

Commit 04bf289

Browse files
committed
build: add nix flake
1 parent d85d645 commit 04bf289

File tree

3 files changed

+87
-0
lines changed

3 files changed

+87
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
.env
2+
vendor
3+
result

flake.lock

Lines changed: 42 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = "nixpkgs/nixos-23.05";
4+
systems.url = "github:nix-systems/default";
5+
};
6+
7+
outputs = { self, nixpkgs, systems }:
8+
let
9+
version = "v1.0.1";
10+
lib = nixpkgs.lib;
11+
eachSystem = lib.genAttrs (import systems);
12+
pkgsFor = eachSystem (system: nixpkgs.legacyPackages.${system});
13+
in {
14+
devShell = eachSystem(system: pkgsFor.${system}.mkShell {
15+
buildInputs = with pkgsFor.${system}; [ go ];
16+
});
17+
packages = eachSystem (system:
18+
let
19+
pkgs = pkgsFor.${system};
20+
in {
21+
default = pkgs.buildGoModule {
22+
pname = "commit-status-poster";
23+
version = version;
24+
src = ./.;
25+
vendorHash = "sha256-e3l8lZqbjb7ZaUUM2MipYqilkkxI+BsVac+22OdOpz8=";
26+
};
27+
dockerImage = pkgs.dockerTools.buildImage {
28+
name = "commit-status-poster";
29+
tag = version;
30+
copyToRoot = pkgs.buildEnv {
31+
name = "commit-status-poster";
32+
paths = with pkgs; [
33+
self.packages.${system}.default
34+
dockerTools.caCertificates
35+
];
36+
};
37+
config = {
38+
Entrypoint = [ "/bin/commit-status-poster" ];
39+
};
40+
};
41+
});
42+
};
43+
}

0 commit comments

Comments
 (0)