forked from ComposableFi/picasso
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
85 lines (84 loc) · 2.52 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
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
{
description = "composable-cosmos";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
gomod2nix = {
url = github:nix-community/gomod2nix;
inputs.nixpkgs.follows = "nixpkgs";
};
cosmos = {
url = "github:informalsystems/cosmos.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ {
flake-parts,
gomod2nix,
cosmos,
self,
...
}:
flake-parts.lib.mkFlake {inherit inputs;} {
imports = [
];
systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
perSystem = {
config,
self',
inputs',
pkgs,
system,
...
}: let
inherit (inputs.gomod2nix.legacyPackages.${system}) buildGoApplication mkGoEvn gomod2nix;
libwasmvm = cosmos.packages.${system}.libwasmvm_1_5_0;
cosmwasm-check = cosmos.packages.${system}.cosmwasm-check;
cosmosLib = cosmos.lib {inherit pkgs cosmwasm-check;};
in {
formatter = pkgs.alejandra;
devShells = {
default = pkgs.mkShell {
buildInputs = with pkgs; [
bingo
gci
gnumake
go
golangci-lint
gomod2nix
gotools
];
};
};
packages = {
centaurid = buildGoApplication rec {
pname = "centaurid";
version = "v7.0.0";
src = ./.;
subPackages = ["cmd/${pname}"];
modules = ./gomod2nix.toml;
preFixup = ''
${cosmosLib.wasmdPreFixupPhase libwasmvm pname}
'';
checkPhase = "true";
buildInputs = [libwasmvm];
ldflags = ''
-X github.com/cosmos/cosmos-sdk/version.Name=centauri -X github.com/cosmos/cosmos-sdk/version.AppName=${pname} -X github.com/cosmos/cosmos-sdk/version.Version=${version} -X github.com/cosmos/cosmos-sdk/version.Commit=${self.rev or self.dirtyRev or "dirty"} -X github.com/cometbft/cometbft/version.TMCoreSemVer=v0.37.2
'';
};
default = pkgs.writeShellApplication {
name = "ci";
text = ''
go get mvdan.cc/gofumpt
go get github.com/client9/misspell/cmd/misspell
go get golang.org/x/tools/cmd/goimports
make lint
nix fmt
go mod tidy
golangci-lint run --fix
gomod2nix
'';
};
};
};
};
}