Skip to content

Commit

Permalink
chore(nix): nix-filter -> lib.fileset
Browse files Browse the repository at this point in the history
  • Loading branch information
getchoo committed Nov 9, 2024
1 parent f1d6410 commit 96729aa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 35 deletions.
16 changes: 0 additions & 16 deletions flake.lock

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

8 changes: 2 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
{
description = "Check the forecast for today's Nix builds";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nix-filter.url = "github:numtide/nix-filter";
};
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

outputs =
{
self,
nixpkgs,
nix-filter,
}:
let
inherit (nixpkgs) lib;
Expand Down Expand Up @@ -142,7 +138,7 @@
);

overlays.default = final: _: {
nix-forecast = final.callPackage ./nix/package.nix { inherit nix-filter self; };
nix-forecast = final.callPackage ./nix/package.nix { };
};
};
}
28 changes: 15 additions & 13 deletions nix/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,28 @@
nix,
rustPlatform,
versionCheckHook,

nix-filter,
self,
}:

let
fs = lib.fileset;
in
rustPlatform.buildRustPackage rec {
pname = "nix-forecast";
inherit (passthru.cargoTOML.package) version;

src = nix-filter {
root = self;
include = [
"Cargo.toml"
"Cargo.lock"
"build.rs"
"src/"
];
src = fs.toSource {
root = ../.;
fileset = fs.intersection (fs.gitTracked ../.) (
fs.unions [
../Cargo.lock
../Cargo.toml
../build.rs
../src
]
);
};

cargoLock.lockFile = self + "/Cargo.lock";
cargoLock.lockFile = ../Cargo.lock;

nativeBuildInputs = [
installShellFiles
Expand All @@ -48,7 +50,7 @@ rustPlatform.buildRustPackage rec {
};

passthru = {
cargoTOML = lib.importTOML (self + "/Cargo.toml");
cargoTOML = lib.importTOML ../Cargo.toml;
};

meta = {
Expand Down

0 comments on commit 96729aa

Please sign in to comment.