aboutsummaryrefslogtreecommitdiffstats
path: root/home/fast-p/flake.nix
blob: f12cd4499da00374b58f14dcd0cb0ee02feac6fd (plain) (blame)
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
{
  description = "A Nix flake for building the fast-p Go binary";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
  };

  outputs =
    { self, nixpkgs }:
    let
      # Support multiple systems
      supportedSystems = [
        "x86_64-linux"
        "aarch64-linux"
      ];

      # Helper function to generate outputs for each system
      forEachSystem =
        f:
        nixpkgs.lib.genAttrs supportedSystems (
          system:
          f {
            inherit system;
            pkgs = nixpkgs.legacyPackages.${system};
          }
        );

    in
    {
      packages = forEachSystem (
        { system, pkgs }:
        {
          default = pkgs.buildGoModule {
            pname = "fast-p";
            version = "0.1.0";
            src = ./.;
            vendorHash = "sha256-/lKWY6NZrw8aGe1/R2jspT4EZQxAxP0ujckpwZQGn2w="; # Run `nix build` to get actual hash
          };
        }
      );

      devShells = forEachSystem (
        { pkgs, ... }:
        {
          default = pkgs.mkShell { packages = with pkgs; [ go ]; };
        }
      );
    };
}