Merge pull request #55 from Mic92/indent

replace non-longer present pp-aterm with indent
This commit is contained in:
John Ericson 2018-03-31 13:27:12 -04:00 committed by GitHub
commit 6a6a23a6d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 66 additions and 67 deletions

View file

@ -138,11 +138,11 @@
<screen><xi:include href="./06/pretty-print-fast.txt" parse="text" /></screen>
<para>
The installed <code>pp-aterm</code> program can be used to pretty print
The installed <code>indent</code> program can be used to pretty print
<filename>.drv</filename> files:
</para>
<screen><xi:include href="./06/pp-aterm.txt" parse="text" /></screen>
<screen><xi:include href="./06/indent.txt" parse="text" /></screen>
<para>

View file

@ -1,13 +1,12 @@
$ pp-aterm -i /nix/store/d4xczdij7xazjfm5kn4nmphx63mpv676-myname.drv
Derive(
[("out", "/nix/store/fy5lyr5iysn4ayyxvpnsya8r5y5bwjnl-myname", "", "")]
, [("/nix/store/1zcs1y4n27lqs0gw4v038i303pb89rw6-coreutils-8.21.drv", ["out"])]
, []
, "x86_64-linux"
, "/nix/store/8w4cbiy7wqvaqsnsnb3zvabq1cp2zhyz-coreutils-8.21/bin/true"
, []
, [ ("builder", "/nix/store/8w4cbiy7wqvaqsnsnb3zvabq1cp2zhyz-coreutils-8.21/bin/true")
, ("name", "myname")
, ("out", "/nix/store/fy5lyr5iysn4ayyxvpnsya8r5y5bwjnl-myname")
, ("system", "x86_64-linux")
]
$ indent < /nix/store/d4xczdij7xazjfm5kn4nmphx63mpv676-myname.drv
Derive ([("out", "/nix/store/ly2k1vswbfmswr33hw0kf0ccilrpisnk-myname", "",
"")],
[("/nix/store/hixdnzz2wp75x1jy65cysq06yl74vx7q-coreutils-8.29.drv",
["out"])],[], "x86_64-linux",
"/nix/store/qrxs7sabhqcr3j9ai0j0cp58zfnny0jz-coreutils-8.29/bin/true",
[],
[("builder",
"/nix/store/qrxs7sabhqcr3j9ai0j0cp58zfnny0jz-coreutils-8.29/bin/true"),
("name", "myname"), ("out",
"/nix/store/ly2k1vswbfmswr33hw0kf0ccilrpisnk-myname"),
("system", "x86_64-linux")])

6
pills/06/indent.txt Normal file
View file

@ -0,0 +1,6 @@
$ indent < /nix/store/z3hhlxbckx4g3n9sw91nnvlkjvyw754p-myname.drv
Derive ([("out", "/nix/store/40s0qmrfb45vlh6610rk29ym318dswdr-myname", "",
"")],[],[], "mysystem", "mybuilder",[],[("builder", "mybuilder"),
("name", "myname"), ("out",
"/nix/store/40s0qmrfb45vlh6610rk29ym318dswdr-myname"),
("system", "mysystem")])

View file

@ -1,13 +0,0 @@
$ indent < /nix/store/z3hhlxbckx4g3n9sw91nnvlkjvyw754p-myname.drv
Derive(
[("out", "/nix/store/40s0qmrfb45vlh6610rk29ym318dswdr-myname", "", "")]
, []
, []
, "mysystem"
, "mybuilder"
, []
, [ ("builder", "mybuilder")
, ("name", "myname")
, ("out", "/nix/store/40s0qmrfb45vlh6610rk29ym318dswdr-myname")
, ("system", "mysystem")
]

View file

@ -161,7 +161,6 @@
<para>
We added something else to the derivation this time: the args attribute.
Let's see how this changed the .drv compared to the previous pill:
<!-- pp-aterm is no longer in nixpkgs, see nixos/nixpkgs#25371. This bit should be changed to reflect this. -->
<xi:include href="./07/foo.drv.xml" />
Much like the usual .drv, except that there's a list of arguments in there

View file

@ -1,14 +1,13 @@
<screen xmlns="http://docbook.org/ns/docbook"><prompt>$ </prompt><userinput>pp-aterm -i /nix/store/g6jj1mjzq68i66rbqyb3gpx3k0x606af-<emphasis>foo.drv</emphasis></userinput>
<computeroutput>Derive(
[("out", "/nix/store/w024zci0x1hh1wj6gjq0jagkc1sgrf5r-foo", "", "")]
, [("/nix/store/jdggv3q1sb15140qdx0apvyrps41m4lr-bash-4.2-p45.drv", ["out"])]
, ["/nix/store/5d1i99yd1fy4wkyx85iz5bvh78j2j96r-builder.sh"]
, "x86_64-linux"
, "/nix/store/ihmkc7z2wqk3bbipfnlh0yjrlfkkgnv6-bash-4.2-p45/bin/bash"
, ["/nix/store/5d1i99yd1fy4wkyx85iz5bvh78j2j96r-builder.sh"]
, [ ("builder", "/nix/store/ihmkc7z2wqk3bbipfnlh0yjrlfkkgnv6-bash-4.2-p45/bin/bash")
, ("name", "foo")
, ("out", "/nix/store/w024zci0x1hh1wj6gjq0jagkc1sgrf5r-foo")
, ("system", "x86_64-linux")
]
)</computeroutput></screen>
<screen xmlns="http://docbook.org/ns/docbook"><prompt>$ </prompt><userinput>indent < /nix/store/g6jj1mjzq68i66rbqyb3gpx3k0x606af-<emphasis>foo.drv</emphasis></userinput>
<computeroutput>Derive ([("out", "/nix/store/3ry68pkk8sll57xgx641niynj1w62qsn-foo", "", "")],
[("/nix/store/hcgwbx42mcxr7ksnv0i1fg7kw6jvxshb-bash-4.4-p19.drv",
["out"])],
["/nix/store/5d1i99yd1fy4wkyx85iz5bvh78j2j96r-builder.sh"],
"x86_64-linux",
"/nix/store/q1g0rl8zfmz7r371fp5p42p4acmv297d-bash-4.4-p19/bin/bash",
["/nix/store/5d1i99yd1fy4wkyx85iz5bvh78j2j96r-builder.sh"],
[("builder",
"/nix/store/q1g0rl8zfmz7r371fp5p42p4acmv297d-bash-4.4-p19/bin/bash"),
("name", "foo"), ("out",
"/nix/store/3ry68pkk8sll57xgx641niynj1w62qsn-foo"),
("system", "x86_64-linux")])</computeroutput></screen>

View file

@ -1,4 +1,4 @@
$ pp-aterm -i /nix/store/ymsf5zcqr9wlkkqdjwhqllgwa97rff5i-bar.drv
Derive(
[("out", "/nix/store/a00d5f71k0vp5a6klkls0mvr1f7sx6ch-bar", "sha256", "f3f3c4763037e059b4d834eaf68595bbc02ba19f6d2a500dce06d124e2cd99bb")]
$ indent < /nix/store/ymsf5zcqr9wlkkqdjwhqllgwa97rff5i-bar.drv
Derive ([("out", "/nix/store/a00d5f71k0vp5a6klkls0mvr1f7sx6ch-bar", "sha256",
"f3f3c4763037e059b4d834eaf68595bbc02ba19f6d2a500dce06d124e2cd99bb")],
...

View file

@ -1,20 +1,29 @@
$ pp-aterm -i $(nix-instantiate hello.nix)
Derive(
[("out", "/nix/store/6flbdbpq6sc1dc79xjx01bz43zwgj3wc-hello", "", "")]
, [("/nix/store/8z4xw8a0ax1csa0l83zflsm4jw9c94w2-bash-4.3-p39.drv", ["out"]), ("/nix/store/j0905apmxw2qb4ng5j40d4ghpiwa3mi1-stdenv.drv", ["out"])]
, ["/nix/store/0q6pfasdma4as22kyaknk4kwx4h58480-hello-2.10.tar.gz", "/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"]
, "x86_64-linux"
, "/nix/store/zmd4jk4db5lgxb8l93mhkvr3x92g2sx2-bash-4.3-p39/bin/bash"
, ["-e", "/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"]
, [ ("buildInputs", "")
, ("builder", "/nix/store/zmd4jk4db5lgxb8l93mhkvr3x92g2sx2-bash-4.3-p39/bin/bash")
, ("name", "hello")
, ("nativeBuildInputs", "")
, ("out", "/nix/store/6flbdbpq6sc1dc79xjx01bz43zwgj3wc-hello")
, ("propagatedBuildInputs", "")
, ("propagatedNativeBuildInputs", "")
, ("src", "/nix/store/0q6pfasdma4as22kyaknk4kwx4h58480-hello-2.10.tar.gz")
, ("stdenv", "/nix/store/k4jklkcag4zq4xkqhkpy156mgfm34ipn-stdenv")
, ("system", "x86_64-linux")
]
)
$ indent < $(nix-instantiate hello.nix)
Derive ([("out", "/nix/store/6y0mzdarm5qxfafvn2zm9nr01d1j0a72-hello", "",
"")],
[("/nix/store/hcgwbx42mcxr7ksnv0i1fg7kw6jvxshb-bash-4.4-p19.drv",
["out"]),
("/nix/store/sfxh3ybqh97cgl4s59nrpi78kgcc8f3d-stdenv-linux.drv",
["out"])],
["/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh",
"/nix/store/svc70mmzrlgq42m9acs0prsmci7ksh6h-hello-2.10.tar.gz"],
"x86_64-linux",
"/nix/store/q1g0rl8zfmz7r371fp5p42p4acmv297d-bash-4.4-p19/bin/bash",
["-e",
"/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh"],
[("buildInputs", ""),
("builder",
"/nix/store/q1g0rl8zfmz7r371fp5p42p4acmv297d-bash-4.4-p19/bin/bash"),
("configureFlags", ""), ("depsBuildBuild", ""),
("depsBuildBuildPropagated", ""), ("depsBuildTarget", ""),
("depsBuildTargetPropagated", ""), ("depsHostBuild", ""),
("depsHostBuildPropagated", ""), ("depsTargetTarget", ""),
("depsTargetTargetPropagated", ""), ("name", "hello"),
("nativeBuildInputs", ""), ("out",
"/nix/store/6y0mzdarm5qxfafvn2zm9nr01d1j0a72-hello"),
("propagatedBuildInputs", ""), ("propagatedNativeBuildInputs", ""),
("src",
"/nix/store/svc70mmzrlgq42m9acs0prsmci7ksh6h-hello-2.10.tar.gz"),
("stdenv",
"/nix/store/6kz2vbh98s2r1pfshidkzhiy2s2qdw0a-stdenv-linux"),
("system", "x86_64-linux")])

View file

@ -1,5 +1,5 @@
$ nix-build hello.nix
...
/nix/store/6flbdbpq6sc1dc79xjx01bz43zwgj3wc-hello
/nix/store/6y0mzdarm5qxfafvn2zm9nr01d1j0a72-hello
$ result/bin/hello
Hello, world!