chore: add nix flake

This commit is contained in:
Technofab 2023-06-26 00:26:48 +02:00
parent 507039ecc0
commit 4a61b4dc3d
No known key found for this signature in database
GPG key ID: A0AA746B951C8830
3 changed files with 77 additions and 1 deletions

34
flake.nix Normal file
View file

@ -0,0 +1,34 @@
{
description = "Powerproto";
inputs.nixpkgs.url = "nixpkgs/nixos-23.05";
outputs = { self, nixpkgs, systems }:
let
version = "0.4.2";
forEachSystem = nixpkgs.lib.genAttrs (import systems);
nixpkgsFor = forEachSystem (system: import nixpkgs { inherit system; });
in {
# Provide some binary packages for selected system types.
packages = forEachSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in {
powerproto = pkgs.buildGoModule {
pname = "powerproto";
inherit version;
src = ./.;
CGO_ENABLED = 0;
ldflags = [ "-s" "-w" "-X main.Version=${version}" ];
vendorSha256 = "sha256-MwL6eA5u7dusWDIgbfyyvNqoP4ZhpSWaQuLsUI+YU9k=";
doCheck = false;
};
}
);
defaultPackage = forEachSystem (system: self.packages.${system}.powerproto);
};
}