Skip to content

Commit

Permalink
feat: Allow installation using nix
Browse files Browse the repository at this point in the history
  • Loading branch information
Dries De Peuter authored and Dries De Peuter committed Nov 23, 2024
1 parent 66074be commit 3df29a6
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
26 changes: 26 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
description = "A Nix flake for a Go project using buildGoModule";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs"; # Use Nixpkgs for dependencies
};

outputs = { self, nixpkgs }: {
packages = nixpkgs.lib.genAttrs [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ] (system:
let
pkgs = import nixpkgs { inherit system; };
in
pkgs.buildGoModule rec {
pname = "projecthelper";
version = "0.5.0"; # Replace with your version

# The source code for the Go project
src = ./.;

installPhase = ''
mkdir -p $out/bin
cp $GOPATH/bin/projecthelper $out/bin/
'';

vendorHash = "sha256-Xq61Ji6gMP6OFdHSQqfrJVsKdatYM0ZezMbdz4Adr1A="; # nixpkgs.lib.fakeHash;

# Metadata
meta = with pkgs.lib; {
description = "A Go project packaged with buildGoModule";
license = licenses.mit; # Replace with your project's license
maintainers = [ maintainers.yourGitHubHandle ];
platforms = platforms.all; # Declare all platforms as supported
};
}
);
} ;
}

0 comments on commit 3df29a6

Please sign in to comment.