From 8142658f8165147d4576a50687b9fdd5f0dfd0a7 Mon Sep 17 00:00:00 2001 From: Florian Warzecha Date: Mon, 6 May 2024 22:44:06 +0200 Subject: [PATCH] feat(rust): replace nix-filter with lib.fileset --- rust/flake.nix | 7 ------- rust/nix/packages/bin.nix | 18 ++++++++++-------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/rust/flake.nix b/rust/flake.nix index a223587..b33f129 100644 --- a/rust/flake.nix +++ b/rust/flake.nix @@ -11,10 +11,6 @@ url = "github:nix-community/fenix"; inputs.nixpkgs.follows = "nixpkgs"; }; - - nix-filter = { - url = "github:numtide/nix-filter"; - }; }; outputs = @@ -22,7 +18,6 @@ self, nixpkgs, fenix, - nix-filter, ... }@inputs: let @@ -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; @@ -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; diff --git a/rust/nix/packages/bin.nix b/rust/nix/packages/bin.nix index 2c400e4..84289f3 100644 --- a/rust/nix/packages/bin.nix +++ b/rust/nix/packages/bin.nix @@ -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;