Skip to content

Commit

Permalink
feat: add docker builder use nix (#911)
Browse files Browse the repository at this point in the history
* fix(typo): no -> not

* fix: update version

* feat: use nix to build docker image

* feat: ignore nix result

* fix(nix docker builder): failed to verify certificate
  • Loading branch information
Nobooooody authored May 19, 2024
1 parent a29b116 commit 6210ed9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ zerobot
ZeroBot-Plugin*
*.syso
/.direnv
/result
4 changes: 2 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
}:
buildGoApplication {
pname = "ZeroBot-Plugin";
version = "1.7.6";
version = "1.8.0";
pwd = ./.;
src = ./.;
# spec go version manually bcs
# https://github.com/nix-community/gomod2nix/blob/30e3c3a9ec4ac8453282ca7f67fca9e1da12c3e6/builder/default.nix#L130
# do no work
# do not work
go = pkgs.go_1_20;
modules = ./gomod2nix.toml;
}
25 changes: 20 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,26 @@
callPackage = pkgs.darwin.apple_sdk_11_0.callPackage or pkgs.callPackage;
in {
# doCheck will fail at write files
packages.default =
(callPackage ./. {
inherit (gomod2nix.legacyPackages.${system}) buildGoApplication;
})
.overrideAttrs (_: {doCheck = false;});
packages = rec {

ZeroBot-Plugin =
(callPackage ./. {
inherit (gomod2nix.legacyPackages.${system}) buildGoApplication;
})
.overrideAttrs (_: {doCheck = false;});

default = ZeroBot-Plugin;

docker_builder = pkgs.dockerTools.buildLayeredImage {
name = "ZeroBot-Plugin";
tag = "latest";
contents = [
self.packages.${system}.ZeroBot-Plugin
pkgs.cacert
];
};

};
devShells.default = callPackage ./shell.nix {
inherit (gomod2nix.legacyPackages.${system}) mkGoEnv gomod2nix;
};
Expand Down

0 comments on commit 6210ed9

Please sign in to comment.