Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
feat(rust): replace nix-filter with lib.fileset
Browse files Browse the repository at this point in the history
  • Loading branch information
liketechnik committed May 6, 2024
1 parent 38f8e55 commit 8142658
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
7 changes: 0 additions & 7 deletions rust/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,13 @@
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};

nix-filter = {
url = "github:numtide/nix-filter";
};
};

outputs =
{
self,
nixpkgs,
fenix,
nix-filter,
...
}@inputs:
let
Expand Down Expand Up @@ -70,7 +65,6 @@
pkgsCross.callPackage (./. + "/nix/packages/${packageName}.nix") {
inherit cargoMeta;
flake-self = self;
nix-filter = import inputs.nix-filter;
rustPlatform = pkgsCross.makeRustPlatform {
cargo = toolchain;
rustc = toolchain;
Expand Down Expand Up @@ -104,7 +98,6 @@
${packageName} = pkgs.callPackage (./. + "/nix/packages/${packageName}.nix") {
inherit cargoMeta;
flake-self = self;
nix-filter = import inputs.nix-filter;
rustPlatform = pkgs.makeRustPlatform {
cargo = fenix-channel.toolchain;
rustc = fenix-channel.toolchain;
Expand Down
18 changes: 10 additions & 8 deletions rust/nix/packages/bin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@
lib,
flake-self,
cargoMeta,
nix-filter,
rustPlatform,
}:

let
fs = lib.fileset;
sourceFiles = fs.unions [
(fs.maybeMissing ../../src)
(fs.maybeMissing ../../Cargo.toml)
(fs.maybeMissing ../../Cargo.lock)
];
in
rustPlatform.buildRustPackage {
inherit (cargoMeta.package) version;
pname = cargoMeta.package.name;

src = nix-filter {
src = fs.toSource {
root = ../../.;
include = [
"src"
"Cargo.toml"
"Cargo.lock"
];
fileset = sourceFiles;
};

cargoLock.lockFile = ../../Cargo.lock;
Expand Down

0 comments on commit 8142658

Please sign in to comment.