-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
116 lines (104 loc) · 3.61 KB
/
flake.nix
File metadata and controls
116 lines (104 loc) · 3.61 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
112
113
114
115
116
{
description = "A Nix-flake-based Go 1.25 development environment";
inputs = {
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2511";
nixpkgs-unstable.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
nur = {
url = "github:nix-community/NUR";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nixpkgs-unstable, nur }:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forEachSupportedSystem = f:
nixpkgs.lib.genAttrs supportedSystems (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ nur.overlays.default ];
config.allowUnfreePredicate = pkg: builtins.elem (nixpkgs.lib.getName pkg) [
"goreleaser-pro"
];
};
pkgs-unstable = import nixpkgs-unstable {
inherit system;
};
in
f { pkgs = pkgs; pkgs-unstable = pkgs-unstable; system = system; }
);
speakeasyVersion = "1.759.2";
speakeasyPlatforms = {
"x86_64-linux" = "linux_amd64";
"aarch64-linux" = "linux_arm64";
"x86_64-darwin" = "darwin_amd64";
"aarch64-darwin" = "darwin_arm64";
};
# Checksums from https://github.com/speakeasy-api/speakeasy/releases/download/v1.759.2/checksums.txt
speakeasyHashes = {
"x86_64-linux" = "9234e2e9138f03ac18f0ca034d0c5a0a7b8749ea91b16814b4a643afd680d8fd";
"aarch64-linux" = "ba92a8c5799ed14acba94d317694ed32e35883e9439a07b28c58f7c8c0ea16f5";
"x86_64-darwin" = "b4cfe13627e8822718b5820c68898f51b6381e604c9578650c9b0c3f40f800b0";
"aarch64-darwin" = "dda057dbbd83bdaa47f9ccf3311e455013d957d11f45d8336b97b91ba2a56d6d";
};
in
{
packages = forEachSupportedSystem ({ pkgs, pkgs-unstable, system }:
{
speakeasy = pkgs.stdenv.mkDerivation {
pname = "speakeasy";
version = speakeasyVersion;
src = pkgs.fetchurl {
url = "https://github.com/speakeasy-api/speakeasy/releases/download/v${speakeasyVersion}/speakeasy_${speakeasyPlatforms.${system}}.zip";
sha256 = speakeasyHashes.${system};
};
nativeBuildInputs = [ pkgs.unzip ];
dontUnpack = true;
installPhase = ''
mkdir -p $out/bin
unzip $src
ls -al
install -m755 speakeasy $out/bin/
'';
name = "speakeasy";
};
}
);
defaultPackage.x86_64-linux = self.packages.x86_64-linux.speakeasy;
defaultPackage.aarch64-linux = self.packages.aarch64-linux.speakeasy;
defaultPackage.x86_64-darwin = self.packages.x86_64-darwin.speakeasy;
defaultPackage.aarch64-darwin = self.packages.aarch64-darwin.speakeasy;
devShells = forEachSupportedSystem ({ pkgs, pkgs-unstable, system }:
let
stablePackages = with pkgs; [
ginkgo
go_1_25
go-tools
goperf
gotools
jq
just
yq-go
];
unstablePackages = with pkgs-unstable; [
golangci-lint
openapi-generator-cli
];
otherPackages = [
pkgs.nur.repos.goreleaser.goreleaser-pro
self.packages.${system}.speakeasy
];
in
{
default = pkgs.mkShell {
packages = stablePackages ++ unstablePackages ++ otherPackages;
};
}
);
};
}