-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add flake to build via Nix and gomod2nix
- Loading branch information
Showing
5 changed files
with
316 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use flake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,6 @@ | |
**/debug.test | ||
|
||
vendor | ||
|
||
result | ||
.direnv/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/24.05"; | ||
gomod2nix = { | ||
url = "github:nix-community/gomod2nix"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
treefmt-nix.url = "github:numtide/treefmt-nix"; | ||
}; | ||
|
||
outputs = | ||
{ self | ||
, nixpkgs | ||
, gomod2nix | ||
, flake-utils | ||
, treefmt-nix | ||
, ... | ||
}: | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
pumba = with pkgs; gomod2nix.legacyPackages.${system}.buildGoApplication { | ||
name = "pumba"; | ||
src = ./.; | ||
pwd = ./.; # Must be added due to bug https://github.com/nix-community/gomod2nix/issues/120 | ||
|
||
# Rename the binary as it's called 'cmd' presently. | ||
fixupPhase = '' | ||
mv $out/bin/cmd $out/bin/pumba | ||
''; | ||
}; | ||
|
||
goEnv = gomod2nix.legacyPackages.${system}.mkGoEnv { pwd = ./.; }; | ||
|
||
pkgs = import nixpkgs { inherit system; }; | ||
in | ||
{ | ||
# Development shells for hacking | ||
devShells.default = pkgs.mkShell { | ||
packages = with pkgs; [ | ||
goEnv | ||
gomod2nix.packages.${system}.default # gomod2nix CLI | ||
]; | ||
}; | ||
|
||
packages = { | ||
default = pumba; | ||
}; | ||
|
||
formatter = | ||
let | ||
fmt = treefmt-nix.lib.evalModule pkgs (_: { | ||
projectRootFile = "flake.nix"; | ||
programs.nixpkgs-fmt.enable = true; | ||
}); | ||
in | ||
fmt.config.build.wrapper; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
schema = 3 | ||
|
||
[mod] | ||
[mod."github.com/Microsoft/go-winio"] | ||
version = "v0.6.1" | ||
hash = "sha256-BL0BVaHtmPKQts/711W59AbHXjGKqFS4ZTal0RYnR9I=" | ||
[mod."github.com/cpuguy83/go-md2man/v2"] | ||
version = "v2.0.2" | ||
hash = "sha256-OvWCtDsVrYzM84SMQwOXPLBxnWnMC1hDm+KiI6zm3uk=" | ||
[mod."github.com/davecgh/go-spew"] | ||
version = "v1.1.1" | ||
hash = "sha256-nhzSUrE1fCkN0+RL04N4h8jWmRFPPPWbCuDc7Ss0akI=" | ||
[mod."github.com/docker/distribution"] | ||
version = "v2.8.2+incompatible" | ||
hash = "sha256-ocVWMRt5ErWdVsj3rsNa/QhizG5b/PCu8LoOlUi24/c=" | ||
[mod."github.com/docker/docker"] | ||
version = "v23.0.3+incompatible" | ||
hash = "sha256-JvrWYi6rfQW566wXke4HKUwlCdUTxR+kyTM2tz8pCO8=" | ||
[mod."github.com/docker/go-connections"] | ||
version = "v0.4.0" | ||
hash = "sha256-GHNIjOuuNp5lFQ308+nDNwQPGESCVV7bCUxSW5ZxZlc=" | ||
[mod."github.com/docker/go-units"] | ||
version = "v0.5.0" | ||
hash = "sha256-iK/V/jJc+borzqMeqLY+38Qcts2KhywpsTk95++hImE=" | ||
[mod."github.com/gogo/protobuf"] | ||
version = "v1.3.2" | ||
hash = "sha256-pogILFrrk+cAtb0ulqn9+gRZJ7sGnnLLdtqITvxvG6c=" | ||
[mod."github.com/google/go-cmp"] | ||
version = "v0.5.9" | ||
hash = "sha256-lQc4O00R3QSMGs9LP8Sy7A9kj0cqV5rrUdpnGeipIyg=" | ||
[mod."github.com/johntdyer/slack-go"] | ||
version = "v0.0.0-20180213144715-95fac1160b22" | ||
hash = "sha256-jd/Od/vnon2CEkxQ2Mf+w32fSSBIkTX0vgpytHJJYYw=" | ||
[mod."github.com/johntdyer/slackrus"] | ||
version = "v0.0.0-20210521205746-42486fb4c48c" | ||
hash = "sha256-80ztGeOVqiuja9MoHizUPqBoGRV378PFjZpx50/gbno=" | ||
[mod."github.com/kr/text"] | ||
version = "v0.2.0" | ||
hash = "sha256-fadcWxZOORv44oak3jTxm6YcITcFxdGt4bpn869HxUE=" | ||
[mod."github.com/moby/term"] | ||
version = "v0.0.0-20210619224110-3f7ff695adc6" | ||
hash = "sha256-ji80C4u0OJb59wIuPF4LiWf/yaGqZVfFsy+irp25Sc0=" | ||
[mod."github.com/morikuni/aec"] | ||
version = "v1.0.0" | ||
hash = "sha256-5zYgLeGr3K+uhGKlN3xv0PO67V+2Zw+cezjzNCmAWOE=" | ||
[mod."github.com/niemeyer/pretty"] | ||
version = "v0.0.0-20200227124842-a10e7caefd8e" | ||
hash = "sha256-m2D7hWZrDst0rb91lmjSuNrzBQbmQ0Oe2UOp3wn8qso=" | ||
[mod."github.com/opencontainers/go-digest"] | ||
version = "v1.0.0" | ||
hash = "sha256-cfVDjHyWItmUGZ2dzQhCHgmOmou8v7N+itDkLZVkqkQ=" | ||
[mod."github.com/opencontainers/image-spec"] | ||
version = "v1.1.0-rc4" | ||
hash = "sha256-rsc3wL80rmQhf4tiHQ0RJAcTsbdzqqS3TIlK9BWzOKQ=" | ||
[mod."github.com/pkg/errors"] | ||
version = "v0.9.1" | ||
hash = "sha256-mNfQtcrQmu3sNg/7IwiieKWOgFQOVVe2yXgKBpe/wZw=" | ||
[mod."github.com/pmezard/go-difflib"] | ||
version = "v1.0.0" | ||
hash = "sha256-/FtmHnaGjdvEIKAJtrUfEhV7EVo5A/eYrtdnUkuxLDA=" | ||
[mod."github.com/russross/blackfriday/v2"] | ||
version = "v2.1.0" | ||
hash = "sha256-R+84l1si8az5yDqd5CYcFrTyNZ1eSYlpXKq6nFt4OTQ=" | ||
[mod."github.com/sirupsen/logrus"] | ||
version = "v1.9.3" | ||
hash = "sha256-EnxsWdEUPYid+aZ9H4/iMTs1XMvCLbXZRDyvj89Ebms=" | ||
[mod."github.com/stretchr/objx"] | ||
version = "v0.5.0" | ||
hash = "sha256-nY4mvP0f0Ry1IKMKQAYNuioA5h4red4mmQqeGZw6EF0=" | ||
[mod."github.com/stretchr/testify"] | ||
version = "v1.8.4" | ||
hash = "sha256-MoOmRzbz9QgiJ+OOBo5h5/LbilhJfRUryvzHJmXAWjo=" | ||
[mod."github.com/urfave/cli"] | ||
version = "v1.22.12" | ||
hash = "sha256-FTdBlhQvyDhgrDcSJDxgSLS/cBSP8B1BC/AxGA9Lyss=" | ||
[mod."golang.org/x/mod"] | ||
version = "v0.12.0" | ||
hash = "sha256-M/oXnzm7odpJdQzEnG6W0pNYtl0uhOM/l7qgfGVpU2M=" | ||
[mod."golang.org/x/net"] | ||
version = "v0.15.0" | ||
hash = "sha256-k0hgSwNmZz9nN9cqqACNHdnejV50AAwzxnoyTs9liXw=" | ||
[mod."golang.org/x/sync"] | ||
version = "v0.3.0" | ||
hash = "sha256-bCJKLvwExhYacH2ZrWlZ38lr1d6oNenNt2m1QqDCs0o=" | ||
[mod."golang.org/x/sys"] | ||
version = "v0.12.0" | ||
hash = "sha256-Ht/PhBJGWNBg4ksmdUu4+7hJjFypSwoUN/8DJricd+0=" | ||
[mod."golang.org/x/time"] | ||
version = "v0.1.0" | ||
hash = "sha256-9tbFLEh3MbhbDxU3vw763vf8ppsZicpfAbo5V4PslLE=" | ||
[mod."golang.org/x/tools"] | ||
version = "v0.13.0" | ||
hash = "sha256-OCgLOwia8fNHxfdogXVApf0/qK6jE2ukegOx7lkOzfo=" | ||
[mod."gopkg.in/check.v1"] | ||
version = "v1.0.0-20200227125254-8fa46927fb4f" | ||
hash = "sha256-nGV66SlDrpDfhkzlr9h52JybsCioW3ix5bKmbkEfoDs=" | ||
[mod."gopkg.in/yaml.v3"] | ||
version = "v3.0.1" | ||
hash = "sha256-FqL9TKYJ0XkNwJFnq9j0VvJ5ZUU1RvH/52h/f5bkYAU=" | ||
[mod."gotest.tools/v3"] | ||
version = "v3.0.2" | ||
hash = "sha256-R9KZ5NexCr9mexcjZhPlhRy+cx2d19vGD7hQ9xfFy/4=" |