Skip to content

Commit

Permalink
Use rustPlatform in place of naersk
Browse files Browse the repository at this point in the history
  • Loading branch information
DanNixon committed Mar 25, 2024
1 parent 9dda216 commit 93bd151
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 58 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ jobs:
run: nix develop --command cargo-deny check

- name: Clippy
run: nix build -L .#clippy
run: nix develop --command cargo clippy --all-targets -- -D clippy::all

- name: Test
run: nix build -L .#test
run: nix develop --command cargo test --all-targets

build:
name: Build
Expand All @@ -47,10 +47,5 @@ jobs:
- uses: DeterminateSystems/nix-installer-action@v10
- uses: DeterminateSystems/magic-nix-cache-action@v4

# Evaluate the devshell here so that the time reported for subsequent
# steps that use it reflect what is actually done there.
- name: Evaluate devshell
run: nix develop

- name: Build
run: nix build -L
run: nix build --print-build-logs
21 changes: 0 additions & 21 deletions flake.lock

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

33 changes: 4 additions & 29 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";

flake-utils.url = "github:numtide/flake-utils";

naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = {
self,
nixpkgs,
flake-utils,
fenix,
naersk,
}:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = (import nixpkgs) {
inherit system;
};

naersk' = pkgs.callPackage naersk {
rustPlatform = pkgs.makeRustPlatform {
cargo = pkgs.cargo;
rustc = pkgs.rustc;
};
Expand Down Expand Up @@ -61,34 +54,16 @@
};

packages = rec {
default = naersk'.buildPackage {
name = name;
default = rustPlatform.buildRustPackage {
pname = name;
version = version;

src = ./.;
cargoLock.lockFile = ./Cargo.lock;

nativeBuildInputs = nativeBuildInputs;
buildInputs = buildInputs;
};

clippy = naersk'.buildPackage {
mode = "clippy";
src = ./.;

nativeBuildInputs = nativeBuildInputs;
buildInputs = buildInputs;
};

test = naersk'.buildPackage {
mode = "test";
src = ./.;

nativeBuildInputs = nativeBuildInputs;
buildInputs = buildInputs;

# Ensure detailed test output appears in nix build log
cargoTestOptions = x: x ++ ["1>&2"];
};
};
}
);
Expand Down

0 comments on commit 93bd151

Please sign in to comment.