Sha256: 45f6fba9f9799192e973c01a41e5e1be841a1044e14430ad83986ebc90b8c374
Contents?: true
Size: 1.87 KB
Versions: 2
Compression:
Stored size: 1.87 KB
Contents
{ confDir, name, dir ? "cluster", channels, pkgs, lib }: let pinFileName = builtins.replaceStrings [ "/" ] [ ":" ] name; pinFilePath = "${toString confDir}/swpins/${dir}/${pinFileName}.json"; pinFileJson = builtins.readFile pinFilePath; pinFileSpecs = if builtins.pathExists pinFilePath then builtins.fromJSON pinFileJson else {}; pinFileSwpins = lib.mapAttrs (k: v: swpin v) pinFileSpecs; channelPath = chan: "${toString confDir}/swpins/channels/${chan}.json"; channelJson = chan: builtins.readFile (channelPath chan); channelSpecs = chan: builtins.fromJSON (channelJson chan); channelSwpins = chan: lib.mapAttrs (k: v: swpin v) (channelSpecs chan); allChannelSwpins = map channelSwpins channels; allSwpins = (lib.foldl (a: b: a // b) {} allChannelSwpins) // pinFileSwpins; swpin = { fetcher, ... }: fetchers.${fetcher.type} fetcher.options; fetchers = rec { directory = opts: opts.path; git = opts: let filter = lib.filterAttrs (k: v: builtins.elem k [ "url" "rev" "sha256" "fetchSubmodules" ]); in pkgs.fetchgit (filter opts); zip = opts: pkgs.fetchzip opts; git-rev = opts: let repo = fetchers.${opts.wrapped_fetcher.type} opts.wrapped_fetcher.options; shortRev = lib.substring 0 9 (opts.rev); in pkgs.runCommand "git-${shortRev}" {} '' cp -a ${repo} $out chmod 700 $out echo "${opts.rev}" > $out/.git-revision echo ".git.${shortRev}" > $out/.version-suffix ''; }; pinFileInfos = lib.mapAttrs (k: v: v.info or {}) pinFileSpecs; channelInfos = chan: lib.mapAttrs (k: v: v.info or {}) (channelSpecs chan); allChannelInfos = map channelInfos channels; allInfos = (lib.foldl (a: b: a // b) {} allChannelInfos) // pinFileInfos; in { evaluated = allSwpins; infos = allInfos; }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
confctl-2.0.0 | nix/lib/swpins/eval.nix |
confctl-1.0.0 | nix/lib/swpins/eval.nix |