Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline nix-derivation (and PRs), extend #289

Draft
wants to merge 67 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
cab6459
Initial commit
Gabriella439 Jun 5, 2017
60439ee
Add property tests
Gabriella439 Jun 5, 2017
c035165
Update documentation
Gabriella439 Jun 5, 2017
8b12912
Add `README.md`
Gabriella439 Jun 5, 2017
c5cea2d
Fix typo in haddocks
Gabriella439 Jun 5, 2017
9821e1a
Change the `builder` field to a `String`
Gabriella439 Jun 7, 2017
8df67c7
Polish source code
Gabriella439 Jun 7, 2017
c178a6d
Add benchmark
Gabriella439 Jun 8, 2017
1e1830a
Add `shell.nix`
Oct 21, 2017
52270b7
Add `pretty-derivation` executable
Oct 21, 2017
ad19d04
Document `pretty-derivation` in the `README`
Oct 21, 2017
3b6ca71
Version 1.0.0 → 1.0.1
Oct 21, 2017
eea98e0
Fix `.cabal` file
Oct 21, 2017
a932ba4
Increase upper bounds on dependencies (#2)
Gabriella439 Nov 4, 2018
69cfd0e
Version 1.0.1 → 1.0.2 (#3)
Gabriella439 Nov 4, 2018
b108aa5
Higher order Derivation, filepath (#4)
sorki Apr 27, 2020
db6d461
Fix `shell.nix` (#6)
Gabriella439 Apr 27, 2020
7e335a4
Version 1.0.2 → 1.1.0 (#5)
Gabriella439 Apr 27, 2020
3f95b84
Delete references to release.nix from default.nix (#7)
sorki Apr 30, 2020
69fb26a
Add missing re-exports (#8)
sorki May 19, 2020
4fb51cf
Version 1.1.0 → 1.1.1 (#9)
Gabriella439 May 19, 2020
73e2ee5
Bump QuickCheck dep to < 2.15 (#10)
cdepillabout Jan 2, 2021
bd19633
GitHub Actions CI (#12)
sorki Mar 20, 2021
33acefc
Improve performance of `textParser` (#13)
Gabriella439 Mar 21, 2021
249bfc5
Add installation instructions to readme (#14)
RocketPuppy Mar 22, 2021
97c1fae
Build against `attoparsec-0.14` (#15)
Gabriella439 Mar 26, 2021
196a51f
Version 1.1.1 → 1.1.2 (#16)
Gabriella439 Mar 26, 2021
97ed33b
Allow text-2.0 (#17)
sjakobi Dec 30, 2021
216fc99
ci: Update versions (#19)
sorki Apr 22, 2022
4d22dd5
Build against `vector-0.13` (#20)
Gabriella439 Jul 2, 2022
7ace1d4
Support derivations with content-addressed outputs
rickynils Jul 23, 2022
a581bc1
Also update `vector` bound for test suite, too
Gabriella439 Jul 24, 2022
f4e9a41
Increase upper bound on `criterion` (#21)
Gabriella439 Sep 2, 2022
974d8f1
Fix deadname
Gabriella439 Sep 4, 2022
e1789cc
Fix deadname
Gabriella439 Sep 4, 2022
188155e
Fix deadname
Gabriella439 Sep 4, 2022
ac33b21
Bump bounds, update CI (#22)
sorki Nov 20, 2023
0165fd4
Version 1.1.2 → 1.1.3 (#23)
Gabriella439 Nov 20, 2023
1d97425
Add outputName and drvOutput type parameters to Derivation
sorki Dec 5, 2023
92dd4e7
Add drvInputs parameter to Derivation, DerivationInputs type
sorki Dec 5, 2023
25c9c15
Align nicely, return -> pure
sorki Dec 5, 2023
9d7cb76
hlint: drop unused RecordWildcards, use <$>
sorki Dec 5, 2023
cbc2572
Support derivations with content-addressed outputs
rickynils Dec 10, 2023
3f5b593
Build against `QuickCheck-2.15` (#27)
Gabriella439 Oct 5, 2024
7c06c33
Merge branch 'main' into pr-24
Ericson2314 Oct 30, 2024
2e10dfb
Merge branch 'main' into pr-26
Ericson2314 Oct 30, 2024
9c51ab0
Merge branch 'pr-24' into pr-26
Ericson2314 Oct 30, 2024
eacb5eb
Add 'nix-derivation/' from commit '9c51ab0d4500160035885ef85bbfce2169…
Ericson2314 Oct 31, 2024
ad1adfd
Complete build with new `nix-derivation`
Ericson2314 Oct 31, 2024
b76952d
Add support for dynamic derivations
Ericson2314 Oct 31, 2024
509fee9
Merge branch 'content-address-method-cleanup' into derivation-work
Ericson2314 Oct 31, 2024
c28fac2
Merge branch 'content-address-method-cleanup' into derivation-work
Ericson2314 Nov 1, 2024
4841894
Merge branch 'master' into content-address-method-cleanup
Ericson2314 Nov 4, 2024
a184f42
Merge branch 'content-address-method-cleanup' into derivation-work
Ericson2314 Nov 4, 2024
61dc135
Progress integrating the derivation type
Ericson2314 Nov 5, 2024
78d6ce7
Merge branch 'master' into derivation-work
Ericson2314 Nov 5, 2024
1ebff0d
WIP daemon protocol
Ericson2314 Nov 9, 2024
115af91
Progress on `hnix-core-aterm`
Ericson2314 Dec 25, 2024
e39462b
Everything builds but the ATerm tests
Ericson2314 Dec 25, 2024
16cf064
Import qualified post, derivation outputs in protocol
Ericson2314 Jan 1, 2025
a0f0a86
Get `hnix-store-aterm` tests building
Ericson2314 Jan 2, 2025
35017eb
Sort inputs in test file
Ericson2314 Jan 2, 2025
7b27443
Better errors for quick check test
Ericson2314 Jan 2, 2025
50a1cd6
Get `hnix-store-aterm` tests passing!
Ericson2314 Jan 2, 2025
9274e45
Make the main derivation representation better typed
Ericson2314 Jan 19, 2025
6a5639a
Fix mistake
Ericson2314 Jan 19, 2025
4ab6dbe
Rename Realisation's `DerivationOutput` to `BuildTraceKey`
Ericson2314 Jan 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ tests: true
benchmarks: true

packages:
./hnix-store-aterm/hnix-store-aterm.cabal
./hnix-store-core/hnix-store-core.cabal
./hnix-store-db/hnix-store-db.cabal
./hnix-store-json/hnix-store-json.cabal
Expand Down
3 changes: 3 additions & 0 deletions cabal.project.local.ci
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
package hnix-store-aterm
ghc-options: -Wunused-packages -Wall -Werror

package hnix-store-core
ghc-options: -Wunused-packages -Wall -Werror

Expand Down
1 change: 1 addition & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ let
haskellPackages = packageSet.override overrideHaskellPackages;
in {
inherit (haskellPackages)
hnix-store-aterm
hnix-store-core
hnix-store-db
hnix-store-json
Expand Down
24 changes: 24 additions & 0 deletions hnix-store-aterm/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Copyright (c) 2017 Gabriella Gonzalez
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Gabriella Gonzalez nor the names of other contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
218 changes: 218 additions & 0 deletions hnix-store-aterm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
# `hnix-store-aterm`

[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/Gabriella439/Haskell-Nix-Derivation-Library/ci.yaml?branch=main)](https://github.com/Gabriella439/Haskell-Nix-Derivation-Library/actions/workflows/ci.yaml)
[![Hackage version](https://img.shields.io/hackage/v/hnix-store-aterm.svg?color=success)](https://hackage.haskell.org/package/hnix-store-aterm)
[![Dependencies](https://img.shields.io/hackage-deps/v/hnix-store-aterm?label=Dependencies)](https://packdeps.haskellers.com/feed?needle=hnix-store-aterm)

Use this package to parse and render Nix derivations such as those stored
in `/nix/store/*.drv` files. For example, if you had the following derivation
saved at
`/nix/store/zzhs4fb83x5ygvjqn5rdpmpnishpdgy6-perl-MIME-Types-2.13.drv`:

```
Derive([("devdoc","/nix/store/15x9ii8c3n5wb5lg80cm8x0yk6zy7rha-perl-MIME-Types-2
.13-devdoc","",""),("out","/nix/store/93d75ghjyibmbxgfzwhh4b5zwsxzs44w-perl-MIME
-Types-2.13","","")],[("/nix/store/57h2hjsdkdiwbzilcjqkn46138n1xb4a-perl-5.22.3.
drv",["out"]),("/nix/store/cvdbbvnvg131bz9bwyyk97jpq1crclqr-MIME-Types-2.13.tar.
gz.drv",["out"]),("/nix/store/p5g31bc5x92awghx9dlm065d7j773l0r-stdenv.drv",["out
"]),("/nix/store/x50y5qihwsn0lfjhrf1s81b5hgb9w632-bash-4.4-p5.drv",["out"])],["/
nix/store/cdips4lakfk1qbf1x68fq18wnn3r5r14-builder.sh"],"x86_64-linux","/nix/sto
re/fi3mbd2ml4pbgzyasrlnp0wyy6qi48fh-bash-4.4-p5/bin/bash",["-e","/nix/store/cdip
s4lakfk1qbf1x68fq18wnn3r5r14-builder.sh"],[("AUTOMATED_TESTING","1"),("PERL_AUTO
INSTALL","--skipdeps"),("buildInputs",""),("builder","/nix/store/fi3mbd2ml4pbgzy
asrlnp0wyy6qi48fh-bash-4.4-p5/bin/bash"),("checkTarget","test"),("devdoc","/nix/
store/15x9ii8c3n5wb5lg80cm8x0yk6zy7rha-perl-MIME-Types-2.13-devdoc"),("doCheck",
"1"),("installTargets","pure_install"),("name","perl-MIME-Types-2.13"),("nativeB
uildInputs","/nix/store/nsa311yg8h93wfaacjk16c96a98bs09f-perl-5.22.3"),("out","/
nix/store/93d75ghjyibmbxgfzwhh4b5zwsxzs44w-perl-MIME-Types-2.13"),("outputs","ou
t devdoc"),("propagatedBuildInputs",""),("propagatedNativeBuildInputs",""),("src
","/nix/store/5smhymz7viq8p47mc3jgyvqd003ab732-MIME-Types-2.13.tar.gz"),("stdenv
","/nix/store/s3rlr45jzlzx0d6k2azlpxa5zwzr7xyy-stdenv"),("system","x86_64-linux"
)])
```

... you could parse that derivation using:

```
>>> text <- Data.Text.Lazy.IO.readFile "/nix/store/zzhs4fb83x5ygvjqn5rdpmpnishpdgy6-perl-MIME-Types-2.13.drv"
>>> let result = Data.Attoparsec.Text.Lazy.parse System.Nix.Derivation.ATerm.parseDerivation text
>>> result
Done "" (Derivation {outputs = fromList [("devdoc",DerivationOutput {path = File
Path "/nix/store/15x9ii8c3n5wb5lg80cm8x0yk6zy7rha-perl-MIME-Types-2.13-devdoc",
hashAlgo = "", hash = ""}),("out",DerivationOutput {path = FilePath "/nix/store/
93d75ghjyibmbxgfzwhh4b5zwsxzs44w-perl-MIME-Types-2.13", hashAlgo = "", hash = ""
})], inputDrvs = fromList [(FilePath "/nix/store/57h2hjsdkdiwbzilcjqkn46138n1xb4
a-perl-5.22.3.drv",fromList ["out"]),(FilePath "/nix/store/cvdbbvnvg131bz9bwyyk9
7jpq1crclqr-MIME-Types-2.13.tar.gz.drv",fromList ["out"]),(FilePath "/nix/store/
p5g31bc5x92awghx9dlm065d7j773l0r-stdenv.drv",fromList ["out"]),(FilePath "/nix/s
tore/x50y5qihwsn0lfjhrf1s81b5hgb9w632-bash-4.4-p5.drv",fromList ["out"])], input
Srcs = fromList [FilePath "/nix/store/cdips4lakfk1qbf1x68fq18wnn3r5r14-builder.s
h"], platform = "x86_64-linux", builder = FilePath "/nix/store/fi3mbd2ml4pbgzyas
rlnp0wyy6qi48fh-bash-4.4-p5/bin/bash", args = ["-e","/nix/store/cdips4lakfk1qbf1
x68fq18wnn3r5r14-builder.sh"], env = fromList [("AUTOMATED_TESTING","1"),("PERL_
AUTOINSTALL","--skipdeps"),("buildInputs",""),("builder","/nix/store/fi3mbd2ml4p
bgzyasrlnp0wyy6qi48fh-bash-4.4-p5/bin/bash"),("checkTarget","test"),("devdoc","/
nix/store/15x9ii8c3n5wb5lg80cm8x0yk6zy7rha-perl-MIME-Types-2.13-devdoc"),("doChe
ck","1"),("installTargets","pure_install"),("name","perl-MIME-Types-2.13"),("nat
iveBuildInputs","/nix/store/nsa311yg8h93wfaacjk16c96a98bs09f-perl-5.22.3"),("out
","/nix/store/93d75ghjyibmbxgfzwhh4b5zwsxzs44w-perl-MIME-Types-2.13"),("outputs"
,"out devdoc"),("propagatedBuildInputs",""),("propagatedNativeBuildInputs",""),(
"src","/nix/store/5smhymz7viq8p47mc3jgyvqd003ab732-MIME-Types-2.13.tar.gz"),("st
denv","/nix/store/s3rlr45jzlzx0d6k2azlpxa5zwzr7xyy-stdenv"),("system","x86_64-li
nux")]})
```

... and render the result back to the original derivation:

```
>>> fmap buildDerivation result
Done "" "Derive([(\"devdoc\",\"/nix/store/15x9ii8c3n5wb5lg80cm8x0yk6zy7rha-perl-
MIME-Types-2.13-devdoc\",\"\",\"\"),(\"out\",\"/nix/store/93d75ghjyibmbxgfzwhh4b
5zwsxzs44w-perl-MIME-Types-2.13\",\"\",\"\")],[(\"/nix/store/57h2hjsdkdiwbzilcjq
kn46138n1xb4a-perl-5.22.3.drv\",[\"out\"]),(\"/nix/store/cvdbbvnvg131bz9bwyyk97j
pq1crclqr-MIME-Types-2.13.tar.gz.drv\",[\"out\"]),(\"/nix/store/p5g31bc5x92awghx
9dlm065d7j773l0r-stdenv.drv\",[\"out\"]),(\"/nix/store/x50y5qihwsn0lfjhrf1s81b5h
gb9w632-bash-4.4-p5.drv\",[\"out\"])],[\"/nix/store/cdips4lakfk1qbf1x68fq18wnn3r
5r14-builder.sh\"],\"x86_64-linux\",\"/nix/store/fi3mbd2ml4pbgzyasrlnp0wyy6qi48f
h-bash-4.4-p5/bin/bash\",[\"-e\",\"/nix/store/cdips4lakfk1qbf1x68fq18wnn3r5r14-b
uilder.sh\"],[(\"AUTOMATED_TESTING\",\"1\"),(\"PERL_AUTOINSTALL\",\"--skipdeps\"
),(\"buildInputs\",\"\"),(\"builder\",\"/nix/store/fi3mbd2ml4pbgzyasrlnp0wyy6qi4
8fh-bash-4.4-p5/bin/bash\"),(\"checkTarget\",\"test\"),(\"devdoc\",\"/nix/store/
15x9ii8c3n5wb5lg80cm8x0yk6zy7rha-perl-MIME-Types-2.13-devdoc\"),(\"doCheck\",\"1
\"),(\"installTargets\",\"pure_install\"),(\"name\",\"perl-MIME-Types-2.13\"),(\
"nativeBuildInputs\",\"/nix/store/nsa311yg8h93wfaacjk16c96a98bs09f-perl-5.22.3\"
),(\"out\",\"/nix/store/93d75ghjyibmbxgfzwhh4b5zwsxzs44w-perl-MIME-Types-2.13\")
,(\"outputs\",\"out devdoc\"),(\"propagatedBuildInputs\",\"\"),(\"propagatedNati
veBuildInputs\",\"\"),(\"src\",\"/nix/store/5smhymz7viq8p47mc3jgyvqd003ab732-MIM
E-Types-2.13.tar.gz\"),(\"stdenv\",\"/nix/store/s3rlr45jzlzx0d6k2azlpxa5zwzr7xyy
-stdenv\"),(\"system\",\"x86_64-linux\")])"
```

You can also use the `pretty-derivation` executable installed as part of this
package to pretty-print the Haskell representation of a Nix derivations:

```shell
$ pretty-derivation < /nix/store/0008hdcdvkrr5mcqahy416hv6rmb5fwg-void-0.7.1.tar.gz.drv
Derivation
{ outputs =
fromList
[ ( "out"
, DerivationOutput
{ path =
FilePath
"/nix/store/fbbqa4x05q9x0w6s1fqmx7k676d2zyz1-void-0.7.1.tar.gz"
, hashAlgo = "sha256"
, hash =
"c9f0fd93680c029abb9654b5464be260652829961b18b7046f96a0df95e825f4"
}
)
]
, inputDrvs =
fromList
[ ( FilePath
"/nix/store/cwnn2alfww3six2ywph5hnnlmxwhv9c7-curl-7.52.1.drv"
, fromList [ "dev" ]
)
, ( FilePath
"/nix/store/kzs0g1ch3a59ar14xnms1wj22p2bnr9l-stdenv.drv"
, fromList [ "out" ]
)
, ( FilePath
"/nix/store/qq7pqyfn98314fd30xspb1hi3rqda2lh-bash-4.3-p48.drv"
, fromList [ "out" ]
)
, ( FilePath
"/nix/store/r1b0rbna957biiy63m75yxsw3aphps9b-mirrors-list.drv"
, fromList [ "out" ]
)
]
, inputSrcs =
fromList
[ FilePath "/nix/store/5pqfb6ik1cxqq1d0irlx3060jx1qjmsn-builder.sh"
]
, platform = "x86_64-linux"
, builder =
"/nix/store/gabjbkwga2dhhp2wzyaxl83r8hjjfc37-bash-4.3-p48/bin/bash"
, args =
[ "-e" , "/nix/store/5pqfb6ik1cxqq1d0irlx3060jx1qjmsn-builder.sh" ]
, env =
fromList
[ ( "buildInputs" , "" )
, ( "builder"
, "/nix/store/gabjbkwga2dhhp2wzyaxl83r8hjjfc37-bash-4.3-p48/bin/bash"
)
, ( "curlOpts" , "" )
, ( "downloadToTemp" , "" )
, ( "executable" , "" )
, ( "impureEnvVars"
, "http_proxy https_proxy ftp_proxy all_proxy no_proxy NIX_CURL_FLAGS NIX_HASHED_MIRRORS NIX_CONNECT_TIMEOUT NIX_MIRRORS_apache NIX_MIRRORS_bioc NIX_MIRRORS_bitlbee NIX_MIRRORS_cpan NIX_MIRRORS_debian NIX_MIRRORS_fedora NIX_MIRRORS_gcc NIX_MIRRORS_gentoo NIX_MIRRORS_gnome NIX_MIRRORS_gnu NIX_MIRRORS_gnupg NIX_MIRRORS_hackage NIX_MIRRORS_hashedMirrors NIX_MIRRORS_imagemagick NIX_MIRRORS_kde NIX_MIRRORS_kernel NIX_MIRRORS_metalab NIX_MIRRORS_mozilla NIX_MIRRORS_mysql NIX_MIRRORS_oldsuse NIX_MIRRORS_openbsd NIX_MIRRORS_opensuse NIX_MIRRORS_postgresql NIX_MIRRORS_pypi NIX_MIRRORS_roy NIX_MIRRORS_sagemath NIX_MIRRORS_samba NIX_MIRRORS_savannah NIX_MIRRORS_sourceforge NIX_MIRRORS_sourceforgejp NIX_MIRRORS_steamrt NIX_MIRRORS_ubuntu NIX_MIRRORS_xfce NIX_MIRRORS_xorg"
)
, ( "mirrorsFile"
, "/nix/store/ab4zh0ga99y5xj441arp89zl8s4jfc7y-mirrors-list"
)
, ( "name" , "void-0.7.1.tar.gz" )
, ( "nativeBuildInputs"
, "/nix/store/3ngwsbzhibvc434nqwq6jph6w7c2was6-curl-7.52.1-dev"
)
, ( "out"
, "/nix/store/fbbqa4x05q9x0w6s1fqmx7k676d2zyz1-void-0.7.1.tar.gz"
)
, ( "outputHash"
, "c9f0fd93680c029abb9654b5464be260652829961b18b7046f96a0df95e825f4"
)
, ( "outputHashAlgo" , "sha256" )
, ( "outputHashMode" , "flat" )
, ( "postFetch" , "" )
, ( "preferHashedMirrors" , "1" )
, ( "preferLocalBuild" , "1" )
, ( "propagatedBuildInputs" , "" )
, ( "propagatedNativeBuildInputs" , "" )
, ( "showURLs" , "" )
, ( "stdenv"
, "/nix/store/985d95clq0216a6pcp3qzw4igp84ajvr-stdenv"
)
, ( "system" , "x86_64-linux" )
, ( "urls" , "mirror://hackage/void-0.7.1.tar.gz" )
]
}
```

## Installation

With Nix:

```
$ nix-env -iA nixpkgs.haskellPackages.hnix-store-aterm
```

## Development status

If you would like to add support for additional functionality, just open an
issue or pull request

## License (BSD 3-clause)

Copyright (c) 2017 Gabriella Gonzalez
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Gabriella Gonzalez nor the names of other contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2 changes: 2 additions & 0 deletions hnix-store-aterm/Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain
28 changes: 28 additions & 0 deletions hnix-store-aterm/bench/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{-# LANGUAGE OverloadedStrings #-}
import Criterion (Benchmark)

import Criterion qualified
import Criterion.Main qualified
import Data.Attoparsec.Text.Lazy qualified
import Data.Text.Lazy.IO qualified

import System.Nix.StorePath
import System.Nix.Derivation.ATerm qualified

main :: IO ()
main = Criterion.Main.defaultMain benchmarks

benchmarks :: [Benchmark]
benchmarks =
[ Criterion.Main.env
(Data.Text.Lazy.IO.readFile "tests/example1.drv")
bench0
]
where
bench0 example =
Criterion.bench "example" (Criterion.nf parseExample example)

parseExample =
Data.Attoparsec.Text.Lazy.parse $
System.Nix.Derivation.ATerm.parseTraditionalDerivation
(StoreDir "/nix/store")
Loading
Loading