nvfetcher-0.7.0.0: Generate nix sources expr for the latest version of packages
Copyright(c) 2021-2022 berberman
LicenseMIT
Maintainerberberman <[email protected]>
Stabilityexperimental
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

NvFetcher.NixFetcher

Description

NixFetcher is used to describe how to fetch package sources.

There are five types of fetchers overall:

  1. FetchGit -- nix-prefetch-git
  2. FetchGitHub -- nix-prefetch-git/nix-prefetch-url
  3. FetchUrl -- nix-prefetch-url
  4. FetchTarball -- nix-prefetch-url
  5. FetchDocker -- nix-prefetch-docker

As you can see the type signature of prefetch: a fetcher will be filled with the fetch result (hash) after the prefetch.

Synopsis

Types

data RunFetch Source #

The input of prefetch rule

Instances

Instances details
Generic RunFetch Source # 
Instance details

Defined in NvFetcher.Types

Associated Types

type Rep RunFetch :: Type -> Type #

Methods

from :: RunFetch -> Rep RunFetch x #

to :: Rep RunFetch x -> RunFetch #

Show RunFetch Source # 
Instance details

Defined in NvFetcher.Types

Binary RunFetch Source # 
Instance details

Defined in NvFetcher.Types

Methods

put :: RunFetch -> Put #

get :: Get RunFetch #

putList :: [RunFetch] -> Put #

NFData RunFetch Source # 
Instance details

Defined in NvFetcher.Types

Methods

rnf :: RunFetch -> () #

Eq RunFetch Source # 
Instance details

Defined in NvFetcher.Types

Ord RunFetch Source # 
Instance details

Defined in NvFetcher.Types

Hashable RunFetch Source # 
Instance details

Defined in NvFetcher.Types

Methods

hashWithSalt :: Int -> RunFetch -> Int #

hash :: RunFetch -> Int #

type Rep RunFetch Source # 
Instance details

Defined in NvFetcher.Types

type Rep RunFetch = D1 ('MetaData "RunFetch" "NvFetcher.Types" "nvfetcher-0.7.0.0-E76LQsRhWAxEniEZnhJWIT" 'False) (C1 ('MetaCons "RunFetch" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ForceFetch) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NixFetcher 'Fresh))))
type RuleResult RunFetch Source # 
Instance details

Defined in NvFetcher.Types

data ForceFetch Source #

Whether to cache the fetched sha256

ForceFetch indicates alwaysRerun the fetcher rule

Constructors

ForceFetch 
NoForceFetch 

Instances

Instances details
Generic ForceFetch Source # 
Instance details

Defined in NvFetcher.Types

Associated Types

type Rep ForceFetch :: Type -> Type #

Show ForceFetch Source # 
Instance details

Defined in NvFetcher.Types

Binary ForceFetch Source # 
Instance details

Defined in NvFetcher.Types

Default ForceFetch Source # 
Instance details

Defined in NvFetcher.Types

Methods

def :: ForceFetch #

NFData ForceFetch Source # 
Instance details

Defined in NvFetcher.Types

Methods

rnf :: ForceFetch -> () #

Eq ForceFetch Source # 
Instance details

Defined in NvFetcher.Types

Ord ForceFetch Source # 
Instance details

Defined in NvFetcher.Types

Hashable ForceFetch Source # 
Instance details

Defined in NvFetcher.Types

Pretty ForceFetch Source # 
Instance details

Defined in NvFetcher.Types

Methods

pretty :: ForceFetch -> Doc ann #

prettyList :: [ForceFetch] -> Doc ann #

type Rep ForceFetch Source # 
Instance details

Defined in NvFetcher.Types

type Rep ForceFetch = D1 ('MetaData "ForceFetch" "NvFetcher.Types" "nvfetcher-0.7.0.0-E76LQsRhWAxEniEZnhJWIT" 'False) (C1 ('MetaCons "ForceFetch" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NoForceFetch" 'PrefixI 'False) (U1 :: Type -> Type))

data NixFetcher (k :: FetchStatus) Source #

If the package is prefetched, then we can obtain the SHA256

Instances

Instances details
ToJSON (NixFetcher 'Fetched) Source # 
Instance details

Defined in NvFetcher.Types

Generic (NixFetcher k) Source # 
Instance details

Defined in NvFetcher.Types

Associated Types

type Rep (NixFetcher k) :: Type -> Type #

Methods

from :: NixFetcher k -> Rep (NixFetcher k) x #

to :: Rep (NixFetcher k) x -> NixFetcher k #

ForFetchResult Show k => Show (NixFetcher k) Source # 
Instance details

Defined in NvFetcher.Types

ForFetchResult Binary k => Binary (NixFetcher k) Source # 
Instance details

Defined in NvFetcher.Types

Methods

put :: NixFetcher k -> Put #

get :: Get (NixFetcher k) #

putList :: [NixFetcher k] -> Put #

ForFetchResult NFData k => NFData (NixFetcher k) Source # 
Instance details

Defined in NvFetcher.Types

Methods

rnf :: NixFetcher k -> () #

ForFetchResult Eq k => Eq (NixFetcher k) Source # 
Instance details

Defined in NvFetcher.Types

Methods

(==) :: NixFetcher k -> NixFetcher k -> Bool #

(/=) :: NixFetcher k -> NixFetcher k -> Bool #

ForFetchResult Ord k => Ord (NixFetcher k) Source # 
Instance details

Defined in NvFetcher.Types

ForFetchResult Hashable k => Hashable (NixFetcher k) Source # 
Instance details

Defined in NvFetcher.Types

Methods

hashWithSalt :: Int -> NixFetcher k -> Int #

hash :: NixFetcher k -> Int #

ToNixExpr (NixFetcher 'Fetched) Source # 
Instance details

Defined in NvFetcher.NixExpr

Pretty (NixFetcher k) Source # 
Instance details

Defined in NvFetcher.Types

Methods

pretty :: NixFetcher k -> Doc ann #

prettyList :: [NixFetcher k] -> Doc ann #

type Rep (NixFetcher k) Source # 
Instance details

Defined in NvFetcher.Types

type Rep (NixFetcher k) = D1 ('MetaData "NixFetcher" "NvFetcher.Types" "nvfetcher-0.7.0.0-E76LQsRhWAxEniEZnhJWIT" 'False) ((C1 ('MetaCons "FetchGit" 'PrefixI 'True) (((S1 ('MetaSel ('Just "_furl") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "_rev") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Version)) :*: (S1 ('MetaSel ('Just "_deepClone") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "_fetchSubmodules") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))) :*: ((S1 ('MetaSel ('Just "_leaveDotGit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "_sparseCheckout") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text])) :*: (S1 ('MetaSel ('Just "_name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "_sha256") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (FetchResult Checksum k))))) :+: C1 ('MetaCons "FetchGitHub" 'PrefixI 'True) (((S1 ('MetaSel ('Just "_fowner") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "_frepo") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "_rev") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Version) :*: S1 ('MetaSel ('Just "_deepClone") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))) :*: ((S1 ('MetaSel ('Just "_fetchSubmodules") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool) :*: S1 ('MetaSel ('Just "_leaveDotGit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :*: (S1 ('MetaSel ('Just "_sparseCheckout") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Text]) :*: (S1 ('MetaSel ('Just "_name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "_sha256") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (FetchResult Checksum k))))))) :+: (C1 ('MetaCons "FetchUrl" 'PrefixI 'True) (S1 ('MetaSel ('Just "_furl") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "_name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "_sha256") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (FetchResult Checksum k)))) :+: (C1 ('MetaCons "FetchTarball" 'PrefixI 'True) (S1 ('MetaSel ('Just "_furl") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "_sha256") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (FetchResult Checksum k))) :+: C1 ('MetaCons "FetchDocker" 'PrefixI 'True) (((S1 ('MetaSel ('Just "_imageName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "_imageTag") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "_imageDigest") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (FetchResult ContainerDigest k)) :*: S1 ('MetaSel ('Just "_sha256") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (FetchResult Checksum k)))) :*: ((S1 ('MetaSel ('Just "_fos") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "_farch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text))) :*: (S1 ('MetaSel ('Just "_finalImageName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: (S1 ('MetaSel ('Just "_finalImageTag") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "_tlsVerify") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Bool)))))))))

data FetchStatus Source #

Fetch status

Constructors

Fresh 
Fetched 

type family FetchResult a (k :: FetchStatus) where ... Source #

Prefetched fetchers hold hashes

Equations

FetchResult _ Fresh = () 
FetchResult a Fetched = a 

Rules

prefetchRule :: Rules () Source #

Rules of nix fetcher

Functions

gitHubFetcher Source #

Arguments

:: (Text, Text)

owner and repo

-> PackageFetcher 

Create a fetcher from github repo

pypiFetcher :: Text -> PackageFetcher Source #

Create a fetcher from pypi

gitHubReleaseFetcher Source #

Arguments

:: (Text, Text)

owner and repo

-> Text

file name

-> PackageFetcher 

Create a fetcher from github release

gitHubReleaseFetcher' Source #

Arguments

:: (Text, Text)

owner and repo

-> (Version -> Text)

file name computed from version

-> PackageFetcher 

Create a fetcher from github release

gitFetcher :: Text -> PackageFetcher Source #

Create a fetcher from git url

urlFetcher :: Text -> NixFetcher Fresh Source #

Create a fetcher from url

urlFetcher' :: Text -> Maybe Text -> NixFetcher Fresh Source #

Create a fetcher from url specifying the file name

openVsxFetcher Source #

Arguments

:: (Text, Text)

publisher and extension name

-> PackageFetcher 

Create a fetcher from openvsx

vscodeMarketplaceFetcher Source #

Arguments

:: (Text, Text)

publisher and extension name

-> PackageFetcher 

Create a fetcher from vscode marketplace

tarballFetcher :: Text -> NixFetcher Fresh Source #

Create a fetcher from url, using fetchTarball