Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for running a custom “prefetcher” command against files extracted from a fetched source, plumbing the configuration through package definitions and output formats.
Changes:
- Introduces
prefetchconfiguration parsing and newPackage/PackageResultfields to carry prefetch outputs. - Adds a new Shake oracle/rule to run custom prefetchers via a generated Nix derivation.
- Extends Nix expression/JSON rendering to include prefetch results; various Haddock/formatting updates.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 20 comments.
Show a summary per file
| File | Description |
|---|---|
| src/NvFetcher/Types.hs | Adds new query/type + package/result fields for custom prefetching; refactors comments/formatting. |
| src/NvFetcher/PackageSet.hs | Plumbs PackagePrefetchFiles through newPackage/DSL type lists. |
| src/NvFetcher/NixExpr.hs | Adds fetcherToExtractDrv and renders prefetch results in ToNixExpr PackageResult. |
| src/NvFetcher/GetGitCommitDate.hs | Module header/comment formatting only. |
| src/NvFetcher/ExtractSrc.hs | Module header formatting and additional imports (some appear unused). |
| src/NvFetcher/CustomPreFetcher.hs | New module implementing the custom prefetcher Shake oracle via nix-build. |
| src/NvFetcher/Core.hs | Wires the new rule into coreRules and computes _prprefetchFiles. |
| app/Config.hs | Adds TOML decoding for [pkg].prefetch into PackagePrefetchFiles. |
| nvfetcher.cabal | Exposes the new module. |
| shell.nix | Adds a development shell with required tools (incl. prefetch-npm-deps). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import NvFetcher.Types | ||
| import NvFetcher.Types.ShakeExtras (getBuildDir, withRetry) | ||
| import NvFetcher.Utils (quote, quoteAndEscape, quoteIfNeeds) | ||
| import qualified NvFetcher.Utils as T |
|
|
||
| import Data.Coerce (coerce) | ||
| import qualified Data.HashMap.Strict as HMap | ||
| import Data.Text.Prettyprint.Doc.Render.Tutorials.TreeRenderingTutorial (paragraph) |
Comment on lines
+33
to
+41
| import Data.HashMap.Internal.Array (run) | ||
| import Data.HashMap.Strict (HashMap) | ||
| import qualified Data.HashMap.Strict as HM | ||
| import Data.List (intercalate) | ||
| import qualified Data.List.NonEmpty as NE | ||
| import qualified Data.Text as T | ||
| import Data.Text.Internal.Read (IParser (runP)) | ||
| import Development.Shake | ||
| import Development.Shake.Command (CmdArguments, IsCmdArgument) |
|
|
||
| -- | Configuration available for evey version sourece. | ||
| -- See <https://nvchecker.readthedocs.io/en/latest/usage.html#global-options> for details. | ||
| {- | Configuration available for evey version sourece. |
Comment on lines
+28
to
+29
| This module provides function that extracts files contents from package sources. | ||
| Because we use @nix-instantiate@ to build drv, so @<nixpkgs>@ (@NIX_PATH@) is required. |
| NvFetcher.Core | ||
| NvFetcher.ExtractSrc | ||
| NvFetcher.FetchRustGitDeps | ||
| NvFetcher.CustomPrefetcher |
| {-# LANGUAGE DeriveAnyClass #-} | ||
| {-# LANGUAGE DeriveGeneric #-} | ||
| {-# LANGUAGE DerivingVia #-} | ||
| {-# LANGUAGE ExistentialQuantification #-} |
Comment on lines
+47
to
+49
| import qualified Data.Text as T | ||
| import qualified Data.Text.IO as T | ||
|
|
|
|
||
| -- | Configuration available for evey version sourece. | ||
| -- See <https://nvchecker.readthedocs.io/en/latest/usage.html#global-options> for details. | ||
| {- | Configuration available for evey version sourece. |
| {- | This package is fetched from git | ||
|
|
||
| Similar to 'fetchGit', but allows a modifier to the fetcher. | ||
| See 'fetchGitHub'' for a concret example. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
add custom fetcher capabilities