Skip to content

Commit 7383ff5

Browse files
committed
refactor(nix): drop the nix-filter input
The remaining nix-filter uses map directly onto nixpkgs lib: the Rust build subset becomes a lib.fileset union, and the repository-wide check source becomes lib.cleanSourceWith with the same directory excludes. The resulting sources contain the same file lists as before.
1 parent afc6080 commit 7383ff5

6 files changed

Lines changed: 27 additions & 40 deletions

File tree

‎.agents/skills/skill-creator/SKILL.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ description: Guides repo-local skill creation and updates. Use when adding or ed
88
`.agents/skills/` is the source of truth for repo-local skills. `.claude/skills` is generated by
99
`agent-skills-nix` through the Nix dev-shell hook and is gitignored — never edit or commit it.
1010

11-
`nix/agent-skills.nix` holds the local-only wiring, and the flake's `nix-filter` includes only
12-
`.agents/skills` in the skill source. There are intentionally no global `agent-skills-nix` targets
11+
`nix/agent-skills.nix` holds the local-only wiring, and its `lib.fileset` source includes only
12+
`.agents/skills`. There are intentionally no global `agent-skills-nix` targets
1313
and no git-hook skill sync here.
1414

1515
## Adding or Editing a Skill

‎flake.lock‎

Lines changed: 0 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎flake.nix‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
url = "github:anomalyco/models.dev";
3131
flake = false;
3232
};
33-
nix-filter.url = "github:numtide/nix-filter";
3433
rust-overlay = {
3534
url = "github:oxalica/rust-overlay";
3635
inputs.nixpkgs.follows = "nixpkgs";

‎nix/checks.nix‎

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ inputs, ... }:
1+
{ inputs, lib, ... }:
22
let
33
root = ./..;
44
in
@@ -22,16 +22,21 @@ in
2222
commonArgs
2323
version
2424
;
25-
nixFilter = inputs.nix-filter.lib;
26-
rustSrc = import ./rust-src.nix { inherit nixFilter root; };
27-
repoSrc = nixFilter {
28-
inherit root;
29-
exclude = [
30-
(nixFilter.matchName "node_modules")
31-
(nixFilter.matchName "target")
32-
(nixFilter.matchName "dist")
33-
(nixFilter.matchName "coverage")
34-
];
25+
rustSrc = import ./rust-src.nix { inherit lib root; };
26+
repoSrc = lib.cleanSourceWith {
27+
name = "source";
28+
src = root;
29+
filter =
30+
path: type:
31+
!(
32+
type == "directory"
33+
&& builtins.elem (baseNameOf path) [
34+
"node_modules"
35+
"target"
36+
"dist"
37+
"coverage"
38+
]
39+
);
3540
};
3641
ccusage-clippy = craneLib.cargoClippy (
3742
commonArgs

‎nix/rust-src.nix‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
# * ccusage-core/build.rs reads ../../../flake.lock
55
# * config_schema.rs tests include_str! ../../../../ccusage.example.json
66
# * main.rs tests include_str! ../../../../package.json
7-
{ nixFilter, root }:
8-
nixFilter {
7+
{ lib, root }:
8+
lib.fileset.toSource {
99
inherit root;
10-
include = [
11-
"rust"
12-
"flake.lock"
13-
"ccusage.example.json"
14-
"package.json"
10+
fileset = lib.fileset.unions [
11+
(root + /rust)
12+
(root + /flake.lock)
13+
(root + /ccusage.example.json)
14+
(root + /package.json)
1515
];
1616
}

‎nix/tests.nix‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# recompiling into an uncached `rust/target` on every CI run. Built by the CI
44
# test job via `nix build .#ccusage-tests`; the derivation succeeds only when
55
# `cargo test --workspace` passes.
6-
{ inputs, ... }:
6+
{ inputs, lib, ... }:
77
let
88
root = ./..;
99
in
@@ -22,8 +22,7 @@ in
2222
rustToolchain = pkgs.rust-bin.fromRustupToolchainFile (root + /rust-toolchain.toml);
2323
craneLib = (inputs.crane.mkLib pkgs).overrideToolchain rustToolchain;
2424
inherit (config.packages.ccusage.passthru) cargoArtifacts commonArgs;
25-
nixFilter = inputs.nix-filter.lib;
26-
testSrc = import ./rust-src.nix { inherit nixFilter root; };
25+
testSrc = import ./rust-src.nix { inherit lib root; };
2726
in
2827
{
2928
packages.ccusage-tests = craneLib.cargoTest (

0 commit comments

Comments
 (0)