feat(rust): replace nix-filter with lib.fileset

This commit is contained in:
Florian Warzecha 2024-05-06 22:44:06 +02:00
parent 38f8e550cf
commit 8142658f81
Signed by: liketechnik
GPG key ID: 4BE8C7D97F910C60
2 changed files with 10 additions and 15 deletions

View file

@ -11,10 +11,6 @@
url = "github:nix-community/fenix"; url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nix-filter = {
url = "github:numtide/nix-filter";
};
}; };
outputs = outputs =
@ -22,7 +18,6 @@
self, self,
nixpkgs, nixpkgs,
fenix, fenix,
nix-filter,
... ...
}@inputs: }@inputs:
let let
@ -70,7 +65,6 @@
pkgsCross.callPackage (./. + "/nix/packages/${packageName}.nix") { pkgsCross.callPackage (./. + "/nix/packages/${packageName}.nix") {
inherit cargoMeta; inherit cargoMeta;
flake-self = self; flake-self = self;
nix-filter = import inputs.nix-filter;
rustPlatform = pkgsCross.makeRustPlatform { rustPlatform = pkgsCross.makeRustPlatform {
cargo = toolchain; cargo = toolchain;
rustc = toolchain; rustc = toolchain;
@ -104,7 +98,6 @@
${packageName} = pkgs.callPackage (./. + "/nix/packages/${packageName}.nix") { ${packageName} = pkgs.callPackage (./. + "/nix/packages/${packageName}.nix") {
inherit cargoMeta; inherit cargoMeta;
flake-self = self; flake-self = self;
nix-filter = import inputs.nix-filter;
rustPlatform = pkgs.makeRustPlatform { rustPlatform = pkgs.makeRustPlatform {
cargo = fenix-channel.toolchain; cargo = fenix-channel.toolchain;
rustc = fenix-channel.toolchain; rustc = fenix-channel.toolchain;

View file

@ -2,21 +2,23 @@
lib, lib,
flake-self, flake-self,
cargoMeta, cargoMeta,
nix-filter,
rustPlatform, rustPlatform,
}: }:
let
fs = lib.fileset;
sourceFiles = fs.unions [
(fs.maybeMissing ../../src)
(fs.maybeMissing ../../Cargo.toml)
(fs.maybeMissing ../../Cargo.lock)
];
in
rustPlatform.buildRustPackage { rustPlatform.buildRustPackage {
inherit (cargoMeta.package) version; inherit (cargoMeta.package) version;
pname = cargoMeta.package.name; pname = cargoMeta.package.name;
src = nix-filter { src = fs.toSource {
root = ../../.; root = ../../.;
include = [ fileset = sourceFiles;
"src"
"Cargo.toml"
"Cargo.lock"
];
}; };
cargoLock.lockFile = ../../Cargo.lock; cargoLock.lockFile = ../../Cargo.lock;