-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(nix): build and develop with nix (#172)
* chore(nix): build and develop with nix * docs: adds nix flake instructions
- Loading branch information
1 parent
ba001bc
commit b2b9e6b
Showing
10 changed files
with
226 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: nix build | ||
|
||
on: | ||
push: | ||
branches: ["master"] | ||
pull_request: | ||
branches: ["master"] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
e2e-with-nix: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: cachix/install-nix-action@v27 | ||
with: | ||
github_access_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- run: nix flake check | ||
- run: nix build .#nightly --verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
description = "New flake"; | ||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs"; | ||
utils.url = "github:numtide/flake-utils"; | ||
}; | ||
outputs = { self, nixpkgs, utils }: | ||
utils.lib.eachDefaultSystem (system: | ||
let | ||
pkgs = import nixpkgs { | ||
inherit system; | ||
# Inject the namespace copkgs into the package set | ||
overlays = [ | ||
(_: prev: { | ||
copkgs = { | ||
ergoProxy = pkgs.callPackage ./nix/package.nix { inherit pkgs; }; | ||
nightly = pkgs.callPackage ./nix/package-nightly.nix { | ||
inherit pkgs; | ||
}; | ||
}; | ||
} | ||
) | ||
]; | ||
}; | ||
in { | ||
devShells.default = import ./nix/dev-env.nix { | ||
inherit pkgs; | ||
}; | ||
|
||
packages = { | ||
default = pkgs.copkgs.ergoProxy; | ||
ergoProxy = pkgs.copkgs.ergoProxy; | ||
nightly = pkgs.copkgs.nightly; | ||
}; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ pkgs ? import <nixpkgs> {} }: | ||
pkgs.mkShell { | ||
# buildInputs is for dependencies you'd need "at run time", | ||
# were you to to use nix-build not nix-shell and build whatever you were working on | ||
buildInputs = [ | ||
pkgs.go | ||
pkgs.copkgs.ergoProxy | ||
]; | ||
|
||
shell = pkgs.zsh; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ pkgs, ... }: | ||
let | ||
_version = "v0.4.1-nighlty"; | ||
in | ||
pkgs.buildGoModule { | ||
# name of our derivation | ||
name = "ergo-proxy"; | ||
version = "${_version}"; | ||
doCheck = true; | ||
|
||
# sources that will be used for our derivation. | ||
src = ../.; | ||
|
||
modSha256 = "sha256-yXWM59zoZkQPpOouJoUd5KWfpdCBw47wknb+hYy6rh0="; | ||
|
||
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 ]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ pkgs, ... }: | ||
let | ||
_version = "v0.4.1"; | ||
in | ||
pkgs.buildGoModule { | ||
# name of our derivation | ||
name = "ergo-proxy"; | ||
version = "${_version}"; | ||
|
||
# sources that will be used for our derivation. | ||
src = pkgs.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 ]; | ||
}; | ||
} |