-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nix): Nix support via flake (#28)
* set up nix flake * add CI for nix on GHA * update README
- Loading branch information
Showing
7 changed files
with
143 additions
and
24 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: Test Nix Flake build | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: cachix/install-nix-action@v22 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-23.05 | ||
github_access_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- run: nix build . --show-trace | ||
|
||
- run: nix flake check |
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 |
---|---|---|
|
@@ -8,4 +8,6 @@ sources | |
grimd | ||
grimd.log | ||
grimd.toml | ||
.DS_Store | ||
.DS_Store | ||
|
||
result |
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,46 @@ | ||
{ | ||
description = "Grimd, a fast dns proxy, built to black-hole internet advertisements and malware servers"; | ||
|
||
|
||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
inputs.flake-utils.url = "github:numtide/flake-utils"; | ||
|
||
outputs = { self, nixpkgs, flake-utils, ... }: | ||
(flake-utils.lib.eachDefaultSystem (system: | ||
let pkgs = import nixpkgs { inherit system; }; in { | ||
|
||
# Build & packaging | ||
## use with `nix build` | ||
packages = rec { | ||
grimd = pkgs.buildGo121Module { | ||
inherit system; | ||
vendorSha256 = "sha256-5dIZzqaw88lKuh1JHJurRZCPgrNzDHK/53bXKNGQBvQ="; | ||
pname = "grimd"; | ||
version = "0.0.1-test"; | ||
src = ./.; | ||
}; | ||
default = grimd; | ||
}; | ||
|
||
|
||
# Dev environment | ||
## use with `nix develop` | ||
devShells = rec { | ||
grimd = pkgs.mkShell { | ||
packages = [ pkgs.fish pkgs.go_1_21 ]; | ||
# Note that `shellHook` still uses bash syntax. This starts fish, then exists the bash shell when fish exits. | ||
shellHook = "fish && exit"; | ||
}; | ||
default = grimd; | ||
}; | ||
|
||
|
||
# App | ||
## use with `nix run` | ||
apps = rec { | ||
grimd = flake-utils.lib.mkApp { drv = self.packages.${system}.grimd; }; | ||
default = grimd; | ||
}; | ||
|
||
})); | ||
} |
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