3
0
Fork 0
forked from mirrors/nixpkgs

autonix: tweak manifest format

This commit is contained in:
Thomas Tuegel 2015-02-21 10:58:37 -06:00
parent 7bf2021349
commit fdcfefee2c
2 changed files with 16 additions and 14 deletions

View file

@ -36,9 +36,10 @@ let
writeManifestXML = filename:
let
generateStores = mapAttrs (n: pkg: pkg.store);
manifest = generateStores (importManifest filename { mirror = ""; });
manifest = importManifest filename { mirror = ""; };
stores = generateStores manifest;
in
writeText "manifest.xml" (builtins.toXML manifest);
writeText "manifest.xml" (builtins.toXML stores);
/* Generate a set of Nix expressions for the collection, given a
* manifest.nix, dependencies.nix, and renames.nix in the same directory.
@ -69,9 +70,8 @@ let
in derive (postResolve (resolve (preResolve packages)));
pkgNameVersion = pkg: nameFromURL pkg.name ".tar";
pkgAttrName = pkg: (builtins.parseDrvName (pkgNameVersion pkg)).name;
pkgVersion = pkg: (builtins.parseDrvName (pkgNameVersion pkg)).version;
pkgAttrName = pkg: (builtins.parseDrvName pkg.name).name;
pkgVersion = pkg: (builtins.parseDrvName pkg.name).version;
depAttrNames = [
"buildInputs" "nativeBuildInputs"
@ -112,7 +112,7 @@ let
builtins.listToAttrs
(map (p: nameValuePair (toLower (pkgAttrName p)) p) manifest);
orig = import path { inherit mirror; };
orig = import path { inherit stdenv fetchurl mirror; };
in
fold (f: x: f x) orig [ withNames bestVersions ];
@ -134,11 +134,10 @@ let
deps = import (path + "/dependencies.nix") {};
mkPkg = pkg: pkgManifest:
mkPkg = name: manifest:
{
name = nameFromURL pkgManifest.name ".tar";
src = { inherit (pkgManifest) sha256 name url; };
inherit (deps."${pkg}")
inherit (manifest) name src;
inherit (deps."${name}")
buildInputs nativeBuildInputs propagatedBuildInputs
propagatedNativeBuildInputs propagatedUserEnvPkgs;
};

View file

@ -6,7 +6,7 @@
cat >../manifest.nix <<EOF
# This file is generated automatically. DO NOT EDIT!
{ mirror }:
{ stdenv, fetchurl, mirror }:
[
EOF
@ -24,10 +24,13 @@ workdir=$(pwd)
store=$(@nix@/bin/nix-store --print-fixed-path sha256 "$sha256" "$name")
cat >>../manifest.nix <<EOF
{
url = "\${mirror}/${url}";
sha256 = "${sha256}";
name = "${name}";
name = stdenv.lib.nameFromURL "${name}" ".tar";
store = "${store}";
src = fetchurl {
url = "\${mirror}/${url}";
sha256 = "${sha256}";
name = "${name}";
};
}
EOF
fi