This repository was archived by the owner on Sep 19, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
77 lines (68 loc) · 2.17 KB
/
flake.nix
File metadata and controls
77 lines (68 loc) · 2.17 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
{
description = "Surf the net like the way it should be";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
outputs = {
self,
nixpkgs,
}: let
goVersion = 24; # Change this to update the whole Go stack
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 = [self.overlays.default];
};
in
f pkgs
);
in {
overlays.default = final: prev: {
go = final."go_1_${toString goVersion}";
};
# Development shells
devShells = forEachSupportedSystem (pkgs: {
default = pkgs.mkShell {
packages = with pkgs; [
go # Go (version provided by the overlay)
gotools # Additional Go tools like goimports, godoc, etc.
golangci-lint
gopls
libpcap
];
shellHook = ''
export SHELL=$(which zsh)
'';
};
});
# Package derivation for building your Go binary.
packages = forEachSupportedSystem (pkgs: {
nyn = pkgs.buildGoModule {
pname = "nyn";
version = "0.0.1";
src = pkgs.fetchFromGitHub {
owner = "diredocks";
repo = "nyn";
rev = "v0.0.1"; # You can change this to a specific commit or tag
hash = "sha256-cUHXhxAwaPNmh+mB8GCAw+Wk9HLvM2/kdPyEEWOxcGo="; # Replace after first build attempt
};
# Set this to an empty string initially, then run `nix build` and replace it with the generated hash
vendorHash = "sha256-9+Ts7kaVGANAPiV4zsjMBFJF+g5ASTMcE/CAOmK2FpQ=";
buildInputs = [pkgs.libpcap];
meta = with pkgs.lib; {
description = "Surf the net like the way it should be";
license = licenses.mit;
platforms = supportedSystems;
};
};
});
# App definition so you can run it via `nix run .#nyn`
apps = forEachSupportedSystem (pkgs: {
nyn = {
type = "app";
program = "${self.packages.${pkgs.system}.nyn}/bin/nyn";
};
});
};
}