Skip to content

custom fetcher#149

Open
auscyber wants to merge 1 commit intoberberman:masterfrom
auscyber:customfetcher
Open

custom fetcher#149
auscyber wants to merge 1 commit intoberberman:masterfrom
auscyber:customfetcher

Conversation

@auscyber
Copy link
Contributor

add custom fetcher capabilities

Copilot AI review requested due to automatic review settings March 16, 2026 08:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 prefetch configuration parsing and new Package/PackageResult fields 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants