Skip to content

Commit

Permalink
Add nix flake build
Browse files Browse the repository at this point in the history
  • Loading branch information
kilimnik committed Mar 4, 2023
1 parent 3365def commit f86996d
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 45 deletions.
40 changes: 26 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,34 @@ permissions:
contents: write

jobs:
test_nix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix flake show
- run: nix build ".#packages.x86_64-linux.auth_proxy"
- run: nix build ".#packages.x86_64-linux.vault_plugin"

pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
paths_result: ${{ steps.skip_check.outputs.paths_result }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
paths_filter: |
app:
paths:
- 'app/**'
needs: test_nix
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
paths_result: ${{ steps.skip_check.outputs.paths_result }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
paths_filter: |
app:
paths:
- 'app/**'
build:
needs: pre_job
needs: [pre_job, test_nix]
name: Build and Release
environment: Deploy
runs-on: ubuntu-latest
Expand All @@ -40,7 +52,7 @@ jobs:

- uses: actions/setup-go@v3
with:
go-version: '^1.18.0'
go-version: "^1.18.0"

- uses: actions/checkout@v3
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
result
27 changes: 5 additions & 22 deletions flake.lock

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

29 changes: 20 additions & 9 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
{
inputs = {
nixpkgs-master.url = "github:nixos/nixpkgs/master";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, flake-utils, nixpkgs-unstable, nixpkgs-master, ... }@inputs:
outputs = { self, flake-utils, nixpkgs, ... }@inputs:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs-master = nixpkgs-master.legacyPackages.${system}.appendOverlays [

];

pkgs = import nixpkgs-unstable ({
pkgs = import nixpkgs ({
inherit system;

overlays = [
Expand All @@ -23,6 +18,22 @@

in
{
packages = {
auth_proxy = pkgs.buildGoModule rec {
name = "auth_proxy";

src = ./auth_proxy;

vendorHash = "sha256-skp304q/dO1cBH6LIlrSg1rAoALtOK1wtweC0LJRPyI=";
};
vault_plugin = pkgs.buildGoModule rec {
name = "vault_plugin";

src = ./vault_plugin;

vendorHash = "sha256-/6aE5w6Rki1ZIXMX9Ryo4XrGzS/01xZQiWDUROriixs=";
};
};
devShell = pkgs.pkgs.mkShell {

buildInputs = with pkgs;
Expand All @@ -34,7 +45,7 @@
cmake
vault-bin
protoc-gen-go
pkgs-master.protoc-gen-connect-go
pkgs.protoc-gen-connect-go
];
shellHook = ''
export CFLAGS="-I${pkgs.glibc.dev}/include"
Expand Down

0 comments on commit f86996d

Please sign in to comment.