Skip to content

Commit

Permalink
chore: nix packaging (#154)
Browse files Browse the repository at this point in the history
* chore: adds nix derivation for distribution

* fixes the version
  • Loading branch information
cristianoliveira authored Mar 31, 2024
1 parent 7e6733b commit eb4a115
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ bin/
# Gogland specific files
.idea
*.iml
result
1 change: 1 addition & 0 deletions check-nix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nix-build --no-out-link -E 'with import <nixpkgs> {}; callPackage ./default.nix {}'
8 changes: 8 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# default.nix
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-22.11";
pkgs = import nixpkgs { config = {}; overlays = []; };
in
{
ergo = pkgs.callPackage ./ergo.nix { };
}
35 changes: 35 additions & 0 deletions ergo.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# allow our nixpkgs import to be overridden if desired
{ pkgs ? import <nixpkgs> {}, fetchFromGitHub, buildGoModule, ... }:

let
_version = "v0.3.2";
in
buildGoModule rec {
# name of our derivation
name = "ergo-proxy";
version = "${_version}";

# sources that will be used for our derivation.
src = fetchFromGitHub {
owner = "cristianoliveira";
repo = "ergo";
rev = _version;
sha256 = "sha256-C3lJWuRyGuvo33kvj3ktWKYuUZ2yJ8pDBNX7YZn6wNM=";
};

modSha256 = "0fagi529m1gf5jrqdlg9vxxq4yz9k9q8h92ch0gahp43kxfbgr4q";

vendorHash = "sha256-yXWM59zoZkQPpOouJoUd5KWfpdCBw47wknb+hYy6rh0=";

ldflags = [
"-s" "-w"
"-X main.VERSION=${_version}"
];

meta = with pkgs.lib; {
description = "Ergo: The reverse proxy agent for local domain management";
homepage = "https://github.com/cristianoliveira/ergo";
license = licenses.mit;
maintainers = with maintainers; [ cristianoliveira ];
};
}

0 comments on commit eb4a115

Please sign in to comment.