Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): add nix flake build #75

Merged
merged 2 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,27 @@ jobs:
name: binsider-${{ matrix.build.TARGET }}-assets
path: target/debug/binsider*

nix-flake:
name: Build Nix flake
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4

- name: Install Nix
uses: nixbuild/nix-quick-install-action@v27

- name: Restore and cache Nix store
uses: nix-community/cache-nix-action@v5
with:
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix') }}
restore-prefixes-first-match: nix-${{ runner.os }}-
gc-max-store-size-linux: 1073741824
purge: false

- name: Check Nix flake
run: nix flake check --all-systems

test:
name: Test
runs-on: ubuntu-latest
Expand Down
42 changes: 23 additions & 19 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,33 @@
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
binsider' = { buildType }: pkgs.rustPlatform.buildRustPackage {
name = "binsider";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
checkType = "debug";
inherit buildType;
checkFlags = [
"--skip=test_extract_strings"
"--skip=test_init"
];
meta = with pkgs.lib; {
description = "Analyze ELF binaries like a boss";
homepage = "https://binsider.dev/";
license = [ licenses.mit licenses.asl20 ];
};
};
in
{
rec {
packages = rec {
binsider = pkgs.rustPlatform.buildRustPackage {
name = "binsider";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
checkType = "debug";
checkFlags = [
"--skip=test_extract_strings"
"--skip=test_init"
];
meta = with pkgs.lib; {
description = "Analyze ELF binaries like a boss";
homepage = "https://binsider.dev/";
license = [ licenses.mit licenses.asl20 ];
};
};
binsider = binsider' { buildType = "release"; };
binsider-debug = binsider' { buildType = "debug"; };
default = binsider;
};
checks.check = packages.binsider-debug;

}
);

}