mirror of
https://github.com/nix-community/dream2nix.git
synced 2025-01-05 13:29:29 +03:00
add documentation strings to stack-lock/utils.nix
This commit is contained in:
parent
b45c224383
commit
7bbfd8e940
@ -16,6 +16,7 @@ in rec {
|
|||||||
tar --strip-components 1 -xf ${pkgs.all-cabal-hashes}
|
tar --strip-components 1 -xf ${pkgs.all-cabal-hashes}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# The cabal2json program
|
||||||
cabal2json = let
|
cabal2json = let
|
||||||
haskellLib = pkgs.haskell.lib.compose;
|
haskellLib = pkgs.haskell.lib.compose;
|
||||||
haskellPackages = pkgs.haskell.packages.ghc8107.override {
|
haskellPackages = pkgs.haskell.packages.ghc8107.override {
|
||||||
@ -45,6 +46,7 @@ in rec {
|
|||||||
in
|
in
|
||||||
l.fromJSON (l.readFile jsonFile);
|
l.fromJSON (l.readFile jsonFile);
|
||||||
|
|
||||||
|
# fromYaml IFD implementation
|
||||||
fromYaml = file: let
|
fromYaml = file: let
|
||||||
file' = l.path {path = file;};
|
file' = l.path {path = file;};
|
||||||
jsonFile = pkgs.runCommand "yaml.json" {} ''
|
jsonFile = pkgs.runCommand "yaml.json" {} ''
|
||||||
@ -53,6 +55,7 @@ in rec {
|
|||||||
in
|
in
|
||||||
l.fromJSON (l.readFile jsonFile);
|
l.fromJSON (l.readFile jsonFile);
|
||||||
|
|
||||||
|
# converts all cabal files for a given list of candidates to json files
|
||||||
batchCabal2Json = candidates: let
|
batchCabal2Json = candidates: let
|
||||||
candidatesJsonStr = l.toJSON candidates;
|
candidatesJsonStr = l.toJSON candidates;
|
||||||
convertOne = name: version: ''
|
convertOne = name: version: ''
|
||||||
@ -73,6 +76,10 @@ in rec {
|
|||||||
(l.concatStringsSep "\n"
|
(l.concatStringsSep "\n"
|
||||||
(l.map (c: convertOne c.name c.version) candidates));
|
(l.map (c: convertOne c.name c.version) candidates));
|
||||||
|
|
||||||
|
/*
|
||||||
|
Converts all cabal files for a given list of candiates to an attrset.
|
||||||
|
access like: ${name}.${version}.${some_cabal_attr}
|
||||||
|
*/
|
||||||
batchCabalData = candidates: let
|
batchCabalData = candidates: let
|
||||||
batchJson = batchCabal2Json candidates;
|
batchJson = batchCabal2Json candidates;
|
||||||
in
|
in
|
||||||
|
Loading…
Reference in New Issue
Block a user