From a06fc7d27f03e0bed9d56990c004ff8c97eec433 Mon Sep 17 00:00:00 2001 From: Alex David Date: Wed, 28 Jan 2026 13:06:37 -0800 Subject: [PATCH] Use filesets to improve caching --- tests/flake.nix | 18 ++++++++++++++++-- website/flake.nix | 11 +++++++++-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/tests/flake.nix b/tests/flake.nix index 5cb8de6..c80b67f 100644 --- a/tests/flake.nix +++ b/tests/flake.nix @@ -8,7 +8,10 @@ pkgs = import nixpkgs { system = "x86_64-linux"; }; lib = pkgs.lib; haskellPackages = pkgs.haskell.packages.ghc912; - cabal2nix = haskellPackages.callCabal2nix "jail-nix-tests" ./. { }; + cabal2nix = haskellPackages.callCabal2nix "jail-nix-tests" (lib.fileset.toSource { + root = ./.; + fileset = ./jail-nix-tests.cabal; + }) { }; testDependencies = [ (haskellPackages.ghc.withPackages (p: cabal2nix.buildInputs)) pkgs.cabal-install @@ -43,7 +46,18 @@ ${ lib.pipe { - jail-nix = ../.; + jail-nix = + with lib.fileset; + toSource { + root = ../.; + fileset = difference ../. (unions [ + ../.build.yml + ../LICENSE + ../README.md + ../tests + ../website + ]); + }; nixpkgs = nixpkgs; } [ diff --git a/website/flake.nix b/website/flake.nix index 0ef8bc0..c98a4d8 100644 --- a/website/flake.nix +++ b/website/flake.nix @@ -19,11 +19,18 @@ }; }; + docsFileSet = + with lib.fileset; + toSource { + root = ../.; + fileset = ../lib; + }; + formatCombinatorDoc = name: combinatorObj: let attrPos = builtins.unsafeGetAttrPos "impl" combinatorObj; - file = lib.removePrefix (toString ./..) attrPos.file; + file = lib.removePrefix (toString docsFileSet) attrPos.file; in '' ### ${name} @@ -37,7 +44,7 @@ combinatorDocs = let allCombinators = - (import ../lib/combinators.nix pkgs (throw "Docs must not depend on jail arg")).docs; + (import (docsFileSet + /lib/combinators.nix) pkgs (throw "Docs must not depend on jail arg")).docs; formatSection = filter: