-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
119 lines (111 loc) · 3.08 KB
/
Copy pathflake.nix
File metadata and controls
119 lines (111 loc) · 3.08 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
117
118
119
{
description = "A Nix-flake-based Go development environment";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
pre-commit-hooks = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
pre-commit-hooks,
}:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forEachSupportedSystem =
f:
nixpkgs.lib.genAttrs supportedSystems (
system:
f {
pkgs = import nixpkgs {
inherit system;
};
}
);
in
{
devShells = forEachSupportedSystem (
{ pkgs }:
{
default = pkgs.mkShell {
shellHook = ''
export LD_LIBRARY_PATH=${pkgs.lib.getLib pkgs.alsa-lib}/lib:${pkgs.lib.getLib pkgs.wayland}/lib:${pkgs.lib.getLib pkgs.libGL}/lib:${pkgs.lib.getLib pkgs.libdecor}/lib:${pkgs.lib.getLib pkgs.libxkbcommon}/lib:$LD_LIBRARY_PATH
${self.checks.${pkgs.system}.pre-commit-check.shellHook}
'';
hardeningDisable = [ "fortify" ]; # Make delve work with direnv IDE extension
nativeBuildInputs = with pkgs; [
go
];
packages = with pkgs; [
air
gotools
gopls
self.checks.${system}.pre-commit-check.enabledPackages
];
};
}
);
packages = forEachSupportedSystem (
{ pkgs }:
{
default = pkgs.buildGoModule {
pname = "chip8-go";
version = "0.1.0";
src = ./.;
vendorHash = "sha256-61sZUaaYdVSb3Vw0Csc9yHFNlAEhIyGeq2ujkfa6HS4=";
doCheck = false;
nativeBuildInputs = with pkgs; [
makeWrapper
];
postFixup = ''
wrapProgram $out/bin/chip8-go \
--prefix LD_LIBRARY_PATH : "${
pkgs.lib.makeLibraryPath (
with pkgs;
[
alsa-lib
libjack2
pipewire
wayland
libxkbcommon
libdecor
xorg.libX11
xorg.libXext
xorg.libXcursor
xorg.libXinerama
xorg.libXi
xorg.libXrandr
xorg.libXxf86vm
libGL
vulkan-loader
mesa
]
)
}"
'';
};
}
);
checks = forEachSupportedSystem (
{ pkgs }:
{
pre-commit-check = pre-commit-hooks.lib.${pkgs.system}.run {
src = ./.;
hooks = {
gofmt.enable = true;
golangci-lint.enable = true;
govet.enable = true;
};
};
}
);
};
}