-
Notifications
You must be signed in to change notification settings - Fork 29
/
flake.nix
75 lines (70 loc) · 2.34 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
{
description = "Pushup is a new web framework for Go";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }:
let
name = "pushup";
forEachSystem = fn:
nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-darwin" "aarch64-linux" ]
(system:
fn {
pkgs = nixpkgs.legacyPackages.${system};
inherit system;
});
fs = nixpkgs.lib.fileset;
in {
packages = forEachSystem ({ pkgs, system }:
let
pname = name;
version = "0.0.1"; # TODO(paulsmith): source from version.go
sourceFiles = fs.difference
# include anything that matches these files inc. recursive directories
(fs.unions [
(fs.fileFilter (file: file.hasExt "go") ./.)
./_runtime
./banner.txt
./go.mod
./scaffold
./testdata
./vendor
])
# exclude these files
(fs.unions [ ./example ./tools ]);
src = fs.toSource {
root = ./.;
fileset = sourceFiles;
};
vendorHash = null;
subPackages = ".";
CGO_ENABLED = 0;
meta = with nixpkgs.lib; {
description = "Pushup web framework for Go";
homepage = "https://pushup.adhoc.dev/";
license = licenses.mit;
};
in {
# https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/go/module.nix
default = pkgs.buildGoModule.override {
go = pkgs.go_1_23;
} rec {
inherit pname version src vendorHash subPackages CGO_ENABLED meta;
};
withGo = pkgs.buildGoModule.override {
go = pkgs.go_1_23;
} rec {
inherit pname version src vendorHash subPackages CGO_ENABLED meta;
nativeBuildInputs = with pkgs; [ makeWrapper ];
allowGoReference = true;
postInstall = ''
wrapProgram $out/bin/${pname} --prefix PATH : ${
pkgs.lib.makeBinPath (with pkgs; [ go_1_23 ])
}
'';
};
});
devShells = forEachSystem ({ pkgs, ... }: {
default =
pkgs.mkShell { buildInputs = with pkgs; [ go_1_23 gotools gopls ]; };
});
};
}