### Installation and Execution Commands Source: https://github.com/berberman/nvfetcher/blob/master/README.md Common commands to install and run nvfetcher using Nix, including shell environments and flake-based execution. ```bash # Install via nix-shell nix-shell -p nvfetcher # Run via flakes nix run github:berberman/nvfetcher # Develop with Haskell library nix develop github:berberman/nvfetcher#ghcWithNvfetcher runghc Main.hs ``` -------------------------------- ### TOML configuration for package sources Source: https://context7.com/berberman/nvfetcher/llms.txt Examples of defining various package sources in nvfetcher.toml, including GitHub, PyPI, Git, and container registries. ```toml [rustdesk] src.github = "rustdesk/rustdesk" fetch.github = "rustdesk/rustdesk" [feeluown-core] src.pypi = "feeluown" fetch.pypi = "feeluown" [gcc-10] src.github_tag = "gcc-mirror/gcc" src.include_regex = "releases/gcc-10.*" fetch.github = "gcc-mirror/gcc" [nvfetcher-git] src.git = "https://github.com/berberman/nvfetcher" fetch.github = "berberman/nvfetcher" git.date_format = "%Y-%m-%d %H:%M:%S %Z" git.date_tz = "UTC" [apple-emoji] src.manual = "0.0.0.20200413" fetch.url = "https://example.com/file.ttf" [alpine] src.container = "library/alpine" src.include_regex = "3\..*" fetch.docker = "library/alpine" [nixpkgs] src.git = "https://github.com/NixOS/nixpkgs" fetch.tarball = "https://github.com/nixos/nixpkgs/archive/$ver.tar.gz" [cmd-example] src.cmd = "echo v2.5" fetch.github = "lilydjwg/nvchecker" [vscode-LiveServer] src.openvsx = "ritwickdey.LiveServer" fetch.openvsx = "ritwickdey.LiveServer" passthru = { publisher = "ritwickdey", name = "LiveServer" } [rust-git-dependency-example] src.manual = "8a5f37a8f80a3b05290707febf57e88661cee442" fetch.git = "https://gist.github.com/NickCao/6c4dbc4e15db5da107de6cdb89578375" cargo_lock = ["Cargo.lock"] [wallpapers] src.github = "George-Miao/wallpaper" fetch.github = "George-Miao/wallpaper" extract = ["wallpaper/*.jpg"] [wallpaper] fetch.url = "https://example.com/image.jpg" src.manual = "latest" url.name = "wallpaper.jpg" [noto-fonts-cjk-sans] src.manual = "Sans2.004" fetch.github = "notofonts/noto-cjk" git.fetchSubmodules = true git.sparseCheckout = ["Sans/OTC"] ``` -------------------------------- ### Haskell Nvfetcher Library Usage Source: https://github.com/berberman/nvfetcher/blob/master/README.md Example of using the nvfetcher Haskell library directly via the `runNvFetcher` entry point. This allows defining packages in Haskell, bypassing TOML constraints. ```Haskell import NvFetcher main :: IO () main = runNvFetcher [...] ``` -------------------------------- ### Generated Nix Expressions Structure Source: https://context7.com/berberman/nvfetcher/llms.txt An example of the auto-generated _sources/generated.nix file. This file contains the Nix expressions for various packages, including source URLs, hashes, and Cargo lock file configurations for Rust projects. ```nix # This file was generated by nvfetcher, please do not modify it manually. { fetchgit, fetchurl, fetchFromGitHub, dockerTools, }: { rustdesk = { pname = "rustdesk"; version = "1.4.2"; src = fetchFromGitHub { owner = "rustdesk"; repo = "rustdesk"; rev = "1.4.2"; fetchSubmodules = false; sha256 = "sha256-b/KuWECsmEcz9nPiuPqCcGQ1p+GdbaELScaIXnUTGv8="; }; cargoLock."Cargo.lock" = { lockFile = ./. + "/sha256-xxx/Cargo.lock"; outputHashes = { "dependency-0.1.0" = "sha256-xxx"; }; }; }; feeluown-core = { pname = "feeluown-core"; version = "3.8.2"; src = fetchurl { url = "https://pypi.org/packages/source/f/feeluown/feeluown-3.8.2.tar.gz"; sha256 = "sha256-xxx"; }; }; } ``` -------------------------------- ### Build Nvchecker from Source Source: https://github.com/berberman/nvfetcher/blob/master/README.md Instructions for cloning the nvfetcher repository, entering the development environment, and building the project using Cabal. ```Shell $ git clone https://github.com/berberman/nvfetcher $ nix develop $ cabal update $ cabal build ``` -------------------------------- ### CLI usage for nvfetcher Source: https://context7.com/berberman/nvfetcher/llms.txt Demonstrates common command-line operations for nvfetcher, including running updates, filtering packages, and managing the build environment. ```bash nvfetcher nvfetcher --build-dir ./nix-sources nvfetcher --filter "rust.*" nvfetcher --verbose --timing nvfetcher -j 8 nvfetcher --keyfile ~/.config/nvchecker/keyfile.toml nvfetcher --commit-changes nvfetcher --changelog changelog.txt nvfetcher --keep-going nvfetcher clean nvfetcher purge ``` -------------------------------- ### Nix Fetcher Configuration Options Source: https://github.com/berberman/nvfetcher/blob/master/README.md Configure how nvfetcher fetches package sources. Supports fetching from GitHub, PyPI, Git, direct URLs, OpenVSX, VS Marketplace, tarballs, and Docker images. The `$ver` variable is available for version substitution. ```Nix fetch.github = "owner/repo" fetch.pypi = "pypi_name" fetch.git = "git_url" fetch.url = "url" fetch.openvsx = "publisher.ext_name" fetch.vsmarketplace = "publisher.ext_name" fetch.tarball = "tarball_url" fetch.docker = "owner/name" ``` -------------------------------- ### Integrating Generated Sources into Nix Flakes Source: https://context7.com/berberman/nvfetcher/llms.txt Shows how to import the generated sources file into a flake.nix file to build packages using the updated source definitions. ```nix # flake.nix { inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; outputs = { self, nixpkgs }: let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; sources = pkgs.callPackage ./_sources/generated.nix {}; in { packages.${system} = { rustdesk = pkgs.rustPlatform.buildRustPackage { inherit (sources.rustdesk) pname version src cargoLock; }; feeluown = pkgs.python3Packages.buildPythonPackage { inherit (sources.feeluown-core) pname version src; }; }; }; } ``` -------------------------------- ### Nix Prefetch Git Configuration Source: https://github.com/berberman/nvfetcher/blob/master/README.md Optional configuration for `nix-prefetch-git` when using `fetch.github` or `fetch.git`. Enables deep cloning, fetching submodules, and controlling whether the `.git` directory is left behind. ```Nix git.deepClone = true git.fetchSubmodules = true git.leaveDotGit = true ``` -------------------------------- ### Docker Image Fetching Configuration Source: https://github.com/berberman/nvfetcher/blob/master/README.md Optional configuration for fetching Docker images using `fetch.docker` or `dockerTools.pullImage`. Allows specifying the OS, architecture, and final image name/tag. ```Nix docker.os = "os_name" docker.arch = "arch_name" docker.finalImageName = "image_name" docker.finalImageTag = "image_tag" docker.tlsVerify = true ``` -------------------------------- ### Nix Prefetch URL Configuration Source: https://github.com/berberman/nvfetcher/blob/master/README.md Optional configuration for `nix-prefetch-url` when using `fetch.url`. Allows specifying a custom file name for the downloaded content. The `$ver` variable is available for version substitution. ```Nix url.name = "file_name" ``` -------------------------------- ### Advanced Git Fetching with fetchGit' and fetchGitHub' in Haskell Source: https://context7.com/berberman/nvfetcher/llms.txt fetchGit' and fetchGitHub' provide advanced options for fetching from git repositories, including support for submodules and sparse checkouts. These functions allow for more granular control over the git fetch process. ```haskell {-# LANGUAGE OverloadedStrings #-} module Main where import NvFetcher packageSet :: PackageSet () packageSet = do -- Fetch with submodules define $ package "with-submodules" `sourceGit` "https://github.com/owner/repo" `fetchGit'` ("https://github.com/owner/repo", fetchSubmodules .~ True) -- Sparse checkout define $ package "sparse" `sourceManual` "v1.0" `fetchGitHub'` ("owner", "repo", sparseCheckout .~ ["src/", "lib/"]) ``` -------------------------------- ### Defining Custom Version Sources in Haskell Source: https://context7.com/berberman/nvfetcher/llms.txt Demonstrates how to define a package set using the sourceCmd function to fetch versions from an external shell command. This allows integration with arbitrary APIs or scripts to determine the latest package version. ```haskell {-# LANGUAGE OverloadedStrings #-} module Main where import NvFetcher packageSet :: PackageSet () packageSet = do define $ package "custom-version" `sourceCmd` "curl -s https://api.example.com/version" `fetchUrl` (\v -> "https://example.com/releases/" <> coerce v <> ".tar.gz") ``` -------------------------------- ### Package DSL - sourceManual and fetchUrl Source: https://context7.com/berberman/nvfetcher/llms.txt Defines a package with a manually specified version and a URL to fetch from. The URL can be static or dynamically generated based on the version string. ```Haskell {-# LANGUAGE OverloadedStrings #-} module Main where import NvFetcher packageSet :: PackageSet () packageSet = do -- Static URL with manual version define $ package "apple-emoji" `sourceManual` "0.0.0.20200413" `fetchUrl` const "https://example.com/AppleColorEmoji.ttf" -- URL with version interpolation define $ package "custom-release" `sourceManual` "1.2.3" `fetchUrl` (\v -> "https://example.com/releases/" <> coerce v <> "/file.tar.gz") ``` -------------------------------- ### Haskell Library API usage Source: https://context7.com/berberman/nvfetcher/llms.txt Shows how to integrate nvfetcher into a Haskell project using the runNvFetcher and runNvFetcher' functions with custom configurations. ```haskell {-# LANGUAGE OverloadedStrings #-} module Main where import NvFetcher main :: IO () main = runNvFetcher packageSet packageSet :: PackageSet () packageSet = do define $ package "fd" `fromGitHub` ("sharkdp", "fd") define $ package "feeluown-core" `fromPypi` "feeluown" ``` ```haskell {-# LANGUAGE OverloadedStrings #-} module Main where import Data.Default (def) import NvFetcher import NvFetcher.Config main :: IO () main = runNvFetcher' customConfig packageSet where customConfig = def { buildDir = "_custom_sources" , retry = 5 , keepGoing = True } packageSet :: PackageSet () packageSet = do define $ package "example" `fromGitHub` ("owner", "repo") ``` -------------------------------- ### nvfetcher CLI Usage Source: https://github.com/berberman/nvfetcher/blob/master/README.md The command-line interface for nvfetcher allows users to specify build directories, configuration files, and execution targets. It supports various flags for customization, such as filtering packages, setting thread counts, and enabling verbose output. ```bash Usage: nvfetcher [--version] [--help] [-o|--build-dir DIR] [--commit-changes] [-l|--changelog FILE] [-j NUM] [-r|--retry NUM] [-t|--timing] [-v|--verbose] [-f|--filter REGEX] [-k|--keyfile FILE] [--keep-old] [--keep-going] [TARGET] [-c|--config FILE] ``` -------------------------------- ### Package DSL - sourceGit and fetchGitHub Source: https://context7.com/berberman/nvfetcher/llms.txt Tracks git commits from a specified repository URL using `sourceGit` and optionally fetches release information from a corresponding GitHub repository using `fetchGitHub`. Useful for tracking HEAD or specific branches. ```Haskell {-# LANGUAGE OverloadedStrings #-} module Main where import NvFetcher packageSet :: PackageSet () packageSet = do -- Track latest git commit define $ package "nvfetcher-git" `sourceGit` "https://github.com/berberman/nvfetcher" `fetchGitHub` ("berberman", "nvfetcher") -- Track specific branch define $ package "dev-branch" `sourceGit'` ("https://github.com/owner/repo", "develop") `fetchGitHub` ("owner", "repo") ``` -------------------------------- ### Nix Source File Extraction Configuration Source: https://github.com/berberman/nvfetcher/blob/master/README.md Configure optional source file extraction using globs. Files matching the globs are copied to the build directory, and corresponding entries are generated in the Nix expression. Directories are ignored. ```Nix extract = [ "glob_1" "glob_2" ] ``` -------------------------------- ### Haskell Library API - runNvFetcherNoCLI Source: https://context7.com/berberman/nvfetcher/llms.txt Executes the NvFetcher without using the command-line interface, enabling programmatic control over package fetching. It takes default options and a PackageSet as input. ```Haskell {-# LANGUAGE OverloadedStrings #-} module Main where import Data.Default (def) import NvFetcher import NvFetcher.Options (Target(..)) main :: IO () main = runNvFetcherNoCLI def Build packageSet packageSet :: PackageSet () packageSet = do define $ package "mypackage" `fromGitHub` ("owner", "repo") ``` -------------------------------- ### Package DSL - fromOpenVsx and fromVscodeMarketplace Source: https://context7.com/berberman/nvfetcher/llms.txt Defines packages for VSCode extensions, allowing fetching from either the Open VSX Registry or the Visual Studio Marketplace. It requires the publisher and extension name. ```Haskell {-# LANGUAGE OverloadedStrings #-} module Main where import NvFetcher packageSet :: PackageSet () packageSet = do -- Open VSX extension define $ package "vscode-LiveServer" `fromOpenVsx` ("ritwickdey", "LiveServer") -- VS Marketplace extension define $ package "vscode-python" `fromVscodeMarketplace` ("ms-python", "python") ``` -------------------------------- ### Package DSL - fromGitHub for GitHub Releases Source: https://context7.com/berberman/nvfetcher/llms.txt Defines a package that tracks releases directly from a GitHub repository. It supports basic release tracking and advanced options like enabling submodules. ```Haskell {-# LANGUAGE OverloadedStrings #-} module Main where import NvFetcher packageSet :: PackageSet () packageSet = do -- Simple GitHub release tracking define $ package "fd" `fromGitHub` ("sharkdp", "fd") -- GitHub with custom fetcher options (enable submodules) define $ package "qliveplayer" `fromGitHub'` ("THMonster", "QLivePlayer", fetchSubmodules .~ True) ``` -------------------------------- ### Configuration Reference - Config Type Source: https://context7.com/berberman/nvfetcher/llms.txt Defines the global configuration options for the Nvfetcher build system. ```APIDOC ## [Haskell] Config Type ### Description Defines the behavior of the Nvfetcher build process, including directory paths, retry logic, and caching. ### Parameters - **shakeConfig** (ShakeOptions) - Optional - Build system configuration. - **buildDir** (FilePath) - Optional - Output directory (default: "_sources"). - **retry** (Int) - Optional - Number of retries on failure (default: 3). - **cacheNvchecker** (Bool) - Optional - Toggle caching of version checks (default: True). - **keepOldFiles** (Bool) - Optional - Whether to persist old generated files (default: False). ``` -------------------------------- ### Nix Force Fetching Configuration Source: https://github.com/berberman/nvfetcher/blob/master/README.md Force nvfetcher to always fetch the package, even if the version has not changed. This is useful when the download URL is not solely determined by the version. No version change log is produced in this case. ```Nix fetch.force = true ``` -------------------------------- ### Package DSL - fromPypi for PyPI Packages Source: https://context7.com/berberman/nvfetcher/llms.txt Defines a package that tracks and fetches releases from the Python Package Index (PyPI). It requires the package name as it appears on PyPI. ```Haskell {-# LANGUAGE OverloadedStrings #-} module Main where import NvFetcher packageSet :: PackageSet () packageSet = do define $ package "feeluown-core" `fromPypi` "feeluown" define $ package "requests" `fromPypi` "requests" ``` -------------------------------- ### Define nvfetcher Configuration Source: https://github.com/berberman/nvfetcher/blob/master/README.md A TOML configuration file defining a package source from GitHub and specifying a Cargo lock file for dependency hash calculation. ```toml [rustdeck] src.github = "rustdesk/rustdesk" fetch.github = "rustdesk/rustdesk" cargo_lock = ["Cargo.lock"] ``` -------------------------------- ### Version Source - sourceCmd Source: https://context7.com/berberman/nvfetcher/llms.txt Defines how to retrieve a package version using a custom shell command. ```APIDOC ## [Haskell] sourceCmd ### Description Allows fetching a package version by executing a shell command, useful for APIs or custom versioning schemes. ### Method N/A (Haskell DSL) ### Parameters #### Request Body - **command** (String) - Required - The shell command to execute to retrieve the version string. ### Request Example ```haskell `sourceCmd` "curl -s https://api.example.com/version" ``` ### Response #### Success Response (200) - **version** (String) - The version string returned by the command output. ``` -------------------------------- ### Lens Modifiers for Fetching and Versioning Source: https://context7.com/berberman/nvfetcher/llms.txt Lists the available lenses for modifying ListOptions, NvcheckerOptions, and NixFetcher configurations, allowing for precise control over how versions are filtered and fetched. ```haskell -- ListOptions lenses (for filtering tags/versions) includeRegex :: Lens' ListOptions (Maybe Text) excludeRegex :: Lens' ListOptions (Maybe Text) sortVersionKey :: Lens' ListOptions (Maybe VersionSortMethod) ignored :: Lens' ListOptions (Maybe Text) -- NvcheckerOptions lenses (for tweaking versions) stripPrefix :: Lens' NvcheckerOptions (Maybe Text) fromPattern :: Lens' NvcheckerOptions (Maybe Text) toPattern :: Lens' NvcheckerOptions (Maybe Text) -- NixFetcher lenses (for customizing fetch behavior) fetchSubmodules :: Lens' (NixFetcher k) Bool deepClone :: Lens' (NixFetcher k) Bool leaveDotGit :: Lens' (NixFetcher k) Bool sparseCheckout :: Lens' (NixFetcher k) [Text] ``` -------------------------------- ### Configure Git Date Formatting with gitDateFormat and gitTimeZone in Haskell Source: https://context7.com/berberman/nvfetcher/llms.txt gitDateFormat and gitTimeZone allow for custom configuration of how git commit dates are formatted and localized. This is particularly relevant when fetching versions from git repositories where date information is used. ```haskell {-# LANGUAGE OverloadedStrings #-} module Main where import NvFetcher packageSet :: PackageSet () packageSet = do define $ package "dated-package" `sourceGit` "https://github.com/owner/repo" `fetchGitHub` ("owner", "repo") `gitDateFormat` (Just "%Y-%m-%d %H:%M:%S") `gitTimeZone` (Just "UTC") ``` -------------------------------- ### Package DSL - fromGitHubTag for GitHub Tags Source: https://context7.com/berberman/nvfetcher/llms.txt Defines a package that tracks specific tags from a GitHub repository, allowing filtering using include and exclude regular expressions. This is useful for targeting specific versions or release patterns. ```Haskell {-# LANGUAGE OverloadedStrings #-} module Main where import NvFetcher packageSet :: PackageSet () packageSet = do -- Track specific tag pattern using regex define $ package "gcc-10" `fromGitHubTag` ("gcc-mirror", "gcc", includeRegex ?~ "releases/gcc-10.*" ) -- Track tags excluding prereleases define $ package "stable-release" `fromGitHubTag` ("owner", "repo", excludeRegex ?~ ".*-rc.*" ) ``` -------------------------------- ### Package DSL - extractSource for File Extraction Source: https://context7.com/berberman/nvfetcher/llms.txt Fetches source code from a defined package and then extracts specific files or directories using glob patterns. This is useful for isolating necessary build artifacts or configuration files. ```Haskell {-# LANGUAGE OverloadedStrings #-} module Main where import NvFetcher packageSet :: PackageSet () packageSet = do -- Extract Cargo.lock for inspection define $ package "rustdesk" `fromGitHub` ("rustdesk", "rustdesk") `extractSource` ["Cargo.lock"] -- Extract multiple file patterns define $ package "wallpapers" `fromGitHub` ("George-Miao", "wallpaper") `extractSource` ["wallpaper/*.jpg", "wallpaper/*.png"] ``` -------------------------------- ### Nix Pinned Package Configuration Source: https://github.com/berberman/nvfetcher/blob/master/README.md Set a package as pinned. Nvchecker will check for new versions only if no existing version is found. ```Nix pinned = true ``` -------------------------------- ### Rust Cargo.lock Vendor Configuration Source: https://github.com/berberman/nvfetcher/blob/master/README.md Automate the process of vendoring Rust dependencies from `Cargo.lock` files. Nvchecker extracts lock files and calculates `cargoLock.outputHashes` for use with `rustPlatform.buildRustPackage`. ```Nix cargo_lock = [ "cargo_lock_glob_1" "cargo_lock_glob_2" ] ``` -------------------------------- ### Package DSL - hasCargoLock for Rust Dependencies Source: https://context7.com/berberman/nvfetcher/llms.txt Processes `Cargo.lock` files to compute output hashes for Rust git dependencies. This function can handle single or multiple `Cargo.lock` files, supporting workspaces. ```Haskell {-# LANGUAGE OverloadedStrings #-} module Main where import NvFetcher packageSet :: PackageSet () packageSet = do -- Single Cargo.lock define $ package "rust-project" `fromGitHub` ("owner", "rust-app") `hasCargoLock` ["Cargo.lock"] -- Multiple Cargo.lock files (workspace) define $ package "revda" `sourceGit` "https://github.com/THMonster/Revda" `fetchGitHub'` ("THMonster", "Revda", fetchSubmodules .~ True) `hasCargoLock` ["dmlive/Cargo.lock", "dmlive/tars-stream/Cargo.lock"] ``` -------------------------------- ### Extract Version from Webpage with sourceWebpage in Haskell Source: https://context7.com/berberman/nvfetcher/llms.txt sourceWebpage allows extracting version information directly from the content of a webpage using a regular expression. It takes a URL and a regex pattern to identify and capture the version string. The 'id' function is used here as a placeholder for potential transformations. ```haskell {-# LANGUAGE OverloadedStrings #-} module Main where import NvFetcher packageSet :: PackageSet () packageSet = do -- Extract version from webpage define $ package "vim" `sourceWebpage` ("http://ftp.vim.org/pub/vim/patches/", "\d+\.\d+\.\d+", id) `fetchGitHub` ("vim", "vim") ``` -------------------------------- ### Nix Git Commit Date Formatting Source: https://github.com/berberman/nvfetcher/blob/master/README.md Configure the format and timezone for Git commit dates. Supports custom `strftime` formats and IANA time zone names or 'local'. ```Nix git.date_format = "%Y-%m-%d" git.date_tz = "America/New_York" ``` -------------------------------- ### Nvfetcher Configuration Data Structure Source: https://context7.com/berberman/nvfetcher/llms.txt Defines the Config data type in Haskell, which controls the behavior of the nvfetcher build process, including directory paths, retry logic, and post-build actions. ```haskell data Config = Config { shakeConfig :: ShakeOptions , buildDir :: FilePath , customRules :: Rules () , actionAfterBuild :: Action () , actionAfterClean :: Action () , retry :: Int , filterRegex :: Maybe String , cacheNvchecker :: Bool , keepOldFiles :: Bool , keyfile :: Maybe FilePath , keepGoing :: Bool } ``` -------------------------------- ### Nix Passthru Attributes Configuration Source: https://github.com/berberman/nvfetcher/blob/master/README.md Define additional attributes to be generated for a package using the `passthru` configuration. Currently, only string values are supported. ```Nix passthru = { k1 = "v1"; k2 = "v2"; } ``` -------------------------------- ### Generated JSON Metadata Source: https://github.com/berberman/nvfetcher/blob/master/README.md The JSON file generated by nvfetcher that tracks package state, including version, source details, and cargo lock information. ```json { "rustdesk": { "cargoLock": { "Cargo.lock": [ "sha256-b_KuWECsmEcz9nPiuPqCcGQ1p+GdbaELScaIXnUTGv8=/Cargo.lock", { "android-wakelock-0.1.0": "sha256-09EH/U1BBs3l4galQOrTKmPUYBgryUjfc/rqPZhdYc4=" } ] }, "date": null, "extract": null, "name": "rustdesk", "pinned": false, "src": { "owner": "rustdesk", "repo": "rustdesk", "rev": "1.4.2", "sha256": "sha256-b/KuWECsmEcz9nPiuPqCcGQ1p+GdbaELScaIXnUTGv8=", "type": "github" }, "version": "1.4.2" } } ``` -------------------------------- ### Force Re-fetching with forceFetch in Haskell Source: https://context7.com/berberman/nvfetcher/llms.txt The forceFetch function ensures that a package is re-fetched regardless of whether its version has changed. This is useful for scenarios where the content at a URL might change even if the version identifier does not. ```haskell {-# LANGUAGE OverloadedStrings #-} module Main where import NvFetcher packageSet :: PackageSet () packageSet = do -- Always fetch, useful when URL doesn't change but content does define $ forceFetch $ package "nightly-build" `sourceManual` "nightly" `fetchUrl` const "https://example.com/nightly-latest.tar.gz" ``` -------------------------------- ### Generated Nix Expression Source: https://github.com/berberman/nvfetcher/blob/master/README.md The resulting Nix expression generated by nvfetcher, containing package metadata, source fetcher details, and cargo lock hashes. ```nix { fetchgit, fetchurl, fetchFromGitHub, dockerTools, }: { rustdesk = { pname = "rustdesk"; version = "1.4.2"; src = fetchFromGitHub { owner = "rustdesk"; repo = "rustdesk"; rev = "1.4.2"; fetchSubmodules = false; sha256 = "sha256-b/KuWECsmEcz9nPiuPqCcGQ1p+GdbaELScaIXnUTGv8="; }; cargoLock."Cargo.lock" = { lockFile = ./. + "/sha256-b_KuWECsmEcz9nPiuPqCcGQ1p+GdbaELScaIXnUTGv8=/Cargo.lock"; outputHashes = { "filedescriptor-0.8.2" = "sha256-zXTt9eHAVdCPipWAMFeiqk1JteX+7IZcXZ7uvxkzDjQ="; }; }; }; } ``` -------------------------------- ### Track Versions from Repology with sourceRepology in Haskell Source: https://context7.com/berberman/nvfetcher/llms.txt sourceRepology enables tracking package versions directly from the Repology service. It requires the package name and the distribution identifier (e.g., 'arch') to fetch the latest version information. ```haskell {-# LANGUAGE OverloadedStrings #-} module Main where import NvFetcher packageSet :: PackageSet () packageSet = do define $ package "htop" `sourceRepology` ("htop", "arch") `fetchGitHub` ("htop-dev", "htop") ``` -------------------------------- ### Pin Package Version with pinned in Haskell Source: https://context7.com/berberman/nvfetcher/llms.txt The pinned function is used to fix a package version, preventing it from being automatically updated by NvFetcher. This is useful for maintaining stability or when a specific version is required. ```haskell {-# LANGUAGE OverloadedStrings #-} module Main where import NvFetcher packageSet :: PackageSet () packageSet = do -- Pinned package won't check for new versions define $ pinned $ package "stable-dep" `fromGitHub` ("owner", "repo") ``` -------------------------------- ### Track Versions from Arch Linux Repositories with sourceArchLinux and sourceAur in Haskell Source: https://context7.com/berberman/nvfetcher/llms.txt sourceArchLinux and sourceAur are used to track package versions from the official Arch Linux repositories and the Arch User Repository (AUR), respectively. These functions simplify the process of keeping packages updated from these sources. ```haskell {-# LANGUAGE OverloadedStrings #-} module Main where import NvFetcher packageSet :: PackageSet () packageSet = do -- Arch Linux official repo define $ package "pacman" `sourceArchLinux` "pacman" `fetchGitHub` ("archlinux", "pacman") -- AUR package define $ package "yay" `sourceAur` "yay" `fetchGitHub` ("Jguer", "yay") ``` -------------------------------- ### Extract Version from HTTP Header with sourceHttpHeader in Haskell Source: https://context7.com/berberman/nvfetcher/llms.txt sourceHttpHeader extracts version information from HTTP response headers. It supports specifying a URL, a regex for the version, and options for sorting version keys, such as using Vercmp for comparison. ```haskell {-# LANGUAGE OverloadedStrings #-} module Main where import NvFetcher packageSet :: PackageSet () packageSet = do -- Extract from HTTP header with list options define $ package "redirect-version" `sourceHttpHeader` ("https://example.com/latest", "v(\d+\.\d+)", sortVersionKey ?~ Vercmp) `fetchUrl` (\v -> "https://example.com/releases/" <> coerce v <> ".tar.gz") ``` -------------------------------- ### Fetch Source as Tarball with fetchTarball in Haskell Source: https://context7.com/berberman/nvfetcher/llms.txt The fetchTarball function is used to fetch source code directly as a tarball, which NvFetcher will automatically extract. This simplifies the process of handling tarball archives as package sources. ```haskell {-# LANGUAGE OverloadedStrings #-} module Main where import NvFetcher packageSet :: PackageSet () packageSet = do define $ package "nixpkgs" `sourceGit` "https://github.com/NixOS/nixpkgs" `fetchTarball` (\v -> "https://github.com/nixos/nixpkgs/archive/" <> coerce v <> ".tar.gz") ``` -------------------------------- ### Lens Modifiers Reference Source: https://context7.com/berberman/nvfetcher/llms.txt Lenses for fine-tuning version filtering and fetcher behavior. ```APIDOC ## [Haskell] Lens Modifiers ### Description Utility lenses to modify ListOptions, NvcheckerOptions, and NixFetcher configurations. ### Available Lenses - **includeRegex** (Lens' ListOptions) - Filter versions by regex. - **stripPrefix** (Lens' NvcheckerOptions) - Remove prefixes from version strings. - **fetchSubmodules** (Lens' (NixFetcher k)) - Toggle git submodule fetching. - **sparseCheckout** (Lens' (NixFetcher k)) - Configure sparse checkout paths. ``` -------------------------------- ### Add Custom Attributes with passthru in Haskell Source: https://context7.com/berberman/nvfetcher/llms.txt The passthru function enables the addition of custom attributes to the generated Nix expression for a package. This allows for enriching package definitions with metadata beyond standard versioning and fetching information. ```haskell {-# LANGUAGE OverloadedStrings #-} module Main where import NvFetcher packageSet :: PackageSet () packageSet = do define $ package "vscode-ext" `fromOpenVsx` ("publisher", "extension") `passthru` [("publisher", "publisher"), ("name", "extension"), ("custom", "value")] ``` -------------------------------- ### Modify Version String with tweakVersion in Haskell Source: https://context7.com/berberman/nvfetcher/llms.txt The tweakVersion function allows modification of version strings obtained from nvchecker. It supports pattern matching and transformation to clean up or reformat version identifiers. This is useful for standardizing version formats across different sources. ```haskell {-# LANGUAGE OverloadedStrings #-} module Main where import NvFetcher packageSet :: PackageSet () packageSet = do -- Strip 'v' prefix from version define $ package "vim" `sourceWebpage` ("http://ftp.vim.org/pub/vim/patches/7.3/", "7\.3\.\d+", id) `fetchGitHub` ("vim", "vim") `tweakVersion` (\v -> v & fromPattern ?~ "(.+)" & toPattern ?~ "v\1") -- Strip prefix define $ package "stripped" `fromGitHub` ("owner", "repo") `tweakVersion` (stripPrefix ?~ "release-") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.