Repository: jwiegley/hnix Branch: master Commit: b2ac3b41a360 Files: 404 Total size: 1.6 MB Directory structure: gitextract_q_z2xg1p/ ├── .fourmolu.yaml ├── .github/ │ ├── dependabot.yml │ └── workflows/ │ ├── Cabal-Linux.yml │ ├── HLint.yml │ ├── On-Release-Cabal-Linux.yml │ ├── On-Release-Nixpkgs-integration.yml │ └── Quality.yml ├── .gitignore ├── .gitmodules ├── .hlint.yaml ├── CLAUDE.md ├── CODEOWNERS ├── ChangeLog.md ├── LICENSE.md ├── License ├── Makefile ├── ReadMe.md ├── benchmarks/ │ ├── Main.hs │ └── ParserBench.hs ├── brittany.yaml ├── build.sh ├── cabal.project ├── data/ │ ├── let-comments-multiline.nix │ ├── let-comments.nix │ ├── let.nix │ ├── nix/ │ │ ├── README.md │ │ └── tests/ │ │ └── lang/ │ │ ├── binary-data │ │ ├── data │ │ ├── dir1/ │ │ │ └── a.nix │ │ ├── dir2/ │ │ │ ├── a.nix │ │ │ └── b.nix │ │ ├── dir3/ │ │ │ ├── a.nix │ │ │ ├── b.nix │ │ │ └── c.nix │ │ ├── dir4/ │ │ │ ├── a.nix │ │ │ └── c.nix │ │ ├── eval-fail-abort.nix │ │ ├── eval-fail-assert.nix │ │ ├── eval-fail-bad-antiquote-1.nix │ │ ├── eval-fail-bad-antiquote-2.nix │ │ ├── eval-fail-bad-antiquote-3.nix │ │ ├── eval-fail-blackhole.nix │ │ ├── eval-fail-deepseq.nix │ │ ├── eval-fail-hashfile-missing.nix │ │ ├── eval-fail-missing-arg.nix │ │ ├── eval-fail-nonexist-path.nix │ │ ├── eval-fail-path-slash.nix │ │ ├── eval-fail-remove.nix │ │ ├── eval-fail-scope-5.nix │ │ ├── eval-fail-seq.nix │ │ ├── eval-fail-substring.nix │ │ ├── eval-fail-to-path.nix │ │ ├── eval-fail-undeclared-arg.nix │ │ ├── eval-okay-any-all.exp │ │ ├── eval-okay-any-all.nix │ │ ├── eval-okay-arithmetic.exp │ │ ├── eval-okay-arithmetic.nix │ │ ├── eval-okay-attrnames.exp │ │ ├── eval-okay-attrnames.nix │ │ ├── eval-okay-attrs.exp │ │ ├── eval-okay-attrs.nix │ │ ├── eval-okay-attrs2.exp │ │ ├── eval-okay-attrs2.nix │ │ ├── eval-okay-attrs3.exp │ │ ├── eval-okay-attrs3.nix │ │ ├── eval-okay-attrs4.exp │ │ ├── eval-okay-attrs4.nix │ │ ├── eval-okay-attrs5.exp │ │ ├── eval-okay-attrs5.nix │ │ ├── eval-okay-attrs6.exp │ │ ├── eval-okay-attrs6.nix │ │ ├── eval-okay-autoargs.exp │ │ ├── eval-okay-autoargs.flags │ │ ├── eval-okay-autoargs.nix │ │ ├── eval-okay-backslash-newline-1.exp │ │ ├── eval-okay-backslash-newline-1.nix │ │ ├── eval-okay-backslash-newline-2.exp │ │ ├── eval-okay-backslash-newline-2.nix │ │ ├── eval-okay-builtins-add.exp │ │ ├── eval-okay-builtins-add.nix │ │ ├── eval-okay-builtins.exp │ │ ├── eval-okay-builtins.nix │ │ ├── eval-okay-callable-attrs.exp │ │ ├── eval-okay-callable-attrs.nix │ │ ├── eval-okay-catattrs.exp │ │ ├── eval-okay-catattrs.nix │ │ ├── eval-okay-closure.exp.xml │ │ ├── eval-okay-closure.nix │ │ ├── eval-okay-comments.exp │ │ ├── eval-okay-comments.nix │ │ ├── eval-okay-concat.exp │ │ ├── eval-okay-concat.nix │ │ ├── eval-okay-concatmap.exp │ │ ├── eval-okay-concatmap.nix │ │ ├── eval-okay-concatstringssep.exp │ │ ├── eval-okay-concatstringssep.nix │ │ ├── eval-okay-context-introspection.exp │ │ ├── eval-okay-context-introspection.nix │ │ ├── eval-okay-context.exp │ │ ├── eval-okay-context.nix │ │ ├── eval-okay-curpos.exp │ │ ├── eval-okay-curpos.nix │ │ ├── eval-okay-deepseq.exp │ │ ├── eval-okay-deepseq.nix │ │ ├── eval-okay-delayed-with-inherit.exp │ │ ├── eval-okay-delayed-with-inherit.nix │ │ ├── eval-okay-delayed-with.exp │ │ ├── eval-okay-delayed-with.nix │ │ ├── eval-okay-dynamic-attrs-2.exp │ │ ├── eval-okay-dynamic-attrs-2.nix │ │ ├── eval-okay-dynamic-attrs-bare.exp │ │ ├── eval-okay-dynamic-attrs-bare.nix │ │ ├── eval-okay-dynamic-attrs.exp │ │ ├── eval-okay-dynamic-attrs.nix │ │ ├── eval-okay-elem.exp │ │ ├── eval-okay-elem.nix │ │ ├── eval-okay-empty-args.exp │ │ ├── eval-okay-empty-args.nix │ │ ├── eval-okay-eq-derivations.exp │ │ ├── eval-okay-eq-derivations.nix │ │ ├── eval-okay-eq.exp.disabled │ │ ├── eval-okay-eq.nix │ │ ├── eval-okay-filter.exp │ │ ├── eval-okay-filter.nix │ │ ├── eval-okay-flatten.exp │ │ ├── eval-okay-flatten.nix │ │ ├── eval-okay-float.exp │ │ ├── eval-okay-float.nix │ │ ├── eval-okay-floor-ceil.exp │ │ ├── eval-okay-floor-ceil.nix │ │ ├── eval-okay-foldlStrict.exp │ │ ├── eval-okay-foldlStrict.nix │ │ ├── eval-okay-fromTOML.exp │ │ ├── eval-okay-fromTOML.nix │ │ ├── eval-okay-fromjson-escapes.exp │ │ ├── eval-okay-fromjson-escapes.nix │ │ ├── eval-okay-fromjson.exp │ │ ├── eval-okay-fromjson.nix │ │ ├── eval-okay-functionargs.exp.xml │ │ ├── eval-okay-functionargs.nix │ │ ├── eval-okay-getattrpos-functionargs.exp │ │ ├── eval-okay-getattrpos-functionargs.nix │ │ ├── eval-okay-getattrpos-undefined.exp │ │ ├── eval-okay-getattrpos-undefined.nix │ │ ├── eval-okay-getattrpos.exp │ │ ├── eval-okay-getattrpos.nix │ │ ├── eval-okay-getenv.exp │ │ ├── eval-okay-getenv.nix │ │ ├── eval-okay-hash.exp │ │ ├── eval-okay-hashfile.exp │ │ ├── eval-okay-hashfile.nix │ │ ├── eval-okay-hashstring.exp │ │ ├── eval-okay-hashstring.nix │ │ ├── eval-okay-if.exp │ │ ├── eval-okay-if.nix │ │ ├── eval-okay-import.exp │ │ ├── eval-okay-import.nix │ │ ├── eval-okay-ind-string.exp │ │ ├── eval-okay-ind-string.nix │ │ ├── eval-okay-let.exp │ │ ├── eval-okay-let.nix │ │ ├── eval-okay-list.exp │ │ ├── eval-okay-list.nix │ │ ├── eval-okay-listtoattrs.exp │ │ ├── eval-okay-listtoattrs.nix │ │ ├── eval-okay-logic.exp │ │ ├── eval-okay-logic.nix │ │ ├── eval-okay-map.exp │ │ ├── eval-okay-map.nix │ │ ├── eval-okay-mapattrs.exp │ │ ├── eval-okay-mapattrs.nix │ │ ├── eval-okay-nested-with.exp │ │ ├── eval-okay-nested-with.nix │ │ ├── eval-okay-new-let.exp │ │ ├── eval-okay-new-let.nix │ │ ├── eval-okay-null-dynamic-attrs.exp │ │ ├── eval-okay-null-dynamic-attrs.nix │ │ ├── eval-okay-overrides.exp │ │ ├── eval-okay-overrides.nix │ │ ├── eval-okay-partition.exp │ │ ├── eval-okay-partition.nix │ │ ├── eval-okay-path-antiquotation.nix │ │ ├── eval-okay-path.nix │ │ ├── eval-okay-pathexists.exp │ │ ├── eval-okay-pathexists.nix │ │ ├── eval-okay-patterns.exp │ │ ├── eval-okay-patterns.nix │ │ ├── eval-okay-readDir.exp │ │ ├── eval-okay-readDir.nix │ │ ├── eval-okay-readfile.exp │ │ ├── eval-okay-readfile.nix │ │ ├── eval-okay-redefine-builtin.exp │ │ ├── eval-okay-redefine-builtin.nix │ │ ├── eval-okay-regex-match.exp │ │ ├── eval-okay-regex-match.nix │ │ ├── eval-okay-regex-split.exp │ │ ├── eval-okay-regex-split.nix │ │ ├── eval-okay-remove.exp │ │ ├── eval-okay-remove.nix │ │ ├── eval-okay-replacestrings.exp │ │ ├── eval-okay-replacestrings.nix │ │ ├── eval-okay-scope-1.exp │ │ ├── eval-okay-scope-1.nix │ │ ├── eval-okay-scope-2.exp │ │ ├── eval-okay-scope-2.nix │ │ ├── eval-okay-scope-3.exp │ │ ├── eval-okay-scope-3.nix │ │ ├── eval-okay-scope-4.exp │ │ ├── eval-okay-scope-4.nix │ │ ├── eval-okay-scope-6.exp │ │ ├── eval-okay-scope-6.nix │ │ ├── eval-okay-scope-7.exp │ │ ├── eval-okay-scope-7.nix │ │ ├── eval-okay-search-path.exp │ │ ├── eval-okay-search-path.flags │ │ ├── eval-okay-search-path.nix │ │ ├── eval-okay-seq.exp │ │ ├── eval-okay-seq.nix │ │ ├── eval-okay-sort.exp │ │ ├── eval-okay-sort.nix │ │ ├── eval-okay-splitversion.exp │ │ ├── eval-okay-splitversion.nix │ │ ├── eval-okay-string.exp │ │ ├── eval-okay-string.nix │ │ ├── eval-okay-strings-as-attrs-names.exp │ │ ├── eval-okay-strings-as-attrs-names.nix │ │ ├── eval-okay-substring.exp │ │ ├── eval-okay-substring.nix │ │ ├── eval-okay-tail-call-1.exp-disabled │ │ ├── eval-okay-tail-call-1.nix │ │ ├── eval-okay-tojson.exp │ │ ├── eval-okay-tojson.nix │ │ ├── eval-okay-toxml.exp │ │ ├── eval-okay-toxml.nix │ │ ├── eval-okay-toxml2.exp │ │ ├── eval-okay-toxml2.nix │ │ ├── eval-okay-tryeval.exp │ │ ├── eval-okay-tryeval.nix │ │ ├── eval-okay-types.exp │ │ ├── eval-okay-types.nix │ │ ├── eval-okay-versions.exp │ │ ├── eval-okay-versions.nix │ │ ├── eval-okay-with.exp │ │ ├── eval-okay-with.nix │ │ ├── eval-okay-xml.exp.xml │ │ ├── eval-okay-xml.nix │ │ ├── imported.nix │ │ ├── imported2.nix │ │ ├── lib.nix │ │ ├── parse-fail-dup-attrs-1.nix │ │ ├── parse-fail-dup-attrs-2.nix │ │ ├── parse-fail-dup-attrs-3.nix │ │ ├── parse-fail-dup-attrs-4.nix │ │ ├── parse-fail-dup-attrs-7.nix │ │ ├── parse-fail-dup-formals.nix │ │ ├── parse-fail-mixed-nested-attrs1.nix │ │ ├── parse-fail-mixed-nested-attrs2.nix │ │ ├── parse-fail-patterns-1.nix │ │ ├── parse-fail-regression-20060610.nix │ │ ├── parse-fail-uft8.nix │ │ ├── parse-fail-undef-var-2.nix │ │ ├── parse-fail-undef-var.nix │ │ ├── parse-okay-1.nix │ │ ├── parse-okay-crlf.nix │ │ ├── parse-okay-dup-attrs-5.nix │ │ ├── parse-okay-dup-attrs-6.nix │ │ ├── parse-okay-mixed-nested-attrs-1.nix │ │ ├── parse-okay-mixed-nested-attrs-2.nix │ │ ├── parse-okay-mixed-nested-attrs-3.nix │ │ ├── parse-okay-regression-20041027.nix │ │ ├── parse-okay-regression-751.nix │ │ ├── parse-okay-subversion.nix │ │ ├── parse-okay-url.nix │ │ └── readDir/ │ │ ├── bar │ │ └── foo/ │ │ └── git-hates-directories │ ├── nixpkgs-all-packages-pretty.nix │ ├── nixpkgs-all-packages.nix │ ├── simple-pretty.nix │ └── simple.nix ├── default.nix ├── doc/ │ ├── grammar.y │ └── lexer.l ├── flake.nix ├── hnix.cabal ├── hydra.json ├── jobsets.nix ├── lefthook.yml ├── main/ │ ├── Main.hs │ └── Repl.hs ├── release.nix ├── shell.nix ├── src/ │ ├── Nix/ │ │ ├── Atoms.hs │ │ ├── Builtins.hs │ │ ├── Cache.hs │ │ ├── Cited/ │ │ │ └── Basic.hs │ │ ├── Cited.hs │ │ ├── Context.hs │ │ ├── Convert.hs │ │ ├── Effects/ │ │ │ ├── Basic.hs │ │ │ └── Derivation.hs │ │ ├── Effects.hs │ │ ├── Eval.hs │ │ ├── Exec.hs │ │ ├── Expr/ │ │ │ ├── Shorthands.hs │ │ │ ├── Strings.hs │ │ │ ├── Types/ │ │ │ │ └── Annotated.hs │ │ │ └── Types.hs │ │ ├── Expr.hs │ │ ├── Frames.hs │ │ ├── Fresh/ │ │ │ └── Basic.hs │ │ ├── Fresh.hs │ │ ├── Json.hs │ │ ├── Lint.hs │ │ ├── Normal.hs │ │ ├── Options/ │ │ │ └── Parser.hs │ │ ├── Options.hs │ │ ├── Parser.hs │ │ ├── Prelude.hs │ │ ├── Pretty.hs │ │ ├── Reduce.hs │ │ ├── Render/ │ │ │ └── Frame.hs │ │ ├── Render.hs │ │ ├── Scope.hs │ │ ├── Standard.hs │ │ ├── String/ │ │ │ └── Coerce.hs │ │ ├── String.hs │ │ ├── TH.hs │ │ ├── Thunk/ │ │ │ └── Basic.hs │ │ ├── Thunk.hs │ │ ├── Type/ │ │ │ ├── Assumption.hs │ │ │ ├── Env.hs │ │ │ ├── Infer.hs │ │ │ ├── LICENSE │ │ │ └── Type.hs │ │ ├── Unused.hs │ │ ├── Utils/ │ │ │ └── Fix1.hs │ │ ├── Utils.hs │ │ ├── Value/ │ │ │ ├── Equal.hs │ │ │ └── Monad.hs │ │ ├── Value.hs │ │ ├── Var.hs │ │ └── XML.hs │ └── Nix.hs └── tests/ ├── EvalTests.hs ├── Main.hs ├── NixLanguageTests.hs ├── ParserTests.hs ├── PrettyParseTests.hs ├── PrettyTests.hs ├── ReduceExprTests.hs ├── TestCommon.hs ├── eval-compare/ │ ├── builtins.appendContext.nix │ ├── builtins.eq-bottom-00.nix │ ├── builtins.fetchurl-01.nix │ ├── builtins.fromJSON-01.nix │ ├── builtins.getContext.nix │ ├── builtins.lessThan-01.nix │ ├── builtins.mapAttrs-01.nix │ ├── builtins.pathExists.nix │ ├── builtins.replaceStrings-01.nix │ ├── builtins.split-01.nix │ ├── builtins.split-02.nix │ ├── builtins.split-03.nix │ ├── builtins.split-04.nix │ ├── builtins.string.store.nix │ ├── builtins.toJSON.nix │ ├── current-system.nix │ ├── ellipsis.nix │ ├── ind-string-01.nix │ ├── ind-string-02.nix │ ├── ind-string-03.nix │ ├── ind-string-04.nix │ ├── ind-string-05.nix │ ├── ind-string-06.nix │ ├── ind-string-07.nix │ ├── ind-string-08.nix │ ├── ind-string-09.nix │ ├── ind-string-10.nix │ ├── ind-string-11.nix │ ├── ind-string-12.nix │ ├── ind-string-13.nix │ ├── ind-string-14.nix │ ├── ind-string-15.nix │ ├── ind-string-16.nix │ ├── ind-string-17.nix │ ├── ind-string-18.nix │ ├── ind-string-19.nix │ ├── paths-01.nix │ └── placeholder.nix └── files/ ├── attrs.nix ├── callLibs.nix ├── eighty.nix ├── file.nix ├── file2.nix ├── findFile.nix ├── force.nix ├── goodbye.nix ├── hello.nix ├── hello2.nix ├── if-then.nix ├── lint.nix ├── loop.nix ├── test.nix └── with.nix ================================================ FILE CONTENTS ================================================ ================================================ FILE: .fourmolu.yaml ================================================ indentation: 2 column-limit: none function-arrows: trailing comma-style: leading import-export-style: diff-friendly indent-wheres: false record-brace-space: false newlines-between-decls: 1 haddock-style: multi-line let-style: auto in-style: right-align single-constraint-parens: auto unicode: never respectful: true ================================================ FILE: .github/dependabot.yml ================================================ version: 2 updates: # Maintain dependencies for GitHub Actions - package-ecosystem: "github-actions" directory: "/" schedule: interval: "daily" ================================================ FILE: .github/workflows/Cabal-Linux.yml ================================================ name: "Hackage, Cabal, Linux" on: pull_request: push: branches: - master schedule: - cron: "45 02 * * *" env: cabalConfig: --enable-tests --enable-benchmarks --disable-optimization --enable-deterministic jobs: build10: name: "GHC" runs-on: ubuntu-latest strategy: fail-fast: false matrix: ghc: [ "9.10" ] steps: - name: "Git checkout" uses: actions/checkout@v4 with: submodules: recursive - name: "Haskell env setup" id: HaskEnvSetup uses: haskell-actions/setup@v2 with: ghc-version: ${{ matrix.ghc }} - name: "Install additional system packages" run: sudo apt install libsodium-dev # 2020-08-01: NOTE: Nix instantiate still needed for HNix tests - name: "Install Nix" uses: cachix/install-nix-action@v25 - name: "Repository update" run: cabal v2-update # Freeze is for the caching - name: "Configuration freeze" run: cabal v2-freeze $cabalConfig --minimize-conflict-set - name: "Configuring GitHub cache" uses: actions/cache@v3 with: path: | ${{ steps.HaskEnvSetup.outputs.cabal-store }} dist-newstyle key: ${{ runner.os }}-Cabal-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} # 2022-04-22: `v2-` added to invalidate corrupted caches, can be removed after one week restore-keys: ${{ runner.os }}-Cabal-${{ matrix.ghc }}-v2- - name: "Build" run: cabal v2-build $cabalConfig - name: "Tests" run: cabal v2-test $cabalConfig - name: "Haddock" if: ${{ matrix.ghc == '9.0' }} run: cabal v2-haddock $cabalConfig - name: "Source distribution file" if: ${{ matrix.ghc == '9.0' }} run: cabal v2-sdist ================================================ FILE: .github/workflows/HLint.yml ================================================ name: "Checking code" on: pull_request: push: branches: - master jobs: build10: name: "HLint" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: 'Installing' uses: haskell-actions/hlint-setup@v2 with: version: '3.5' - name: 'Checking code' uses: haskell-actions/hlint-run@v2 with: path: . fail-on: warning ================================================ FILE: .github/workflows/On-Release-Cabal-Linux.yml ================================================ name: "Release testing, Hackage, Cabal, Linux" on: release: # created: a draft is saved, or a release or pre-release is published without previously being saved as a draft types: [ created ] env: cabalConfig: --enable-tests --enable-benchmarks --disable-optimization --enable-deterministic jobs: build10: name: "GHC" runs-on: ubuntu-latest strategy: matrix: ghc: [ "9.10" ] steps: - name: "Git checkout" uses: actions/checkout@v4 with: submodules: recursive - name: "Haskell env setup" id: HaskEnvSetup uses: haskell-actions/setup@v2 with: ghc-version: ${{ matrix.ghc }} - name: "Install additional system packages" run: sudo apt install libsodium-dev # 2020-08-01: NOTE: Nix instantiate still needed for HNix tests - name: "Install Nix" uses: cachix/install-nix-action@v25 - name: "Repository update" run: cabal v2-update # NOTE: Freeze is for the caching - name: "Configuration freeze" run: cabal v2-freeze $cabalConfig - name: "Configuring GitHub cache" uses: actions/cache@v3 with: path: | ${{ steps.HaskEnvSetup.outputs.cabal-store }} dist-newstyle key: ${{ runner.os }}-Cabal-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} # 2022-04-22: `v2-` added to invalidate corrupted caches, can be removed after one week restore-keys: ${{ runner.os }}-Cabal-${{ matrix.ghc }}-v2- - name: "Build" run: cabal v2-build $cabalConfig - name: "Tests" run: cabal v2-test $cabalConfig ================================================ FILE: .github/workflows/On-Release-Nixpkgs-integration.yml ================================================ name: "Direct import & build inside Nixpkgs" on: release: # created: a draft is saved, or a release or pre-release is published without previously being saved as a draft types: [ created ] jobs: build10: name: "Clean integration test" runs-on: ubuntu-latest steps: - name: "Git checkout" uses: actions/checkout@v4 - name: "Local cache" uses: actions/cache@v3 with: path: | /nix/store key: ${{ runner.os }}-Nixpkgs-integration-test - name: "Install Nix" uses: cachix/install-nix-action@v25 with: nix_path: "nixpkgs=channel:nixos-unstable" - name: "Run Nixpkgs integration test" uses: Anton-Latukha/test-haskell-nixpkgs-integration-action@v1 ================================================ FILE: .github/workflows/Quality.yml ================================================ name: "Quality checks" on: pull_request: push: branches: - master jobs: formatting: name: "Formatting (fourmolu)" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: cachix/install-nix-action@v25 with: extra_nix_config: | accept-flake-config = true - name: "Check Haskell formatting" run: nix build .#checks.x86_64-linux.formatting --print-build-logs - name: "Check shell script formatting" run: nix build .#checks.x86_64-linux.shell-formatting --print-build-logs shellcheck: name: "ShellCheck" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: cachix/install-nix-action@v25 with: extra_nix_config: | accept-flake-config = true - name: "Lint shell scripts" run: nix build .#checks.x86_64-linux.shellcheck --print-build-logs warnings: name: "Build (warnings as errors)" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: recursive - uses: haskell-actions/setup@v2 with: ghc-version: "9.10" - uses: cachix/install-nix-action@v25 - run: sudo apt install libsodium-dev - run: cabal v2-update - name: "Build with -Werror" run: > cabal v2-build --enable-tests --enable-benchmarks --disable-optimization --enable-deterministic --ghc-options=-Werror haddock: name: "Documentation (Haddock)" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: recursive - uses: haskell-actions/setup@v2 with: ghc-version: "9.10" - uses: cachix/install-nix-action@v25 - run: sudo apt install libsodium-dev - run: cabal v2-update - name: "Build documentation" run: > cabal v2-haddock --disable-optimization --enable-deterministic - name: "Upload documentation" uses: actions/upload-artifact@v4 with: name: haddock-docs path: dist-newstyle/build/**/doc/ coverage: name: "Code coverage" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: recursive - uses: haskell-actions/setup@v2 with: ghc-version: "9.10" - uses: cachix/install-nix-action@v25 - run: sudo apt install libsodium-dev - run: cabal v2-update - name: "Build and test with coverage" run: | cabal v2-configure --enable-tests --enable-coverage --disable-optimization cabal v2-build cabal v2-test - name: "Upload coverage report" uses: actions/upload-artifact@v4 with: name: coverage-report path: dist-newstyle/build/**/hpc/ benchmarks: name: "Benchmarks" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: recursive - uses: haskell-actions/setup@v2 with: ghc-version: "9.10" - uses: cachix/install-nix-action@v25 - run: sudo apt install libsodium-dev - run: cabal v2-update - name: "Run benchmarks" run: | cabal v2-build --enable-benchmarks --disable-optimization cabal v2-bench 2>&1 | tee benchmark-results.txt - name: "Upload benchmark results" uses: actions/upload-artifact@v4 with: name: benchmark-results path: benchmark-results.txt nix-build: name: "Nix build" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: cachix/install-nix-action@v25 with: extra_nix_config: | accept-flake-config = true - name: "Build with Nix" run: nix build --print-build-logs ================================================ FILE: .gitignore ================================================ **/#* **/*~ **/.#* /.history /Setup /dist/ /nix-test-eval* /nix/ TAGS cabal.project.local ctags dist-newstyle result* .ghc.environment.* .hnixrc ================================================ FILE: .gitmodules ================================================ ================================================ FILE: .hlint.yaml ================================================ - group: {name: generalise, enabled: true} - group: {name: future, enabled: true} - group: {name: attoparsec, enabled: true} - group: {name: use-lens, enabled: true} - arguments: - "-XConstraintKinds" - "-XDeriveGeneric" - "-XGeneralizedNewtypeDeriving" - "-XLambdaCase" - "-XOverloadedStrings" - "-XRecordWildCards" - "-XScopedTypeVariables" - "-XStandaloneDeriving" - "-XTupleSections" - "-XTypeApplications" - "-XViewPatterns" - ignore: name: Use unless - ignore: name: Use head - ignore: name: Use Foldable.forM_ - hint: lhs: "pure mempty" note: "Use 'stub'" rhs: stub - hint: lhs: "[]" note: "Use `mempty`" rhs: mempty - hint: lhs: "(: mempty)" note: "Use `one`" rhs: one - hint: lhs: "(:| mempty)" note: "Use `one`" rhs: one - hint: lhs: Data.Sequence.singleton note: "Use `one`" rhs: one - hint: lhs: Data.Text.singleton note: "Use `one`" rhs: one - hint: lhs: Data.Text.Lazy.singleton note: "Use `one`" rhs: one - hint: lhs: Data.ByteString.singleton note: "Use `one`" rhs: one - hint: lhs: Data.ByteString.Lazy.singleton note: "Use `one`" rhs: one - hint: lhs: Data.Map.singleton note: "Use `one`" rhs: one - hint: lhs: Data.Map.Strict.singleton note: "Use `one`" rhs: one - hint: lhs: Data.HashMap.Strict.singleton note: "Use `one`" rhs: one - hint: lhs: Data.HashMap.Lazy.singleton note: "Use `one`" rhs: one - hint: lhs: Data.IntMap.singleton note: "Use `one`" rhs: one - hint: lhs: Data.IntMap.Strict.singleton note: "Use `one`" rhs: one - hint: lhs: Data.Set.singleton note: "Use `one`" rhs: one - hint: lhs: Data.HashSet.singleton note: "Use `one`" rhs: one - hint: lhs: Data.IntSet.singleton note: "Use `one`" rhs: one - warn: lhs: "Control.Exception.evaluate (x `deepseq` mempty)" rhs: evaluateNF_ x - warn: lhs: "void (evaluateWHNF x)" rhs: evaluateWHNF_ x - warn: lhs: "void (evaluateNF x)" rhs: evaluateNF_ x - warn: lhs: "foldl' (+) 0" rhs: sum - warn: lhs: "foldl' (*) 1" rhs: product - hint: lhs: "fmap and (sequenceA s)" note: Applying this hint would mean that some actions that were being executed previously would no longer be executed. rhs: andM s - hint: lhs: "and <$> sequenceA s" note: Applying this hint would mean that some actions that were being executed previously would no longer be executed. rhs: andM s - hint: lhs: "fmap or (sequenceA s)" note: Applying this hint would mean that some actions that were being executed previously would no longer be executed. rhs: orM s - hint: lhs: "or <$> sequenceA s" note: Applying this hint would mean that some actions that were being executed previously would no longer be executed. rhs: orM s - hint: lhs: "fmap and (traversable f s)" note: Applying this hint would mean that some actions that were being executed previously would no longer be executed. rhs: allM f s - hint: lhs: "and <$> traversable f s" note: Applying this hint would mean that some actions that were being executed previously would no longer be executed. rhs: allM f s - hint: lhs: "fmap or (traversable f s)" note: Applying this hint would mean that some actions that were being executed previously would no longer be executed. rhs: anyM f s - hint: lhs: "or <$> traversable f s" note: Applying this hint would mean that some actions that were being executed previously would no longer be executed. rhs: anyM f s - warn: lhs: "getAlt (foldMap (Alt . f) xs)" rhs: asumMap xs - warn: lhs: "getAlt . foldMap (Alt . f)" rhs: asumMap - hint: lhs: "foldr (\\x acc -> f x <|> acc) empty" note: "Use 'asumMap'" rhs: asumMap f - hint: lhs: "asum (fmap f xs)" note: "Use 'asumMap'" rhs: asumMap f xs - warn: lhs: "fmap fst &&& fmap snd" rhs: unzip - hint: lhs: "fmap (fmap f) x" note: "Use '(<<$>>)'" rhs: "f <<$>> x" - warn: lhs: "fmap f (nonEmpty x)" rhs: viaNonEmpty f x - warn: lhs: fmap f . nonEmpty rhs: viaNonEmpty f - warn: lhs: "f <$> nonEmpty x" rhs: viaNonEmpty f x - warn: lhs: partitionEithers . fmap f rhs: partitionWith f - warn: lhs: partitionEithers $ fmap f x rhs: partitionWith f x - warn: lhs: forever note: "'forever' is loosely typed and may hide errors" rhs: infinitely - warn: lhs: "unlessM (not <$> x)" rhs: whenM x - warn: lhs: "either (const True) (const False)" rhs: isLeft - warn: lhs: "either (const False) (const True)" rhs: isRight - warn: lhs: "either id (const a)" rhs: fromLeft a - warn: lhs: "either (const b) id" rhs: fromRight b - warn: lhs: "either Just (const Nothing)" rhs: leftToMaybe - warn: lhs: "either (const Nothing) Just" rhs: rightToMaybe - warn: lhs: "maybe (Left l) Right" rhs: maybeToRight l - warn: lhs: "maybe (Right r) Left" rhs: maybeToLeft r - warn: lhs: "case m of [] -> stub ; (x:xs) -> f (x :| xs)" rhs: whenNotNull m f - warn: lhs: "case m of (x:xs) -> f (x :| xs); [] -> stub" rhs: whenNotNull m f - warn: lhs: "m >>= \\case [] -> stub ; (x:xs) -> f (x :| xs)" rhs: whenNotNullM m f - warn: lhs: "m >>= \\case (x:xs) -> f (x :| xs); [] -> stub" rhs: whenNotNullM m f - warn: lhs: mapMaybe leftToMaybe rhs: lefts - warn: lhs: mapMaybe rightToMaybe rhs: rights - warn: lhs: flip runReaderT rhs: usingReaderT - warn: lhs: flip runReader rhs: usingReader - warn: lhs: flip runStateT rhs: usingStateT - warn: lhs: flip runState rhs: usingState - warn: lhs: "fst <$> usingStateT s st" rhs: evaluatingStateT s st - warn: lhs: "fst (usingState s st)" rhs: evaluatingState s st - warn: lhs: "snd <$> usingStateT s st" rhs: executingStateT s st - warn: lhs: "snd (usingState s st)" rhs: executingState s st - warn: lhs: "MaybeT (pure m)" rhs: hoistMaybe m - warn: lhs: MaybeT . pure rhs: hoistMaybe - warn: lhs: "ExceptT (pure m)" rhs: hoistEither m - warn: lhs: ExceptT . pure rhs: hoistEither - warn: lhs: fromMaybe mempty rhs: maybeToMonoid - warn: lhs: "m ?: mempty" rhs: maybeToMonoid m - warn: lhs: "Data.Map.toAscList (Data.Map.fromList x)" rhs: sortWith fst x - warn: lhs: "Data.Map.toDescList (Data.Map.fromList x)" rhs: "sortWith (Down . fst) x" - warn: lhs: "Data.Set.toList (Data.Set.fromList l)" rhs: sortNub l - warn: lhs: "Data.Set.assocs (Data.Set.fromList l)" rhs: sortNub l - warn: lhs: "Data.Set.toAscList (Data.Set.fromList l)" rhs: sortNub l - warn: lhs: "Data.HashSet.toList (Data.HashSet.fromList l)" rhs: unstableNub l - warn: lhs: nub note: "'nub' is O(n^2), 'ordNub' is O(n log n)" rhs: ordNub - warn: lhs: "sortBy (comparing f)" note: "If the function you are using for 'comparing' is slow, use 'sortOn' instead of 'sortWith', because 'sortOn' caches applications the function and 'sortWith' doesn't." rhs: sortWith f - warn: lhs: sortOn fst note: "'sortWith' will be faster here because it doesn't do caching" rhs: sortWith fst - warn: lhs: sortOn snd note: "'sortWith' will be faster here because it doesn't do caching" rhs: sortWith snd - warn: lhs: "sortOn (Down . fst)" note: "'sortWith' will be faster here because it doesn't do caching" rhs: "sortWith (Down . fst)" - warn: lhs: "sortOn (Down . snd)" note: "'sortWith' will be faster here because it doesn't do caching" rhs: "sortWith (Down . snd)" - warn: lhs: Data.Text.Lazy.IO.putStr rhs: putLText - warn: lhs: Data.Text.Lazy.IO.putStrLn rhs: putLTextLn - warn: lhs: Data.ByteString.Char8.putStr rhs: putBS - warn: lhs: Data.ByteString.Char8.putStrLn rhs: putBSLn - warn: lhs: Data.ByteString.Lazy.Char8.putStr rhs: putLBS - warn: lhs: Data.ByteString.Lazy.Char8.putStrLn rhs: putLBSLn - warn: lhs: Data.Text.Lazy.Text rhs: LText - warn: lhs: Data.ByteString.Lazy.ByteString rhs: LByteString - warn: lhs: Data.ByteString.UTF8.fromString rhs: encodeUtf8 - warn: lhs: Data.ByteString.UTF8.toString rhs: decodeUtf8 - warn: lhs: Data.Text.Encoding.encodeUtf8 rhs: encodeUtf8 - warn: lhs: Data.Text.Encoding.decodeUtf8 rhs: decodeUtf8 - warn: lhs: "Data.ByteString.Lazy.toStrict (encodeUtf8 x)" rhs: encodeUtf8 x - warn: lhs: "toStrict (encodeUtf8 x)" rhs: encodeUtf8 x - warn: lhs: "decodeUtf8 (Data.ByteString.Lazy.fromStrict x)" rhs: decodeUtf8 x - warn: lhs: "decodeUtf8 (fromStrict x)" rhs: decodeUtf8 x - warn: lhs: Data.ByteString.Lazy.UTF8.fromString rhs: encodeUtf8 - warn: lhs: Data.ByteString.Lazy.UTF8.toString rhs: decodeUtf8 - warn: lhs: "Data.ByteString.Lazy.fromStrict (Data.Text.Encoding.encodeUtf8 x)" rhs: encodeUtf8 x - warn: lhs: "Data.ByteString.Lazy.fromStrict (encodeUtf8 x)" rhs: encodeUtf8 x - warn: lhs: "Data.Text.Encoding.decodeUtf8 (Data.ByteString.Lazy.toStrict x)" rhs: decodeUtf8 x - warn: lhs: "Data.Text.Encoding.decodeUtf8 (toStrict x)" rhs: decodeUtf8 x - warn: lhs: "decodeUtf8 (Data.ByteString.Lazy.toStrict x)" rhs: decodeUtf8 x - warn: lhs: "decodeUtf8 (toStrict x)" rhs: decodeUtf8 x - warn: lhs: Data.Text.pack rhs: toText - warn: lhs: Data.Text.unpack rhs: toString - warn: lhs: Data.Text.Lazy.pack rhs: toLText - warn: lhs: Data.Text.Lazy.unpack rhs: toString - warn: lhs: Data.Text.Lazy.toStrict rhs: toText - warn: lhs: Data.Text.Lazy.fromStrict rhs: toLText - warn: lhs: "Data.Text.pack (show x)" rhs: show x - warn: lhs: "Data.Text.Lazy.pack (show x)" rhs: show x - warn: lhs: Data.ByteString.Lazy.fromStrict rhs: fromStrict - warn: lhs: Data.ByteString.Lazy.toStrict rhs: toStrict - warn: lhs: Data.Text.Lazy.fromStrict rhs: fromStrict - warn: lhs: Data.Text.Lazy.toStrict rhs: toStrict - warn: lhs: Control.Applicative.Alternative name: "Use 'Alternative' from Relude" note: "'Alternative' is already exported from Relude" rhs: Alternative - warn: lhs: Control.Applicative.empty name: "Use 'empty' from Relude" note: "'empty' is already exported from Relude" rhs: empty - warn: lhs: "(Control.Applicative.<|>)" name: "Use '<|>' from Relude" note: "Operator '(<|>)' is already exported from Relude" rhs: "(<|>)" - warn: lhs: Control.Applicative.some name: "Use 'some' from Relude" note: "'some' is already exported from Relude" rhs: some - warn: lhs: Control.Applicative.many name: "Use 'many' from Relude" note: "'many' is already exported from Relude" rhs: many - warn: lhs: Control.Applicative.Const name: "Use 'Const' from Relude" note: "'Const' is already exported from Relude" rhs: Const - warn: lhs: Control.Applicative.getConst name: "Use 'getConst' from Relude" note: "'getConst' is already exported from Relude" rhs: getConst - warn: lhs: Control.Applicative.ZipList name: "Use 'ZipList' from Relude" note: "'ZipList' is already exported from Relude" rhs: ZipList - warn: lhs: Control.Applicative.getZipList name: "Use 'getZipList' from Relude" note: "'getZipList' is already exported from Relude" rhs: getZipList - warn: lhs: Control.Applicative.liftA2 name: "Use 'liftA2' from Relude" note: "'liftA2' is already exported from Relude" rhs: liftA2 - warn: lhs: Control.Applicative.liftA3 name: "Use 'liftA3' from Relude" note: "'liftA3' is already exported from Relude" rhs: liftA3 - warn: lhs: Control.Applicative.optional name: "Use 'optional' from Relude" note: "'optional' is already exported from Relude" rhs: optional - warn: lhs: "(Control.Applicative.<**>)" name: "Use '<**>' from Relude" note: "Operator '(<**>)' is already exported from Relude" rhs: "(<**>)" - warn: lhs: Data.Char.chr name: "Use 'chr' from Relude" note: "'chr' is already exported from Relude" rhs: chr - warn: lhs: Data.Int.Int8 name: "Use 'Int8' from Relude" note: "'Int8' is already exported from Relude" rhs: Int8 - warn: lhs: Data.Int.Int16 name: "Use 'Int16' from Relude" note: "'Int16' is already exported from Relude" rhs: Int16 - warn: lhs: Data.Int.Int32 name: "Use 'Int32' from Relude" note: "'Int32' is already exported from Relude" rhs: Int32 - warn: lhs: Data.Int.Int64 name: "Use 'Int64' from Relude" note: "'Int64' is already exported from Relude" rhs: Int64 - warn: lhs: Data.Word.Word8 name: "Use 'Word8' from Relude" note: "'Word8' is already exported from Relude" rhs: Word8 - warn: lhs: Data.Word.Word16 name: "Use 'Word16' from Relude" note: "'Word16' is already exported from Relude" rhs: Word16 - warn: lhs: Data.Word.Word32 name: "Use 'Word32' from Relude" note: "'Word32' is already exported from Relude" rhs: Word32 - warn: lhs: Data.Word.Word64 name: "Use 'Word64' from Relude" note: "'Word64' is already exported from Relude" rhs: Word64 - warn: lhs: Data.Word.byteSwap16 name: "Use 'byteSwap16' from Relude" note: "'byteSwap16' is already exported from Relude" rhs: byteSwap16 - warn: lhs: Data.Word.byteSwap32 name: "Use 'byteSwap32' from Relude" note: "'byteSwap32' is already exported from Relude" rhs: byteSwap32 - warn: lhs: Data.Word.byteSwap64 name: "Use 'byteSwap64' from Relude" note: "'byteSwap64' is already exported from Relude" rhs: byteSwap64 - warn: lhs: Numeric.Natural.Natural name: "Use 'Natural' from Relude" note: "'Natural' is already exported from Relude" rhs: Natural - warn: lhs: System.IO.IOMode name: "Use 'IOMode' from Relude" note: "'IOMode' is already exported from Relude" rhs: IOMode - warn: lhs: System.IO.ReadMode name: "Use 'ReadMode' from Relude" note: "'ReadMode' is already exported from Relude" rhs: ReadMode - warn: lhs: System.IO.WriteMode name: "Use 'WriteMode' from Relude" note: "'WriteMode' is already exported from Relude" rhs: WriteMode - warn: lhs: System.IO.AppendMode name: "Use 'AppendMode' from Relude" note: "'AppendMode' is already exported from Relude" rhs: AppendMode - warn: lhs: System.IO.ReadWriteMode name: "Use 'ReadWriteMode' from Relude" note: "'ReadWriteMode' is already exported from Relude" rhs: ReadWriteMode - warn: lhs: Data.Ord.Down name: "Use 'Down' from Relude" note: "'Down' is already exported from Relude" rhs: Down - warn: lhs: Data.Ord.comparing name: "Use 'comparing' from Relude" note: "'comparing' is already exported from Relude" rhs: comparing - warn: lhs: Data.Coerce.Coercible name: "Use 'Coercible' from Relude" note: "'Coercible' is already exported from Relude" rhs: Coercible - warn: lhs: Data.Coerce.coerce name: "Use 'coerce' from Relude" note: "'coerce' is already exported from Relude" rhs: coerce - warn: lhs: Data.Kind.Constraint name: "Use 'Constraint' from Relude" note: "'Constraint' is already exported from Relude" rhs: Constraint - warn: lhs: Data.Kind.Type name: "Use 'Type' from Relude" note: "'Type' is already exported from Relude" rhs: Type - warn: lhs: Data.Typeable.Typeable name: "Use 'Typeable' from Relude" note: "'Typeable' is already exported from Relude" rhs: Typeable - warn: lhs: Data.Proxy.Proxy name: "Use 'Proxy' from Relude" note: "'Proxy' is already exported from Relude" rhs: Proxy - warn: lhs: Data.Typeable.Typeable name: "Use 'Typeable' from Relude" note: "'Typeable' is already exported from Relude" rhs: Typeable - warn: lhs: Data.Void.Void name: "Use 'Void' from Relude" note: "'Void' is already exported from Relude" rhs: Void - warn: lhs: Data.Void.absurd name: "Use 'absurd' from Relude" note: "'absurd' is already exported from Relude" rhs: absurd - warn: lhs: Data.Void.vacuous name: "Use 'vacuous' from Relude" note: "'vacuous' is already exported from Relude" rhs: vacuous - warn: lhs: Data.Base.maxInt name: "Use 'maxInt' from Relude" note: "'maxInt' is already exported from Relude" rhs: maxInt - warn: lhs: Data.Base.minInt name: "Use 'minInt' from Relude" note: "'minInt' is already exported from Relude" rhs: minInt - warn: lhs: Data.Base.ord name: "Use 'ord' from Relude" note: "'ord' is already exported from Relude" rhs: ord - warn: lhs: GHC.Enum.boundedEnumFrom name: "Use 'boundedEnumFrom' from Relude" note: "'boundedEnumFrom' is already exported from Relude" rhs: boundedEnumFrom - warn: lhs: GHC.Enum.boundedEnumFromThen name: "Use 'boundedEnumFromThen' from Relude" note: "'boundedEnumFromThen' is already exported from Relude" rhs: boundedEnumFromThen - warn: lhs: GHC.Generics.Generic name: "Use 'Generic' from Relude" note: "'Generic' is already exported from Relude" rhs: Generic - warn: lhs: GHC.Real.Ratio name: "Use 'Ratio' from Relude" note: "'Ratio' is already exported from Relude" rhs: Ratio - warn: lhs: GHC.Real.Rational name: "Use 'Rational' from Relude" note: "'Rational' is already exported from Relude" rhs: Rational - warn: lhs: GHC.Real.denominator name: "Use 'denominator' from Relude" note: "'denominator' is already exported from Relude" rhs: denominator - warn: lhs: GHC.Real.numerator name: "Use 'numerator' from Relude" note: "'numerator' is already exported from Relude" rhs: numerator - warn: lhs: GHC.TypeNats.CmpNat name: "Use 'CmpNat' from Relude" note: "'CmpNat' is already exported from Relude" rhs: CmpNat - warn: lhs: GHC.TypeNats.KnownNat name: "Use 'KnownNat' from Relude" note: "'KnownNat' is already exported from Relude" rhs: KnownNat - warn: lhs: GHC.TypeNats.Nat name: "Use 'Nat' from Relude" note: "'Nat' is already exported from Relude" rhs: Nat - warn: lhs: GHC.TypeNats.SomeNat name: "Use 'SomeNat' from Relude" note: "'SomeNat' is already exported from Relude" rhs: SomeNat - warn: lhs: GHC.TypeNats.natVal name: "Use 'natVal' from Relude" note: "'natVal' is already exported from Relude" rhs: natVal - warn: lhs: GHC.TypeNats.someNatVal name: "Use 'someNatVal' from Relude" note: "'someNatVal' is already exported from Relude" rhs: someNatVal - warn: lhs: GHC.TypeLits.CmpNat name: "Use 'CmpNat' from Relude" note: "'CmpNat' is already exported from Relude" rhs: CmpNat - warn: lhs: GHC.TypeLits.KnownNat name: "Use 'KnownNat' from Relude" note: "'KnownNat' is already exported from Relude" rhs: KnownNat - warn: lhs: GHC.TypeLits.Nat name: "Use 'Nat' from Relude" note: "'Nat' is already exported from Relude" rhs: Nat - warn: lhs: GHC.TypeLits.SomeNat name: "Use 'SomeNat' from Relude" note: "'SomeNat' is already exported from Relude" rhs: SomeNat - warn: lhs: GHC.TypeLits.natVal name: "Use 'natVal' from Relude" note: "'natVal' is already exported from Relude" rhs: natVal - warn: lhs: GHC.TypeLits.someNatVal name: "Use 'someNatVal' from Relude" note: "'someNatVal' is already exported from Relude" rhs: someNatVal - warn: lhs: GHC.ExecutionStack.getStackTrace name: "Use 'getStackTrace' from Relude" note: "'getStackTrace' is already exported from Relude" rhs: getStackTrace - warn: lhs: GHC.ExecutionStack.showStackTrace name: "Use 'showStackTrace' from Relude" note: "'showStackTrace' is already exported from Relude" rhs: showStackTrace - warn: lhs: GHC.OverloadedLabels.IsLabel name: "Use 'IsLabel' from Relude" note: "'IsLabel' is already exported from Relude" rhs: IsLabel - warn: lhs: GHC.OverloadedLabels.fromLabel name: "Use 'fromLabel' from Relude" note: "'fromLabel' is already exported from Relude" rhs: fromLabel - warn: lhs: GHC.Stack.CallStack name: "Use 'CallStack' from Relude" note: "'CallStack' is already exported from Relude" rhs: CallStack - warn: lhs: GHC.Stack.HasCallStack name: "Use 'HasCallStack' from Relude" note: "'HasCallStack' is already exported from Relude" rhs: HasCallStack - warn: lhs: GHC.Stack.callStack name: "Use 'callStack' from Relude" note: "'callStack' is already exported from Relude" rhs: callStack - warn: lhs: GHC.Stack.currentCallStack name: "Use 'currentCallStack' from Relude" note: "'currentCallStack' is already exported from Relude" rhs: currentCallStack - warn: lhs: GHC.Stack.getCallStack name: "Use 'getCallStack' from Relude" note: "'getCallStack' is already exported from Relude" rhs: getCallStack - warn: lhs: GHC.Stack.prettyCallStack name: "Use 'prettyCallStack' from Relude" note: "'prettyCallStack' is already exported from Relude" rhs: prettyCallStack - warn: lhs: GHC.Stack.prettySrcLoc name: "Use 'prettySrcLoc' from Relude" note: "'prettySrcLoc' is already exported from Relude" rhs: prettySrcLoc - warn: lhs: GHC.Stack.withFrozenCallStack name: "Use 'withFrozenCallStack' from Relude" note: "'withFrozenCallStack' is already exported from Relude" rhs: withFrozenCallStack - warn: lhs: Data.Bifoldable.Bifoldable name: "Use 'Bifoldable' from Relude" note: "'Bifoldable' is already exported from Relude" rhs: Bifoldable - warn: lhs: Data.Bifoldable.bifold name: "Use 'bifold' from Relude" note: "'bifold' is already exported from Relude" rhs: bifold - warn: lhs: Data.Bifoldable.bifoldMap name: "Use 'bifoldMap' from Relude" note: "'bifoldMap' is already exported from Relude" rhs: bifoldMap - warn: lhs: Data.Bifoldable.bifoldr name: "Use 'bifoldr' from Relude" note: "'bifoldr' is already exported from Relude" rhs: bifoldr - warn: lhs: Data.Bifoldable.bifoldl name: "Use 'bifoldl' from Relude" note: "'bifoldl' is already exported from Relude" rhs: bifoldl - warn: lhs: "Data.Bifoldable.bifoldl'" name: "Use 'bifoldl'' from Relude" note: "'bifoldl'' is already exported from Relude" rhs: "bifoldl'" - warn: lhs: Data.Bifoldable.bifoldlM name: "Use 'bifoldlM' from Relude" note: "'bifoldlM' is already exported from Relude" rhs: bifoldlM - warn: lhs: "Data.Bifoldable.bifoldr'" name: "Use 'bifoldr'' from Relude" note: "'bifoldr'' is already exported from Relude" rhs: "bifoldr'" - warn: lhs: Data.Bifoldable.bifoldrM name: "Use 'bifoldrM' from Relude" note: "'bifoldrM' is already exported from Relude" rhs: bifoldrM - warn: lhs: Data.Bifoldable.bitraverse_ name: "Use 'bitraverse_' from Relude" note: "'bitraverse_' is already exported from Relude" rhs: bitraverse_ - warn: lhs: Data.Bifoldable.bifor_ name: "Use 'bifor_' from Relude" note: "'bifor_' is already exported from Relude" rhs: bifor_ - warn: lhs: Data.Bifoldable.biasum name: "Use 'biasum' from Relude" note: "'biasum' is already exported from Relude" rhs: biasum - warn: lhs: Data.Bifoldable.bisequence_ name: "Use 'bisequence_' from Relude" note: "'bisequence_' is already exported from Relude" rhs: bisequence_ - warn: lhs: Data.Bifoldable.biList name: "Use 'biList' from Relude" note: "'biList' is already exported from Relude" rhs: biList - warn: lhs: Data.Bifoldable.binull name: "Use 'binull' from Relude" note: "'binull' is already exported from Relude" rhs: binull - warn: lhs: Data.Bifoldable.bilength name: "Use 'bilength' from Relude" note: "'bilength' is already exported from Relude" rhs: bilength - warn: lhs: Data.Bifoldable.bielem name: "Use 'bielem' from Relude" note: "'bielem' is already exported from Relude" rhs: bielem - warn: lhs: Data.Bifoldable.biand name: "Use 'biand' from Relude" note: "'biand' is already exported from Relude" rhs: biand - warn: lhs: Data.Bifoldable.bior name: "Use 'bior' from Relude" note: "'bior' is already exported from Relude" rhs: bior - warn: lhs: Data.Bifoldable.biany name: "Use 'biany' from Relude" note: "'biany' is already exported from Relude" rhs: biany - warn: lhs: Data.Bifoldable.biall name: "Use 'biall' from Relude" note: "'biall' is already exported from Relude" rhs: biall - warn: lhs: Data.Bifoldable.bifind name: "Use 'bifind' from Relude" note: "'bifind' is already exported from Relude" rhs: bifind - warn: lhs: Data.Bitraversable.Bitraversable name: "Use 'Bitraversable' from Relude" note: "'Bitraversable' is already exported from Relude" rhs: Bitraversable - warn: lhs: Data.Bitraversable.bitraverse name: "Use 'bitraverse' from Relude" note: "'bitraverse' is already exported from Relude" rhs: bitraverse - warn: lhs: Data.Bitraversable.bisequence name: "Use 'bisequence' from Relude" note: "'bisequence' is already exported from Relude" rhs: bisequence - warn: lhs: Data.Bitraversable.bifor name: "Use 'bifor' from Relude" note: "'bifor' is already exported from Relude" rhs: bifor - warn: lhs: Data.Bitraversable.bimapDefault name: "Use 'bimapDefault' from Relude" note: "'bimapDefault' is already exported from Relude" rhs: bimapDefault - warn: lhs: Data.Bitraversable.bifoldMapDefault name: "Use 'bifoldMapDefault' from Relude" note: "'bifoldMapDefault' is already exported from Relude" rhs: bifoldMapDefault - warn: lhs: Control.Monad.guard name: "Use 'guard' from Relude" note: "'guard' is already exported from Relude" rhs: guard - warn: lhs: Control.Monad.when name: "Use 'when' from Relude" note: "'when' is already exported from Relude" rhs: when - warn: lhs: Data.Bool.bool name: "Use 'bool' from Relude" note: "'bool' is already exported from Relude" rhs: bool - warn: lhs: Data.Hashable.Hashable name: "Use 'Hashable' from Relude" note: "'Hashable' is already exported from Relude" rhs: Hashable - warn: lhs: Data.Hashable.hashWithSalt name: "Use 'hashWithSalt' from Relude" note: "'hashWithSalt' is already exported from Relude" rhs: hashWithSalt - warn: lhs: Data.HashMap.Strict.HashMap name: "Use 'HashMap' from Relude" note: "'HashMap' is already exported from Relude" rhs: HashMap - warn: lhs: Data.HashSet.HashSet name: "Use 'HashSet' from Relude" note: "'HashSet' is already exported from Relude" rhs: HashSet - warn: lhs: Data.IntMap.Strict.IntMap name: "Use 'IntMap' from Relude" note: "'IntMap' is already exported from Relude" rhs: IntMap - warn: lhs: Data.IntSet.IntSet name: "Use 'IntSet' from Relude" note: "'IntSet' is already exported from Relude" rhs: IntSet - warn: lhs: Data.Map.Strict.Map name: "Use 'Map' from Relude" note: "'Map' is already exported from Relude" rhs: Map - warn: lhs: Data.Sequence.Sequence name: "Use 'Sequence' from Relude" note: "'Sequence' is already exported from Relude" rhs: Sequence - warn: lhs: Data.Set.Set name: "Use 'Set' from Relude" note: "'Set' is already exported from Relude" rhs: Set - warn: lhs: Data.Tuple.swap name: "Use 'swap' from Relude" note: "'swap' is already exported from Relude" rhs: swap - warn: lhs: Data.Vector.Vector name: "Use 'Vector' from Relude" note: "'Vector' is already exported from Relude" rhs: Vector - warn: lhs: GHC.Exts.IsList name: "Use 'IsList' from Relude" note: "'IsList' is already exported from Relude" rhs: IsList - warn: lhs: GHC.Exts.fromList name: "Use 'fromList' from Relude" note: "'fromList' is already exported from Relude" rhs: fromList - warn: lhs: GHC.Exts.fromListN name: "Use 'fromListN' from Relude" note: "'fromListN' is already exported from Relude" rhs: fromListN - warn: lhs: Debug.Trace.trace name: "Use 'trace' from Relude" note: "'trace' is already exported from Relude" rhs: trace - warn: lhs: Debug.Trace.traceShow name: "Use 'traceShow' from Relude" note: "'traceShow' is already exported from Relude" rhs: traceShow - warn: lhs: Debug.Trace.traceShowId name: "Use 'traceShowId' from Relude" note: "'traceShowId' is already exported from Relude" rhs: traceShowId - warn: lhs: Debug.Trace.traceShowM name: "Use 'traceShowM' from Relude" note: "'traceShowM' is already exported from Relude" rhs: traceShowM - warn: lhs: Debug.Trace.traceM name: "Use 'traceM' from Relude" note: "'traceM' is already exported from Relude" rhs: traceM - warn: lhs: Debug.Trace.traceId name: "Use 'traceId' from Relude" note: "'traceId' is already exported from Relude" rhs: traceId - warn: lhs: Control.DeepSeq.NFData name: "Use 'NFData' from Relude" note: "'NFData' is already exported from Relude" rhs: NFData - warn: lhs: Control.DeepSeq.rnf name: "Use 'rnf' from Relude" note: "'rnf' is already exported from Relude" rhs: rnf - warn: lhs: Control.DeepSeq.deepseq name: "Use 'deepseq' from Relude" note: "'deepseq' is already exported from Relude" rhs: deepseq - warn: lhs: Control.DeepSeq.force name: "Use 'force' from Relude" note: "'force' is already exported from Relude" rhs: force - warn: lhs: "(Control.DeepSeq.$!!)" name: "Use '$!!' from Relude" note: "Operator '($!!)' is already exported from Relude" rhs: "($!!)" - warn: lhs: Control.Exception.Exception name: "Use 'Exception' from Relude" note: "'Exception' is already exported from Relude" rhs: Exception - warn: lhs: Control.Exception.SomeException name: "Use 'SomeException' from Relude" note: "'SomeException' is already exported from Relude" rhs: SomeException - warn: lhs: Control.Exception.toException name: "Use 'toException' from Relude" note: "'toException' is already exported from Relude" rhs: toException - warn: lhs: Control.Exception.fromException name: "Use 'fromException' from Relude" note: "'fromException' is already exported from Relude" rhs: fromException - warn: lhs: Control.Exception.displayException name: "Use 'displayException' from Relude" note: "'displayException' is already exported from Relude" rhs: displayException - warn: lhs: Data.Foldable.asum name: "Use 'asum' from Relude" note: "'asum' is already exported from Relude" rhs: asum - warn: lhs: Data.Foldable.find name: "Use 'find' from Relude" note: "'find' is already exported from Relude" rhs: find - warn: lhs: Data.Foldable.find name: "Use 'find' from Relude" note: "'find' is already exported from Relude" rhs: find - warn: lhs: Data.Foldable.fold name: "Use 'fold' from Relude" note: "'fold' is already exported from Relude" rhs: fold - warn: lhs: "Data.Foldable.foldl'" name: "Use 'foldl'' from Relude" note: "'foldl'' is already exported from Relude" rhs: "foldl'" - warn: lhs: forM_ b a name: "Use 'traverse_'" rhs: traverse_ a b - warn: lhs: for_ b a name: "Use 'traverse_'" note: "'for_' is already exported from Relude" rhs: traverse a b - warn: lhs: Data.Foldable.sequenceA_ name: "Use 'sequenceA_' from Relude" note: "'sequenceA_' is already exported from Relude" rhs: sequenceA_ - warn: lhs: Data.Foldable.toList name: "Use 'toList' from Relude" note: "'toList' is already exported from Relude" rhs: toList - warn: lhs: forM b a name: "Use 'traverse'" rhs: traverse a b - warn: lhs: Data.Traversable.mapAccumL name: "Use 'mapAccumL' from Relude" note: "'mapAccumL' is already exported from Relude" rhs: mapAccumL - warn: lhs: Data.Traversable.mapAccumR name: "Use 'mapAccumR' from Relude" note: "'mapAccumR' is already exported from Relude" rhs: mapAccumR - warn: lhs: "(Control.Arrow.&&&)" name: "Use '&&&' from Relude" note: "Operator '(&&&)' is already exported from Relude" rhs: "(&&&)" - warn: lhs: "(Control.Category.>>>)" name: "Use '>>>' from Relude" note: "Operator '(>>>)' is already exported from Relude" rhs: "(>>>)" - warn: lhs: "(Control.Category.<<<)" name: "Use '<<<' from Relude" note: "Operator '(<<<)' is already exported from Relude" rhs: "(<<<)" - warn: lhs: Data.Function.fix name: "Use 'fix' from Relude" note: "'fix' is already exported from Relude" rhs: fix - warn: lhs: Data.Function.on name: "Use 'on' from Relude" note: "'on' is already exported from Relude" rhs: 'on' - warn: lhs: Data.Bifunctor.Bifunctor name: "Use 'Bifunctor' from Relude" note: "'Bifunctor' is already exported from Relude" rhs: Bifunctor - warn: lhs: Data.Bifunctor.bimap name: "Use 'bimap' from Relude" note: "'bimap' is already exported from Relude" rhs: bimap - warn: lhs: Data.Bifunctor.first name: "Use 'first' from Relude" note: "'first' is already exported from Relude" rhs: first - warn: lhs: Data.Bifunctor.second name: "Use 'second' from Relude" note: "'second' is already exported from Relude" rhs: second - warn: lhs: Data.Functor.void name: "Use 'void' from Relude" note: "'void' is already exported from Relude" rhs: void - warn: lhs: "(Data.Functor.$>)" name: "Use '$>' from Relude" note: "Operator '($>)' is already exported from Relude" rhs: "($>)" - warn: lhs: "(Data.Functor.<&>)" name: "Use '<&>' from Relude" note: "Operator '(<&>)' is already exported from Relude" rhs: "(<&>)" - warn: lhs: Data.Functor.Compose.Compose name: "Use 'Compose' from Relude" note: "'Compose' is already exported from Relude" rhs: Compose - warn: lhs: Data.Functor.Identity.Identity name: "Use 'Identity' from Relude" note: "'Identity' is already exported from Relude" rhs: Identity - warn: lhs: Data.Functor.Identity.runIdentity name: "Use 'runIdentity' from Relude" note: "'runIdentity' is already exported from Relude" rhs: runIdentity - warn: lhs: Control.Concurrent.MVar.MVar name: "Use 'MVar' from Relude" note: "'MVar' is already exported from Relude" rhs: MVar - warn: lhs: Control.Concurrent.MVar.newEmptyMVar name: "Use 'newEmptyMVar' from Relude" note: "'newEmptyMVar' is already exported from Relude" rhs: newEmptyMVar - warn: lhs: Control.Concurrent.MVar.newMVar name: "Use 'newMVar' from Relude" note: "'newMVar' is already exported from Relude" rhs: newMVar - warn: lhs: Control.Concurrent.MVar.putMVar name: "Use 'putMVar' from Relude" note: "'putMVar' is already exported from Relude" rhs: putMVar - warn: lhs: Control.Concurrent.MVar.readMVar name: "Use 'readMVar' from Relude" note: "'readMVar' is already exported from Relude" rhs: readMVar - warn: lhs: Control.Concurrent.MVar.swapMVar name: "Use 'swapMVar' from Relude" note: "'swapMVar' is already exported from Relude" rhs: swapMVar - warn: lhs: Control.Concurrent.MVar.takeMVar name: "Use 'takeMVar' from Relude" note: "'takeMVar' is already exported from Relude" rhs: takeMVar - warn: lhs: Control.Concurrent.MVar.tryPutMVar name: "Use 'tryPutMVar' from Relude" note: "'tryPutMVar' is already exported from Relude" rhs: tryPutMVar - warn: lhs: Control.Concurrent.MVar.tryReadMVar name: "Use 'tryReadMVar' from Relude" note: "'tryReadMVar' is already exported from Relude" rhs: tryReadMVar - warn: lhs: Control.Concurrent.MVar.tryTakeMVar name: "Use 'tryTakeMVar' from Relude" note: "'tryTakeMVar' is already exported from Relude" rhs: tryTakeMVar - warn: lhs: Control.Monad.STM.STM name: "Use 'STM' from Relude" note: "'STM' is already exported from Relude" rhs: STM - warn: lhs: Control.Monad.STM.atomically name: "Use 'atomically' from Relude" note: "'atomically' is already exported from Relude" rhs: atomically - warn: lhs: Control.Monad.STM.throwSTM name: "Use 'throwSTM' from Relude" note: "'throwSTM' is already exported from Relude" rhs: throwSTM - warn: lhs: Control.Monad.STM.catchSTM name: "Use 'catchSTM' from Relude" note: "'catchSTM' is already exported from Relude" rhs: catchSTM - warn: lhs: Control.Concurrent.STM.TVar.TVar name: "Use 'TVar' from Relude" note: "'TVar' is already exported from Relude" rhs: TVar - warn: lhs: Control.Concurrent.STM.TVar.newTVarIO name: "Use 'newTVarIO' from Relude" note: "'newTVarIO' is already exported from Relude" rhs: newTVarIO - warn: lhs: Control.Concurrent.STM.TVar.readTVarIO name: "Use 'readTVarIO' from Relude" note: "'readTVarIO' is already exported from Relude" rhs: readTVarIO - warn: lhs: "Control.Concurrent.STM.TVar.modifyTVar'" name: "Use 'modifyTVar'' from Relude" note: "'modifyTVar'' is already exported from Relude" rhs: "modifyTVar'" - warn: lhs: Control.Concurrent.STM.TVar.newTVar name: "Use 'newTVar' from Relude" note: "'newTVar' is already exported from Relude" rhs: newTVar - warn: lhs: Control.Concurrent.STM.TVar.readTVar name: "Use 'readTVar' from Relude" note: "'readTVar' is already exported from Relude" rhs: readTVar - warn: lhs: Control.Concurrent.STM.TVar.writeTVar name: "Use 'writeTVar' from Relude" note: "'writeTVar' is already exported from Relude" rhs: writeTVar - warn: lhs: Control.Concurrent.STM.TMVar.TMVar name: "Use 'TMVar' from Relude" note: "'TMVar' is already exported from Relude" rhs: TMVar - warn: lhs: Control.Concurrent.STM.TMVar.newTMVar name: "Use 'newTMVar' from Relude" note: "'newTMVar' is already exported from Relude" rhs: newTMVar - warn: lhs: Control.Concurrent.STM.TMVar.newEmptyTMVar name: "Use 'newEmptyTMVar' from Relude" note: "'newEmptyTMVar' is already exported from Relude" rhs: newEmptyTMVar - warn: lhs: Control.Concurrent.STM.TMVar.newTMVarIO name: "Use 'newTMVarIO' from Relude" note: "'newTMVarIO' is already exported from Relude" rhs: newTMVarIO - warn: lhs: Control.Concurrent.STM.TMVar.newEmptyTMVarIO name: "Use 'newEmptyTMVarIO' from Relude" note: "'newEmptyTMVarIO' is already exported from Relude" rhs: newEmptyTMVarIO - warn: lhs: Control.Concurrent.STM.TMVar.takeTMVar name: "Use 'takeTMVar' from Relude" note: "'takeTMVar' is already exported from Relude" rhs: takeTMVar - warn: lhs: Control.Concurrent.STM.TMVar.putTMVar name: "Use 'putTMVar' from Relude" note: "'putTMVar' is already exported from Relude" rhs: putTMVar - warn: lhs: Control.Concurrent.STM.TMVar.readTMVar name: "Use 'readTMVar' from Relude" note: "'readTMVar' is already exported from Relude" rhs: readTMVar - warn: lhs: Control.Concurrent.STM.TMVar.tryReadTMVar name: "Use 'tryReadTMVar' from Relude" note: "'tryReadTMVar' is already exported from Relude" rhs: tryReadTMVar - warn: lhs: Control.Concurrent.STM.TMVar.swapTMVar name: "Use 'swapTMVar' from Relude" note: "'swapTMVar' is already exported from Relude" rhs: swapTMVar - warn: lhs: Control.Concurrent.STM.TMVar.tryTakeTMVar name: "Use 'tryTakeTMVar' from Relude" note: "'tryTakeTMVar' is already exported from Relude" rhs: tryTakeTMVar - warn: lhs: Control.Concurrent.STM.TMVar.tryPutTMVar name: "Use 'tryPutTMVar' from Relude" note: "'tryPutTMVar' is already exported from Relude" rhs: tryPutTMVar - warn: lhs: Control.Concurrent.STM.TMVar.isEmptyTMVar name: "Use 'isEmptyTMVar' from Relude" note: "'isEmptyTMVar' is already exported from Relude" rhs: isEmptyTMVar - warn: lhs: Control.Concurrent.STM.TMVar.mkWeakTMVar name: "Use 'mkWeakTMVar' from Relude" note: "'mkWeakTMVar' is already exported from Relude" rhs: mkWeakTMVar - warn: lhs: Data.IORef.IORef name: "Use 'IORef' from Relude" note: "'IORef' is already exported from Relude" rhs: IORef - warn: lhs: Data.IORef.atomicModifyIORef name: "Use 'atomicModifyIORef' from Relude" note: "'atomicModifyIORef' is already exported from Relude" rhs: atomicModifyIORef - warn: lhs: "Data.IORef.atomicModifyIORef'" name: "Use 'atomicModifyIORef'' from Relude" note: "'atomicModifyIORef'' is already exported from Relude" rhs: "atomicModifyIORef'" - warn: lhs: Data.IORef.atomicWriteIORef name: "Use 'atomicWriteIORef' from Relude" note: "'atomicWriteIORef' is already exported from Relude" rhs: atomicWriteIORef - warn: lhs: Data.IORef.modifyIORef name: "Use 'modifyIORef' from Relude" note: "'modifyIORef' is already exported from Relude" rhs: modifyIORef - warn: lhs: "Data.IORef.modifyIORef'" name: "Use 'modifyIORef'' from Relude" note: "'modifyIORef'' is already exported from Relude" rhs: "modifyIORef'" - warn: lhs: Data.IORef.newIORef name: "Use 'newIORef' from Relude" note: "'newIORef' is already exported from Relude" rhs: newIORef - warn: lhs: Data.IORef.readIORef name: "Use 'readIORef' from Relude" note: "'readIORef' is already exported from Relude" rhs: readIORef - warn: lhs: Data.IORef.writeIORef name: "Use 'writeIORef' from Relude" note: "'writeIORef' is already exported from Relude" rhs: writeIORef - warn: lhs: "atomicModifyIORef ref (\\a -> (f a, mempty))" rhs: atomicModifyIORef_ ref f - warn: lhs: "atomicModifyIORef ref $ \\a -> (f a, mempty)" rhs: atomicModifyIORef_ ref f - warn: lhs: "atomicModifyIORef' ref $ \\a -> (f a, mempty)" rhs: "atomicModifyIORef'_ ref f" - warn: lhs: "atomicModifyIORef' ref (\\a -> (f a, mempty))" rhs: "atomicModifyIORef'_ ref f" - warn: lhs: Data.Text.IO.getLine name: "Use 'getLine' from Relude" note: "'getLine' is already exported from Relude" rhs: getLine - warn: lhs: System.IO.hFlush name: "Use 'hFlush' from Relude" note: "'hFlush' is already exported from Relude" rhs: hFlush - warn: lhs: System.IO.hIsEOF name: "Use 'hIsEOF' from Relude" note: "'hIsEOF' is already exported from Relude" rhs: hIsEOF - warn: lhs: System.IO.hSetBuffering name: "Use 'hSetBuffering' from Relude" note: "'hSetBuffering' is already exported from Relude" rhs: hSetBuffering - warn: lhs: System.IO.hGetBuffering name: "Use 'hGetBuffering' from Relude" note: "'hGetBuffering' is already exported from Relude" rhs: hGetBuffering - warn: lhs: System.IO.Handle name: "Use 'Handle' from Relude" note: "'Handle' is already exported from Relude" rhs: Handle - warn: lhs: System.IO.stdin name: "Use 'stdin' from Relude" note: "'stdin' is already exported from Relude" rhs: stdin - warn: lhs: System.IO.stdout name: "Use 'stdout' from Relude" note: "'stdout' is already exported from Relude" rhs: stdout - warn: lhs: System.IO.stderr name: "Use 'stderr' from Relude" note: "'stderr' is already exported from Relude" rhs: stderr - warn: lhs: System.IO.withFile name: "Use 'withFile' from Relude" note: "'withFile' is already exported from Relude" rhs: withFile - warn: lhs: System.IO.BufferMode name: "Use 'BufferMode' from Relude" note: "'BufferMode' is already exported from Relude" rhs: BufferMode - warn: lhs: System.Environment.getArgs name: "Use 'getArgs' from Relude" note: "'getArgs' is already exported from Relude" rhs: getArgs - warn: lhs: System.Environment.lookupEnv name: "Use 'lookupEnv' from Relude" note: "'lookupEnv' is already exported from Relude" rhs: lookupEnv - warn: lhs: Data.List.genericDrop name: "Use 'genericDrop' from Relude" note: "'genericDrop' is already exported from Relude" rhs: genericDrop - warn: lhs: Data.List.genericLength name: "Use 'genericLength' from Relude" note: "'genericLength' is already exported from Relude" rhs: genericLength - warn: lhs: Data.List.genericReplicate name: "Use 'genericReplicate' from Relude" note: "'genericReplicate' is already exported from Relude" rhs: genericReplicate - warn: lhs: Data.List.genericSplitAt name: "Use 'genericSplitAt' from Relude" note: "'genericSplitAt' is already exported from Relude" rhs: genericSplitAt - warn: lhs: Data.List.genericTake name: "Use 'genericTake' from Relude" note: "'genericTake' is already exported from Relude" rhs: genericTake - warn: lhs: Data.List.group name: "Use 'group' from Relude" note: "'group' is already exported from Relude" rhs: group - warn: lhs: Data.List.inits name: "Use 'inits' from Relude" note: "'inits' is already exported from Relude" rhs: inits - warn: lhs: Data.List.intercalate name: "Use 'intercalate' from Relude" note: "'intercalate' is already exported from Relude" rhs: intercalate - warn: lhs: Data.List.intersperse name: "Use 'intersperse' from Relude" note: "'intersperse' is already exported from Relude" rhs: intersperse - warn: lhs: Data.List.isPrefixOf name: "Use 'isPrefixOf' from Relude" note: "'isPrefixOf' is already exported from Relude" rhs: isPrefixOf - warn: lhs: Data.List.permutations name: "Use 'permutations' from Relude" note: "'permutations' is already exported from Relude" rhs: permutations - warn: lhs: "Data.List.scanl'" name: "Use 'scanl'' from Relude" note: "'scanl'' is already exported from Relude" rhs: "scanl'" - warn: lhs: Data.List.sort name: "Use 'sort' from Relude" note: "'sort' is already exported from Relude" rhs: sort - warn: lhs: Data.List.sortBy name: "Use 'sortBy' from Relude" note: "'sortBy' is already exported from Relude" rhs: sortBy - warn: lhs: Data.List.sortOn name: "Use 'sortOn' from Relude" note: "'sortOn' is already exported from Relude" rhs: sortOn - warn: lhs: Data.List.subsequences name: "Use 'subsequences' from Relude" note: "'subsequences' is already exported from Relude" rhs: subsequences - warn: lhs: Data.List.tails name: "Use 'tails' from Relude" note: "'tails' is already exported from Relude" rhs: tails - warn: lhs: Data.List.transpose name: "Use 'transpose' from Relude" note: "'transpose' is already exported from Relude" rhs: transpose - warn: lhs: Data.List.uncons name: "Use 'uncons' from Relude" note: "'uncons' is already exported from Relude" rhs: uncons - warn: lhs: Data.List.unfoldr name: "Use 'unfoldr' from Relude" note: "'unfoldr' is already exported from Relude" rhs: unfoldr - warn: lhs: Data.List.NonEmpty.NonEmpty name: "Use 'NonEmpty' from Relude" note: "'NonEmpty' is already exported from Relude" rhs: NonEmpty - warn: lhs: "(Data.List.NonEmpty.:|)" name: "Use ':|' from Relude" note: "Operator '(:|)' is already exported from Relude" rhs: "(:|)" - warn: lhs: Data.List.NonEmpty.nonEmpty name: "Use 'nonEmpty' from Relude" note: "'nonEmpty' is already exported from Relude" rhs: nonEmpty - warn: lhs: Data.List.NonEmpty.head name: "Use 'head' from Relude" note: "'head' is already exported from Relude" rhs: head - warn: lhs: Data.List.NonEmpty.init name: "Use 'init' from Relude" note: "'init' is already exported from Relude" rhs: init - warn: lhs: Data.List.NonEmpty.last name: "Use 'last' from Relude" note: "'last' is already exported from Relude" rhs: last - warn: lhs: Data.List.NonEmpty.tail name: "Use 'tail' from Relude" note: "'tail' is already exported from Relude" rhs: tail - warn: lhs: GHC.Exts.sortWith name: "Use 'sortWith' from Relude" note: "'sortWith' is already exported from Relude" rhs: sortWith - warn: lhs: Control.Monad.Except.ExceptT name: "Use 'ExceptT' from Relude" note: "'ExceptT' is already exported from Relude" rhs: ExceptT - warn: lhs: Control.Monad.Except.runExceptT name: "Use 'runExceptT' from Relude" note: "'runExceptT' is already exported from Relude" rhs: runExceptT - warn: lhs: Control.Monad.Reader.MonadReader name: "Use 'MonadReader' from Relude" note: "'MonadReader' is already exported from Relude" rhs: MonadReader - warn: lhs: Control.Monad.Reader.Reader name: "Use 'Reader' from Relude" note: "'Reader' is already exported from Relude" rhs: Reader - warn: lhs: Control.Monad.Reader.ReaderT name: "Use 'ReaderT' from Relude" note: "'ReaderT' is already exported from Relude" rhs: ReaderT - warn: lhs: Control.Monad.Reader.runReaderT name: "Use 'runReaderT' from Relude" note: "'runReaderT' is already exported from Relude" rhs: runReaderT - warn: lhs: Control.Monad.Reader.ask name: "Use 'ask' from Relude" note: "'ask' is already exported from Relude" rhs: ask - warn: lhs: Control.Monad.Reader.asks name: "Use 'asks' from Relude" note: "'asks' is already exported from Relude" rhs: asks - warn: lhs: Control.Monad.Reader.local name: "Use 'local' from Relude" note: "'local' is already exported from Relude" rhs: local - warn: lhs: Control.Monad.Reader.reader name: "Use 'reader' from Relude" note: "'reader' is already exported from Relude" rhs: reader - warn: lhs: Control.Monad.Reader.runReader name: "Use 'runReader' from Relude" note: "'runReader' is already exported from Relude" rhs: runReader - warn: lhs: Control.Monad.Reader.withReader name: "Use 'withReader' from Relude" note: "'withReader' is already exported from Relude" rhs: withReader - warn: lhs: Control.Monad.Reader.withReaderT name: "Use 'withReaderT' from Relude" note: "'withReaderT' is already exported from Relude" rhs: withReaderT - warn: lhs: Control.Monad.State.Strict.MonadState name: "Use 'MonadState' from Relude" note: "'MonadState' is already exported from Relude" rhs: MonadState - warn: lhs: Control.Monad.State.Strict.State name: "Use 'State' from Relude" note: "'State' is already exported from Relude" rhs: State - warn: lhs: Control.Monad.State.Strict.StateT name: "Use 'StateT' from Relude" note: "'StateT' is already exported from Relude" rhs: StateT - warn: lhs: Control.Monad.State.Strict.runStateT name: "Use 'runStateT' from Relude" note: "'runStateT' is already exported from Relude" rhs: runStateT - warn: lhs: Control.Monad.State.Strict.evalState name: "Use 'evalState' from Relude" note: "'evalState' is already exported from Relude" rhs: evalState - warn: lhs: Control.Monad.State.Strict.evalStateT name: "Use 'evalStateT' from Relude" note: "'evalStateT' is already exported from Relude" rhs: evalStateT - warn: lhs: Control.Monad.State.Strict.execState name: "Use 'execState' from Relude" note: "'execState' is already exported from Relude" rhs: execState - warn: lhs: Control.Monad.State.Strict.execStateT name: "Use 'execStateT' from Relude" note: "'execStateT' is already exported from Relude" rhs: execStateT - warn: lhs: Control.Monad.State.Strict.get name: "Use 'get' from Relude" note: "'get' is already exported from Relude" rhs: get - warn: lhs: Control.Monad.State.Strict.gets name: "Use 'gets' from Relude" note: "'gets' is already exported from Relude" rhs: gets - warn: lhs: Control.Monad.State.Strict.modify name: "Use 'modify' from Relude" note: "'modify' is already exported from Relude" rhs: modify - warn: lhs: "Control.Monad.State.Strict.modify'" name: "Use 'modify'' from Relude" note: "'modify'' is already exported from Relude" rhs: "modify'" - warn: lhs: Control.Monad.State.Strict.put name: "Use 'put' from Relude" note: "'put' is already exported from Relude" rhs: put - warn: lhs: Control.Monad.State.Strict.runState name: "Use 'runState' from Relude" note: "'runState' is already exported from Relude" rhs: runState - warn: lhs: Control.Monad.State.Strict.state name: "Use 'state' from Relude" note: "'state' is already exported from Relude" rhs: state - warn: lhs: Control.Monad.State.Strict.withState name: "Use 'withState' from Relude" note: "'withState' is already exported from Relude" rhs: withState - warn: lhs: Control.Monad.Trans.MonadIO name: "Use 'MonadIO' from Relude" note: "'MonadIO' is already exported from Relude" rhs: MonadIO - warn: lhs: Control.Monad.Trans.MonadTrans name: "Use 'MonadTrans' from Relude" note: "'MonadTrans' is already exported from Relude" rhs: MonadTrans - warn: lhs: Control.Monad.Trans.lift name: "Use 'lift' from Relude" note: "'lift' is already exported from Relude" rhs: lift - warn: lhs: Control.Monad.Trans.liftIO name: "Use 'liftIO' from Relude" note: "'liftIO' is already exported from Relude" rhs: liftIO - warn: lhs: Control.Monad.Trans.Identity.IdentityT name: "Use 'IdentityT' from Relude" note: "'IdentityT' is already exported from Relude" rhs: IdentityT - warn: lhs: Control.Monad.Trans.Identity.runIdentityT name: "Use 'runIdentityT' from Relude" note: "'runIdentityT' is already exported from Relude" rhs: runIdentityT - warn: lhs: Control.Monad.Trans.Maybe.MaybeT name: "Use 'MaybeT' from Relude" note: "'MaybeT' is already exported from Relude" rhs: MaybeT - warn: lhs: Control.Monad.Trans.Maybe.maybeToExceptT name: "Use 'maybeToExceptT' from Relude" note: "'maybeToExceptT' is already exported from Relude" rhs: maybeToExceptT - warn: lhs: Control.Monad.Trans.Maybe.exceptToMaybeT name: "Use 'exceptToMaybeT' from Relude" note: "'exceptToMaybeT' is already exported from Relude" rhs: exceptToMaybeT - warn: lhs: Control.Monad.MonadPlus name: "Use 'MonadPlus' from Relude" note: "'MonadPlus' is already exported from Relude" rhs: MonadPlus - warn: lhs: Control.Monad.mzero name: "Use 'mzero' from Relude" note: "'mzero' is already exported from Relude" rhs: mzero - warn: lhs: Control.Monad.mplus name: "Use 'mplus' from Relude" note: "'mplus' is already exported from Relude" rhs: mplus - warn: lhs: Control.Monad.filterM name: "Use 'filterM' from Relude" note: "'filterM' is already exported from Relude" rhs: filterM - warn: lhs: Control.Monad.forever name: "Use 'forever' from Relude" note: "'forever' is already exported from Relude" rhs: forever - warn: lhs: Control.Monad.join name: "Use 'join' from Relude" note: "'join' is already exported from Relude" rhs: join - warn: lhs: Control.Monad.mapAndUnzipM name: "Use 'mapAndUnzipM' from Relude" note: "'mapAndUnzipM' is already exported from Relude" rhs: mapAndUnzipM - warn: lhs: Control.Monad.mfilter name: "Use 'mfilter' from Relude" note: "'mfilter' is already exported from Relude" rhs: mfilter - warn: lhs: Control.Monad.replicateM name: "Use 'replicateM' from Relude" note: "'replicateM' is already exported from Relude" rhs: replicateM - warn: lhs: Control.Monad.replicateM_ name: "Use 'replicateM_' from Relude" note: "'replicateM_' is already exported from Relude" rhs: replicateM_ - warn: lhs: Control.Monad.zipWithM name: "Use 'zipWithM' from Relude" note: "'zipWithM' is already exported from Relude" rhs: zipWithM - warn: lhs: Control.Monad.zipWithM_ name: "Use 'zipWithM_' from Relude" note: "'zipWithM_' is already exported from Relude" rhs: zipWithM_ - warn: lhs: "(Control.Monad.<$!>)" name: "Use '<$!>' from Relude" note: "Operator '(<$!>)' is already exported from Relude" rhs: "(<$!>)" - warn: lhs: "(Control.Monad.<=<)" name: "Use '<=<' from Relude" note: "Operator '(<=<)' is already exported from Relude" rhs: "(<=<)" - warn: lhs: "(Control.Monad.=<<)" name: "Use '=<<' from Relude" note: "Operator '(=<<)' is already exported from Relude" rhs: "(=<<)" - warn: lhs: "(Control.Monad.>=>)" name: "Use '>=>' from Relude" note: "Operator '(>=>)' is already exported from Relude" rhs: "(>=>)" - warn: lhs: Control.Monad.Fail.MonadFail name: "Use 'MonadFail' from Relude" note: "'MonadFail' is already exported from Relude" rhs: MonadFail - warn: lhs: Data.Maybe.catMaybes name: "Use 'catMaybes' from Relude" note: "'catMaybes' is already exported from Relude" rhs: catMaybes - warn: lhs: Data.Maybe.fromMaybe name: "Use 'fromMaybe' from Relude" note: "'fromMaybe' is already exported from Relude" rhs: fromMaybe - warn: lhs: Data.Maybe.isJust name: "Use 'isJust' from Relude" note: "'isJust' is already exported from Relude" rhs: isJust - warn: lhs: Data.Maybe.isNothing name: "Use 'isNothing' from Relude" note: "'isNothing' is already exported from Relude" rhs: isNothing - warn: lhs: Data.Maybe.listToMaybe name: "Use 'listToMaybe' from Relude" note: "'listToMaybe' is already exported from Relude" rhs: listToMaybe - warn: lhs: Data.Maybe.mapMaybe name: "Use 'mapMaybe' from Relude" note: "'mapMaybe' is already exported from Relude" rhs: mapMaybe - warn: lhs: Data.Maybe.maybeToList name: "Use 'maybeToList' from Relude" note: "'maybeToList' is already exported from Relude" rhs: maybeToList - warn: lhs: Data.Either.isLeft name: "Use 'isLeft' from Relude" note: "'isLeft' is already exported from Relude" rhs: isLeft - warn: lhs: Data.Either.isRight name: "Use 'isRight' from Relude" note: "'isRight' is already exported from Relude" rhs: isRight - warn: lhs: Data.Either.lefts name: "Use 'lefts' from Relude" note: "'lefts' is already exported from Relude" rhs: lefts - warn: lhs: Data.Either.partitionEithers name: "Use 'partitionEithers' from Relude" note: "'partitionEithers' is already exported from Relude" rhs: partitionEithers - warn: lhs: Data.Either.rights name: "Use 'rights' from Relude" note: "'rights' is already exported from Relude" rhs: rights - warn: lhs: Data.Monoid.All name: "Use 'All' from Relude" note: "'All' is already exported from Relude" rhs: All - warn: lhs: Data.Monoid.getAll name: "Use 'getAll' from Relude" note: "'getAll' is already exported from Relude" rhs: getAll - warn: lhs: Data.Monoid.Alt name: "Use 'Alt' from Relude" note: "'Alt' is already exported from Relude" rhs: Alt - warn: lhs: Data.Monoid.getAlt name: "Use 'getAlt' from Relude" note: "'getAlt' is already exported from Relude" rhs: getAlt - warn: lhs: Data.Monoid.Any name: "Use 'Any' from Relude" note: "'Any' is already exported from Relude" rhs: Any - warn: lhs: Data.Monoid.getAny name: "Use 'getAny' from Relude" note: "'getAny' is already exported from Relude" rhs: getAny - warn: lhs: Data.Monoid.Ap name: "Use 'Ap' from Relude" note: "'Ap' is already exported from Relude" rhs: Ap - warn: lhs: Data.Monoid.getAp name: "Use 'getAp' from Relude" note: "'getAp' is already exported from Relude" rhs: getAp - warn: lhs: Data.Monoid.Dual name: "Use 'Dual' from Relude" note: "'Dual' is already exported from Relude" rhs: Dual - warn: lhs: Data.Monoid.getDual name: "Use 'getDual' from Relude" note: "'getDual' is already exported from Relude" rhs: getDual - warn: lhs: Data.Monoid.Endo name: "Use 'Endo' from Relude" note: "'Endo' is already exported from Relude" rhs: Endo - warn: lhs: Data.Monoid.appEndo name: "Use 'appEndo' from Relude" note: "'appEndo' is already exported from Relude" rhs: appEndo - warn: lhs: Data.Monoid.First name: "Use 'First' from Relude" note: "'First' is already exported from Relude" rhs: First - warn: lhs: Data.Monoid.getFirst name: "Use 'getFirst' from Relude" note: "'getFirst' is already exported from Relude" rhs: getFirst - warn: lhs: Data.Monoid.Last name: "Use 'Last' from Relude" note: "'Last' is already exported from Relude" rhs: Last - warn: lhs: Data.Monoid.getLast name: "Use 'getLast' from Relude" note: "'getLast' is already exported from Relude" rhs: getLast - warn: lhs: Data.Monoid.Product name: "Use 'Product' from Relude" note: "'Product' is already exported from Relude" rhs: Product - warn: lhs: Data.Monoid.getProduct name: "Use 'getProduct' from Relude" note: "'getProduct' is already exported from Relude" rhs: getProduct - warn: lhs: Data.Monoid.Sum name: "Use 'Sum' from Relude" note: "'Sum' is already exported from Relude" rhs: Sum - warn: lhs: Data.Monoid.getSum name: "Use 'getSum' from Relude" note: "'getSum' is already exported from Relude" rhs: getSum - warn: lhs: Data.Semigroup.Option name: "Use 'Option' from Relude" note: "'Option' is already exported from Relude" rhs: Option - warn: lhs: Data.Semigroup.getOption name: "Use 'getOption' from Relude" note: "'getOption' is already exported from Relude" rhs: getOption - warn: lhs: Data.Semigroup.Semigroup name: "Use 'Semigroup' from Relude" note: "'Semigroup' is already exported from Relude" rhs: Semigroup - warn: lhs: Data.Semigroup.sconcat name: "Use 'sconcat' from Relude" note: "'sconcat' is already exported from Relude" rhs: sconcat - warn: lhs: Data.Semigroup.stimes name: "Use 'stimes' from Relude" note: "'stimes' is already exported from Relude" rhs: stimes - warn: lhs: "(Data.Semigroup.<>)" name: "Use '<>' from Relude" note: "Operator '(<>)' is already exported from Relude" rhs: "(<>)" - warn: lhs: Data.Semigroup.WrappedMonoid name: "Use 'WrappedMonoid' from Relude" note: "'WrappedMonoid' is already exported from Relude" rhs: WrappedMonoid - warn: lhs: Data.Semigroup.cycle1 name: "Use 'cycle1' from Relude" note: "'cycle1' is already exported from Relude" rhs: cycle1 - warn: lhs: Data.Semigroup.mtimesDefault name: "Use 'mtimesDefault' from Relude" note: "'mtimesDefault' is already exported from Relude" rhs: mtimesDefault - warn: lhs: Data.Semigroup.stimesIdempotent name: "Use 'stimesIdempotent' from Relude" note: "'stimesIdempotent' is already exported from Relude" rhs: stimesIdempotent - warn: lhs: Data.Semigroup.stimesIdempotentMonoid name: "Use 'stimesIdempotentMonoid' from Relude" note: "'stimesIdempotentMonoid' is already exported from Relude" rhs: stimesIdempotentMonoid - warn: lhs: Data.Semigroup.stimesMonoid name: "Use 'stimesMonoid' from Relude" note: "'stimesMonoid' is already exported from Relude" rhs: stimesMonoid - warn: lhs: Data.ByteString.ByteString name: "Use 'ByteString' from Relude" note: "'ByteString' is already exported from Relude" rhs: ByteString - warn: lhs: Data.ByteString.Short.ShortByteString name: "Use 'ShortByteString' from Relude" note: "'ShortByteString' is already exported from Relude" rhs: ShortByteString - warn: lhs: Data.ByteString.Short.toShort name: "Use 'toShort' from Relude" note: "'toShort' is already exported from Relude" rhs: toShort - warn: lhs: Data.ByteString.Short.fromShort name: "Use 'fromShort' from Relude" note: "'fromShort' is already exported from Relude" rhs: fromShort - warn: lhs: Data.String.IsString name: "Use 'IsString' from Relude" note: "'IsString' is already exported from Relude" rhs: IsString - warn: lhs: Data.String.fromString name: "Use 'fromString' from Relude" note: "'fromString' is already exported from Relude" rhs: fromString - warn: lhs: Data.Text.Text name: "Use 'Text' from Relude" note: "'Text' is already exported from Relude" rhs: Text - warn: lhs: Data.Text.lines name: "Use 'lines' from Relude" note: "'lines' is already exported from Relude" rhs: lines - warn: lhs: Data.Text.unlines name: "Use 'unlines' from Relude" note: "'unlines' is already exported from Relude" rhs: unlines - warn: lhs: Data.Text.words name: "Use 'words' from Relude" note: "'words' is already exported from Relude" rhs: words - warn: lhs: Data.Text.unwords name: "Use 'unwords' from Relude" note: "'unwords' is already exported from Relude" rhs: unwords - warn: lhs: "Data.Text.Encoding.decodeUtf8'" name: "Use 'decodeUtf8'' from Relude" note: "'decodeUtf8'' is already exported from Relude" rhs: "decodeUtf8'" - warn: lhs: Data.Text.Encoding.decodeUtf8With name: "Use 'decodeUtf8With' from Relude" note: "'decodeUtf8With' is already exported from Relude" rhs: decodeUtf8With - warn: lhs: Data.Text.Encoding.Error.OnDecodeError name: "Use 'OnDecodeError' from Relude" note: "'OnDecodeError' is already exported from Relude" rhs: OnDecodeError - warn: lhs: Data.Text.Encoding.Error.OnError name: "Use 'OnError' from Relude" note: "'OnError' is already exported from Relude" rhs: OnError - warn: lhs: Data.Text.Encoding.Error.UnicodeException name: "Use 'UnicodeException' from Relude" note: "'UnicodeException' is already exported from Relude" rhs: UnicodeException - warn: lhs: Data.Text.Encoding.Error.lenientDecode name: "Use 'lenientDecode' from Relude" note: "'lenientDecode' is already exported from Relude" rhs: lenientDecode - warn: lhs: Data.Text.Encoding.Error.strictDecode name: "Use 'strictDecode' from Relude" note: "'strictDecode' is already exported from Relude" rhs: strictDecode - warn: lhs: Text.Read.Read name: "Use 'Read' from Relude" note: "'Read' is already exported from Relude" rhs: Read - warn: lhs: Text.Read.readMaybe name: "Use 'readMaybe' from Relude" note: "'readMaybe' is already exported from Relude" rhs: readMaybe - warn: lhs: "(liftIO (newEmptyMVar ))" name: "'liftIO' is not needed" note: "If you import 'newEmptyMVar' from Relude, it's already lifted" rhs: newEmptyMVar - warn: lhs: "(liftIO (newMVar x))" name: "'liftIO' is not needed" note: "If you import 'newMVar' from Relude, it's already lifted" rhs: newMVar - warn: lhs: "(liftIO (putMVar x y))" name: "'liftIO' is not needed" note: "If you import 'putMVar' from Relude, it's already lifted" rhs: putMVar - warn: lhs: "(liftIO (readMVar x))" name: "'liftIO' is not needed" note: "If you import 'readMVar' from Relude, it's already lifted" rhs: readMVar - warn: lhs: "(liftIO (swapMVar x y))" name: "'liftIO' is not needed" note: "If you import 'swapMVar' from Relude, it's already lifted" rhs: swapMVar - warn: lhs: "(liftIO (takeMVar x))" name: "'liftIO' is not needed" note: "If you import 'takeMVar' from Relude, it's already lifted" rhs: takeMVar - warn: lhs: "(liftIO (tryPutMVar x y))" name: "'liftIO' is not needed" note: "If you import 'tryPutMVar' from Relude, it's already lifted" rhs: tryPutMVar - warn: lhs: "(liftIO (tryReadMVar x))" name: "'liftIO' is not needed" note: "If you import 'tryReadMVar' from Relude, it's already lifted" rhs: tryReadMVar - warn: lhs: "(liftIO (tryTakeMVar x))" name: "'liftIO' is not needed" note: "If you import 'tryTakeMVar' from Relude, it's already lifted" rhs: tryTakeMVar - warn: lhs: "(liftIO (atomically x))" name: "'liftIO' is not needed" note: "If you import 'atomically' from Relude, it's already lifted" rhs: atomically - warn: lhs: "(liftIO (newTVarIO x))" name: "'liftIO' is not needed" note: "If you import 'newTVarIO' from Relude, it's already lifted" rhs: newTVarIO - warn: lhs: "(liftIO (readTVarIO x))" name: "'liftIO' is not needed" note: "If you import 'readTVarIO' from Relude, it's already lifted" rhs: readTVarIO - warn: lhs: "(liftIO (newTMVarIO x))" name: "'liftIO' is not needed" note: "If you import 'newTMVarIO' from Relude, it's already lifted" rhs: newTMVarIO - warn: lhs: "(liftIO (newEmptyTMVarIO ))" name: "'liftIO' is not needed" note: "If you import 'newEmptyTMVarIO' from Relude, it's already lifted" rhs: newEmptyTMVarIO - warn: lhs: "(liftIO (exitWith x))" name: "'liftIO' is not needed" note: "If you import 'exitWith' from Relude, it's already lifted" rhs: exitWith - warn: lhs: "(liftIO (exitFailure ))" name: "'liftIO' is not needed" note: "If you import 'exitFailure' from Relude, it's already lifted" rhs: exitFailure - warn: lhs: "(liftIO (exitSuccess ))" name: "'liftIO' is not needed" note: "If you import 'exitSuccess' from Relude, it's already lifted" rhs: exitSuccess - warn: lhs: "(liftIO (die x))" name: "'liftIO' is not needed" note: "If you import 'die' from Relude, it's already lifted" rhs: die - warn: lhs: "(liftIO (readFile x))" name: "'liftIO' is not needed" note: "If you import 'readFile' from Relude, it's already lifted" rhs: readFile - warn: lhs: "(liftIO (writeFile x y))" name: "'liftIO' is not needed" note: "If you import 'writeFile' from Relude, it's already lifted" rhs: writeFile - warn: lhs: "(liftIO (appendFile x y))" name: "'liftIO' is not needed" note: "If you import 'appendFile' from Relude, it's already lifted" rhs: appendFile - warn: lhs: "(liftIO (readFileText x))" name: "'liftIO' is not needed" note: "If you import 'readFileText' from Relude, it's already lifted" rhs: readFileText - warn: lhs: "(liftIO (writeFileText x y))" name: "'liftIO' is not needed" note: "If you import 'writeFileText' from Relude, it's already lifted" rhs: writeFileText - warn: lhs: "(liftIO (appendFileText x y))" name: "'liftIO' is not needed" note: "If you import 'appendFileText' from Relude, it's already lifted" rhs: appendFileText - warn: lhs: "(liftIO (readFileLText x))" name: "'liftIO' is not needed" note: "If you import 'readFileLText' from Relude, it's already lifted" rhs: readFileLText - warn: lhs: "(liftIO (writeFileLText x y))" name: "'liftIO' is not needed" note: "If you import 'writeFileLText' from Relude, it's already lifted" rhs: writeFileLText - warn: lhs: "(liftIO (appendFileLText x y))" name: "'liftIO' is not needed" note: "If you import 'appendFileLText' from Relude, it's already lifted" rhs: appendFileLText - warn: lhs: "(liftIO (readFileBS x))" name: "'liftIO' is not needed" note: "If you import 'readFileBS' from Relude, it's already lifted" rhs: readFileBS - warn: lhs: "(liftIO (writeFileBS x y))" name: "'liftIO' is not needed" note: "If you import 'writeFileBS' from Relude, it's already lifted" rhs: writeFileBS - warn: lhs: "(liftIO (appendFileBS x y))" name: "'liftIO' is not needed" note: "If you import 'appendFileBS' from Relude, it's already lifted" rhs: appendFileBS - warn: lhs: "(liftIO (readFileLBS x))" name: "'liftIO' is not needed" note: "If you import 'readFileLBS' from Relude, it's already lifted" rhs: readFileLBS - warn: lhs: "(liftIO (writeFileLBS x y))" name: "'liftIO' is not needed" note: "If you import 'writeFileLBS' from Relude, it's already lifted" rhs: writeFileLBS - warn: lhs: "(liftIO (appendFileLBS x y))" name: "'liftIO' is not needed" note: "If you import 'appendFileLBS' from Relude, it's already lifted" rhs: appendFileLBS - warn: lhs: "(liftIO (newIORef x))" name: "'liftIO' is not needed" note: "If you import 'newIORef' from Relude, it's already lifted" rhs: newIORef - warn: lhs: "(liftIO (readIORef x))" name: "'liftIO' is not needed" note: "If you import 'readIORef' from Relude, it's already lifted" rhs: readIORef - warn: lhs: "(liftIO (writeIORef x y))" name: "'liftIO' is not needed" note: "If you import 'writeIORef' from Relude, it's already lifted" rhs: writeIORef - warn: lhs: "(liftIO (modifyIORef x y))" name: "'liftIO' is not needed" note: "If you import 'modifyIORef' from Relude, it's already lifted" rhs: modifyIORef - warn: lhs: "(liftIO (modifyIORef' x y))" name: "'liftIO' is not needed" note: "If you import 'modifyIORef'' from Relude, it's already lifted" rhs: "modifyIORef'" - warn: lhs: "(liftIO (atomicModifyIORef x y))" name: "'liftIO' is not needed" note: "If you import 'atomicModifyIORef' from Relude, it's already lifted" rhs: atomicModifyIORef - warn: lhs: "(liftIO (atomicModifyIORef' x y))" name: "'liftIO' is not needed" note: "If you import 'atomicModifyIORef'' from Relude, it's already lifted" rhs: "atomicModifyIORef'" - warn: lhs: "(liftIO (atomicWriteIORef x y))" name: "'liftIO' is not needed" note: "If you import 'atomicWriteIORef' from Relude, it's already lifted" rhs: atomicWriteIORef - warn: lhs: "(liftIO (getLine ))" name: "'liftIO' is not needed" note: "If you import 'getLine' from Relude, it's already lifted" rhs: getLine - warn: lhs: "(liftIO (print x))" name: "'liftIO' is not needed" note: "If you import 'print' from Relude, it's already lifted" rhs: print - warn: lhs: "(liftIO (putStr x))" name: "'liftIO' is not needed" note: "If you import 'putStr' from Relude, it's already lifted" rhs: putStr - warn: lhs: "(liftIO (putStrLn x))" name: "'liftIO' is not needed" note: "If you import 'putStrLn' from Relude, it's already lifted" rhs: putStrLn - warn: lhs: "(liftIO (putText x))" name: "'liftIO' is not needed" note: "If you import 'putText' from Relude, it's already lifted" rhs: putText - warn: lhs: "(liftIO (putTextLn x))" name: "'liftIO' is not needed" note: "If you import 'putTextLn' from Relude, it's already lifted" rhs: putTextLn - warn: lhs: "(liftIO (putLText x))" name: "'liftIO' is not needed" note: "If you import 'putLText' from Relude, it's already lifted" rhs: putLText - warn: lhs: "(liftIO (putLTextLn x))" name: "'liftIO' is not needed" note: "If you import 'putLTextLn' from Relude, it's already lifted" rhs: putLTextLn - warn: lhs: "(liftIO (putBS x))" name: "'liftIO' is not needed" note: "If you import 'putBS' from Relude, it's already lifted" rhs: putBS - warn: lhs: "(liftIO (putBSLn x))" name: "'liftIO' is not needed" note: "If you import 'putBSLn' from Relude, it's already lifted" rhs: putBSLn - warn: lhs: "(liftIO (putLBS x))" name: "'liftIO' is not needed" note: "If you import 'putLBS' from Relude, it's already lifted" rhs: putLBS - warn: lhs: "(liftIO (putLBSLn x))" name: "'liftIO' is not needed" note: "If you import 'putLBSLn' from Relude, it's already lifted" rhs: putLBSLn - warn: lhs: "(liftIO (hFlush x))" name: "'liftIO' is not needed" note: "If you import 'hFlush' from Relude, it's already lifted" rhs: hFlush - warn: lhs: "(liftIO (hIsEOF x))" name: "'liftIO' is not needed" note: "If you import 'hIsEOF' from Relude, it's already lifted" rhs: hIsEOF - warn: lhs: "(liftIO (hSetBuffering x y))" name: "'liftIO' is not needed" note: "If you import 'hSetBuffering' from Relude, it's already lifted" rhs: hSetBuffering - warn: lhs: "(liftIO (hGetBuffering x))" name: "'liftIO' is not needed" note: "If you import 'hGetBuffering' from Relude, it's already lifted" rhs: hGetBuffering - warn: lhs: "(liftIO (getArgs ))" name: "'liftIO' is not needed" note: "If you import 'getArgs' from Relude, it's already lifted" rhs: getArgs - warn: lhs: "(liftIO (lookupEnv x))" name: "'liftIO' is not needed" note: "If you import 'lookupEnv' from Relude, it's already lifted" rhs: lookupEnv - hint: lhs: "fmap (bimap f g)" note: "Use `bimapF` from `Relude.Extra.Bifunctor`" rhs: bimapF f g - hint: lhs: "bimap f g <$> x" note: "Use `bimapF` from `Relude.Extra.Bifunctor`" rhs: bimapF f g x - hint: lhs: "fmap (first f)" note: "Use `firstF` from `Relude.Extra.Bifunctor`" rhs: firstF f - hint: lhs: fmap . first note: "Use `firstF` from `Relude.Extra.Bifunctor`" rhs: firstF - hint: lhs: "fmap (second f)" note: "Use `secondF` from `Relude.Extra.Bifunctor`" rhs: secondF f - hint: lhs: fmap . second note: "Use `secondF` from `Relude.Extra.Bifunctor`" rhs: secondF - hint: lhs: "[minBound .. maxBound]" note: "Use `universe` from `Relude.Extra.Enum`" rhs: universe - hint: lhs: toEnum note: "`toEnum` from `Prelude` is a pure function but it may throw exception. Consider using `safeToEnum` from `Relude.Extra.Enum` instead." rhs: safeToEnum - hint: lhs: sum xs / length xs note: "Use `average` from `Relude.Extra.Foldable`" rhs: average xs - hint: lhs: "\\a -> (a, a)" note: "Use `dup`" rhs: dup - warn: lhs: "() <$ a" rhs: void a - hint: lhs: "pass" note: "Use 'stub'" rhs: stub - hint: lhs: "bool mempty a b" note: "Use `whenTrue`" rhs: a `whenTrue` b - hint: lhs: "bool a mempty b" note: "Use `whenFalse`" rhs: a `whenFalse` b - hint: lhs: "maybe mempty a b" note: "Use `whenJust`" rhs: a `whenJust` b - hint: lhs: "(mempty, mempty)" note: "Is `mempty`" rhs: mempty - hint: lhs: "concat a" note: "Use `fold`" rhs: fold a - hint: lhs: "mconcat a" note: "Use `fold`" rhs: fold a - hint: lhs: "concatMap a" note: "Use `foldMap`" rhs: foldMap a - hint: lhs: "[a]" note: "Use `one`" rhs: (one a) # Submitted upstream: https://github.com/ndmitchell/hlint/pull/1309 remove when merges - hint: lhs: "either Left f e" note: "Use `=<<`" rhs: f =<< e - warn: {lhs: "init (one x)", rhs: "mempty", name: Evaluate} - warn: {lhs: "null (one x)", rhs: "False", name: Evaluate} - warn: {lhs: "foldr1 f (one x)", rhs: x, name: Evaluate} - warn: {lhs: "scanr f z mempty", rhs: "one z", name: Evaluate} - warn: {lhs: "scanr1 f mempty", rhs: "mempty", name: Evaluate} - warn: {lhs: "scanr1 f (one x)", rhs: "one x", name: Evaluate} - warn: {lhs: "fold (one a)", rhs: a, name: Evaluate} - warn: {lhs: "cycle (one x)", rhs: repeat x} - hint: {lhs: "\\x -> one x", rhs: "(one x)"} - hint: {lhs: "elem x (one y)", rhs: x == y, note: ValidInstance Eq a} - hint: {lhs: "notElem x (one y)", rhs: x /= y, note: ValidInstance Eq a} - warn: {lhs: "sequenceA (one a)", rhs: "pure <$> a"} - warn: {lhs: "head $ x <> one y", rhs: "headDef y x"} - warn: {lhs: "pictures (one p)", rhs: p, name: Evaluate} - hint: lhs: "x : mempty" note: "Use `one`" rhs: one x - hint: lhs: "x :| mempty" note: "Use `one`" rhs: one x - hint: lhs: "join . fmap join" note: "Monad law" rhs: join . join - hint: lhs: "join . fmap pure" note: "Monad law" rhs: id - hint: lhs: "join . pure" note: "Monad law" rhs: id - hint: lhs: "join (f . pure)" note: "Monad law" rhs: (f =<< pure) - hint: lhs: "join . (f <<$>>)" note: "Monad law" rhs: fmap f . join - hint: lhs: "Data.Traversable.sequence" note: "Modern name is `sequenceA`" rhs: sequenceA - hint: lhs: "()" note: "Use `mempty`" rhs: mempty - hint: lhs: "return" note: "Please, use `pure` instead. even GHC already deprecates `return` starting from `9.2`." rhs: pure - hint: lhs: "map" note: "Use `fmap`" rhs: fmap - hint: lhs: "mapM" note: "Use `traverse`" rhs: traverse - hint: lhs: "unless b" note: "Use `when not` as it reads intuitively." rhs: when (not b) ================================================ FILE: CLAUDE.md ================================================ # HNix Codebase Guide for Claude Code This guide provides essential context for working with HNix - a Haskell implementation of the Nix expression language using advanced functional programming techniques including recursion schemes and abstract definitional interpreters. ## Quick Start Commands ### Essential Development Workflow ```bash # Enter development environment nix-shell # Build the project cabal v2-configure cabal v2-build # Run a single test cabal v2-test --test-options="--pattern '/Parser/basic literals/'" # Interactive REPL for exploration cabal v2-repl > :load Nix.Eval > :type evalExprLoc # Quick evaluation test cabal v2-run hnix -- --eval --expr '1 + 1' ``` ### Testing Commands ```bash # Standard test suite cabal v2-test # All tests including Nixpkgs parsing (slow) env ALL_TESTS=yes cabal v2-test # Only Nixpkgs compatibility tests env NIXPKGS_TESTS=yes cabal v2-test # Pretty-printer round-trip tests env PRETTY_TESTS=yes cabal v2-test # Test with coverage cabal v2-configure --enable-coverage cabal v2-test --enable-coverage ``` ### Debugging & Profiling ```bash # Memory profiling (upload .prof to speedscope.app) cabal v2-run --enable-profiling --flags=profiling \ hnix -- --eval --expr 'builtins.length [1 2 3]' +RTS -hy -l # Stack trace on error cabal v2-run hnix -- --trace --eval --expr 'throw "error"' +RTS -xc # Heap profiling for thunk leaks cabal v2-run hnix -- --eval --expr 'import {}' \ +RTS -h -i0.1 -RTS && hp2ps -e8in -c hnix.hp # Reduce complex expressions for minimal repro hnix --reduce bug.nix --eval --expr 'import ./bug.nix' ``` ## Architecture: Working with Recursion Schemes ### Core Expression Types ```haskell -- The functor (non-recursive structure) data NExprF r -- 18 constructors: NConstant, NStr, NSym, NList, etc. -- Fixed point gives recursion type NExpr = Fix NExprF -- Location annotations via composition type NExprLoc = Fix (AnnF SrcSpan NExprF) ``` ### Using ADI for Custom Behavior The `adi` function (`src/Nix/Utils.hs:345`) enables behavior injection: ```haskell -- Example: Add tracing to evaluation tracingEval :: NExprLoc -> m (NValue t f m) tracingEval = adi addTrace baseEval where addTrace :: Transform NExprLocF (m (NValue t f m)) addTrace f e = do traceM $ "Evaluating: " ++ show (void e) result <- f e traceM $ "Result: " ++ show result pure result ``` Common ADI use cases: - **Error context**: `evalWithMetaInfo = adi addMetaInfo evalContent` - **Profiling**: Inject timing measurements at each recursion - **Memoization**: Cache results of sub-expressions - **Debugging**: Track evaluation path ### Free Monad Value System ```haskell type NValue t f m = Free (NValue' t f m) t -- Pure t = thunk (unevaluated) -- Free v = evaluated value ``` **Memory implications**: - Thunks accumulate until forced - Use `force` explicitly to prevent buildup - Monitor with `+RTS -s` for thunk statistics ## Working with the Effect System ### Core Type Classes ```haskell class MonadEval v m where evalExprLoc :: NExprLoc -> m v -- Evaluate expression evalError :: Doc v -> m a -- Report error class MonadThunk t m a | t -> m a where thunk :: m a -> m t -- Create thunk force :: t -> m a -- Force evaluation class (MonadEval v m, MonadThunk t m v) => MonadNix e t f m ``` ### Adding New Effects ```haskell -- Define capability class Monad m => MonadMyEffect m where myOperation :: String -> m Int -- Add to evaluation monad newtype MyNix m a = MyNix (ReaderT MyEnv m a) deriving (Functor, Applicative, Monad) instance MonadMyEffect (MyNix m) where myOperation s = MyNix $ asks (lookupThing s . myEnvData) ``` ## Extending HNix ### Adding Built-ins 1. Add to `src/Nix/Builtins.hs`: ```haskell builtinsList :: [(Text, BuiltinType)] builtinsList = [ ("myBuiltin", arity2 myBuiltinImpl) -- ... ] myBuiltinImpl :: MonadNix e t f m => NValue t f m -> NValue t f m -> m (NValue t f m) myBuiltinImpl arg1 arg2 = do -- Force evaluation if needed str <- fromStringNoContext =<< fromValue arg1 num <- fromValue arg2 -- Perform operation pure $ nvStr $ makeNixString (str <> show num) ``` 2. Test in `tests/EvalTests.hs` 3. Document behavior matching Nix semantics ### Modifying Evaluation ```haskell -- Hook into evaluation via MonadEval instance instance MonadEval (NValue t f m) MyCustomNix where evalExprLoc expr = do -- Pre-evaluation hook logExpression expr -- Delegate to standard evaluation result <- standardEvalExprLoc expr -- Post-evaluation hook recordMetrics expr result pure result ``` ## Common Pitfalls & Solutions ### Memory Issues **Problem**: Thunk accumulation causing memory exhaustion ```haskell -- BAD: Builds huge thunk chain foldl' (\acc x -> thunk (acc + x)) 0 [1..1000000] -- GOOD: Forces evaluation incrementally foldl' (\acc x -> force acc >>= \a -> pure (a + x)) 0 [1..1000000] ``` **Problem**: Lazy fields in strict data ```haskell -- BAD: ~ makes field lazy despite ! on data data MyData = MyData { ~myField :: !Int } -- GOOD: Strict field in strict data data MyData = MyData { myField :: !Int } ``` ### Debugging Infinite Recursion 1. Enable tracing: `--trace` flag 2. Use `--reduce` to minimize test case 3. Add ADI transform to track recursion depth: ```haskell depthCheck :: Transform NExprLocF (ReaderT Int m (NValue t f m)) depthCheck f e = do depth <- ask when (depth > 1000) $ error "Recursion limit" local (+1) (f e) ``` ### Performance Optimization **Profile first**: ```bash # Generate flamegraph cabal v2-run hnix -- --eval --expr 'import {}' \ +RTS -p -RTS ``` **Common optimizations**: 1. Add strictness annotations to accumulators 2. Use `HashMap` instead of association lists 3. Cache frequently computed values 4. Specialize polymorphic functions with `{-# SPECIALIZE #-}` ## Module Organization & Dependencies ### Layered Architecture ``` ┌─────────────────┐ │ Builtins │ (100+ built-in functions) ├─────────────────┤ │ Effects │ (MonadNix, MonadEval constraints) ├─────────────────┤ │ Exec │ (High-level evaluation) ├─────────────────┤ │ Eval │ (Core evaluation with ADI) ├─────────────────┤ │ Value/Thunk │ (Free monad values, lazy evaluation) ├─────────────────┤ │ Expr │ (NExprF functor, parser, pretty-printer) └─────────────────┘ ``` ### Key Files for Common Tasks - **Adding language features**: Start with `src/Nix/Parser.hs`, add to `NExprF` in `src/Nix/Expr/Types.hs` - **Modifying evaluation**: `src/Nix/Eval.hs` for core, `src/Nix/Exec.hs` for high-level - **Debugging issues**: `src/Nix/Reduce.hs` for test reduction, `src/Nix/Cited.hs` for error context - **Performance work**: `src/Nix/Thunk/Basic.hs` for thunk implementation - **Built-in functions**: `src/Nix/Builtins.hs` - match Nix semantics exactly ## Testing Philosophy ### Test Categories - **Language tests** (`tests/NixLanguageTests.hs`): Official Nix test suite - **Evaluation tests** (`tests/EvalTests.hs`): HNix-specific behavior - **Parser tests** (`tests/ParserTests.hs`): Round-trip properties - **Pretty tests** (`tests/PrettyTests.hs`): Pretty-printer correctness ### Writing Effective Tests ```haskell -- Property-based test for parser round-trip prop_parse_pretty :: NExpr -> Property prop_parse_pretty expr = parseNixText (prettyNix expr) === Right expr -- Golden test for evaluation goldenEval :: String -> NExpr -> TestTree goldenEval name expr = goldenVsString name path $ do result <- runLazyM defaultOptions $ evalExprLoc expr pure $ encodeUtf8 $ prettyNValue result ``` ## Important Implementation Notes ### Custom Prelude Uses `relude` with project utilities in `Nix.Utils`. Key differences: - `panic` instead of `error` for impossible cases - `pass` for noop in do-blocks - Strict `Text` by default ### String Context Nix strings carry derivation context - critical for store paths: ```haskell -- Context propagates through operations makeNixString :: Text -> NixString -- No context makeNixStringWithContext :: Text -> Context -> NixString ``` ### Store Integration **Warning**: `derivationStrict` creates real `/nix/store` entries. Use `--dry-run` for testing. ### Position Tracking Custom `NSourcePos` for performance - strict fields prevent memory leaks during parsing. ## Current Status & Goals **Primary Goal**: Evaluate all of Nixpkgs ```bash hnix --eval --expr "import {}" --find ``` **Working**: Parser, lazy evaluation, most built-ins, REPL, type inference **In Progress**: Full Nixpkgs evaluation, performance optimization **Known Issues**: Tests disabled by default (`doCheck = false`) due to store interaction ## Resources - [Win for Recursion Schemes](https://newartisans.com/2018/04/win-for-recursion-schemes/) - Essential architectural context - [Design of HNix](https://github.com/haskell-nix/hnix/wiki/Design-of-the-HNix-code-base) - [Gitter Chat](https://gitter.im/haskell-nix/Lobby) ================================================ FILE: CODEOWNERS ================================================ / @jwiegley ================================================ FILE: ChangeLog.md ================================================ # ChangeLog ## [(diff)](https://github.com/haskell-nix/hnix/compare/0.16.0...0.17.0#files_bucket) 0.17.0 * Additional * `Nix.Effect` * [(link)](https://github.com/haskell-nix/hnix/pull/1051) Introduction of new type NarContent, a tagged union type of `byteString` and `FilePath`. * [(link)](https://github.com/haskell-nix/hnix/pull/1051) getURL of instance MonadHttp IO is finally working through hnix-store. Which also means builtins.fetchurl is working through it. * Breaking: * `Nix.Effect` * [(link)](https://github.com/haskell-nix/hnix/pull/1051) MonadStore's addToStore signature changed to `StorePathName -> NarContent -> RecursiveFlag -> RepairFlag -> m (Either ErrorCall StorePath)` with new introduction of NarContent. Which enable us to add byteString as file to Store. It is corresponding to the hnix-store api change. * `Nix.Expr.Types` * [(link)](https://github.com/haskell-nix/hnix/pull/1042/files) The central HNix type `NExprF` changed, the `NApp` was moved out of `NBinary` & now a `NExprF` constructor of its own, the type signatures were changed accordingly. * [(link)](https://github.com/haskell-nix/hnix/pull/1038/files) project was using `megaparsec` `{,Source}Pos` and to use it shipped a lot of orphan instances. To improve the situation & performance (reports [#1026](https://github.com/haskell-nix/hnix/issues/1026), [#746](https://github.com/haskell-nix/hnix/issues/746)) project uses `N{,Source}Pos` types, related type signatures were changed accordingly. * `Nix.Value` * [(link)](https://github.com/haskell-nix/hnix/pull/1046/files) Unify builder `mkNV*` and `NV*` patterns by bidirectional synonyms, a lot of builders `mkNV*` are removed, and merged to `NV*`. e.g. instead of builder `mkNVList`, `NVList` should be used. * [(link)](https://github.com/haskell-nix/hnix/pull/1046/files) Constraint `NVConstraint f = (Comonad f, Applicative f)` was introduced, in order to unify builder `mkNV*` and `NV*` patterns. * `Nix.Parser`: * [(link)](https://github.com/haskell-nix/hnix/pull/1047/files) rm `OperatorInfo`, using `NOperatorDef`. Number of functions changed signatures accordingly: * In `Nix.Pretty`: * `NixDoc ann` * `mkNixDoc` * `selectOp` * `hasAttrOp` * `precedenceWrap` * `wrapPath` * In `Nix.Parser`: * rm `get{App,Unary,Binary,Special}Operator`, currely `NOp` class instances are used instead. * `Nix.Pretty`: * [(link)](https://github.com/haskell-nix/hnix/pull/1047/files) rm `appOp`, instead use `appOpDef`. * [(link)](https://github.com/haskell-nix/hnix/pull/1047/files) `precedenceWrap` behaviour is changed (to be literal to the name), the old behaviour is now a `wrap` function. ## [(diff)](https://github.com/haskell-nix/hnix/compare/0.15.0...0.16.0#files_bucket) 0.16.0 On update problems, please reach out to us. For support refere to: https://github.com/haskell-nix/hnix/issues/984 Partial log (for now): * Breaking: * Where `coerce` should work, removed `newtype` accessors. * [(link)](https://github.com/haskell-nix/hnix/pull/1006/files), [(link)](https://github.com/haskell-nix/hnix/pull/1009/files) Incomprehensible record accessors zoo like: `arg`, `options`, `unStore`, `scFlavor`, `nsContext` `_provenance` - was organized, now all record accessors start with `get*`, and their names tend to have according unique sematic meaning of data action they do. * Builder names got unified. Now they all start with `mk*`. So a lof of `nvSet` became `mkNVSet`. * `Nix.String` builders/destructors instead of `make` use `mk`, & where mentioning of `string` is superflous - dropped it from the name, so `stringIgnoreContext`, became `ignoreContext`. * Type system: * Things that are paths are now `newtype Path = Path String`. * Things that are indentifier names are now `newtype VarName = VarName Text`. * Function signatures changed accordingly. * Additional: * [(link)](https://github.com/haskell-nix/hnix/pull/1019) Matched expression escaping & its representation to breaking changes in Nix `2.4`. * `Builtins` (`builtins` function set) gained functions: * [(link)](https://github.com/haskell-nix/hnix/pull/1032) `path` * [(link)](https://github.com/haskell-nix/hnix/pull/1020) `isPathNix` * [(link)](https://github.com/haskell-nix/hnix/pull/1032) `unsafeDiscardOutputDependency` * [(link)](https://github.com/haskell-nix/hnix/pull/1031) `ceil` * [(link)](https://github.com/haskell-nix/hnix/pull/1031) `floor` * [(link)](https://github.com/haskell-nix/hnix/pull/1021) `hashFile` * [(link)](https://github.com/haskell-nix/hnix/pull/1033) `groupBy` * [(link)](https://github.com/haskell-nix/hnix/pull/1029) `data/nix` submodule (& its tests) updated to 2022-01-17. * Other notes: * `Shorthands` was kept untouched. ## [(diff)](https://github.com/haskell-nix/hnix/compare/0.14.0...0.15.0#files_bucket) 0.15.0 For support refere to: https://github.com/haskell-nix/hnix/issues/984 Partial log (for now): * Breaking: * `Nix.Expr.Shorthands`: * `inherit{,From}`: * dropped second(/third) argument as irrelevant ([report](https://github.com/haskell-nix/hnix/issues/326)) * bindings to inherit changed type from complex `[NKeyName]` (which is for static & dynamic keys) to `[VarName]` (`VarName` is newtype of `Text`). * So examples of use now are: `inherit ["a", "b"]`, `inheritFrom (var "a") ["b", "c"]` * `mkAssert`: fixed ([report](https://github.com/haskell-nix/hnix/issues/969)). * fx presedence between the operators: ```haskell (@@), (@.), (@./), ($==), ($!=), ($<), ($<=), ($>), ($>=), ($&&), ($||), ($->), ($//), ($+), ($-), ($*), ($/), ($++), (==>) ``` Now these shorthands can be used without sectioning & so represent the Nix expressions one to one. ```haskell nix = " a/b // c/def // < def/d" hask = mkRelPath "a/b" $// mkRelPath "c/def" $// mkEnvPath "g" $< mkRelPath "def/d" ``` * Additional * `Nix.Expr.Shorthands`: * added: * `emptySet` * `emptyList` * `mkOp{,2}` * `mk{,Named,Variadic,General}ParamSet` * `mkNeg` - number negation. * `@.<|>` for Nix language `s.x or y` expession. * entered deprecation: * `mkOper{,2}` bacame `mkOp{,2}`. * `mkBinop` became `mkOp2`. * `mkParaset` supeceeded by `mk{,Named{,Variadic},Variadic,General}ParamSet`. * fixed: * `mkAssert` was creating `with`, now properly creates `assert`. ## [(diff)](https://github.com/haskell-nix/hnix/compare/0.13.1...0.14.0#files_bucket) 0.14.0 (2021-07-08) * GHC 9.0 support. * HNix switched to pre-0.9 style of log (aka "no log"). We temporarily stopped producing log, choosing effectiveness over writing about it. * All changes seem trivial (from the inside). There is no changes in `Nix.Expr.Shorthands` module. Would there be difficulties in migration - please write to us - we would tackle & solve it togather. A partial log: * Breaking: * `Nix.Effects`: * rm `pathExits` in favour of `doesPathExist` (in `Nix.Render`: `class MonadFile`: `doesPathExist`) * `Nix.Var`: was found being superflous ([report](https://github.com/haskell-nix/hnix/issues/946)), so reduced. use `Control.Monad.Ref` instead. * `Nix.Normal` * rename `opaque(,->Val)`, indicate that it is a literal. * `Nix.Thunk`: * `class MonadThunkId m => MonadThunk{,F} t m a`: * rename `query(M->){,F}` * Additional: * `Nix.Utils`: * added type `TransformF` * `Nix.Eval`: * added fun: * `evalContent` * `addMetaInfo` * `Nix.Types.Assumption`: * added instances: * `Assumption`: `{Semigroup,Monoid,One}` * `Nix.Type.Env`: * added instances: * `Env`: `{Semigroup,Monoid,One}` * `Nix`: * changed argument order: * `nixEval`: ```haskell -- was: => Maybe FilePath -> Transform g (m a) -> Alg g (m a) -> Fix g -> m a -- became: => Transform g (m a) -> Alg g (m a) -> Maybe FilePath -> Fix g -> m a ``` * `Nix.Normal` * add `thunkVal` literal & use it where appropriate `{deThunk, removeEffects}` * `Nix.Thunk.Basic`: * export `deferred` ### [(diff)](https://github.com/haskell-nix/hnix/compare/0.13.0.1...0.13.1#files_bucket) 0.13.1 (2021-05-22) * [(link)](https://github.com/haskell-nix/hnix/pull/936/files) `Nix.Parser`: `annotateLocation`: Fix source location preservation. * [(link)](https://github.com/haskell-nix/hnix/pull/934/files) Require Cabal dependency `relude` `>= 1.0`: since imports & Cabal file got cleaned-up & that clean-up depends on `relude` reimports introduced in aforementioned version. * Refactors, reorganization in some modules, docs, clean-ups. #### [(diff)](https://github.com/haskell-nix/hnix/compare/0.13.0...0.13.0.1#files_bucket) 0.13.0.1 (2021-05-11) * [(link)](https://github.com/haskell-nix/hnix/pull/931/files) `Nix.Expr.Types`: Fix CPP on `Instances.TH.Lift` import. ## [(diff)](https://github.com/haskell-nix/hnix/compare/0.12.0...0.13.0#files_bucket) 0.13.0 (2021-05-10) * Breaking: * [(link)](https://github.com/haskell-nix/hnix/pull/859/files) [(link)](https://github.com/haskell-nix/hnix/pull/863/files) [(link)](https://github.com/haskell-nix/hnix/pull/866/files) `Nix.Thunk`: `class MonadThunk t m a | t -> m, t -> a`. Class was initially designed with Kleisli arrows (`v -> m a`) in mind, which where put to have the design open and inviting customization & integration. Those functional arguments are for custom implementation, so which in reality of the project were never used and HNax just "essentially" (simplifying, because `pure` was mixed with monadic binds to `f`) was passing `pure` into them (actually, `f <=< pure`). These Kliesli functors got arguments sorted properly and were moved to a `MonadThunkF` class and names gained `*F`. And `MonadThunk` now does only what is needed, for example `force` gets the thunk and computes it. All `MonadThunk{,F}` functions become with a classic Haskell arguments order, specialized, and got more straigh-forward to understand and use, and so now they tail recurse also. Now, for example, instead of `force t f` use it as `v <- force t` `f =<< force t`, or `f <=< force`. tl;dr: results: ```haskell class MonadThunkId m => MonadThunk t m a | t -> m, t -> a where thunkId :: t -> ThunkId m thunk :: m a -> m t queryM :: m a -> t -> m a -- old became `queryMF` force :: t -> m a -- old became `forceF` forceEff :: t -> m a -- old became `forceEffF` further :: t -> m t -- old became `furtherF` -- | Class of Kleisli functors for easiness of customized implementation developlemnt. class MonadThunkF t m a | t -> m, t -> a where queryMF :: (a -> m r) -> m r -> t -> m r -- was :: t -> m r -> (a -> m r) -> m r forceF :: (a -> m r) -> t -> m r -- was :: t -> (a -> m r) -> m r forceEffF :: (a -> m r) -> t -> m r -- was :: t -> (a -> m r) -> m r furtherF :: (m a -> m a) -> t -> m t -- was :: t -> (m a -> m a) -> m t ``` * [(link)](https://github.com/haskell-nix/hnix/pull/862/files) [(link)](https://github.com/haskell-nix/hnix/pull/870/files) [(link)](https://github.com/haskell-nix/hnix/pull/871/files) [(link)](https://github.com/haskell-nix/hnix/pull/872/files) [(link)](https://github.com/haskell-nix/hnix/pull/873/files) `Nix.Value.Monad`: `class MonadValue v m`: instances became specialized, Kleisli versions unflipped the arguments of methods into a classical order and moved to the `class MonadValueF`. As a result, `demand` now gets optimized by GHC and also tail recurse. Please, use `f =<< demand t`, or just use `demandF`, while `demandF` in fact just `kleisli =<< demand t`. ```haskell class MonadValue v m where demand :: v -> m v -- old became `demandF` inform :: v -> m v -- old became `informF` class MonadValueF v m where demandF :: (v -> m r) -> v -> m r -- was :: v -> (v -> m r) -> m r informF :: (m v -> m v) -> v -> m v -- was :: v -> (m v -> m v) -> m v ``` * [(link)](https://github.com/haskell-nix/hnix/pull/863/files) `Nix.Normal`: `normalizeValue` removed first functional argument that was passing the function that did the thunk forcing. Now function provides the thunk forcing. Now to normalize simply use `normalizeValue v`. Old implementation now is `normalizeValueF`. * [(link)](https://github.com/haskell-nix/hnix/pull/859/commits/8e043bcbda13ea4fd66d3eefd6da690bb3923edd) `Nix.Value.Equal`: `valueEqM`: freed from `RankNTypes: forall t f m .`. * [(link)](https://github.com/haskell-nix/hnix/pull/802/commits/529095deaf6bc6b102fe5a3ac7baccfbb8852e49#) `Nix.Strings`: all `hacky*` functions replaced with lawful implemetations, because of that all functions become lawful - dropped the `principled` suffix from functions: * `Nix.String`: ```haskell hackyGetStringNoContext -> getStringNoContext hackyStringIgnoreContext -> stringIgnoreContext hackyMakeNixStringWithoutContext -> makeNixStringWithoutContext principledMempty -> mempty principledStringMempty -> mempty principledStringMConcat -> mconcat principledStringMappend -> mappend principledGetContext -> getContext principledMakeNixString -> makeNixString principledIntercalateNixStrin -> intercalateNixString principledGetStringNoContext -> getStringNoContext principledStringIgnoreContext -> stringIgnoreContext principledMakeNixStringWithoutContext -> makeNixStringWithoutContext principledMakeNixStringWithSingletonContext -> makeNixStringWithSingletonContext principledModifyNixContents -> modifyNixContents ``` * [(link)](https://github.com/haskell-nix/hnix/pull/805/files): * Data type: `MonadFix1T t m`: `Nix.Standard` -> `Nix.Utils.Fix1` * Children found their parents: ```haskell Binary NAtom :: Nix.Expr.Types -> Nix.Atoms FromJSON NAtom :: Nix.Expr.Types -> Nix.Atoms ToJSON NAtom :: Nix.Expr.Types -> Nix.Atoms Eq1 (NValueF p m) :: Nix.Value.Equal -> Nix.Value Eq1 (NValue' t f m a) :: Nix.Value.Equal -> Nix.Value HasCitations m v (NValue' t f m a) :: Nix.Pretty -> Nix.Cited HasCitations m v (NValue t f m) :: Nix.Pretty -> Nix.Cited when (package hashable >= 1.3.1) -- gained instance $ Hashable1 NonEmpty:: Nix.Expr.Types -> Void -- please use upstreamed instance -- | Was upstreamed, released in `ref-tf >= 0.5`. MonadAtomicRef (ST s) :: Nix.Standard -> Void MonadAtomicRef (Fix1T t m) :: Nix.Standard -> Nix.Utils.Fix1 MonadRef (Fix1T t m) :: Nix.Standard -> Nix.Utils.Fix1 MonadEnv (Fix1T t m) :: Nix.Standard -> Nix.Effects MonadExec (Fix1T t m) :: Nix.Standard -> Nix.Effects MonadHttp (Fix1T t m) :: Nix.Standard -> Nix.Effects MonadInstantiate (Fix1T t m) :: Nix.Standard -> Nix.Effects MonadIntrospect (Fix1T t m) :: Nix.Standard -> Nix.Effects MonadPaths (Fix1T t m) :: Nix.Standard -> Nix.Effects MonadPutStr (Fix1T t m) :: Nix.Standard -> Nix.Effects MonadStore (Fix1T t m) :: Nix.Standard -> Nix.Effects MonadFile (Fix1T t m) :: Nix.Standard -> Nix.Render MonadEnv (Fix1 t) :: Nix.Standard -> Nix.Effects MonadExec (Fix1 t) :: Nix.Standard -> Nix.Effects MonadHttp (Fix1 t) :: Nix.Standard -> Nix.Effects MonadInstantiate (Fix1 t) :: Nix.Standard -> Nix.Effects MonadIntrospect (Fix1 t) :: Nix.Standard -> Nix.Effects MonadPaths (Fix1 t) :: Nix.Standard -> Nix.Effects MonadPutStr (Fix1 t) :: Nix.Standard -> Nix.Effects ``` * [(link)](https://github.com/haskell-nix/hnix/pull/878/files) `Nix.Value`: `nvSet{,',P}`: got unflipped, now accept source position argument before the value. * [(link)](https://github.com/haskell-nix/hnix/pull/878/files) `Nix.Pretty`: `mkNixDoc`: got unflipped. * [(link)](https://github.com/haskell-nix/hnix/pull/886/commits/381b0e5df9cc620a25533ff1c84045a4ea37a833) `Nix.Value`: Data constructor for `NValue' t f m a` changed (`NValue -> NValue'`). * [(link)](https://github.com/haskell-nix/hnix/pull/884/files) `Nix.Parser`: `Parser`: Data type was equivalent to `Either`, so became a type synonim for `Either`. * [(link)](https://github.com/haskell-nix/hnix/pull/884/files) `Nix.Thunk.Basic`: `instance MonadThunk (NThunkF m v) m v`: `queryM`: implementation no longer blocks the thunk resource it only reads from. * [(link)](https://github.com/haskell-nix/hnix/pull/908/files): Migrated `(String -> Text)`: * `Nix.Value`: `{NValueF, nvBuiltin{,'}, builtin{,2,3}, describeValue}` * `Nix.Eval`: `MonadNixEval` * `Nix.Render.Frame`: `render{Expr,Value}` * `Nix.Type`: `TVar` * `Nix.Thunk`: `ThunkLoop` * `Nix.Exec`: `{nvBuiltinP, nixInstantiateExpr, exec}` * `Nix.Effects`: * `class`: * `MonadExec: exec'` * `MonadEnv: getEnvVar` * `MonadInstantiate: instatiateExpr` * `parseStoreResult` * `Nix.Effects.Derivation`: `renderSymbolic` * `Nix.Lint`: `{NTypeF, symerr}` * Additional: * [(link)](https://github.com/haskell-nix/hnix/commit/7e6cd97bf3288cb584241611fdb25bf85d7e0ba7) `cabal.project`: freed from the `cryptohash-sha512` override, Hackage trustees made a revision. * [(link)](https://github.com/haskell-nix/hnix/pull/824/commits/4422eb10959115f21045f39e302314a77df4b775) To be more approachable for user understanding, the thunk representation in outputs changed from `"" -> ""`. * [(link)](https://github.com/haskell-nix/hnix/pull/925/commits/37e81c96996b07cbbdf9fa4bf380265e8c008482) The Nix evaluation cycle representation changed `"" -> ""`. * [(link)](https://github.com/haskell-nix/hnix/commit/51a3ff9e0065d50e5c625738696526c4a232b0cf) `Nix.Expr.Types`: added hacky implementation of `liftTyped` for `instance Lift (Fix NExprF)`. * [(link)](https://github.com/haskell-nix/hnix/commit/51a3ff9e0065d50e5c625738696526c4a232b0cf) `Nix.Builtins`: `derivation` primOp internal code always fully evaluated, so GHC now always ships only fully compiled version in the bytecode. * [(link)](https://github.com/haskell-nix/hnix/pull/890): Project switched to prelude `relude`. * A bunch of other stuff that is not user-facing. ## [(diff)](https://github.com/haskell-nix/hnix/compare/0.11.1...0.12.0#files_bucket) 0.12.0 (2021-01-05) * *Disclaimer*: Current `derivationStrict` primOp implementation and so every evaluation of a derivation into a store path currently relies on the `hnix-store-remote`, which for those operations relies on the running `nix-daemon`, and so operations use/produce effects into the `/nix/store`. Be cautious - it is effectful. * Introduction: * New module `Nix.Effects.Derivation`. * Operations on derivations: * old got principled implementations. * also new operations got introduced. * Implementation of the `derivationStrict` primOp. * Breaking: * [(link)](https://github.com/haskell-nix/hnix/pull/554/commits/3bba5549273c892c60aad5dd6d5058a8db40efbf) `Nix.Effects`: **class** `MonadStore` got principled implementation. * `addPath'` got principled into `addToStore`. * `toFile_` got principled into `addTextToStore'`. * For help & easy migration you may use `addPath` & `toFile_` `addTextToStore` standalone functions in the module. * [(link)](https://github.com/haskell-nix/hnix/pull/554/commits/3bba5549273c892c60aad5dd6d5058a8db40efbf) `Nix.Effects.Basic`: `defaultDerivationStrict` got reimplemented & moved into `Nix.Effects.Derivation`. * [(link)](https://github.com/haskell-nix/hnix/pull/554/commits/3bba5549273c892c60aad5dd6d5058a8db40efbf) `Nix.Standard`: instance for `MonadStore (Fix1T t m)` got principled accoding to class `MonadStore` changes. * [(link)](https://github.com/haskell-nix/hnix/pull/554/commits/3bba5549273c892c60aad5dd6d5058a8db40efbf) `Nix.Fresh.Basic`: instance for `MonadStore (StdIdT m)` got principled. * Additional: * [(link)](https://github.com/haskell-nix/hnix/pull/554/commits/3bba5549273c892c60aad5dd6d5058a8db40efbf) **New module `Nix.Effects.Derivation`**: [HNix(0.12.0):Nix.Effects.Derivation documentation](https://hackage.haskell.org/package/hnix-0.12.0/docs/Nix-Effects-Derivation.html). * [(link)](https://github.com/haskell-nix/hnix/pull/554/commits/9bcfbbe88ff0bd8d803296193ee1d8603dc5289e) `Nix.Convert`: Principled `NVPath -> NixString` coercion. * In a form of principled `instance FromValue NixString m (NValue' t f m (NValue t f m))`. * [(link)](https://github.com/haskell-nix/hnix/pull/554/commits/a8e6d28fdb98a1c34f425c8395338fdabe96becc) `Nix.String`: Allow custom computations inside string contexts. * By providing `runWithStringContext{T,}'` methods into the API. * [(link)](https://github.com/haskell-nix/hnix/pull/554/commits/e45f7632c51a9657f6e8d54c39fd4d21c466d85f) Includded support for new `base16-bytestring`, which advertices 2x-4x speed increase of its operations. * [(link)](https://github.com/haskell-nix/hnix/pull/554/commits/3bba5549273c892c60aad5dd6d5058a8db40efbf) `Nix.Effects`: `addPath` & `toFile_` standalone functions got principled implementation through the internal use of the new `MonadStore` type class implementation. * [(link)](https://github.com/haskell-nix/hnix/pull/554/commits/3bba5549273c892c60aad5dd6d5058a8db40efbf) `Nix.Effects`: added `addTextToStore`, `parseStoreResult` implementations. * [(link)](https://github.com/haskell-nix/hnix/pull/554/commits/3bba5549273c892c60aad5dd6d5058a8db40efbf) `Nix.Effects`: added type synonyms `{RecursiveFlag, RepairFlag, StorePathName, FilePathFilter, StorePathSet}`. * [(link)](https://github.com/haskell-nix/hnix/pull/760) `Nix.Exec`: Fixed the rendering of internal `Frames`. * Which is an internal mechanism of a project to passing around messages with their context, still to be used internally). * [(link)](https://github.com/haskell-nix/hnix/pull/554/commits/3bba5549273c892c60aad5dd6d5058a8db40efbf) `HNix / Nix`: The library now also uses `hnix-store-remote`. * [(link)](https://github.com/haskell-nix/hnix/pull/554/commits/06b0fca9fd607eb2e995f003424e797a41ffa5b7) `cabal.project`: project uses `cryptohash-sha512` override, the `hnix-store-core` requires it from `hnix` and uses that override also. [Detailed info](https://github.com/haskell-hvr/cryptohash-sha512/pull/5#issuecomment-752796913). We promise to attend to this issue, probably by migrating to `cryptonite` in the nearest releases. Future note: The HNix is a big project. During the initial development and currently the API for simplicity exposes allmost all functions, types, etc. Big open API means a big effort to create/maintain a quite noisy changelog and you parsing through it, and also creates a frequent requirements to mark releases as major and bother you due to some type changes in some parts that may not be used or applicable to be public API. This year the most gracious API clean-up would happen, we would check and keep open what Hackage projects are using from the API, and the other parts would be open on the request by a way of rapid minor releases. That clean-up is also a work toward splitting the project into several packages some time in the future (split would be into something like Expressions, Evaluation, Executable, Extra), which migration also would be done most thoughful and graceful as possible, with as much easiness and automation provided for migration downstream as possible. If all goes as planned - all downstream would need to do is to get and run our script that would migrate our old map of module imports to new ones, and maybe manually add those newly formed packages into `.cabal` description. If it is possible, please, try to switch & use the higher-level API functions where it is applicable. Thank you. ### [(diff)](https://github.com/haskell-nix/hnix/compare/0.11.0...0.11.1#files_bucket) 0.11.1 (2020-12-09) * Additional: * [(link)](https://github.com/haskell-nix/hnix/commit/d32a6fbaf3df1c8879d1b19a18f21c031a73e56c) `Nix.Builtins`: `isString` fixed - It used to return `True` for values coercible to string like derivations and paths. It only accepts string values now. * [(link)](https://github.com/haskell-nix/hnix/commit/53b4db2525a8f074d8c262fa7b66ce97e5820890) `Nix.Builtins`: `substring` fixed - Negative lengths used to capture an empty string. Now they capture the whole rmeainder of the string. * [(link)](https://github.com/haskell-nix/hnix/commit/dc31c5e64f8c7aaaea14cac0134bd47544533e67) `Nix.Effects`: `pathExists` fixed - Now also works with directories. * [(link)](https://github.com/haskell-nix/hnix/commit/e2ad934492eeac9881527610e4a1c1cf31ea1115) `Nix.Parser`: `->` is now properly right-associative (was non-associative). * [(link)](https://github.com/haskell-nix/hnix/commit/50baea5e1e482be3c4fcc13c9a45b1083243f681) `Nix.Parser`: Nix `assert` parser (`nixAssert` function) now accepts top-level Nix format also (which means also accepts all kinds of statements), before that it accepted only regular Nix expressions. * [(link)](https://github.com/haskell-nix/hnix/commit/59698de7185dfae508e5ccea4377a82023c4a0d5) `Nix.Render`: `renderLocation` now also shows/handles location of errors in raw strings. ## [(diff)](https://github.com/haskell-nix/hnix/compare/0.10.1...0.11.0#files_bucket) 0.11.0 (2020-11-02) * Breaking: * [(link)](https://github.com/haskell-nix/hnix/pull/740) Deleted incorrect `instance Generic1 NKeyName` from `module Nix.Expr.Types`. * [(link)](https://github.com/haskell-nix/hnix/pull/739) Parentheses now are properly included in the location annotation for Nix expressions, change of `nixParens` in `module Nix.Parser` essentially results in the change of all module `nix*` function results, essentially making results of the whole module more proper. * Additional: * [(link)](https://github.com/haskell-nix/hnix/pull/741) Fix QQ Text lifting error: work around of [GHC#12596 "can't find interface-file declaration"](https://gitlab.haskell.org/ghc/ghc/-/issues/12596). * [(link)](https://github.com/haskell-nix/hnix/pull/744) Fix comments inclusion into location annotations, by using pre-whitespace position for source end locations. ### [(diff)](https://github.com/haskell-nix/hnix/compare/0.10.0...0.10.1#files_bucket) 0.10.1 (2020-09-13) * Additional: * [(link)](https://github.com/haskell-nix/hnix/pull/715) `{Binding, NExpr, NExprF, NKeyName}` gained `Ord1` instances. * These instances were required by downstream projects to be able to use newer HNix. * [(link)](https://github.com/haskell-nix/hnix/pull/712) CLI gained `--long-version` option for gathering a detailed debug information. * Currently, reports Git commit and its date. * [(link)](https://github.com/haskell-nix/hnix/issues/718) Currently does not work in case of use of the `nix-build`, in which case simply returns `UNKNOWN` placeholder. ## [(diff)](https://github.com/haskell-nix/hnix/compare/0.9.1...0.10.0#files_bucket) 0.10.0 (2020-09-12) * Breaking: * [(link)](https://github.com/haskell-nix/hnix/pull/699) Removed `NExpr` `{FromJSON, ToJSON}` instances. * This also removed the JSON output feature for unevaluated expression trees. * Additional: * [(link)](https://github.com/haskell-nix/hnix/pull/703) CLI gained `--version` option. * Dependencies: * [(link)](https://github.com/haskell-nix/hnix/pull/686) Requires last major `data-fix` (`0.3`). * [(link)](https://github.com/haskell-nix/hnix/pull/679) Requires last major `prettyprinter` (`1.7`). ### [(diff)](https://github.com/haskell-nix/hnix/compare/0.9.0...0.9.1#files_bucket) 0.9.1 (2020-07-13) * Additional: * REPL: * Better tab completion. * Accepting multi-line input. * Support for passing evaluated expression result of `hnix --eval -E`. to REPL as an `input` variable. * Support for loading `.hnixrc` from the current directory. * Reporting of `builtins.nixVersion` bumped from 2.0 to 2.3. * Dependencies: * Freed from: `{interpolate, contravariant, semigroups, generic-random, tasty-quickcheck}`. * Requires last major `repline` (`0.4`). ## [(diff)](https://github.com/haskell-nix/hnix/compare/0.8.0...0.9.0#files_bucket) 0.9.0 (2020-06-15) * Breaking: * Removed instances due to migration to `haskeline 0.8`: * `instance MonadException m => MonadException(StateT(HashMap FilePath NExprLoc) m)`. * `instance MonadException m => MonadException(Fix1T StandardTF m)`. * Dependencies: * Requires last major `haskeline` (`0.8`). * Additional: * Library: Official support for `GHC 8.4 - 8.10`. * Executable complies only under `GHC 8.10`. * Changelog started. Previous release was `0.8.0`. --- HNix uses [PVP Versioning][1]. [1]: https://pvp.haskell.org ================================================ FILE: LICENSE.md ================================================ Copyright (c) 2014-2025, John Wiegley. 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 New Artisans LLC nor the names of its 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. ================================================ FILE: License ================================================ Copyright (c) 2014, John Wiegley All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. 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. 3. Neither the name of the copyright holder nor the names of its 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 HOLDER 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. ================================================ FILE: Makefile ================================================ all: default.nix default.nix: hnix.cabal cabal2nix --shell . > $@ ================================================ FILE: ReadMe.md ================================================ [![Chatroom Gitter](https://img.shields.io/badge/Chatroom-Gitter-%23753a88)](https://gitter.im/haskell-nix/Lobby) [![Hackage](https://img.shields.io/hackage/v/hnix?color=%235e5086&label=Latest%20release%20on%20Hackage)](https://hackage.haskell.org/package/hnix) [![Hackage Matrix Builder](https://img.shields.io/badge/Hackage%20Matrix-Builder-%235e5086)](https://matrix.hackage.haskell.org/package/hnix) [![Bounds](https://img.shields.io/hackage-deps/v/hnix?label=Released%20dep%20bounds)](https://packdeps.haskellers.com/feed?needle=hnix) [![Hydra CI](https://img.shields.io/badge/Nixpkgs%20Hydra-CI-%234f72bb)](https://hydra.nixos.org/job/nixpkgs/trunk/haskellPackages.hnix.x86_64-linux#tabs-status) [![Repology page](https://img.shields.io/badge/Repology-page-%23005500)](https://repology.org/project/haskell:hnix/versions) # HNix Parser, evaluator and type checker for the Nix language written in Haskell. ## Prerequisites Tooling is WIP, `nix-shell` and `nix-store` are still used for their purpose, so, to access them Nix is required to be installed. *Disclaimer*: Since still using Nix for some operations, current `derivationStrict` primOp implementation and so evaluations of a derivation into a store path currently rely on the `hnix-store-remote`, which for those operations relies on the running `nix-daemon`, and so operations use/produce effects into the `/nix/store`. Be cautious - it is effectful (produces `/nix/store` entries). ## Building the project ### Git clone ```shell git clone 'https://github.com/haskell-nix/hnix.git' && cd hnix ``` ### (optional) Cachix prebuild binary caches If you would use our Nix-shell environment for development, you can connect to our Cachix HNix build caches: 1. Run: ```shell nix-env -iA cachix -f https://cachix.org/api/v1/install ``` 2. Run: `cachix use hnix` ### Building with Cabal Cabal [Quickstart](https://cabal.readthedocs.io/en/3.4/nix-local-build.html). 1. (Optional), to enter the projects reproducible Nix environment: ```shell nix-shell ``` 2. Building: ```shell cabal v2-configure cabal v2-build ``` 3. Loading the project into `ghci` REPL: ```shell cabal v2-repl ``` 4. Testing: * Default suite: ```shell cabal v2-test ``` * All available tests: ```shell env ALL_TESTS=yes cabal v2-test ``` * Selected (list of tests is in `tests/Main.hs`): ```shell env NIXPKGS_TESTS=yes PRETTY_TESTS=1 cabal v2-test ``` #### Checking the project ##### Benchmarks To run benchmarks: ```shell cabal v2-bench ``` ##### Profiling GHC User Manual has a full ["Profiling"](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/profiling.html) section of relevant info. To build `hnix` with profiling enabled: ```shell cabal v2-run hnix --enable-profiling --flags=profiling -- +RTS -p ``` Or to put simply: ```shell # Run profiling for evaluation of a Firefox package. # Generate: # * for all functions # * time profiling data # * memory allocation profiling data # * in the JSON profiling format cabal v2-run --enable-profiling --flags=profiling --enable-library-profiling --profiling-detail='all-functions' hnix -- --eval --expr '(import {}).firefox.outPath' +RTS -Pj # Then, upload the `hnix.prof` to the https://www.speedscope.app/ to analyze it. ``` "RTS" stands for "RunTime System" and has a lot of options, GHC User Manual has ["Running a compiled program"/"Setting RTS options"](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/runtime_control.html) sections describing them. ##### Full debug info To run stack traces & full tracing output on `hnix`: ```shell cabal v2-configure --enable-tests --enable-profiling --flags=profiling --flags=tracing cabal v2-run hnix -- -v5 --trace +RTS -xc ``` This would give the most information as to what happens during parsing & evaluation. #### Runing executable ```shell cabal v2-run hnix -- --help ``` (`--` is for separation between `cabal` & `hnix` args) ### Building with Nix-build There is a number of build options to use with `nix-build`, documentation of them is in: `./default.nix`, keys essentially pass-through the [Nixpkgs Haskell Lib API](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/lib.nix). Options can be used as: ```shell nix-build \ --arg \ --arg \ --argstr "" ``` #### Checking the project ##### Benchmarks ```shell nix-build \ --arg disableOptimization false \ --arg enableDeadCodeElimination true \ --arg doStrip true \ --arg doBenchmark true ``` ##### Profiling ```shell nix-build \ --arg disableOptimization false \ --arg enableDeadCodeElimination true \ --arg enableLibraryProfiling true \ --arg enableExecutableProfiling true ./result/bin/hnix +RTS -p ``` ##### Full debug info ```shell nix-build \ --arg disableOptimization false \ --arg enableDeadCodeElimination true \ --arg doBenchmark true \ --arg doStrip false \ --arg enableLibraryProfiling true \ --arg enableExecutableProfiling true \ --arg doTracing true \ --arg enableDWARFDebugging true ./result/bin/hnix -v5 --trace +RTS -xc ``` #### Runing executable ```shell ./result/bin/hnix ``` ## Using HNix See: ``` hnix --help ``` It has a pretty full/good description of the current options. ### Parse & print To parse a file with `hnix` and pretty print the result: ```shell hnix file.nix ``` ### Evaluating and printing the resulting value Expression from a file: ```shell hnix --eval file.nix ``` Expression: ```shell hnix --eval --expr 'import {}' ``` ### Evaluating Nixpkgs Currently, the main high-level goal is to be able to evaluate all of Nixpkgs: ```shell hnix --eval --expr "import {}" --find ``` ### Options supported only by HNix To see value provenance and thunk context: ```shell hnix -v2 --values --thunk --eval --expr 'import {}' ``` To see tracing as the evaluator runs (note that building with `cabal configure --flags=tracing` will produce much more output than this): ```shell hnix --trace --eval --expr 'import {}' ``` To attempt to generate a reduced test case demonstrating an error: ```shell hnix --reduce bug.nix --eval --expr 'import {}' ``` ### REPL To enter REPL: ```shell hnix --repl ``` Evaluate an expression and load it into REPL: ```shell hnix --eval --expr '(import {}).pkgs.hello' --repl ``` This binds the evaluated expression result to the `input` variable, so that variable can be inspected. Use the `:help` command for a list of all available REPL commands. #### Language laziness Nix is a lazy language with the ability of recursion, so by default REPL and eval prints are lazy: ```shell hnix \ --eval \ --expr '{ x = true; }' { x = ""; } ``` To disable laziness add the `--strict` to commands or `:set strict` in the REPL. ```shell hnix \ --eval \ --strict \ --expr '{ x = true; }' { x = true; } ``` ## Contributing * The Haskell Language Server (HLS) works great with our project. * [Design of the HNix code base Wiki article](https://github.com/haskell-nix/hnix/wiki/Design-of-the-HNix-code-base). 1. If something in the [quests](https://github.com/haskell-nix/hnix/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22+no%3Aassignee) looks interesting, look through the thread and leave a comment taking it, to let others know you're working on it. 2. You are free to chat with everyone on [Gitter](https://gitter.im/haskell-nix/Lobby). 3. When the pull request is ready to be submitted, to save time - please, test it with: ```shell cabal v2-test ``` Please, check that all default tests that were passing prior are still passing. It's OK if no new tests are passing. ### (optional) Minimalistic development status loop with amazing [`ghcid`](https://github.com/ndmitchell/ghcid) If HLS is not your cup of yea: ```shell ghcid --command="cabal v2-repl --repl-options=-fno-code --repl-options=-fno-break-on-exception --repl-options=-fno-break-on-error --repl-options=-v1 --repl-options=-ferror-spans --repl-options=-j" ``` (optional) To use projects reproducible environment, wrap `ghcid ...` command into a `nix-shell --command ' '`. For simplicity `alias` the command in your shell. ## Current status To understand the project implementation state see: * [ChangeLog](https://github.com/haskell-nix/hnix/blob/master/ChangeLog.md) * [Opened reports](https://github.com/haskell-nix/hnix/issues) * [Project status](https://github.com/haskell-nix/hnix/wiki/Project-status) * [Design of the HNix code base](https://github.com/haskell-nix/hnix/wiki/Design-of-the-HNix-code-base) ================================================ FILE: benchmarks/Main.hs ================================================ module Main where import Criterion.Main import Nix.Prelude import qualified ParserBench main :: IO () main = defaultMain $ one ParserBench.benchmarks ================================================ FILE: benchmarks/ParserBench.hs ================================================ module ParserBench (benchmarks) where import Nix.Parser import Nix.Prelude import Criterion benchFile :: Path -> Benchmark benchFile = bench . coerce <*> whnfIO . parseNixFile . ("data/" <>) benchmarks :: Benchmark benchmarks = bgroup "Parser" $ fmap benchFile [ "nixpkgs-all-packages.nix" , "nixpkgs-all-packages-pretty.nix" , "let-comments.nix" , "let-comments-multiline.nix" , "let.nix" , "simple.nix" , "simple-pretty.nix" ] ================================================ FILE: brittany.yaml ================================================ conf_debug: dconf_roundtrip_exactprint_only: false dconf_dump_bridoc_simpl_par: false dconf_dump_ast_unknown: false dconf_dump_bridoc_simpl_floating: false dconf_dump_config: false dconf_dump_bridoc_raw: false dconf_dump_bridoc_final: false dconf_dump_bridoc_simpl_alt: false dconf_dump_bridoc_simpl_indent: false dconf_dump_annotations: false dconf_dump_bridoc_simpl_columns: false dconf_dump_ast_full: false conf_forward: options_ghc: [] conf_errorHandling: econf_ExactPrintFallback: ExactPrintFallbackModeInline econf_Werror: false econf_omit_output_valid_check: false econf_produceOutputOnErrors: false conf_preprocessor: ppconf_CPPMode: CPPModeWarn ppconf_hackAroundIncludes: false conf_obfuscate: false conf_roundtrip_exactprint_only: false conf_version: 1 conf_layout: lconfig_reformatModulePreamble: true lconfig_altChooser: tag: AltChooserBoundedSearch contents: 3 lconfig_allowSingleLineExportList: true lconfig_importColumn: 50 lconfig_hangingTypeSignature: false lconfig_importAsColumn: 50 lconfig_alignmentLimit: 30 lconfig_indentListSpecial: true lconfig_indentAmount: 2 lconfig_alignmentBreakOnMultiline: true lconfig_cols: 80 lconfig_indentPolicy: IndentPolicyFree lconfig_indentWhereSpecial: true lconfig_columnAlignMode: tag: ColumnAlignModeMajority contents: 0.7 ================================================ FILE: build.sh ================================================ #!/usr/bin/env bash # NOTE: Script to easy import nix-build settings from env, useful for tooling env replication and the CI builds, relies on `default.nix` interface, which exposes Nixpkgs Haskell Lib interface # The most strict error checking requirements set -Eexuo pipefail ### NOTE: Section handles imports from env, these are settings for Nixpkgs. ### They use the `default.nix` interface, which exposes expose most of the Nixpkgs Haskell.lib API: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/lib.nix ### Some of these options implicitly switch the dependent options. ### Documentation of this settings is mosly in `default.nix`, since most settings it Nixpkgs related ### Additional documentation is in Nixpkgs Haskell.lib: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/lib.nix # NOTE: If vars not imported - init the vars with default values # Non-set/passed ''/'default' compiler setting means currently default GHC of Nixpkgs ecosystem. compiler=${compiler:-'default'} packageRoot=${packageRoot:-'pkgs.nix-gitignore.gitignoreSource [ ] ./.'} cabalName=${cabalName:-'hnix'} rev=${rev:-'default'} # Account in Cachix to use cachixAccount=${cachixAccount:-'hnix'} allowInconsistentDependencies=${allowInconsistentDependencies:-'false'} doJailbreak=${doJailbreak:-'false'} doCheck=${doCheck:-'true'} sdistTarball=${sdistTarball:-'false'} buildFromSdist=${buildFromSdist:-'false'} failOnAllWarnings=${failOnAllWarnings:-'false'} buildStrictly=${buildStrictly:-'false'} enableDeadCodeElimination=${enableDeadCodeElimination:-'false'} disableOptimization=${disableOptimization:-'true'} linkWithGold=${linkWithGold:-'false'} enableLibraryProfiling=${enableLibraryProfiling:-'false'} enableExecutableProfiling=${enableExecutableProfiling:-'false'} doTracing=${doTracing:-'false'} enableDWARFDebugging=${enableDWARFDebugging:-'false'} doStrip=${doStrip:-'false'} enableSharedLibraries=${enableSharedLibraries:-'true'} enableStaticLibraries=${enableStaticLibraries:-'false'} enableSharedExecutables=${enableSharedExecutables:-'false'} justStaticExecutables=${justStaticExecutables:-'false'} enableSeparateBinOutput=${enableSeparateBinOutput:-'false'} checkUnusedPackages=${checkUnusedPackages:-'false'} doHaddock=${doHaddock:-'false'} doHyperlinkSource=${doHyperlinkSource:-'false'} doCoverage=${doCoverage:-'false'} doBenchmark=${doBenchmark:-'false'} generateOptparseApplicativeCompletions=${generateOptparseApplicativeCompletions:-'false'} # [ "binary1" "binary2" ] - should pass " quotes into Nix interpreter executableNamesToShellComplete=${executableNamesToShellComplete:-'[ "hnix" ]'} withHoogle=${withHoogle:-'false'} # If key not provided (branch is not inside the central repo) - init CACHIX_SIGNING_KEY as empty CACHIX_SIGNING_KEY=${CACHIX_SIGNING_KEY:-""} BUILD_PROJECT() { IFS=$'\n\t' if [ ! "$compiler" = "ghcjs" ]; then # Normal GHC build nix-build \ --argstr compiler "$compiler" \ --argstr rev "$rev" \ --arg allowInconsistentDependencies "$allowInconsistentDependencies" \ --arg doJailbreak "$doJailbreak" \ --arg doCheck "$doCheck" \ --arg sdistTarball "$sdistTarball" \ --arg buildFromSdist "$buildFromSdist" \ --arg failOnAllWarnings "$failOnAllWarnings" \ --arg buildStrictly "$buildStrictly" \ --arg enableDeadCodeElimination "$enableDeadCodeElimination" \ --arg disableOptimization "$disableOptimization" \ --arg linkWithGold "$linkWithGold" \ --arg enableLibraryProfiling "$enableLibraryProfiling" \ --arg enableExecutableProfiling "$enableExecutableProfiling" \ --arg doTracing "$doTracing" \ --arg enableDWARFDebugging "$enableDWARFDebugging" \ --arg doStrip "$doStrip" \ --arg doHyperlinkSource "$doHyperlinkSource" \ --arg enableSharedLibraries "$enableSharedLibraries" \ --arg enableStaticLibraries "$enableStaticLibraries" \ --arg enableSharedExecutables "$enableSharedExecutables" \ --arg justStaticExecutables "$justStaticExecutables" \ --arg checkUnusedPackages "$checkUnusedPackages" \ --arg doCoverage "$doCoverage" \ --arg doHaddock "$doHaddock" \ --arg doBenchmark "$doBenchmark" \ --arg generateOptparseApplicativeCompletions "$generateOptparseApplicativeCompletions" \ --arg executableNamesToShellComplete "$executableNamesToShellComplete" \ --arg withHoogle "$withHoogle" fi } MAIN() { # Overall it is useful to have in CI test builds the latest stable Nix # 2020-06-24: HACK: Do not ask why different commands on Linux and macOS. IDK, wished they we the same. These are the only commands that worked on according platforms right after the fresh Nix installer rollout. # 2020-07-06: HACK: GitHub Actions CI shown that nix-channel or nix-upgrade-nix do not work, there is probably some new rollout, shortcircuting for the time bing with || true (nix-channel --update && nix-env -u) || (sudo nix upgrade-nix) || true # Report the Nixpkgs channel revision nix-instantiate --eval -E 'with import {}; lib.version or lib.nixpkgsVersion' # Secrets are not shared to PRs from forks # nix-build | cachix push - uploads binaries, runs&works only in the branches of the main repository, so for PRs - else case runs if [ ! "$CACHIX_SIGNING_KEY" = "" ]; then # Build of the inside repo branch - enable push Cachix cache BUILD_PROJECT | cachix push "$cachixAccount" else # Build of the side repo/PR - can not push Cachix cache BUILD_PROJECT fi } # Run the entry function of the script MAIN ================================================ FILE: cabal.project ================================================ packages: ./hnix.cabal ================================================ FILE: data/let-comments-multiline.nix ================================================ let b.a = 3; /* this is a multiline comment /* we can also nest these comments */ /* */ b.c = { e = {}; }; /* just some more comments */ b.c.e.f = 4; /* this file is documented really well */ in b /* todo */ ================================================ FILE: data/let-comments.nix ================================================ let b.a = 3; # this is a oneline comment # we can also nest these comments # # # # b.c = { e = {}; }; # just some more comments # b.c.e.f = 4; # this file is documented really well in b # todo ================================================ FILE: data/let.nix ================================================ let b.a = 3; b.c = { e = {}; }; b.c.e.f = 4; in b ================================================ FILE: data/nix/README.md ================================================ Extracted from https://github.com/NixOS/nix (GPLv2) commit 6c2af1f201a925c2aa632737765685c72b642847 Date: Mon Nov 8 14:13:42 202 Keep only `tests/lang` which are required by `hnix`es testsuite. ================================================ FILE: data/nix/tests/lang/data ================================================ foo ================================================ FILE: data/nix/tests/lang/dir1/a.nix ================================================ "a" ================================================ FILE: data/nix/tests/lang/dir2/a.nix ================================================ "X" ================================================ FILE: data/nix/tests/lang/dir2/b.nix ================================================ "b" ================================================ FILE: data/nix/tests/lang/dir3/a.nix ================================================ "X" ================================================ FILE: data/nix/tests/lang/dir3/b.nix ================================================ "X" ================================================ FILE: data/nix/tests/lang/dir3/c.nix ================================================ "c" ================================================ FILE: data/nix/tests/lang/dir4/a.nix ================================================ "X" ================================================ FILE: data/nix/tests/lang/dir4/c.nix ================================================ "X" ================================================ FILE: data/nix/tests/lang/eval-fail-abort.nix ================================================ if true then abort "this should fail" else 1 ================================================ FILE: data/nix/tests/lang/eval-fail-assert.nix ================================================ let { x = arg: assert arg == "y"; 123; body = x "x"; } ================================================ FILE: data/nix/tests/lang/eval-fail-bad-antiquote-1.nix ================================================ "${x: x}" ================================================ FILE: data/nix/tests/lang/eval-fail-bad-antiquote-2.nix ================================================ "${./fnord}" ================================================ FILE: data/nix/tests/lang/eval-fail-bad-antiquote-3.nix ================================================ ''${x: x}'' ================================================ FILE: data/nix/tests/lang/eval-fail-blackhole.nix ================================================ let { body = x; x = y; y = x; } ================================================ FILE: data/nix/tests/lang/eval-fail-deepseq.nix ================================================ builtins.deepSeq { x = abort "foo"; } 456 ================================================ FILE: data/nix/tests/lang/eval-fail-hashfile-missing.nix ================================================ let paths = [ ./this-file-is-definitely-not-there-7392097 "/and/neither/is/this/37293620" ]; in toString (builtins.concatLists (map (hash: map (builtins.hashFile hash) paths) ["md5" "sha1" "sha256" "sha512"])) ================================================ FILE: data/nix/tests/lang/eval-fail-missing-arg.nix ================================================ ({x, y, z}: x + y + z) {x = "foo"; z = "bar";} ================================================ FILE: data/nix/tests/lang/eval-fail-nonexist-path.nix ================================================ # This must fail to evaluate, since ./fnord doesn't exist. If it did # exist, it would produce "/nix/store/-fnord/xyzzy" (with an # appropriate context). "${./fnord}/xyzzy" ================================================ FILE: data/nix/tests/lang/eval-fail-path-slash.nix ================================================ # Trailing slashes in paths are not allowed. # This restriction could be lifted sometime, # for example if we make '/' a path concatenation operator. # See https://github.com/NixOS/nix/issues/1138 # and https://nixos.org/nix-dev/2016-June/020829.html /nix/store/ ================================================ FILE: data/nix/tests/lang/eval-fail-remove.nix ================================================ let { attrs = {x = 123; y = 456;}; body = (removeAttrs attrs ["x"]).x; } ================================================ FILE: data/nix/tests/lang/eval-fail-scope-5.nix ================================================ let { x = "a"; y = "b"; f = {x ? y, y ? x}: x + y; body = f {}; } ================================================ FILE: data/nix/tests/lang/eval-fail-seq.nix ================================================ builtins.seq (abort "foo") 2 ================================================ FILE: data/nix/tests/lang/eval-fail-substring.nix ================================================ builtins.substring (builtins.sub 0 1) 1 "x" ================================================ FILE: data/nix/tests/lang/eval-fail-to-path.nix ================================================ builtins.toPath "foo/bar" ================================================ FILE: data/nix/tests/lang/eval-fail-undeclared-arg.nix ================================================ ({x, z}: x + z) {x = "foo"; y = "bla"; z = "bar";} ================================================ FILE: data/nix/tests/lang/eval-okay-any-all.exp ================================================ [ false false true true true true false true ] ================================================ FILE: data/nix/tests/lang/eval-okay-any-all.nix ================================================ with builtins; [ (any (x: x == 1) []) (any (x: x == 1) [2 3 4]) (any (x: x == 1) [1 2 3 4]) (any (x: x == 1) [4 3 2 1]) (all (x: x == 1) []) (all (x: x == 1) [1]) (all (x: x == 1) [1 2 3]) (all (x: x == 1) [1 1 1]) ] ================================================ FILE: data/nix/tests/lang/eval-okay-arithmetic.exp ================================================ 2216 ================================================ FILE: data/nix/tests/lang/eval-okay-arithmetic.nix ================================================ with import ./lib.nix; let { /* Supposedly tail recursive version: range_ = accum: first: last: if first == last then ([first] ++ accum) else range_ ([first] ++ accum) (builtins.add first 1) last; range = range_ []; */ x = 12; err = abort "urgh"; body = sum [ (sum (range 1 50)) (123 + 456) (0 + -10 + -(-11) + -x) (10 - 7 - -2) (10 - (6 - -1)) (10 - 1 + 2) (3 * 4 * 5) (56088 / 123 / 2) (3 + 4 * const 5 0 - 6 / id 2) (builtins.bitAnd 12 10) # 0b1100 & 0b1010 = 8 (builtins.bitOr 12 10) # 0b1100 | 0b1010 = 14 (builtins.bitXor 12 10) # 0b1100 ^ 0b1010 = 6 (if 3 < 7 then 1 else err) (if 7 < 3 then err else 1) (if 3 < 3 then err else 1) (if 3 <= 7 then 1 else err) (if 7 <= 3 then err else 1) (if 3 <= 3 then 1 else err) (if 3 > 7 then err else 1) (if 7 > 3 then 1 else err) (if 3 > 3 then err else 1) (if 3 >= 7 then err else 1) (if 7 >= 3 then 1 else err) (if 3 >= 3 then 1 else err) (if 2 > 1 == 1 < 2 then 1 else err) (if 1 + 2 * 3 >= 7 then 1 else err) (if 1 + 2 * 3 < 7 then err else 1) # Not integer, but so what. (if "aa" < "ab" then 1 else err) (if "aa" < "aa" then err else 1) (if "foo" < "foobar" then 1 else err) ]; } ================================================ FILE: data/nix/tests/lang/eval-okay-attrnames.exp ================================================ "newxfoonewxy" ================================================ FILE: data/nix/tests/lang/eval-okay-attrnames.nix ================================================ with import ./lib.nix; let attrs = {y = "y"; x = "x"; foo = "foo";} // rec {x = "newx"; bar = x;}; names = builtins.attrNames attrs; values = map (name: builtins.getAttr name attrs) names; in assert values == builtins.attrValues attrs; concat values ================================================ FILE: data/nix/tests/lang/eval-okay-attrs.exp ================================================ 987 ================================================ FILE: data/nix/tests/lang/eval-okay-attrs.nix ================================================ let { as = { x = 123; y = 456; } // { z = 789; } // { z = 987; }; body = if as ? a then as.a else assert as ? z; as.z; } ================================================ FILE: data/nix/tests/lang/eval-okay-attrs2.exp ================================================ 987 ================================================ FILE: data/nix/tests/lang/eval-okay-attrs2.nix ================================================ let { as = { x = 123; y = 456; } // { z = 789; } // { z = 987; }; A = "a"; Z = "z"; body = if builtins.hasAttr A as then builtins.getAttr A as else assert builtins.hasAttr Z as; builtins.getAttr Z as; } ================================================ FILE: data/nix/tests/lang/eval-okay-attrs3.exp ================================================ "foo 22 80 itchyxac" ================================================ FILE: data/nix/tests/lang/eval-okay-attrs3.nix ================================================ let config = { services.sshd.enable = true; services.sshd.port = 22; services.httpd.port = 80; hostName = "itchy"; a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z = "x"; foo = { a = "a"; b.c = "c"; }; }; in if config.services.sshd.enable then "foo ${toString config.services.sshd.port} ${toString config.services.httpd.port} ${config.hostName}" + "${config.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z}" + "${config.foo.a}" + "${config.foo.b.c}" else "bar" ================================================ FILE: data/nix/tests/lang/eval-okay-attrs4.exp ================================================ [ true false true false false true false false ] ================================================ FILE: data/nix/tests/lang/eval-okay-attrs4.nix ================================================ let as = { x.y.z = 123; a.b.c = 456; }; bs = null; in [ (as ? x) (as ? y) (as ? x.y.z) (as ? x.y.z.a) (as ? x.y.a) (as ? a.b.c) (bs ? x) (bs ? x.y.z) ] ================================================ FILE: data/nix/tests/lang/eval-okay-attrs5.exp ================================================ [ 123 "foo" 456 456 "foo" "xyzzy" "xyzzy" true ] ================================================ FILE: data/nix/tests/lang/eval-okay-attrs5.nix ================================================ with import ./lib.nix; let as = { x.y.z = 123; a.b.c = 456; }; bs = { f-o-o.bar = "foo"; }; or = x: y: x || y; in [ as.x.y.z as.foo or "foo" as.x.y.bla or as.a.b.c as.a.b.c or as.x.y.z as.x.y.bla or bs.f-o-o.bar or "xyzzy" as.x.y.bla or bs.bar.foo or "xyzzy" (123).bla or null.foo or "xyzzy" # Backwards compatibility test. (fold or [] [true false false]) ] ================================================ FILE: data/nix/tests/lang/eval-okay-attrs6.exp ================================================ { __overrides = { bar = "qux"; }; bar = "qux"; foo = "bar"; } ================================================ FILE: data/nix/tests/lang/eval-okay-attrs6.nix ================================================ rec { "${"foo"}" = "bar"; __overrides = { bar = "qux"; }; } ================================================ FILE: data/nix/tests/lang/eval-okay-autoargs.exp ================================================ "xyzzy!xyzzy!foobar" ================================================ FILE: data/nix/tests/lang/eval-okay-autoargs.flags ================================================ --arg lib import(lang/lib.nix) --argstr xyzzy xyzzy! -A result ================================================ FILE: data/nix/tests/lang/eval-okay-autoargs.nix ================================================ let foobar = "foobar"; in { xyzzy2 ? xyzzy # mutually recursive args , xyzzy ? "blaat" # will be overridden by --argstr , fb ? foobar , lib # will be set by --arg }: { result = lib.concat [xyzzy xyzzy2 fb]; } ================================================ FILE: data/nix/tests/lang/eval-okay-backslash-newline-1.exp ================================================ "a\nb" ================================================ FILE: data/nix/tests/lang/eval-okay-backslash-newline-1.nix ================================================ "a\ b" ================================================ FILE: data/nix/tests/lang/eval-okay-backslash-newline-2.exp ================================================ "a\nb" ================================================ FILE: data/nix/tests/lang/eval-okay-backslash-newline-2.nix ================================================ ''a''\ b'' ================================================ FILE: data/nix/tests/lang/eval-okay-builtins-add.exp ================================================ [ 5 4 "int" "tt" "float" 4 ] ================================================ FILE: data/nix/tests/lang/eval-okay-builtins-add.nix ================================================ [ (builtins.add 2 3) (builtins.add 2 2) (builtins.typeOf (builtins.add 2 2)) ("t" + "t") (builtins.typeOf (builtins.add 2.0 2)) (builtins.add 2.0 2) ] ================================================ FILE: data/nix/tests/lang/eval-okay-builtins.exp ================================================ /foo ================================================ FILE: data/nix/tests/lang/eval-okay-builtins.nix ================================================ assert builtins ? currentSystem; assert !builtins ? __currentSystem; let { x = if builtins ? dirOf then builtins.dirOf /foo/bar else ""; y = if builtins ? fnord then builtins.fnord "foo" else ""; body = x + y; } ================================================ FILE: data/nix/tests/lang/eval-okay-callable-attrs.exp ================================================ true ================================================ FILE: data/nix/tests/lang/eval-okay-callable-attrs.nix ================================================ ({ __functor = self: x: self.foo && x; foo = false; } // { foo = true; }) true ================================================ FILE: data/nix/tests/lang/eval-okay-catattrs.exp ================================================ [ 1 2 ] ================================================ FILE: data/nix/tests/lang/eval-okay-catattrs.nix ================================================ builtins.catAttrs "a" [ { a = 1; } { b = 0; } { a = 2; } ] ================================================ FILE: data/nix/tests/lang/eval-okay-closure.exp.xml ================================================ ================================================ FILE: data/nix/tests/lang/eval-okay-closure.nix ================================================ let closure = builtins.genericClosure { startSet = [{key = 80;}]; operator = {key, foo ? false}: if builtins.lessThan key 0 then [] else [{key = builtins.sub key 9;} {key = builtins.sub key 13; foo = true;}]; }; sort = (import ./lib.nix).sortBy (a: b: builtins.lessThan a.key b.key); in sort closure ================================================ FILE: data/nix/tests/lang/eval-okay-comments.exp ================================================ "abcdefghijklmnopqrstuvwxyz" ================================================ FILE: data/nix/tests/lang/eval-okay-comments.nix ================================================ # A simple comment "a"+ # And another ## A double comment "b"+ ## And another # Nested # comments # "c"+ # and # some # other # # An empty line, following here: "d"+ # and a comment not starting the line ! "e"+ /* multiline comments */ "f" + /* multiline comments, on multiple lines */ "g" + # Small, tricky comments /**/ "h"+ /*/*/ "i"+ /***/ "j"+ /* /*/ "k"+ /*/* /*/ "l"+ # Comments with an even number of ending '*' used to fail: "m"+ /* */ /* **/ /* ***/ /* ****/ "n"+ /* */ /** */ /*** */ /**** */ "o"+ /** **/ /*** ***/ /**** ****/ "p"+ /* * ** *** **** ***** */ "q"+ # Random comments /* ***** ////// * / * / /* */ "r"+ # Mixed comments /* # */ "s"+ # /* # "t"+ # /* # */ "u"+ # /*********/ "v"+ ## */* "w"+ /* * Multiline, decorated comments * # This ain't a nest'd comm'nt */ "x"+ ''${/** with **/"y" # real /* comments inside ! # */ # (and empty lines) }''+ /* And a multiline comment, on the same line, after some spaces */ # followed by a one-line comment "z" /* EOF */ ================================================ FILE: data/nix/tests/lang/eval-okay-concat.exp ================================================ [ 1 2 3 4 5 6 7 8 9 ] ================================================ FILE: data/nix/tests/lang/eval-okay-concat.nix ================================================ [1 2 3] ++ [4 5 6] ++ [7 8 9] ================================================ FILE: data/nix/tests/lang/eval-okay-concatmap.exp ================================================ [ [ 1 3 5 7 9 ] [ "a" "z" "b" "z" ] ] ================================================ FILE: data/nix/tests/lang/eval-okay-concatmap.nix ================================================ with import ./lib.nix; [ (builtins.concatMap (x: if x / 2 * 2 == x then [] else [ x ]) (range 0 10)) (builtins.concatMap (x: [x] ++ ["z"]) ["a" "b"]) ] ================================================ FILE: data/nix/tests/lang/eval-okay-concatstringssep.exp ================================================ [ "" "foobarxyzzy" "foo, bar, xyzzy" "foo" "" ] ================================================ FILE: data/nix/tests/lang/eval-okay-concatstringssep.nix ================================================ with builtins; [ (concatStringsSep "" []) (concatStringsSep "" ["foo" "bar" "xyzzy"]) (concatStringsSep ", " ["foo" "bar" "xyzzy"]) (concatStringsSep ", " ["foo"]) (concatStringsSep ", " []) ] ================================================ FILE: data/nix/tests/lang/eval-okay-context-introspection.exp ================================================ true ================================================ FILE: data/nix/tests/lang/eval-okay-context-introspection.nix ================================================ let drv = derivation { name = "fail"; builder = "/bin/false"; system = "x86_64-linux"; outputs = [ "out" "foo" ]; }; path = "${./eval-okay-context-introspection.nix}"; desired-context = { "${builtins.unsafeDiscardStringContext path}" = { path = true; }; "${builtins.unsafeDiscardStringContext drv.drvPath}" = { outputs = [ "foo" "out" ]; allOutputs = true; }; }; legit-context = builtins.getContext "${path}${drv.outPath}${drv.foo.outPath}${drv.drvPath}"; constructed-context = builtins.getContext (builtins.appendContext "" desired-context); in legit-context == constructed-context ================================================ FILE: data/nix/tests/lang/eval-okay-context.exp ================================================ "foo eval-okay-context.nix bar" ================================================ FILE: data/nix/tests/lang/eval-okay-context.nix ================================================ let s = "foo ${builtins.substring 33 100 (baseNameOf "${./eval-okay-context.nix}")} bar"; in if s != "foo eval-okay-context.nix bar" then abort "context not discarded" else builtins.unsafeDiscardStringContext s ================================================ FILE: data/nix/tests/lang/eval-okay-curpos.exp ================================================ [ 3 7 4 9 ] ================================================ FILE: data/nix/tests/lang/eval-okay-curpos.nix ================================================ # Bla let x = __curPos; y = __curPos; in [ x.line x.column y.line y.column ] ================================================ FILE: data/nix/tests/lang/eval-okay-deepseq.exp ================================================ 456 ================================================ FILE: data/nix/tests/lang/eval-okay-deepseq.nix ================================================ builtins.deepSeq (let as = { x = 123; y = as; }; in as) 456 ================================================ FILE: data/nix/tests/lang/eval-okay-delayed-with-inherit.exp ================================================ "b-overridden" ================================================ FILE: data/nix/tests/lang/eval-okay-delayed-with-inherit.nix ================================================ let pkgs_ = with pkgs; { a = derivation { name = "a"; system = builtins.currentSystem; builder = "/bin/sh"; args = [ "-c" "touch $out" ]; inherit b; }; inherit b; }; packageOverrides = p: { b = derivation { name = "b-overridden"; system = builtins.currentSystem; builder = "/bin/sh"; args = [ "-c" "touch $out" ]; }; }; pkgs = pkgs_ // (packageOverrides pkgs_); in pkgs.a.b.name ================================================ FILE: data/nix/tests/lang/eval-okay-delayed-with.exp ================================================ "b-overridden b-overridden a" ================================================ FILE: data/nix/tests/lang/eval-okay-delayed-with.nix ================================================ let pkgs_ = with pkgs; { a = derivation { name = "a"; system = builtins.currentSystem; builder = "/bin/sh"; args = [ "-c" "touch $out" ]; inherit b; }; b = derivation { name = "b"; system = builtins.currentSystem; builder = "/bin/sh"; args = [ "-c" "touch $out" ]; inherit a; }; c = b; }; packageOverrides = pkgs: with pkgs; { b = derivation (b.drvAttrs // { name = "${b.name}-overridden"; }); }; pkgs = pkgs_ // (packageOverrides pkgs_); in "${pkgs.a.b.name} ${pkgs.c.name} ${pkgs.b.a.name}" ================================================ FILE: data/nix/tests/lang/eval-okay-dynamic-attrs-2.exp ================================================ true ================================================ FILE: data/nix/tests/lang/eval-okay-dynamic-attrs-2.nix ================================================ { a."${"b"}" = true; a."${"c"}" = false; }.a.b ================================================ FILE: data/nix/tests/lang/eval-okay-dynamic-attrs-bare.exp ================================================ { binds = true; hasAttrs = true; multiAttrs = true; recBinds = true; selectAttrs = true; selectOrAttrs = true; } ================================================ FILE: data/nix/tests/lang/eval-okay-dynamic-attrs-bare.nix ================================================ let aString = "a"; bString = "b"; in { hasAttrs = { a.b = null; } ? ${aString}.b; selectAttrs = { a.b = true; }.a.${bString}; selectOrAttrs = { }.${aString} or true; binds = { ${aString}."${bString}c" = true; }.a.bc; recBinds = rec { ${bString} = a; a = true; }.b; multiAttrs = { ${aString} = true; ${bString} = false; }.a; } ================================================ FILE: data/nix/tests/lang/eval-okay-dynamic-attrs.exp ================================================ { binds = true; hasAttrs = true; multiAttrs = true; recBinds = true; selectAttrs = true; selectOrAttrs = true; } ================================================ FILE: data/nix/tests/lang/eval-okay-dynamic-attrs.nix ================================================ let aString = "a"; bString = "b"; in { hasAttrs = { a.b = null; } ? "${aString}".b; selectAttrs = { a.b = true; }.a."${bString}"; selectOrAttrs = { }."${aString}" or true; binds = { "${aString}"."${bString}c" = true; }.a.bc; recBinds = rec { "${bString}" = a; a = true; }.b; multiAttrs = { "${aString}" = true; "${bString}" = false; }.a; } ================================================ FILE: data/nix/tests/lang/eval-okay-elem.exp ================================================ [ true false 30 ] ================================================ FILE: data/nix/tests/lang/eval-okay-elem.nix ================================================ with import ./lib.nix; let xs = range 10 40; in [ (builtins.elem 23 xs) (builtins.elem 42 xs) (builtins.elemAt xs 20) ] ================================================ FILE: data/nix/tests/lang/eval-okay-empty-args.exp ================================================ "ab" ================================================ FILE: data/nix/tests/lang/eval-okay-empty-args.nix ================================================ ({}: {x,y,}: "${x}${y}") {} {x = "a"; y = "b";} ================================================ FILE: data/nix/tests/lang/eval-okay-eq-derivations.exp ================================================ [ true true true false ] ================================================ FILE: data/nix/tests/lang/eval-okay-eq-derivations.nix ================================================ let drvA1 = derivation { name = "a"; builder = "/foo"; system = "i686-linux"; }; drvA2 = derivation { name = "a"; builder = "/foo"; system = "i686-linux"; }; drvA3 = derivation { name = "a"; builder = "/foo"; system = "i686-linux"; } // { dummy = 1; }; drvC1 = derivation { name = "c"; builder = "/foo"; system = "i686-linux"; }; drvC2 = derivation { name = "c"; builder = "/bar"; system = "i686-linux"; }; in [ (drvA1 == drvA1) (drvA1 == drvA2) (drvA1 == drvA3) (drvC1 == drvC2) ] ================================================ FILE: data/nix/tests/lang/eval-okay-eq.exp.disabled ================================================ Bool(True) ================================================ FILE: data/nix/tests/lang/eval-okay-eq.nix ================================================ ["foobar" (rec {x = 1; y = x;})] == [("foo" + "bar") ({x = 1; y = 1;})] ================================================ FILE: data/nix/tests/lang/eval-okay-filter.exp ================================================ [ 0 2 4 6 8 10 100 102 104 106 108 110 ] ================================================ FILE: data/nix/tests/lang/eval-okay-filter.nix ================================================ with import ./lib.nix; builtins.filter (x: x / 2 * 2 == x) (builtins.concatLists [ (range 0 10) (range 100 110) ]) ================================================ FILE: data/nix/tests/lang/eval-okay-flatten.exp ================================================ "1234567" ================================================ FILE: data/nix/tests/lang/eval-okay-flatten.nix ================================================ with import ./lib.nix; let { l = ["1" "2" ["3" ["4"] ["5" "6"]] "7"]; body = concat (flatten l); } ================================================ FILE: data/nix/tests/lang/eval-okay-float.exp ================================================ [ 3.4 3.5 2.5 1.5 ] ================================================ FILE: data/nix/tests/lang/eval-okay-float.nix ================================================ [ (1.1 + 2.3) (builtins.add (0.5 + 0.5) (2.0 + 0.5)) ((0.5 + 0.5) * (2.0 + 0.5)) ((1.5 + 1.5) / (0.5 * 4.0)) ] ================================================ FILE: data/nix/tests/lang/eval-okay-floor-ceil.exp ================================================ "23;24;23;23" ================================================ FILE: data/nix/tests/lang/eval-okay-floor-ceil.nix ================================================ with import ./lib.nix; let n1 = builtins.floor 23.5; n2 = builtins.ceil 23.5; n3 = builtins.floor 23; n4 = builtins.ceil 23; in builtins.concatStringsSep ";" (map toString [ n1 n2 n3 n4 ]) ================================================ FILE: data/nix/tests/lang/eval-okay-foldlStrict.exp ================================================ 500500 ================================================ FILE: data/nix/tests/lang/eval-okay-foldlStrict.nix ================================================ with import ./lib.nix; builtins.foldl' (x: y: x + y) 0 (range 1 1000) ================================================ FILE: data/nix/tests/lang/eval-okay-fromTOML.exp ================================================ [ { clients = { data = [ [ "gamma" "delta" ] [ 1 2 ] ]; hosts = [ "alpha" "omega" ]; }; database = { connection_max = 5000; enabled = true; ports = [ 8001 8001 8002 ]; server = "192.168.1.1"; }; owner = { name = "Tom Preston-Werner"; }; servers = { alpha = { dc = "eqdc10"; ip = "10.0.0.1"; }; beta = { dc = "eqdc10"; ip = "10.0.0.2"; }; }; title = "TOML Example"; } { "1234" = "value"; "127.0.0.1" = "value"; a = { b = { c = { }; }; }; arr1 = [ 1 2 3 ]; arr2 = [ "red" "yellow" "green" ]; arr3 = [ [ 1 2 ] [ 3 4 5 ] ]; arr4 = [ "all" "strings" "are the same" "type" ]; arr5 = [ [ 1 2 ] [ "a" "b" "c" ] ]; arr7 = [ 1 2 3 ]; arr8 = [ 1 2 ]; bare-key = "value"; bare_key = "value"; bin1 = 214; bool1 = true; bool2 = false; "character encoding" = "value"; d = { e = { f = { }; }; }; dog = { "tater.man" = { type = { name = "pug"; }; }; }; flt1 = 1; flt2 = 3.1415; flt3 = -0.01; flt4 = 5e+22; flt5 = 1e+06; flt6 = -0.02; flt7 = 6.626e-34; flt8 = 9.22462e+06; fruit = [ { name = "apple"; physical = { color = "red"; shape = "round"; }; variety = [ { name = "red delicious"; } { name = "granny smith"; } ]; } { name = "banana"; variety = [ { name = "plantain"; } ]; } ]; g = { h = { i = { }; }; }; hex1 = 3735928559; hex2 = 3735928559; hex3 = 3735928559; int1 = 99; int2 = 42; int3 = 0; int4 = -17; int5 = 1000; int6 = 5349221; int7 = 12345; j = { "ʞ" = { l = { }; }; }; key = "value"; key2 = "value"; name = "Orange"; oct1 = 342391; oct2 = 493; physical = { color = "orange"; shape = "round"; }; products = [ { name = "Hammer"; sku = 738594937; } { } { color = "gray"; name = "Nail"; sku = 284758393; } ]; "quoted \"value\"" = "value"; site = { "google.com" = true; }; str = "I'm a string. \"You can quote me\". Name\tJosé\nLocation\tSF."; table-1 = { key1 = "some string"; key2 = 123; }; table-2 = { key1 = "another string"; key2 = 456; }; x = { y = { z = { w = { animal = { type = { name = "pug"; }; }; name = { first = "Tom"; last = "Preston-Werner"; }; point = { x = 1; y = 2; }; }; }; }; }; "ʎǝʞ" = "value"; } { metadata = { "checksum aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4"; "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"; "checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6"; "checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef"; }; package = [ { dependencies = [ "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" ]; name = "aho-corasick"; source = "registry+https://github.com/rust-lang/crates.io-index"; version = "0.6.4"; } { name = "ansi_term"; source = "registry+https://github.com/rust-lang/crates.io-index"; version = "0.9.0"; } { dependencies = [ "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" ]; name = "atty"; source = "registry+https://github.com/rust-lang/crates.io-index"; version = "0.2.10"; } ]; } { a = [ [ { b = true; } ] ]; c = [ [ { d = true; } ] ]; e = [ [ 123 ] ]; } ] ================================================ FILE: data/nix/tests/lang/eval-okay-fromTOML.nix ================================================ [ (builtins.fromTOML '' # This is a TOML document. title = "TOML Example" [owner] name = "Tom Preston-Werner" #dob = 1979-05-27T07:32:00-08:00 # First class dates [database] server = "192.168.1.1" ports = [ 8001, 8001, 8002 ] connection_max = 5000 enabled = true [servers] # Indentation (tabs and/or spaces) is allowed but not required [servers.alpha] ip = "10.0.0.1" dc = "eqdc10" [servers.beta] ip = "10.0.0.2" dc = "eqdc10" [clients] data = [ ["gamma", "delta"], [1, 2] ] # Line breaks are OK when inside arrays hosts = [ "alpha", "omega" ] '') (builtins.fromTOML '' key = "value" bare_key = "value" bare-key = "value" 1234 = "value" "127.0.0.1" = "value" "character encoding" = "value" "ʎǝʞ" = "value" 'key2' = "value" 'quoted "value"' = "value" name = "Orange" physical.color = "orange" physical.shape = "round" site."google.com" = true # This is legal according to the spec, but cpptoml doesn't handle it. #a.b.c = 1 #a.d = 2 str = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF." int1 = +99 int2 = 42 int3 = 0 int4 = -17 int5 = 1_000 int6 = 5_349_221 int7 = 1_2_3_4_5 hex1 = 0xDEADBEEF hex2 = 0xdeadbeef hex3 = 0xdead_beef oct1 = 0o01234567 oct2 = 0o755 bin1 = 0b11010110 flt1 = +1.0 flt2 = 3.1415 flt3 = -0.01 flt4 = 5e+22 flt5 = 1e6 flt6 = -2E-2 flt7 = 6.626e-34 flt8 = 9_224_617.445_991_228_313 bool1 = true bool2 = false # FIXME: not supported because Nix doesn't have a date/time type. #odt1 = 1979-05-27T07:32:00Z #odt2 = 1979-05-27T00:32:00-07:00 #odt3 = 1979-05-27T00:32:00.999999-07:00 #odt4 = 1979-05-27 07:32:00Z #ldt1 = 1979-05-27T07:32:00 #ldt2 = 1979-05-27T00:32:00.999999 #ld1 = 1979-05-27 #lt1 = 07:32:00 #lt2 = 00:32:00.999999 arr1 = [ 1, 2, 3 ] arr2 = [ "red", "yellow", "green" ] arr3 = [ [ 1, 2 ], [3, 4, 5] ] arr4 = [ "all", 'strings', """are the same""", ''''type''''] arr5 = [ [ 1, 2 ], ["a", "b", "c"] ] arr7 = [ 1, 2, 3 ] arr8 = [ 1, 2, # this is ok ] [table-1] key1 = "some string" key2 = 123 [table-2] key1 = "another string" key2 = 456 [dog."tater.man"] type.name = "pug" [a.b.c] [ d.e.f ] [ g . h . i ] [ j . "ʞ" . 'l' ] [x.y.z.w] name = { first = "Tom", last = "Preston-Werner" } point = { x = 1, y = 2 } animal = { type.name = "pug" } [[products]] name = "Hammer" sku = 738594937 [[products]] [[products]] name = "Nail" sku = 284758393 color = "gray" [[fruit]] name = "apple" [fruit.physical] color = "red" shape = "round" [[fruit.variety]] name = "red delicious" [[fruit.variety]] name = "granny smith" [[fruit]] name = "banana" [[fruit.variety]] name = "plantain" '') (builtins.fromTOML '' [[package]] name = "aho-corasick" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ansi_term" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "atty" version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [metadata] "checksum aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6" "checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef" '') (builtins.fromTOML '' a = [[{ b = true }]] c = [ [ { d = true } ] ] e = [[123]] '') ] ================================================ FILE: data/nix/tests/lang/eval-okay-fromjson-escapes.exp ================================================ "quote \" reverse solidus \\ solidus / backspace  formfeed newline \n carriage return \r horizontal tab \t 1 char unicode encoded backspace  1 char unicode encoded e with accent é 2 char unicode encoded s with caron š 3 char unicode encoded rightwards arrow →" ================================================ FILE: data/nix/tests/lang/eval-okay-fromjson-escapes.nix ================================================ # This string contains all supported escapes in a JSON string, per json.org # \b and \f are not supported by Nix builtins.fromJSON ''"quote \" reverse solidus \\ solidus \/ backspace \b formfeed \f newline \n carriage return \r horizontal tab \t 1 char unicode encoded backspace \u0008 1 char unicode encoded e with accent \u00e9 2 char unicode encoded s with caron \u0161 3 char unicode encoded rightwards arrow \u2192"'' ================================================ FILE: data/nix/tests/lang/eval-okay-fromjson.exp ================================================ true ================================================ FILE: data/nix/tests/lang/eval-okay-fromjson.nix ================================================ # RFC 7159, section 13. builtins.fromJSON '' { "Image": { "Width": 800, "Height": 600, "Title": "View from 15th Floor", "Thumbnail": { "Url": "http://www.example.com/image/481989943", "Height": 125, "Width": 100 }, "Animated" : false, "IDs": [116, 943, 234, 38793, true ,false,null, -100], "Latitude": 37.7668, "Longitude": -122.3959 } } '' == { Image = { Width = 800; Height = 600; Title = "View from 15th Floor"; Thumbnail = { Url = http://www.example.com/image/481989943; Height = 125; Width = 100; }; Animated = false; IDs = [ 116 943 234 38793 true false null (0-100) ]; Latitude = 37.7668; Longitude = -122.3959; }; } ================================================ FILE: data/nix/tests/lang/eval-okay-functionargs.exp.xml ================================================ ================================================ FILE: data/nix/tests/lang/eval-okay-functionargs.nix ================================================ let stdenvFun = { }: { name = "stdenv"; }; stdenv2Fun = { }: { name = "stdenv2"; }; fetchurlFun = { stdenv }: assert stdenv.name == "stdenv"; { name = "fetchurl"; }; atermFun = { stdenv, fetchurl }: { name = "aterm-${stdenv.name}"; }; aterm2Fun = { stdenv, fetchurl }: { name = "aterm2-${stdenv.name}"; }; nixFun = { stdenv, fetchurl, aterm }: { name = "nix-${stdenv.name}-${aterm.name}"; }; mplayerFun = { stdenv, fetchurl, enableX11 ? false, xorg ? null, enableFoo ? true, foo ? null }: assert stdenv.name == "stdenv2"; assert enableX11 -> xorg.libXv.name == "libXv"; assert enableFoo -> foo != null; { name = "mplayer-${stdenv.name}.${xorg.libXv.name}-${xorg.libX11.name}"; }; makeOverridable = f: origArgs: f origArgs // { override = newArgs: makeOverridable f (origArgs // (if builtins.isFunction newArgs then newArgs origArgs else newArgs)); }; callPackage_ = pkgs: f: args: makeOverridable f ((builtins.intersectAttrs (builtins.functionArgs f) pkgs) // args); allPackages = { overrides ? (pkgs: pkgsPrev: { }) }: let callPackage = callPackage_ pkgs; pkgs = pkgsStd // (overrides pkgs pkgsStd); pkgsStd = { inherit pkgs; stdenv = callPackage stdenvFun { }; stdenv2 = callPackage stdenv2Fun { }; fetchurl = callPackage fetchurlFun { }; aterm = callPackage atermFun { }; xorg = callPackage xorgFun { }; mplayer = callPackage mplayerFun { stdenv = pkgs.stdenv2; enableFoo = false; }; nix = callPackage nixFun { }; }; in pkgs; libX11Fun = { stdenv, fetchurl }: { name = "libX11"; }; libX11_2Fun = { stdenv, fetchurl }: { name = "libX11_2"; }; libXvFun = { stdenv, fetchurl, libX11 }: { name = "libXv"; }; xorgFun = { pkgs }: let callPackage = callPackage_ (pkgs // pkgs.xorg); in { libX11 = callPackage libX11Fun { }; libXv = callPackage libXvFun { }; }; in let pkgs = allPackages { }; pkgs2 = allPackages { overrides = pkgs: pkgsPrev: { stdenv = pkgs.stdenv2; nix = pkgsPrev.nix.override { aterm = aterm2Fun { inherit (pkgs) stdenv fetchurl; }; }; xorg = pkgsPrev.xorg // { libX11 = libX11_2Fun { inherit (pkgs) stdenv fetchurl; }; }; }; }; in [ pkgs.stdenv.name pkgs.fetchurl.name pkgs.aterm.name pkgs2.aterm.name pkgs.xorg.libX11.name pkgs.xorg.libXv.name pkgs.mplayer.name pkgs2.mplayer.name pkgs.nix.name pkgs2.nix.name ] ================================================ FILE: data/nix/tests/lang/eval-okay-getattrpos-functionargs.exp ================================================ { column = 11; file = "eval-okay-getattrpos-functionargs.nix"; line = 2; } ================================================ FILE: data/nix/tests/lang/eval-okay-getattrpos-functionargs.nix ================================================ let fun = { foo }: {}; pos = builtins.unsafeGetAttrPos "foo" (builtins.functionArgs fun); in { inherit (pos) column line; file = baseNameOf pos.file; } ================================================ FILE: data/nix/tests/lang/eval-okay-getattrpos-undefined.exp ================================================ null ================================================ FILE: data/nix/tests/lang/eval-okay-getattrpos-undefined.nix ================================================ builtins.unsafeGetAttrPos "abort" builtins ================================================ FILE: data/nix/tests/lang/eval-okay-getattrpos.exp ================================================ { column = 5; file = "eval-okay-getattrpos.nix"; line = 3; } ================================================ FILE: data/nix/tests/lang/eval-okay-getattrpos.nix ================================================ let as = { foo = "bar"; }; pos = builtins.unsafeGetAttrPos "foo" as; in { inherit (pos) column line; file = baseNameOf pos.file; } ================================================ FILE: data/nix/tests/lang/eval-okay-getenv.exp ================================================ "foobar" ================================================ FILE: data/nix/tests/lang/eval-okay-getenv.nix ================================================ builtins.getEnv "TEST_VAR" + (if builtins.getEnv "NO_SUCH_VAR" == "" then "bar" else "bla") ================================================ FILE: data/nix/tests/lang/eval-okay-hash.exp ================================================ ================================================ FILE: data/nix/tests/lang/eval-okay-hashfile.exp ================================================ [ "d3b07384d113edec49eaa6238ad5ff00" "0f343b0931126a20f133d67c2b018a3b" "f1d2d2f924e986ac86fdf7b36c94bcdf32beec15" "60cacbf3d72e1e7834203da608037b1bf83b40e8" "b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c" "5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef" "0cf9180a764aba863a67b6d72f0918bc131c6772642cb2dce5a34f0a702f9470ddc2bf125c12198b1995c233c34b4afd346c54a2334c350a948a51b6e8b4e6b6" "8efb4f73c5655351c444eb109230c556d39e2c7624e9c11abc9e3fb4b9b9254218cc5085b454a9698d085cfa92198491f07a723be4574adc70617b73eb0b6461" ] ================================================ FILE: data/nix/tests/lang/eval-okay-hashfile.nix ================================================ let paths = [ ./data ./binary-data ]; in builtins.concatLists (map (hash: map (builtins.hashFile hash) paths) ["md5" "sha1" "sha256" "sha512"]) ================================================ FILE: data/nix/tests/lang/eval-okay-hashstring.exp ================================================ [ "d41d8cd98f00b204e9800998ecf8427e" "6c69ee7f211c640419d5366cc076ae46" "bb3438fbabd460ea6dbd27d153e2233b" "da39a3ee5e6b4b0d3255bfef95601890afd80709" "cd54e8568c1b37cf1e5badb0779bcbf382212189" "6d12e10b1d331dad210e47fd25d4f260802b7e77" "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" "900a4469df00ccbfd0c145c6d1e4b7953dd0afafadd7534e3a4019e8d38fc663" "ad0387b3bd8652f730ca46d25f9c170af0fd589f42e7f23f5a9e6412d97d7e56" "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e" "9d0886f8c6b389398a16257bc79780fab9831c7fc11c8ab07fa732cb7b348feade382f92617c9c5305fefba0af02ab5fd39a587d330997ff5bd0db19f7666653" "21644b72aa259e5a588cd3afbafb1d4310f4889680f6c83b9d531596a5a284f34dbebff409d23bcc86aee6bad10c891606f075c6f4755cb536da27db5693f3a7" ] ================================================ FILE: data/nix/tests/lang/eval-okay-hashstring.nix ================================================ let strings = [ "" "text 1" "text 2" ]; in builtins.concatLists (map (hash: map (builtins.hashString hash) strings) ["md5" "sha1" "sha256" "sha512"]) ================================================ FILE: data/nix/tests/lang/eval-okay-if.exp ================================================ 3 ================================================ FILE: data/nix/tests/lang/eval-okay-if.nix ================================================ if "foo" != "f" + "oo" then 1 else if false then 2 else 3 ================================================ FILE: data/nix/tests/lang/eval-okay-import.exp ================================================ [ 1 2 3 4 5 6 7 8 9 10 ] ================================================ FILE: data/nix/tests/lang/eval-okay-import.nix ================================================ let overrides = { import = fn: scopedImport overrides fn; scopedImport = attrs: fn: scopedImport (overrides // attrs) fn; builtins = builtins // overrides; } // import ./lib.nix; in scopedImport overrides ./imported.nix ================================================ FILE: data/nix/tests/lang/eval-okay-ind-string.exp ================================================ "This is an indented multi-line string\nliteral. An amount of whitespace at\nthe start of each line matching the minimum\nindentation of all lines in the string\nliteral together will be removed. Thus,\nin this case four spaces will be\nstripped from each line, even though\n THIS LINE is indented six spaces.\n\nAlso, empty lines don't count in the\ndetermination of the indentation level (the\nprevious empty line has indentation 0, but\nit doesn't matter).\nIf the string starts with whitespace\n followed by a newline, it's stripped, but\n that's not the case here. Two spaces are\n stripped because of the \" \" at the start. \nThis line is indented\na bit further.\nAnti-quotations, like so, are\nalso allowed.\n The \\ is not special here.\n' can be followed by any character except another ', e.g. 'x'.\nLikewise for $, e.g. $$ or $varName.\nBut ' followed by ' is special, as is $ followed by {.\nIf you want them, use anti-quotations: '', \${.\n Tabs are not interpreted as whitespace (since we can't guess\n what tab settings are intended), so don't use them.\n\tThis line starts with a space and a tab, so only one\n space will be stripped from each line.\nAlso note that if the last line (just before the closing ' ')\nconsists only of whitespace, it's ignored. But here there is\nsome non-whitespace stuff, so the line isn't removed. \nThis shows a hacky way to preserve an empty line after the start.\nBut there's no reason to do so: you could just repeat the empty\nline.\n Similarly you can force an indentation level,\n in this case to 2 spaces. This works because the anti-quote\n is significant (not whitespace).\nstart on network-interfaces\n\nstart script\n\n rm -f /var/run/opengl-driver\n ln -sf 123 /var/run/opengl-driver\n\n rm -f /var/log/slim.log\n \nend script\n\nenv SLIM_CFGFILE=abc\nenv SLIM_THEMESDIR=def\nenv FONTCONFIG_FILE=/etc/fonts/fonts.conf \t\t\t\t# !!! cleanup\nenv XKB_BINDIR=foo/bin \t\t\t\t# Needed for the Xkb extension.\nenv LD_LIBRARY_PATH=libX11/lib:libXext/lib:/usr/lib/ # related to xorg-sys-opengl - needed to load libglx for (AI)GLX support (for compiz)\n\nenv XORG_DRI_DRIVER_PATH=nvidiaDrivers/X11R6/lib/modules/drivers/ \n\nexec slim/bin/slim\nEscaping of ' followed by ': ''\nEscaping of $ followed by {: \${\nAnd finally to interpret \\n etc. as in a string: \n, \r, \t.\nfoo\n'bla'\nbar\ncut -d $'\\t' -f 1\nending dollar $$\n" ================================================ FILE: data/nix/tests/lang/eval-okay-ind-string.nix ================================================ let s1 = '' This is an indented multi-line string literal. An amount of whitespace at the start of each line matching the minimum indentation of all lines in the string literal together will be removed. Thus, in this case four spaces will be stripped from each line, even though THIS LINE is indented six spaces. Also, empty lines don't count in the determination of the indentation level (the previous empty line has indentation 0, but it doesn't matter). ''; s2 = '' If the string starts with whitespace followed by a newline, it's stripped, but that's not the case here. Two spaces are stripped because of the " " at the start. ''; s3 = '' This line is indented a bit further. ''; # indentation of last line doesn't count if it's empty s4 = '' Anti-quotations, like ${if true then "so" else "not so"}, are also allowed. ''; s5 = '' The \ is not special here. ' can be followed by any character except another ', e.g. 'x'. Likewise for $, e.g. $$ or $varName. But ' followed by ' is special, as is $ followed by {. If you want them, use anti-quotations: ${"''"}, ${"\${"}. ''; s6 = '' Tabs are not interpreted as whitespace (since we can't guess what tab settings are intended), so don't use them. This line starts with a space and a tab, so only one space will be stripped from each line. ''; s7 = '' Also note that if the last line (just before the closing ' ') consists only of whitespace, it's ignored. But here there is some non-whitespace stuff, so the line isn't removed. ''; s8 = '' ${""} This shows a hacky way to preserve an empty line after the start. But there's no reason to do so: you could just repeat the empty line. ''; s9 = '' ${""} Similarly you can force an indentation level, in this case to 2 spaces. This works because the anti-quote is significant (not whitespace). ''; s10 = '' ''; s11 = ''''; s12 = '' ''; s13 = '' start on network-interfaces start script rm -f /var/run/opengl-driver ${if true then "ln -sf 123 /var/run/opengl-driver" else if true then "ln -sf 456 /var/run/opengl-driver" else "" } rm -f /var/log/slim.log end script env SLIM_CFGFILE=${"abc"} env SLIM_THEMESDIR=${"def"} env FONTCONFIG_FILE=/etc/fonts/fonts.conf # !!! cleanup env XKB_BINDIR=${"foo"}/bin # Needed for the Xkb extension. env LD_LIBRARY_PATH=${"libX11"}/lib:${"libXext"}/lib:/usr/lib/ # related to xorg-sys-opengl - needed to load libglx for (AI)GLX support (for compiz) ${if true then "env XORG_DRI_DRIVER_PATH=${"nvidiaDrivers"}/X11R6/lib/modules/drivers/" else if true then "env XORG_DRI_DRIVER_PATH=${"mesa"}/lib/modules/dri" else "" } exec ${"slim"}/bin/slim ''; s14 = '' Escaping of ' followed by ': ''' Escaping of $ followed by {: ''${ And finally to interpret \n etc. as in a string: ''\n, ''\r, ''\t. ''; # Regression test: antiquotation in '${x}' should work, but didn't. s15 = let x = "bla"; in '' foo '${x}' bar ''; # Regression test: accept $'. s16 = '' cut -d $'\t' -f 1 ''; # Accept dollars at end of strings s17 = ''ending dollar $'' + ''$'' + "\n"; in s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10 + s11 + s12 + s13 + s14 + s15 + s16 + s17 ================================================ FILE: data/nix/tests/lang/eval-okay-let.exp ================================================ "foobar" ================================================ FILE: data/nix/tests/lang/eval-okay-let.nix ================================================ let { x = "foo"; y = "bar"; body = x + y; } ================================================ FILE: data/nix/tests/lang/eval-okay-list.exp ================================================ "foobarblatest" ================================================ FILE: data/nix/tests/lang/eval-okay-list.nix ================================================ with import ./lib.nix; let { body = concat ["foo" "bar" "bla" "test"]; } ================================================ FILE: data/nix/tests/lang/eval-okay-listtoattrs.exp ================================================ "AAbar" ================================================ FILE: data/nix/tests/lang/eval-okay-listtoattrs.nix ================================================ # this test shows how to use listToAttrs and that evaluation is still lazy (throw isn't called) with import ./lib.nix; let asi = name: value : { inherit name value; }; list = [ ( asi "a" "A" ) ( asi "b" "B" ) ]; a = builtins.listToAttrs list; b = builtins.listToAttrs ( list ++ list ); r = builtins.listToAttrs [ (asi "result" [ a b ]) ( asi "throw" (throw "this should not be thrown")) ]; x = builtins.listToAttrs [ (asi "foo" "bar") (asi "foo" "bla") ]; in concat (map (x: x.a) r.result) + x.foo ================================================ FILE: data/nix/tests/lang/eval-okay-logic.exp ================================================ 1 ================================================ FILE: data/nix/tests/lang/eval-okay-logic.nix ================================================ assert !false && (true || false) -> true; 1 ================================================ FILE: data/nix/tests/lang/eval-okay-map.exp ================================================ "foobarblabarxyzzybar" ================================================ FILE: data/nix/tests/lang/eval-okay-map.nix ================================================ with import ./lib.nix; concat (map (x: x + "bar") [ "foo" "bla" "xyzzy" ]) ================================================ FILE: data/nix/tests/lang/eval-okay-mapattrs.exp ================================================ { x = "x-foo"; y = "y-bar"; } ================================================ FILE: data/nix/tests/lang/eval-okay-mapattrs.nix ================================================ with import ./lib.nix; builtins.mapAttrs (name: value: name + "-" + value) { x = "foo"; y = "bar"; } ================================================ FILE: data/nix/tests/lang/eval-okay-nested-with.exp ================================================ 2 ================================================ FILE: data/nix/tests/lang/eval-okay-nested-with.nix ================================================ with { x = 1; }; with { x = 2; }; x ================================================ FILE: data/nix/tests/lang/eval-okay-new-let.exp ================================================ "xyzzyfoobar" ================================================ FILE: data/nix/tests/lang/eval-okay-new-let.nix ================================================ let f = z: let x = "foo"; y = "bar"; body = 1; # compat test in z + x + y; arg = "xyzzy"; in f arg ================================================ FILE: data/nix/tests/lang/eval-okay-null-dynamic-attrs.exp ================================================ true ================================================ FILE: data/nix/tests/lang/eval-okay-null-dynamic-attrs.nix ================================================ { ${null} = true; } == {} ================================================ FILE: data/nix/tests/lang/eval-okay-overrides.exp ================================================ 2 ================================================ FILE: data/nix/tests/lang/eval-okay-overrides.nix ================================================ let overrides = { a = 2; }; in (rec { __overrides = overrides; x = a; a = 1; }).x ================================================ FILE: data/nix/tests/lang/eval-okay-partition.exp ================================================ { right = [ 0 2 4 6 8 10 100 102 104 106 108 110 ]; wrong = [ 1 3 5 7 9 101 103 105 107 109 ]; } ================================================ FILE: data/nix/tests/lang/eval-okay-partition.nix ================================================ with import ./lib.nix; builtins.partition (x: x / 2 * 2 == x) (builtins.concatLists [ (range 0 10) (range 100 110) ]) ================================================ FILE: data/nix/tests/lang/eval-okay-path-antiquotation.nix ================================================ let foo = "foo"; in { simple = ./${foo}; surrounded = ./a-${foo}-b; absolute = /${foo}; expr = ./${foo + "/bar"}; home = ~/${foo}; notfirst = ./bar/${foo}; slashes = /${foo}/${"bar"}; } ================================================ FILE: data/nix/tests/lang/eval-okay-path.nix ================================================ builtins.path { path = ./.; filter = path: _: baseNameOf path == "data"; recursive = true; sha256 = "1yhm3gwvg5a41yylymgblsclk95fs6jy72w0wv925mmidlhcq4sw"; name = "output"; } ================================================ FILE: data/nix/tests/lang/eval-okay-pathexists.exp ================================================ true ================================================ FILE: data/nix/tests/lang/eval-okay-pathexists.nix ================================================ builtins.pathExists (builtins.toPath ./lib.nix) && builtins.pathExists (builtins.toPath (builtins.toString ./lib.nix)) && !builtins.pathExists (builtins.toPath (builtins.toString ./bla.nix)) && builtins.pathExists ./lib.nix && !builtins.pathExists ./bla.nix ================================================ FILE: data/nix/tests/lang/eval-okay-patterns.exp ================================================ "abcxyzDDDDEFijk" ================================================ FILE: data/nix/tests/lang/eval-okay-patterns.nix ================================================ let f = args@{x, y, z}: x + args.y + z; g = {x, y, z}@args: f args; h = {x ? "d", y ? x, z ? args.x}@args: x + y + z; j = {x, y, z, ...}: x + y + z; in f {x = "a"; y = "b"; z = "c";} + g {x = "x"; y = "y"; z = "z";} + h {x = "D";} + h {x = "D"; y = "E"; z = "F";} + j {x = "i"; y = "j"; z = "k"; bla = "bla"; foo = "bar";} ================================================ FILE: data/nix/tests/lang/eval-okay-readDir.exp ================================================ { bar = "regular"; foo = "directory"; } ================================================ FILE: data/nix/tests/lang/eval-okay-readDir.nix ================================================ builtins.readDir ./readDir ================================================ FILE: data/nix/tests/lang/eval-okay-readfile.exp ================================================ "builtins.readFile ./eval-okay-readfile.nix\n" ================================================ FILE: data/nix/tests/lang/eval-okay-readfile.nix ================================================ builtins.readFile ./eval-okay-readfile.nix ================================================ FILE: data/nix/tests/lang/eval-okay-redefine-builtin.exp ================================================ false ================================================ FILE: data/nix/tests/lang/eval-okay-redefine-builtin.nix ================================================ let throw = abort "Error!"; in (builtins.tryEval ).success ================================================ FILE: data/nix/tests/lang/eval-okay-regex-match.exp ================================================ true ================================================ FILE: data/nix/tests/lang/eval-okay-regex-match.nix ================================================ with builtins; let matches = pat: s: match pat s != null; splitFN = match "((.*)/)?([^/]*)\\.(nix|cc)"; in assert matches "foobar" "foobar"; assert matches "fo*" "f"; assert !matches "fo+" "f"; assert matches "fo*" "fo"; assert matches "fo*" "foo"; assert matches "fo+" "foo"; assert matches "fo{1,2}" "foo"; assert !matches "fo{1,2}" "fooo"; assert !matches "fo*" "foobar"; assert matches "[[:space:]]+([^[:space:]]+)[[:space:]]+" " foo "; assert !matches "[[:space:]]+([[:upper:]]+)[[:space:]]+" " foo "; assert match "(.*)\\.nix" "foobar.nix" == [ "foobar" ]; assert match "[[:space:]]+([[:upper:]]+)[[:space:]]+" " FOO " == [ "FOO" ]; assert splitFN "/path/to/foobar.nix" == [ "/path/to/" "/path/to" "foobar" "nix" ]; assert splitFN "foobar.cc" == [ null null "foobar" "cc" ]; true ================================================ FILE: data/nix/tests/lang/eval-okay-regex-split.exp ================================================ true ================================================ FILE: data/nix/tests/lang/eval-okay-regex-split.nix ================================================ with builtins; # Non capturing regex returns empty lists assert split "foobar" "foobar" == ["" [] ""]; assert split "fo*" "f" == ["" [] ""]; assert split "fo+" "f" == ["f"]; assert split "fo*" "fo" == ["" [] ""]; assert split "fo*" "foo" == ["" [] ""]; assert split "fo+" "foo" == ["" [] ""]; assert split "fo{1,2}" "foo" == ["" [] ""]; assert split "fo{1,2}" "fooo" == ["" [] "o"]; assert split "fo*" "foobar" == ["" [] "bar"]; # Capturing regex returns a list of sub-matches assert split "(fo*)" "f" == ["" ["f"] ""]; assert split "(fo+)" "f" == ["f"]; assert split "(fo*)" "fo" == ["" ["fo"] ""]; assert split "(f)(o*)" "f" == ["" ["f" ""] ""]; assert split "(f)(o*)" "foo" == ["" ["f" "oo"] ""]; assert split "(fo+)" "foo" == ["" ["foo"] ""]; assert split "(fo{1,2})" "foo" == ["" ["foo"] ""]; assert split "(fo{1,2})" "fooo" == ["" ["foo"] "o"]; assert split "(fo*)" "foobar" == ["" ["foo"] "bar"]; # Matches are greedy. assert split "(o+)" "oooofoooo" == ["" ["oooo"] "f" ["oooo"] ""]; # Matches multiple times. assert split "(b)" "foobarbaz" == ["foo" ["b"] "ar" ["b"] "az"]; # Split large strings containing newlines. null are inserted when a # pattern within the current did not match anything. assert split "[[:space:]]+|([',.!?])" '' Nix Rocks! That's why I use it. '' == [ "Nix" [ null ] "Rocks" ["!"] "" [ null ] "That" ["'"] "s" [ null ] "why" [ null ] "I" [ null ] "use" [ null ] "it" ["."] "" [ null ] "" ]; # Documentation examples assert split "(a)b" "abc" == [ "" [ "a" ] "c" ]; assert split "([ac])" "abc" == [ "" [ "a" ] "b" [ "c" ] "" ]; assert split "(a)|(c)" "abc" == [ "" [ "a" null ] "b" [ null "c" ] "" ]; assert split "([[:upper:]]+)" " FOO " == [ " " [ "FOO" ] " " ]; true ================================================ FILE: data/nix/tests/lang/eval-okay-remove.exp ================================================ 456 ================================================ FILE: data/nix/tests/lang/eval-okay-remove.nix ================================================ let { attrs = {x = 123; y = 456;}; body = (removeAttrs attrs ["x"]).y; } ================================================ FILE: data/nix/tests/lang/eval-okay-replacestrings.exp ================================================ [ "faabar" "fbar" "fubar" "faboor" "fubar" "XaXbXcX" "X" "a_b" ] ================================================ FILE: data/nix/tests/lang/eval-okay-replacestrings.nix ================================================ with builtins; [ (replaceStrings ["o"] ["a"] "foobar") (replaceStrings ["o"] [""] "foobar") (replaceStrings ["oo"] ["u"] "foobar") (replaceStrings ["oo" "a"] ["a" "oo"] "foobar") (replaceStrings ["oo" "oo"] ["u" "i"] "foobar") (replaceStrings [""] ["X"] "abc") (replaceStrings [""] ["X"] "") (replaceStrings ["-"] ["_"] "a-b") ] ================================================ FILE: data/nix/tests/lang/eval-okay-scope-1.exp ================================================ 3 ================================================ FILE: data/nix/tests/lang/eval-okay-scope-1.nix ================================================ (({x}: x: { x = 1; y = x; } ) {x = 2;} 3).y ================================================ FILE: data/nix/tests/lang/eval-okay-scope-2.exp ================================================ 1 ================================================ FILE: data/nix/tests/lang/eval-okay-scope-2.nix ================================================ ((x: {x}: rec { x = 1; y = x; } ) 2 {x = 3;}).y ================================================ FILE: data/nix/tests/lang/eval-okay-scope-3.exp ================================================ 4 ================================================ FILE: data/nix/tests/lang/eval-okay-scope-3.nix ================================================ ((x: as: {x}: rec { inherit (as) x; y = x; } ) 2 {x = 4;} {x = 3;}).y ================================================ FILE: data/nix/tests/lang/eval-okay-scope-4.exp ================================================ "ccdd" ================================================ FILE: data/nix/tests/lang/eval-okay-scope-4.nix ================================================ let { x = "a"; y = "b"; f = {x ? y, y ? x}: x + y; body = f {x = "c";} + f {y = "d";}; } ================================================ FILE: data/nix/tests/lang/eval-okay-scope-6.exp ================================================ "ccdd" ================================================ FILE: data/nix/tests/lang/eval-okay-scope-6.nix ================================================ let { f = {x ? y, y ? x}: x + y; body = f {x = "c";} + f {y = "d";}; } ================================================ FILE: data/nix/tests/lang/eval-okay-scope-7.exp ================================================ 1 ================================================ FILE: data/nix/tests/lang/eval-okay-scope-7.nix ================================================ rec { inherit (x) y; x = { y = 1; }; }.y ================================================ FILE: data/nix/tests/lang/eval-okay-search-path.exp ================================================ "abccX" ================================================ FILE: data/nix/tests/lang/eval-okay-search-path.flags ================================================ -I lang/dir1 -I lang/dir2 -I dir5=lang/dir3 ================================================ FILE: data/nix/tests/lang/eval-okay-search-path.nix ================================================ with import ./lib.nix; with builtins; assert isFunction (import ); assert length __nixPath == 5; assert length (filter (x: baseNameOf x.path == "dir4") __nixPath) == 1; import + import + import + import + (let __nixPath = [ { path = ./dir2; } { path = ./dir1; } ]; in import ) ================================================ FILE: data/nix/tests/lang/eval-okay-seq.exp ================================================ 2 ================================================ FILE: data/nix/tests/lang/eval-okay-seq.nix ================================================ builtins.seq 1 2 ================================================ FILE: data/nix/tests/lang/eval-okay-sort.exp ================================================ [ [ 42 77 147 249 483 526 ] [ 526 483 249 147 77 42 ] [ "bar" "fnord" "foo" "xyzzy" ] [ { key = 1; value = "foo"; } { key = 1; value = "fnord"; } { key = 2; value = "bar"; } ] ] ================================================ FILE: data/nix/tests/lang/eval-okay-sort.nix ================================================ with builtins; [ (sort lessThan [ 483 249 526 147 42 77 ]) (sort (x: y: y < x) [ 483 249 526 147 42 77 ]) (sort lessThan [ "foo" "bar" "xyzzy" "fnord" ]) (sort (x: y: x.key < y.key) [ { key = 1; value = "foo"; } { key = 2; value = "bar"; } { key = 1; value = "fnord"; } ]) ] ================================================ FILE: data/nix/tests/lang/eval-okay-splitversion.exp ================================================ [ "1" "2" "3" ] ================================================ FILE: data/nix/tests/lang/eval-okay-splitversion.nix ================================================ builtins.splitVersion "1.2.3" ================================================ FILE: data/nix/tests/lang/eval-okay-string.exp ================================================ "foobar/a/b/c/d/foo/xyzzy/foo.txt/../foo/x/yescape: \"quote\" \n \\end\nof\nlinefoobarblaatfoo$bar$\"$\"$" ================================================ FILE: data/nix/tests/lang/eval-okay-string.nix ================================================ "foo" + "bar" + toString (/a/b + /c/d) + toString (/foo/bar + "/../xyzzy/." + "/foo.txt") + ("/../foo" + toString /x/y) + "escape: \"quote\" \n \\" + "end of line" + "foo${if true then "b${"a" + "r"}" else "xyzzy"}blaat" + "foo$bar" + "$\"$\"" + "$" ================================================ FILE: data/nix/tests/lang/eval-okay-strings-as-attrs-names.exp ================================================ true ================================================ FILE: data/nix/tests/lang/eval-okay-strings-as-attrs-names.nix ================================================ let attr = { "key 1" = "test"; "key 2" = "caseok"; }; t1 = builtins.getAttr "key 1" attr; t2 = attr."key 2"; t3 = attr ? "key 1"; t4 = builtins.attrNames { inherit (attr) "key 1"; }; # This is permitted, but there is currently no way to reference this # variable. "foo bar" = 1; in t1 == "test" && t2 == "caseok" && t3 == true && t4 == ["key 1"] ================================================ FILE: data/nix/tests/lang/eval-okay-substring.exp ================================================ "ooxfoobarybarzobaabbc" ================================================ FILE: data/nix/tests/lang/eval-okay-substring.nix ================================================ with builtins; let s = "foobar"; in substring 1 2 s + "x" + substring 0 (stringLength s) s + "y" + substring 3 100 s + "z" + substring 2 (sub (stringLength s) 3) s + "a" + substring 3 0 s + "b" + substring 3 1 s + "c" + substring 5 10 "perl" ================================================ FILE: data/nix/tests/lang/eval-okay-tail-call-1.exp-disabled ================================================ 100000 ================================================ FILE: data/nix/tests/lang/eval-okay-tail-call-1.nix ================================================ let f = n: if n == 100000 then n else f (n + 1); in f 0 ================================================ FILE: data/nix/tests/lang/eval-okay-tojson.exp ================================================ "{\"a\":123,\"b\":-456,\"c\":\"foo\",\"d\":\"foo\\n\\\"bar\\\"\",\"e\":true,\"f\":false,\"g\":[1,2,3],\"h\":[\"a\",[\"b\",{\"foo\\nbar\":{}}]],\"i\":3,\"j\":1.44,\"k\":\"foo\"}" ================================================ FILE: data/nix/tests/lang/eval-okay-tojson.nix ================================================ builtins.toJSON { a = 123; b = -456; c = "foo"; d = "foo\n\"bar\""; e = true; f = false; g = [ 1 2 3 ]; h = [ "a" [ "b" { "foo\nbar" = {}; } ] ]; i = 1 + 2; j = 1.44; k = { __toString = self: self.a; a = "foo"; }; } ================================================ FILE: data/nix/tests/lang/eval-okay-toxml.exp ================================================ "\n\n \n \n \n \n \n\n" ================================================ FILE: data/nix/tests/lang/eval-okay-toxml.nix ================================================ # Make sure the expected XML output is produced; in particular, make sure it # doesn't contain source location information. builtins.toXML { a = "s"; } ================================================ FILE: data/nix/tests/lang/eval-okay-toxml2.exp ================================================ "\n\n \n \n \n \n \n \n \n \n \n \n \n \n\n" ================================================ FILE: data/nix/tests/lang/eval-okay-toxml2.nix ================================================ builtins.toXML [("a" + "b") 10 (rec {x = "x"; y = x;})] ================================================ FILE: data/nix/tests/lang/eval-okay-tryeval.exp ================================================ { x = { success = true; value = "x"; }; y = { success = false; value = false; }; z = { success = false; value = false; }; } ================================================ FILE: data/nix/tests/lang/eval-okay-tryeval.nix ================================================ { x = builtins.tryEval "x"; y = builtins.tryEval (assert false; "y"); z = builtins.tryEval (throw "bla"); } ================================================ FILE: data/nix/tests/lang/eval-okay-types.exp ================================================ [ true false true false true false true false true true true true true true true true true true true false true true true false "int" "bool" "string" "null" "set" "list" "lambda" "lambda" "lambda" "lambda" ] ================================================ FILE: data/nix/tests/lang/eval-okay-types.nix ================================================ with builtins; [ (isNull null) (isNull (x: x)) (isFunction (x: x)) (isFunction "fnord") (isString ("foo" + "bar")) (isString [ "x" ]) (isInt (1 + 2)) (isInt { x = 123; }) (isInt (1 / 2)) (isInt (1 + 1)) (isInt (1 / 2)) (isInt (1 * 2)) (isInt (1 - 2)) (isFloat (1.2)) (isFloat (1 + 1.0)) (isFloat (1 / 2.0)) (isFloat (1 * 2.0)) (isFloat (1 - 2.0)) (isBool (true && false)) (isBool null) (isPath /nix/store) (isPath ./.) (isAttrs { x = 123; }) (isAttrs null) (typeOf (3 * 4)) (typeOf true) (typeOf "xyzzy") (typeOf null) (typeOf { x = 456; }) (typeOf [ 1 2 3 ]) (typeOf (x: x)) (typeOf ((x: y: x) 1)) (typeOf map) (typeOf (map (x: x))) ] ================================================ FILE: data/nix/tests/lang/eval-okay-versions.exp ================================================ true ================================================ FILE: data/nix/tests/lang/eval-okay-versions.nix ================================================ let name1 = "hello-1.0.2"; name2 = "hello"; name3 = "915resolution-0.5.2"; name4 = "xf86-video-i810-1.7.4"; eq = 0; lt = builtins.sub 0 1; gt = 1; versionTest = v1: v2: expected: let d1 = builtins.compareVersions v1 v2; d2 = builtins.compareVersions v2 v1; in d1 == builtins.sub 0 d2 && d1 == expected; tests = [ ((builtins.parseDrvName name1).name == "hello") ((builtins.parseDrvName name1).version == "1.0.2") ((builtins.parseDrvName name2).name == "hello") ((builtins.parseDrvName name2).version == "") ((builtins.parseDrvName name3).name == "915resolution") ((builtins.parseDrvName name3).version == "0.5.2") ((builtins.parseDrvName name4).name == "xf86-video-i810") ((builtins.parseDrvName name4).version == "1.7.4") (versionTest "1.0" "2.3" lt) (versionTest "2.1" "2.3" lt) (versionTest "2.3" "2.3" eq) (versionTest "2.5" "2.3" gt) (versionTest "3.1" "2.3" gt) (versionTest "2.3.1" "2.3" gt) (versionTest "2.3.1" "2.3a" gt) (versionTest "2.3pre1" "2.3" lt) (versionTest "2.3pre3" "2.3pre12" lt) (versionTest "2.3a" "2.3c" lt) (versionTest "2.3pre1" "2.3c" lt) (versionTest "2.3pre1" "2.3q" lt) ]; in (import ./lib.nix).and tests ================================================ FILE: data/nix/tests/lang/eval-okay-with.exp ================================================ "xyzzybarxyzzybar" ================================================ FILE: data/nix/tests/lang/eval-okay-with.nix ================================================ let { a = "xyzzy"; as = { a = "foo"; b = "bar"; }; bs = { a = "bar"; }; x = with as; a + b; y = with as; with bs; a + b; body = x + y; } ================================================ FILE: data/nix/tests/lang/eval-okay-xml.exp.xml ================================================ ================================================ FILE: data/nix/tests/lang/eval-okay-xml.nix ================================================ rec { x = 123; y = 567.890; a = "foo"; b = "bar"; c = "foo" + "bar"; f = {z, x, y}: if y then x else z; id = x: x; at = args@{x, y, z}: x; ellipsis = {x, y, z, ...}: x; } ================================================ FILE: data/nix/tests/lang/imported.nix ================================================ # The function ‘range’ comes from lib.nix and was added to the lexical # scope by scopedImport. range 1 5 ++ import ./imported2.nix ================================================ FILE: data/nix/tests/lang/imported2.nix ================================================ range 6 10 ================================================ FILE: data/nix/tests/lang/lib.nix ================================================ with builtins; rec { fold = op: nul: list: if list == [] then nul else op (head list) (fold op nul (tail list)); concat = fold (x: y: x + y) ""; and = fold (x: y: x && y) true; flatten = x: if isList x then fold (x: y: (flatten x) ++ y) [] x else [x]; sum = foldl' (x: y: add x y) 0; hasSuffix = ext: fileName: let lenFileName = stringLength fileName; lenExt = stringLength ext; in !(lessThan lenFileName lenExt) && substring (sub lenFileName lenExt) lenFileName fileName == ext; # Split a list at the given position. splitAt = pos: list: if pos == 0 then {first = []; second = list;} else if list == [] then {first = []; second = [];} else let res = splitAt (sub pos 1) (tail list); in {first = [(head list)] ++ res.first; second = res.second;}; # Stable merge sort. sortBy = comp: list: if lessThan 1 (length list) then let split = splitAt (div (length list) 2) list; first = sortBy comp split.first; second = sortBy comp split.second; in mergeLists comp first second else list; mergeLists = comp: list1: list2: if list1 == [] then list2 else if list2 == [] then list1 else if comp (head list2) (head list1) then [(head list2)] ++ mergeLists comp list1 (tail list2) else [(head list1)] ++ mergeLists comp (tail list1) list2; id = x: x; const = x: y: x; range = first: last: if first > last then [] else genList (n: first + n) (last - first + 1); } ================================================ FILE: data/nix/tests/lang/parse-fail-dup-attrs-1.nix ================================================ { x = 123; y = 456; x = 789; } ================================================ FILE: data/nix/tests/lang/parse-fail-dup-attrs-2.nix ================================================ let { as = { x = 123; y = 456; }; bs = { x = 789; inherit (as) x; }; } ================================================ FILE: data/nix/tests/lang/parse-fail-dup-attrs-3.nix ================================================ let { as = { x = 123; y = 456; }; bs = rec { x = 789; inherit (as) x; }; } ================================================ FILE: data/nix/tests/lang/parse-fail-dup-attrs-4.nix ================================================ { services.ssh.port = 22; services.ssh.port = 23; } ================================================ FILE: data/nix/tests/lang/parse-fail-dup-attrs-7.nix ================================================ rec { x = 1; as = { inherit x; inherit x; }; } ================================================ FILE: data/nix/tests/lang/parse-fail-dup-formals.nix ================================================ {x, y, x}: x ================================================ FILE: data/nix/tests/lang/parse-fail-mixed-nested-attrs1.nix ================================================ { x.z = 3; x = { y = 3; z = 3; }; } ================================================ FILE: data/nix/tests/lang/parse-fail-mixed-nested-attrs2.nix ================================================ { x.y.y = 3; x = { y.y= 3; z = 3; }; } ================================================ FILE: data/nix/tests/lang/parse-fail-patterns-1.nix ================================================ args@{args, x, y, z}: x ================================================ FILE: data/nix/tests/lang/parse-fail-regression-20060610.nix ================================================ let { x = {gcc}: { inherit gcc; }; body = ({ inherit gcc; }).gcc; } ================================================ FILE: data/nix/tests/lang/parse-fail-uft8.nix ================================================ 123 é 4 ================================================ FILE: data/nix/tests/lang/parse-fail-undef-var-2.nix ================================================ let { f = {x, y : ["baz" "bar" z "bat"]}: x + y; body = f {x = "foo"; y = "bar";}; } ================================================ FILE: data/nix/tests/lang/parse-fail-undef-var.nix ================================================ x: y ================================================ FILE: data/nix/tests/lang/parse-okay-1.nix ================================================ {x, y, z}: x + y + z ================================================ FILE: data/nix/tests/lang/parse-okay-crlf.nix ================================================ rec { /* Dit is een test. */ x = # Dit is een test. y; y = 123; # CR or CR/LF (but not explicit \r's) in strings should be # translated to LF. foo = "multi line string test\r"; z = 456; } ================================================ FILE: data/nix/tests/lang/parse-okay-dup-attrs-5.nix ================================================ { services.ssh = { enable = true; }; services.ssh.port = 23; } ================================================ FILE: data/nix/tests/lang/parse-okay-dup-attrs-6.nix ================================================ { services.ssh.port = 23; services.ssh = { enable = true; }; } ================================================ FILE: data/nix/tests/lang/parse-okay-mixed-nested-attrs-1.nix ================================================ { x = { y = 3; z = 3; }; x.q = 3; } ================================================ FILE: data/nix/tests/lang/parse-okay-mixed-nested-attrs-2.nix ================================================ { x.q = 3; x = { y = 3; z = 3; }; } ================================================ FILE: data/nix/tests/lang/parse-okay-mixed-nested-attrs-3.nix ================================================ { services.ssh.enable = true; services.ssh = { port = 123; }; services = { httpd.enable = true; }; } ================================================ FILE: data/nix/tests/lang/parse-okay-regression-20041027.nix ================================================ {stdenv, fetchurl /* pkgconfig, libX11 */ }: stdenv.mkDerivation { name = "libXi-6.0.1"; src = fetchurl { url = http://freedesktop.org/~xlibs/release/libXi-6.0.1.tar.bz2; md5 = "7e935a42428d63a387b3c048be0f2756"; }; /* buildInputs = [pkgconfig]; propagatedBuildInputs = [libX11]; */ } ================================================ FILE: data/nix/tests/lang/parse-okay-regression-751.nix ================================================ let const = a: "const"; in ''${ const { x = "q"; }}'' ================================================ FILE: data/nix/tests/lang/parse-okay-subversion.nix ================================================ { localServer ? false , httpServer ? false , sslSupport ? false , pythonBindings ? false , javaSwigBindings ? false , javahlBindings ? false , stdenv, fetchurl , openssl ? null, httpd ? null, db4 ? null, expat, swig ? null, j2sdk ? null }: assert expat != null; assert localServer -> db4 != null; assert httpServer -> httpd != null && httpd.expat == expat; assert sslSupport -> openssl != null && (httpServer -> httpd.openssl == openssl); assert pythonBindings -> swig != null && swig.pythonSupport; assert javaSwigBindings -> swig != null && swig.javaSupport; assert javahlBindings -> j2sdk != null; stdenv.mkDerivation { name = "subversion-1.1.1"; builder = /foo/bar; src = fetchurl { url = http://subversion.tigris.org/tarballs/subversion-1.1.1.tar.bz2; md5 = "a180c3fe91680389c210c99def54d9e0"; }; # This is a hopefully temporary fix for the problem that # libsvnjavahl.so isn't linked against libstdc++, which causes # loading the library into the JVM to fail. patches = if javahlBindings then [/javahl.patch] else []; openssl = if sslSupport then openssl else null; httpd = if httpServer then httpd else null; db4 = if localServer then db4 else null; swig = if pythonBindings || javaSwigBindings then swig else null; python = if pythonBindings then swig.python else null; j2sdk = if javaSwigBindings then swig.j2sdk else if javahlBindings then j2sdk else null; inherit expat localServer httpServer sslSupport pythonBindings javaSwigBindings javahlBindings; } ================================================ FILE: data/nix/tests/lang/parse-okay-url.nix ================================================ [ x:x https://svn.cs.uu.nl:12443/repos/trace/trunk http://www2.mplayerhq.hu/MPlayer/releases/fonts/font-arial-iso-8859-1.tar.bz2 http://losser.st-lab.cs.uu.nl/~armijn/.nix/gcc-3.3.4-static-nix.tar.gz http://fpdownload.macromedia.com/get/shockwave/flash/english/linux/7.0r25/install_flash_player_7_linux.tar.gz https://ftp5.gwdg.de/pub/linux/archlinux/extra/os/x86_64/unzip-6.0-14-x86_64.pkg.tar.zst ftp://ftp.gtk.org/pub/gtk/v1.2/gtk+-1.2.10.tar.gz ] ================================================ FILE: data/nix/tests/lang/readDir/bar ================================================ ================================================ FILE: data/nix/tests/lang/readDir/foo/git-hates-directories ================================================ ================================================ FILE: data/nixpkgs-all-packages-pretty.nix ================================================ { bootStdenv ? null, config ? null, crossSystem ? null, gccWithCC ? true, gccWithProfiling ? true, noSysDirs ? system != "x86_64-darwin" && system != "x86_64-freebsd" && system != "i686-freebsd" && system != "x86_64-kfreebsd-gnu", platform ? null, system ? builtins.currentSystem }: let config_ = config; platform_ = platform; in let lib = import ../../lib; config = let toPath = builtins.toPath; getEnv = x: if builtins ? getEnv then builtins.getEnv x else ""; pathExists = name: builtins ? pathExists && builtins.pathExists (toPath name); configFile = getEnv "NIXPKGS_CONFIG"; homeDir = getEnv "HOME"; configFile2 = homeDir + "/.nixpkgs/config.nix"; configExpr = if config_ != null then config_ else if configFile != "" && pathExists configFile then import (toPath configFile) else if homeDir != "" && pathExists configFile2 then import (toPath configFile2) else { }; in if builtins.isFunction configExpr then configExpr { inherit pkgs; } else configExpr; platformAuto = let platforms = import ./platforms.nix; in if system == "armv6l-linux" then platforms.raspberrypi else if system == "armv5tel-linux" then platforms.sheevaplug else if system == "mips64el-linux" then platforms.fuloong2f_n32 else if system == "x86_64-linux" then platforms.pc64 else if system == "i686-linux" then platforms.pc32 else platforms.pcBase; platform = if platform_ != null then platform_ else config.platform or platformAuto; helperFunctions = stdenvAdapters // import ../build-support/trivial-builders.nix { inherit (pkgs) stdenv; inherit (pkgs.xorg) lndir; }; stdenvAdapters = import ../stdenv/adapters.nix pkgs; pkgs = applyGlobalOverrides (config.packageOverrides or pkgs: { }); applyGlobalOverrides = overrider: let overrides = overrider pkgsOrig // lib.optionalAttrs (pkgsOrig.stdenv ? overrides && crossSystem == null) (pkgsOrig.stdenv.overrides pkgsOrig); pkgsOrig = pkgsFun pkgs { }; pkgs = pkgsFun pkgs overrides; in pkgs; pkgsFun = pkgs: overrides: with helperFunctions; let defaultScope = pkgs // pkgs.xorg; self = self_ // overrides; self_ = with self; helperFunctions // { inherit system platform; inherit pkgs; callPackage = newScope { }; newScope = extra: lib.callPackageWith (defaultScope // extra); forceSystem = system: kernel: import ./all-packages.nix { inherit system; platform = platform // { kernelArch = kernel; }; inherit bootStdenv noSysDirs gccWithCC gccWithProfiling config crossSystem; }; pkgsi686Linux = forceSystem "i686-linux" "i386"; callPackage_i686 = lib.callPackageWith (pkgsi686Linux // pkgsi686Linux.xorg); path = ../..; x11 = xlibsWrapper; xlibs = xorg // { xlibs = xlibsWrapper; }; inherit lib config stdenvAdapters; inherit (lib) lowPrio hiPrio appendToName makeOverridable; inherit (misc) versionedDerivation; recurseIntoAttrs = attrs: attrs // { recurseForDerivations = true; }; builderDefs = lib.composedArgsAndFun (import ../build-support/builder-defs/builder-defs.nix) { inherit stringsWithDeps lib stdenv writeScript fetchurl fetchmtn fetchgit; }; builderDefsPackage = builderDefs.builderDefsPackage builderDefs; stringsWithDeps = lib.stringsWithDeps; nix-generate-from-cpan = callPackage ../../maintainers/scripts/nix-generate-from-cpan.nix { }; nixpkgs-lint = callPackage ../../maintainers/scripts/nixpkgs-lint.nix { }; allStdenvs = import ../stdenv { inherit system platform config; allPackages = args: import ./all-packages.nix ({ inherit config system; } // args); }; defaultStdenv = allStdenvs.stdenv // { inherit platform; }; stdenvCross = lowPrio (makeStdenvCross defaultStdenv crossSystem binutilsCross gccCrossStageFinal); stdenv = if bootStdenv != null then bootStdenv // { inherit platform; } else if crossSystem != null then stdenvCross else let changer = config.replaceStdenv or null; in if changer != null then changer { pkgs = import ./all-packages.nix { config = removeAttrs config [ "replaceStdenv" ]; }; } else defaultStdenv; stdenvApple = stdenvAdapters.overrideGCC allStdenvs.stdenvNative gccApple; forceNativeDrv = drv: if crossSystem == null then drv else drv // { crossDrv = drv.nativeDrv; }; stdenv_32bit = lowPrio (if system == "x86_64-linux" then overrideGCC stdenv gcc48_multi else stdenv); attrSetToDir = arg: import ../build-support/upstream-updater/attrset-to-dir.nix { inherit writeTextFile stdenv lib; theAttrSet = arg; }; autoreconfHook = makeSetupHook { substitutions = { inherit autoconf automake libtool; }; } ../build-support/setup-hooks/autoreconf.sh; buildEnv = import ../build-support/buildenv { inherit (pkgs) runCommand perl; }; buildFHSChrootEnv = import ../build-support/build-fhs-chrootenv { inherit stdenv glibc glibcLocales gcc coreutils diffutils findutils; inherit gnused gnugrep gnutar gzip bzip2 bashInteractive xz shadow gawk; inherit less buildEnv; }; dotnetenv = import ../build-support/dotnetenv { inherit stdenv; dotnetfx = dotnetfx40; }; scatterOutputHook = makeSetupHook { } ../build-support/setup-hooks/scatter_output.sh; vsenv = callPackage ../build-support/vsenv { vs = vs90wrapper; }; fetchbower = import ../build-support/fetchbower { inherit stdenv git; inherit (nodePackages) fetch-bower; }; fetchbzr = import ../build-support/fetchbzr { inherit stdenv bazaar; }; fetchcvs = import ../build-support/fetchcvs { inherit stdenv cvs; }; fetchdarcs = import ../build-support/fetchdarcs { inherit stdenv darcs nix; }; fetchgit = import ../build-support/fetchgit { inherit stdenv git cacert; }; fetchgitPrivate = import ../build-support/fetchgit/private.nix { inherit fetchgit writeScript openssh stdenv; }; fetchgitrevision = import ../build-support/fetchgitrevision runCommand git; fetchmtn = callPackage ../build-support/fetchmtn (config.fetchmtn or { }); packer = callPackage ../development/tools/packer { }; fetchpatch = callPackage ../build-support/fetchpatch { }; fetchsvn = import ../build-support/fetchsvn { inherit stdenv subversion openssh; sshSupport = true; }; fetchsvnrevision = import ../build-support/fetchsvnrevision runCommand subversion; fetchsvnssh = import ../build-support/fetchsvnssh { inherit stdenv subversion openssh expect; sshSupport = true; }; fetchhg = import ../build-support/fetchhg { inherit stdenv mercurial nix; }; fetchurl = import ../build-support/fetchurl { inherit curl stdenv; }; fetchurlGnome = callPackage ../build-support/fetchurl/gnome.nix { }; fetchurlBoot = stdenv.fetchurlBoot; fetchzip = import ../build-support/fetchzip { inherit lib fetchurl unzip; }; fetchFromGitHub = { owner, repo, rev, sha256 }: fetchzip { name = "${repo}-${rev}-src"; url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; inherit sha256; }; resolveMirrorURLs = { url }: fetchurl { showURLs = true; inherit url; }; libredirect = callPackage ../build-support/libredirect { }; makeDesktopItem = import ../build-support/make-desktopitem { inherit stdenv; }; makeAutostartItem = import ../build-support/make-startupitem { inherit stdenv; inherit lib; }; makeInitrd = { compressor ? "gzip -9", contents }: import ../build-support/kernel/make-initrd.nix { inherit stdenv perl perlArchiveCpio cpio contents ubootChooser compressor; }; makeWrapper = makeSetupHook { } ../build-support/setup-hooks/make-wrapper.sh; makeModulesClosure = { allowMissing ? false, kernel, rootModules }: import ../build-support/kernel/modules-closure.nix { inherit stdenv kmod kernel nukeReferences rootModules allowMissing; }; pathsFromGraph = ../build-support/kernel/paths-from-graph.pl; srcOnly = args: import ../build-support/src-only ({ inherit stdenv; } // args); substituteAll = import ../build-support/substitute/substitute-all.nix { inherit stdenv; }; replaceDependency = import ../build-support/replace-dependency.nix { inherit runCommand nix lib; }; nukeReferences = callPackage ../build-support/nuke-references/default.nix { }; vmTools = import ../build-support/vm/default.nix { inherit pkgs; }; releaseTools = import ../build-support/release/default.nix { inherit pkgs; }; composableDerivation = import ../../lib/composable-derivation.nix { inherit pkgs lib; }; platforms = import ./platforms.nix; setJavaClassPath = makeSetupHook { } ../build-support/setup-hooks/set-java-classpath.sh; fixDarwinDylibNames = makeSetupHook { } ../build-support/setup-hooks/fix-darwin-dylib-names.sh; keepBuildTree = makeSetupHook { } ../build-support/setup-hooks/keep-build-tree.sh; enableGCOVInstrumentation = makeSetupHook { } ../build-support/setup-hooks/enable-coverage-instrumentation.sh; makeGCOVReport = makeSetupHook { deps = [ pkgs.lcov pkgs.enableGCOVInstrumentation ]; } ../build-support/setup-hooks/make-coverage-analysis-report.sh; abduco = callPackage ../tools/misc/abduco { }; acct = callPackage ../tools/system/acct { }; acoustidFingerprinter = callPackage ../tools/audio/acoustid-fingerprinter { ffmpeg = ffmpeg_1; }; actdiag = pythonPackages.actdiag; adom = callPackage ../games/adom { }; aefs = callPackage ../tools/filesystems/aefs { }; aegisub = callPackage ../applications/video/aegisub { wxGTK = wxGTK30; lua = lua5_1; }; aespipe = callPackage ../tools/security/aespipe { }; aescrypt = callPackage ../tools/misc/aescrypt { }; ahcpd = callPackage ../tools/networking/ahcpd { }; aircrackng = callPackage ../tools/networking/aircrack-ng { }; analog = callPackage ../tools/admin/analog { }; apktool = callPackage ../development/tools/apktool { buildTools = androidenv.buildTools; }; apt-offline = callPackage ../tools/misc/apt-offline { }; archivemount = callPackage ../tools/filesystems/archivemount { }; arandr = callPackage ../tools/X11/arandr { }; arcanist = callPackage ../development/tools/misc/arcanist { }; arduino_core = callPackage ../development/arduino/arduino-core { jdk = jdk; jre = jdk; }; argyllcms = callPackage ../tools/graphics/argyllcms { }; arp-scan = callPackage ../tools/misc/arp-scan { }; ascii = callPackage ../tools/text/ascii { }; asymptote = builderDefsPackage ../tools/graphics/asymptote { inherit freeglut ghostscriptX imagemagick fftw boehmgc mesa ncurses readline gsl libsigsegv python zlib perl texinfo xz; texLive = texLiveAggregationFun { paths = [ texLive texLiveExtra texLiveCMSuper ]; }; }; awscli = callPackage ../tools/admin/awscli { }; ec2_api_tools = callPackage ../tools/virtualization/ec2-api-tools { }; ec2_ami_tools = callPackage ../tools/virtualization/ec2-ami-tools { }; altermime = callPackage ../tools/networking/altermime { }; amule = callPackage ../tools/networking/p2p/amule { }; amuleDaemon = appendToName "daemon" (amule.override { monolithic = false; daemon = true; }); amuleGui = appendToName "gui" (amule.override { monolithic = false; client = true; }); androidenv = import ../development/mobile/androidenv { inherit pkgs; pkgs_i686 = pkgsi686Linux; }; apg = callPackage ../tools/security/apg { }; grc = callPackage ../tools/misc/grc { }; otool = callPackage ../os-specific/darwin/otool { }; pass = callPackage ../tools/security/pass { gnupg = gnupg1compat; }; setfile = callPackage ../os-specific/darwin/setfile { }; install_name_tool = callPackage ../os-specific/darwin/install_name_tool { }; xcodeenv = callPackage ../development/mobile/xcodeenv { }; titaniumenv = callPackage ../development/mobile/titaniumenv { inherit pkgs; pkgs_i686 = pkgsi686Linux; }; inherit (androidenv) androidsdk_4_1; aria2 = callPackage ../tools/networking/aria2 { }; aria = aria2; at = callPackage ../tools/system/at { }; atftp = callPackage ../tools/networking/atftp { }; autogen = callPackage ../development/tools/misc/autogen { }; autojump = callPackage ../tools/misc/autojump { }; autorandr = callPackage ../tools/misc/autorandr { inherit (xorg) xrandr xdpyinfo; }; avahi = callPackage ../development/libraries/avahi { qt4Support = config.avahi.qt4Support or false; }; aws = callPackage ../tools/virtualization/aws { }; aws_mturk_clt = callPackage ../tools/misc/aws-mturk-clt { }; axel = callPackage ../tools/networking/axel { }; azureus = callPackage ../tools/networking/p2p/azureus { }; basex = callPackage ../tools/text/xml/basex { }; babeld = callPackage ../tools/networking/babeld { }; badvpn = callPackage ../tools/networking/badvpn { }; banner = callPackage ../games/banner { }; barcode = callPackage ../tools/graphics/barcode { }; bc = callPackage ../tools/misc/bc { }; bcache-tools = callPackage ../tools/filesystems/bcache-tools { }; bchunk = callPackage ../tools/cd-dvd/bchunk { }; bfr = callPackage ../tools/misc/bfr { }; bindfs = callPackage ../tools/filesystems/bindfs { }; bitbucket-cli = pythonPackages.bitbucket-cli; blockdiag = pythonPackages.blockdiag; bmon = callPackage ../tools/misc/bmon { }; bochs = callPackage ../applications/virtualization/bochs { wxSupport = false; }; boomerang = callPackage ../development/tools/boomerang { }; bootchart = callPackage ../tools/system/bootchart { }; bro = callPackage ../applications/networking/ids/bro { }; bsod = callPackage ../misc/emulators/bsod { }; btrfsProgs = callPackage ../tools/filesystems/btrfsprogs { }; bwm_ng = callPackage ../tools/networking/bwm-ng { }; byobu = callPackage ../tools/misc/byobu { }; capstone = callPackage ../development/libraries/capstone { }; catdoc = callPackage ../tools/text/catdoc { }; ccnet = callPackage ../tools/networking/ccnet { }; consul = callPackage ../servers/consul { }; consul_ui = callPackage ../servers/consul/ui.nix { }; chntpw = callPackage ../tools/security/chntpw { }; coprthr = callPackage ../development/libraries/coprthr { flex = flex_2_5_35; }; crawl = callPackage ../games/crawl { lua = lua5; }; cv = callPackage ../tools/misc/cv { }; direnv = callPackage ../tools/misc/direnv { }; ditaa = callPackage ../tools/graphics/ditaa { }; dlx = callPackage ../misc/emulators/dlx { }; eggdrop = callPackage ../tools/networking/eggdrop { }; enca = callPackage ../tools/text/enca { }; fasd = callPackage ../tools/misc/fasd { inherit (haskellPackages) pandoc; }; fop = callPackage ../tools/typesetting/fop { }; mcrl = callPackage ../tools/misc/mcrl { }; mcrl2 = callPackage ../tools/misc/mcrl2 { }; mpdcron = callPackage ../tools/audio/mpdcron { }; syslogng = callPackage ../tools/system/syslog-ng { }; syslogng_incubator = callPackage ../tools/system/syslog-ng-incubator { }; rsyslog = callPackage ../tools/system/rsyslog { }; mcrypt = callPackage ../tools/misc/mcrypt { }; mcelog = callPackage ../os-specific/linux/mcelog { }; apparix = callPackage ../tools/misc/apparix { }; appdata-tools = callPackage ../tools/misc/appdata-tools { }; asciidoc = callPackage ../tools/typesetting/asciidoc { inherit (pythonPackages) matplotlib numpy aafigure recursivePthLoader; enableStandardFeatures = false; }; asciidoc-full = appendToName "full" (asciidoc.override { inherit (pythonPackages) pygments; enableStandardFeatures = true; }); autossh = callPackage ../tools/networking/autossh { }; bacula = callPackage ../tools/backup/bacula { }; beanstalkd = callPackage ../servers/beanstalkd { }; bgs = callPackage ../tools/X11/bgs { }; biber = callPackage ../tools/typesetting/biber { inherit (perlPackages) autovivification BusinessISBN BusinessISMN BusinessISSN ConfigAutoConf DataCompare DataDump DateSimple EncodeEUCJPASCII EncodeHanExtra EncodeJIS2K ExtUtilsLibBuilder FileSlurp IPCRun3 Log4Perl LWPProtocolHttps ListAllUtils ListMoreUtils ModuleBuild MozillaCA ReadonlyXS RegexpCommon TextBibTeX UnicodeCollate UnicodeLineBreak URI XMLLibXMLSimple XMLLibXSLT XMLWriter; }; bibtextools = callPackage ../tools/typesetting/bibtex-tools { inherit (strategoPackages016) strategoxt sdf; }; bittorrent = callPackage ../tools/networking/p2p/bittorrent { gui = true; }; bittornado = callPackage ../tools/networking/p2p/bit-tornado { }; blueman = callPackage ../tools/bluetooth/blueman { inherit (pythonPackages) notify; }; bmrsa = builderDefsPackage (import ../tools/security/bmrsa/11.nix) { inherit unzip; }; bogofilter = callPackage ../tools/misc/bogofilter { }; bsdiff = callPackage ../tools/compression/bsdiff { }; btar = callPackage ../tools/backup/btar { }; bud = callPackage ../tools/networking/bud { inherit (pythonPackages) gyp; }; bup = callPackage ../tools/backup/bup { inherit (pythonPackages) pyxattr pylibacl setuptools fuse; inherit (haskellPackages) pandoc; par2Support = config.bup.par2Support or false; }; ori = callPackage ../tools/backup/ori { }; atool = callPackage ../tools/archivers/atool { }; bzip2 = callPackage ../tools/compression/bzip2 { }; cabextract = callPackage ../tools/archivers/cabextract { }; cadaver = callPackage ../tools/networking/cadaver { }; cantata = callPackage ../applications/audio/cantata { }; can-utils = callPackage ../os-specific/linux/can-utils { }; ccid = callPackage ../tools/security/ccid { }; ccrypt = callPackage ../tools/security/ccrypt { }; cdecl = callPackage ../development/tools/cdecl { }; cdrdao = callPackage ../tools/cd-dvd/cdrdao { }; cdrkit = callPackage ../tools/cd-dvd/cdrkit { }; ceph = callPackage ../tools/filesystems/ceph { }; cfdg = builderDefsPackage ../tools/graphics/cfdg { inherit libpng bison flex ffmpeg; }; checkinstall = callPackage ../tools/package-management/checkinstall { }; cheetahTemplate = builderDefsPackage (import ../tools/text/cheetah-template/2.0.1.nix) { inherit makeWrapper python; }; chkrootkit = callPackage ../tools/security/chkrootkit { }; chrony = callPackage ../tools/networking/chrony { }; chunkfs = callPackage ../tools/filesystems/chunkfs { }; chunksync = callPackage ../tools/backup/chunksync { }; cjdns = callPackage ../tools/networking/cjdns { }; cksfv = callPackage ../tools/networking/cksfv { }; clementine = callPackage ../applications/audio/clementine { }; ciopfs = callPackage ../tools/filesystems/ciopfs { }; colord = callPackage ../tools/misc/colord { }; colord-gtk = callPackage ../tools/misc/colord-gtk { }; colordiff = callPackage ../tools/text/colordiff { }; concurrencykit = callPackage ../development/libraries/concurrencykit { }; connect = callPackage ../tools/networking/connect { }; conspy = callPackage ../os-specific/linux/conspy { }; connman = callPackage ../tools/networking/connman { }; connmanui = callPackage ../tools/networking/connmanui { }; convertlit = callPackage ../tools/text/convertlit { }; collectd = callPackage ../tools/system/collectd { }; colormake = callPackage ../development/tools/build-managers/colormake { }; cowsay = callPackage ../tools/misc/cowsay { }; cpuminer = callPackage ../tools/misc/cpuminer { }; cuetools = callPackage ../tools/cd-dvd/cuetools { }; unifdef = callPackage ../development/tools/misc/unifdef { }; "unionfs-fuse" = callPackage ../tools/filesystems/unionfs-fuse { }; usb_modeswitch = callPackage ../development/tools/misc/usb-modeswitch { }; biosdevname = callPackage ../tools/networking/biosdevname { }; clamav = callPackage ../tools/security/clamav { }; cloc = callPackage ../tools/misc/cloc { inherit (perlPackages) perl AlgorithmDiff RegexpCommon; }; cloog = callPackage ../development/libraries/cloog { }; cloogppl = callPackage ../development/libraries/cloog-ppl { }; convmv = callPackage ../tools/misc/convmv { }; cool-old-term = callPackage ../applications/misc/cool-old-term { }; coreutils = callPackage ../tools/misc/coreutils { aclSupport = crossSystem == null && stdenv.isLinux; }; cpio = callPackage ../tools/archivers/cpio { }; cromfs = callPackage ../tools/archivers/cromfs { }; cron = callPackage ../tools/system/cron { }; cudatoolkit5 = callPackage ../development/compilers/cudatoolkit/5.5.nix { python = python26; }; cudatoolkit6 = callPackage ../development/compilers/cudatoolkit/6.0.nix { python = python26; }; cudatoolkit = cudatoolkit5; curl = callPackage ../tools/networking/curl rec { fetchurl = fetchurlBoot; zlibSupport = true; sslSupport = zlibSupport; scpSupport = zlibSupport && !stdenv.isSunOS && !stdenv.isCygwin; }; curl3 = callPackage ../tools/networking/curl/7.15.nix rec { zlibSupport = true; sslSupport = zlibSupport; }; cunit = callPackage ../tools/misc/cunit { }; curlftpfs = callPackage ../tools/filesystems/curlftpfs { }; cutter = callPackage ../tools/networking/cutter { }; dadadodo = builderDefsPackage (import ../tools/text/dadadodo) { }; daq = callPackage ../applications/networking/ids/daq { }; dar = callPackage ../tools/archivers/dar { }; davfs2 = callPackage ../tools/filesystems/davfs2 { }; dbench = callPackage ../development/tools/misc/dbench { }; dcraw = callPackage ../tools/graphics/dcraw { }; debian_devscripts = callPackage ../tools/misc/debian-devscripts { inherit (perlPackages) CryptSSLeay LWP TimeDate DBFile FileDesktopEntry; }; debootstrap = callPackage ../tools/misc/debootstrap { }; detox = callPackage ../tools/misc/detox { }; ddclient = callPackage ../tools/networking/ddclient { }; dd_rescue = callPackage ../tools/system/dd_rescue { }; ddrescue = callPackage ../tools/system/ddrescue { }; deluge = pythonPackages.deluge; desktop_file_utils = callPackage ../tools/misc/desktop-file-utils { }; despotify = callPackage ../development/libraries/despotify { }; dev86 = callPackage ../development/compilers/dev86 { }; dnsmasq = callPackage ../tools/networking/dnsmasq { }; dnstop = callPackage ../tools/networking/dnstop { }; dhcp = callPackage ../tools/networking/dhcp { }; dhcpcd = callPackage ../tools/networking/dhcpcd { }; diffstat = callPackage ../tools/text/diffstat { }; diffutils = callPackage ../tools/text/diffutils { }; wgetpaste = callPackage ../tools/text/wgetpaste { }; dirmngr = callPackage ../tools/security/dirmngr { }; disper = callPackage ../tools/misc/disper { }; dmd = callPackage ../development/compilers/dmd { }; dmg2img = callPackage ../tools/misc/dmg2img { }; docbook2odf = callPackage ../tools/typesetting/docbook2odf { inherit (perlPackages) PerlMagick; }; docbook2x = callPackage ../tools/typesetting/docbook2x { inherit (perlPackages) XMLSAX XMLParser XMLNamespaceSupport; }; dosfstools = callPackage ../tools/filesystems/dosfstools { }; dotnetfx35 = callPackage ../development/libraries/dotnetfx35 { }; dotnetfx40 = callPackage ../development/libraries/dotnetfx40 { }; dropbear = callPackage ../tools/networking/dropbear { }; dtach = callPackage ../tools/misc/dtach { }; duo-unix = callPackage ../tools/security/duo-unix { }; duplicity = callPackage ../tools/backup/duplicity { inherit (pythonPackages) boto lockfile; gnupg = gnupg1; }; duply = callPackage ../tools/backup/duply { }; dvdplusrwtools = callPackage ../tools/cd-dvd/dvd+rw-tools { }; dvgrab = callPackage ../tools/video/dvgrab { }; dvtm = callPackage ../tools/misc/dvtm { }; e2fsprogs = callPackage ../tools/filesystems/e2fsprogs { }; easyrsa = callPackage ../tools/networking/easyrsa { }; ebook_tools = callPackage ../tools/text/ebook-tools { }; ecryptfs = callPackage ../tools/security/ecryptfs { }; editres = callPackage ../tools/graphics/editres { inherit (xlibs) libXt libXaw; inherit (xorg) utilmacros; }; edk2 = callPackage ../development/compilers/edk2 { }; efibootmgr = callPackage ../tools/system/efibootmgr { }; efivar = callPackage ../tools/system/efivar { }; evemu = callPackage ../tools/system/evemu { }; elasticsearch = callPackage ../servers/search/elasticsearch { }; elasticsearchPlugins = recurseIntoAttrs (callPackage ../servers/search/elasticsearch/plugins.nix { }); emv = callPackage ../tools/misc/emv { }; enblendenfuse = callPackage ../tools/graphics/enblend-enfuse { }; encfs = callPackage ../tools/filesystems/encfs { }; enscript = callPackage ../tools/text/enscript { }; ethtool = callPackage ../tools/misc/ethtool { }; ettercap = callPackage ../applications/networking/sniffers/ettercap { }; euca2ools = callPackage ../tools/virtualization/euca2ools { pythonPackages = python26Packages; }; evtest = callPackage ../applications/misc/evtest { }; exempi = callPackage ../development/libraries/exempi { }; execline = callPackage ../tools/misc/execline { }; exercism = callPackage ../development/tools/exercism { }; exif = callPackage ../tools/graphics/exif { }; exiftags = callPackage ../tools/graphics/exiftags { }; extundelete = callPackage ../tools/filesystems/extundelete { }; expect = callPackage ../tools/misc/expect { }; f2fs-tools = callPackage ../tools/filesystems/f2fs-tools { }; fabric = pythonPackages.fabric; fail2ban = callPackage ../tools/security/fail2ban { systemd = systemd.override { pythonSupport = true; }; }; fakeroot = callPackage ../tools/system/fakeroot { }; fakechroot = callPackage ../tools/system/fakechroot { }; fcitx = callPackage ../tools/inputmethods/fcitx { }; fcron = callPackage ../tools/system/fcron { }; fdm = callPackage ../tools/networking/fdm { }; figlet = callPackage ../tools/misc/figlet { }; file = callPackage ../tools/misc/file { }; filegive = callPackage ../tools/networking/filegive { }; fileschanged = callPackage ../tools/misc/fileschanged { }; findutils = callPackage ../tools/misc/findutils { }; finger_bsd = callPackage ../tools/networking/bsd-finger { }; fio = callPackage ../tools/system/fio { }; flashtool = callPackage_i686 ../development/mobile/flashtool { platformTools = androidenv.platformTools; }; flpsed = callPackage ../applications/editors/flpsed { }; flvstreamer = callPackage ../tools/networking/flvstreamer { }; libbsd = callPackage ../development/libraries/libbsd { }; lprof = callPackage ../tools/graphics/lprof { }; fdk_aac = callPackage ../development/libraries/fdk-aac { }; flvtool2 = callPackage ../tools/video/flvtool2 { }; fontforge = lowPrio (callPackage ../tools/misc/fontforge { }); fontforgeX = callPackage ../tools/misc/fontforge { withX11 = true; }; forktty = callPackage ../os-specific/linux/forktty { }; fortune = callPackage ../tools/misc/fortune { }; fox = callPackage ../development/libraries/fox/default.nix { libpng = libpng12; }; fox_1_6 = callPackage ../development/libraries/fox/fox-1.6.nix { }; fping = callPackage ../tools/networking/fping { }; fprot = callPackage ../tools/security/fprot { }; freeipmi = callPackage ../tools/system/freeipmi { }; freetalk = callPackage ../applications/networking/instant-messengers/freetalk { guile = guile_1_8; }; freetds = callPackage ../development/libraries/freetds { }; ftgl = callPackage ../development/libraries/ftgl { }; ftgl212 = callPackage ../development/libraries/ftgl/2.1.2.nix { }; fuppes = callPackage ../tools/networking/fuppes { ffmpeg = ffmpeg_0_6_90; }; fsfs = callPackage ../tools/filesystems/fsfs { }; fuse_zip = callPackage ../tools/filesystems/fuse-zip { }; fuse_exfat = callPackage ../tools/filesystems/fuse-exfat { }; dos2unix = callPackage ../tools/text/dos2unix { }; uni2ascii = callPackage ../tools/text/uni2ascii { }; g500-control = callPackage ../tools/misc/g500-control { }; galculator = callPackage ../applications/misc/galculator { gtk = gtk3; }; gawk = callPackage ../tools/text/gawk { }; gawkInteractive = appendToName "interactive" (gawk.override { readlineSupport = true; }); gbdfed = callPackage ../tools/misc/gbdfed { gtk = gtk2; }; gdmap = callPackage ../tools/system/gdmap { }; genext2fs = callPackage ../tools/filesystems/genext2fs { }; gengetopt = callPackage ../development/tools/misc/gengetopt { }; getmail = callPackage ../tools/networking/getmail { }; getopt = callPackage ../tools/misc/getopt { }; gftp = callPackage ../tools/networking/gftp { }; gifsicle = callPackage ../tools/graphics/gifsicle { }; glusterfs = callPackage ../tools/filesystems/glusterfs { }; glmark2 = callPackage ../tools/graphics/glmark2 { }; glxinfo = callPackage ../tools/graphics/glxinfo { }; gmvault = callPackage ../tools/networking/gmvault { }; gnokii = builderDefsPackage (import ../tools/misc/gnokii) { inherit intltool perl gettext libusb pkgconfig bluez readline pcsclite libical gtk glib; inherit (xorg) libXpm; }; gnufdisk = callPackage ../tools/system/fdisk { guile = guile_1_8; }; gnugrep = callPackage ../tools/text/gnugrep { libiconv = libiconvOrNull; }; gnulib = callPackage ../development/tools/gnulib { }; gnupatch = callPackage ../tools/text/gnupatch { }; gnupg1orig = callPackage ../tools/security/gnupg1 { }; gnupg1compat = callPackage ../tools/security/gnupg1compat { }; gnupg1 = gnupg1compat; gnupg = callPackage ../tools/security/gnupg { libusb = libusb1; }; gnupg2_1 = lowPrio (callPackage ../tools/security/gnupg/git.nix { libassuan = libassuan2_1; }); gnuplot = callPackage ../tools/graphics/gnuplot { }; gnuplot_qt = gnuplot.override { withQt = true; }; gnuplot_aquaterm = gnuplot.override { aquaterm = true; }; gnused = callPackage ../tools/text/gnused { }; gnutar = callPackage ../tools/archivers/gnutar { }; gnuvd = callPackage ../tools/misc/gnuvd { }; goaccess = callPackage ../tools/misc/goaccess { }; googleAuthenticator = callPackage ../os-specific/linux/google-authenticator { }; gource = callPackage ../applications/version-management/gource { }; gpodder = callPackage ../applications/audio/gpodder { }; gptfdisk = callPackage ../tools/system/gptfdisk { }; grafana = callPackage ../development/tools/misc/grafana { }; grafx2 = callPackage ../applications/graphics/grafx2 { }; graphviz = callPackage ../tools/graphics/graphviz { }; graphviz_2_0 = callPackage ../tools/graphics/graphviz/2.0.nix { }; grive = callPackage ../tools/filesystems/grive { json_c = json-c-0-11; }; groff = callPackage ../tools/text/groff { ghostscript = null; }; grub = callPackage_i686 ../tools/misc/grub { buggyBiosCDSupport = config.grub.buggyBiosCDSupport or true; }; grub2 = callPackage ../tools/misc/grub/2.0x.nix { libusb = libusb1; flex = flex_2_5_35; }; grub2_efi = grub2.override { EFIsupport = true; }; gssdp = callPackage ../development/libraries/gssdp { inherit (gnome) libsoup; }; gt5 = callPackage ../tools/system/gt5 { }; gtest = callPackage ../development/libraries/gtest { }; gtkdatabox = callPackage ../development/libraries/gtkdatabox { }; gtkgnutella = callPackage ../tools/networking/p2p/gtk-gnutella { }; gtkvnc = callPackage ../tools/admin/gtk-vnc { }; gtmess = callPackage ../applications/networking/instant-messengers/gtmess { }; gummiboot = callPackage ../tools/misc/gummiboot { }; gupnp = callPackage ../development/libraries/gupnp { inherit (gnome) libsoup; }; gupnp_av = callPackage ../development/libraries/gupnp-av { }; gupnp_igd = callPackage ../development/libraries/gupnp-igd { }; gupnptools = callPackage ../tools/networking/gupnp-tools { }; gvpe = builderDefsPackage ../tools/networking/gvpe { inherit openssl gmp nettools iproute; }; gvolicon = callPackage ../tools/audio/gvolicon { }; gzip = callPackage ../tools/compression/gzip { }; gzrt = callPackage ../tools/compression/gzrt { }; partclone = callPackage ../tools/backup/partclone { }; partimage = callPackage ../tools/backup/partimage { }; pigz = callPackage ../tools/compression/pigz { }; haproxy = callPackage ../tools/networking/haproxy { }; haveged = callPackage ../tools/security/haveged { }; hardlink = callPackage ../tools/system/hardlink { }; hashcat = callPackage ../tools/security/hashcat { }; halibut = callPackage ../tools/typesetting/halibut { }; hddtemp = callPackage ../tools/misc/hddtemp { }; hdf5 = callPackage ../tools/misc/hdf5 { szip = null; }; heimdall = callPackage ../tools/misc/heimdall { }; hevea = callPackage ../tools/typesetting/hevea { }; highlight = callPackage ../tools/text/highlight { lua = lua5; }; host = callPackage ../tools/networking/host { }; hping = callPackage ../tools/networking/hping { }; httpie = callPackage ../tools/networking/httpie { }; httpfs2 = callPackage ../tools/filesystems/httpfs { }; iasl = callPackage ../development/compilers/iasl { }; icecast = callPackage ../servers/icecast { }; icoutils = callPackage ../tools/graphics/icoutils { }; idutils = callPackage ../tools/misc/idutils { }; idle3tools = callPackage ../tools/system/idle3tools { }; iftop = callPackage ../tools/networking/iftop { }; imapproxy = callPackage ../tools/networking/imapproxy { }; imapsync = callPackage ../tools/networking/imapsync { inherit (perlPackages) MailIMAPClient; }; inadyn = callPackage ../tools/networking/inadyn { }; inetutils = callPackage ../tools/networking/inetutils { }; ioping = callPackage ../tools/system/ioping { }; iodine = callPackage ../tools/networking/iodine { }; iperf = callPackage ../tools/networking/iperf { }; ipmitool = callPackage ../tools/system/ipmitool { static = false; }; ipmiutil = callPackage ../tools/system/ipmiutil { }; ised = callPackage ../tools/misc/ised { }; isl = callPackage ../development/libraries/isl { }; isl_0_12 = callPackage ../development/libraries/isl/0.12.2.nix { }; isync = callPackage ../tools/networking/isync { }; jd-gui = callPackage_i686 ../tools/security/jd-gui { }; jdiskreport = callPackage ../tools/misc/jdiskreport { }; jfsrec = callPackage ../tools/filesystems/jfsrec { boost = boost144; }; jfsutils = callPackage ../tools/filesystems/jfsutils { }; jhead = callPackage ../tools/graphics/jhead { }; jing = callPackage ../tools/text/xml/jing { }; jmtpfs = callPackage ../tools/filesystems/jmtpfs { }; jnettop = callPackage ../tools/networking/jnettop { }; jq = callPackage ../development/tools/jq { }; jscoverage = callPackage ../development/tools/misc/jscoverage { }; jwhois = callPackage ../tools/networking/jwhois { }; kazam = callPackage ../applications/video/kazam { }; kalibrate-rtl = callPackage ../tools/misc/kalibrate-rtl { }; kexectools = callPackage ../os-specific/linux/kexectools { }; keychain = callPackage ../tools/misc/keychain { }; kismet = callPackage ../applications/networking/sniffers/kismet { }; less = callPackage ../tools/misc/less { }; lockfileProgs = callPackage ../tools/misc/lockfile-progs { }; logstash = callPackage ../tools/misc/logstash { }; logstash-forwarder = callPackage ../tools/misc/logstash-forwarder { }; kippo = callPackage ../servers/kippo { }; klavaro = callPackage ../games/klavaro { }; kzipmix = callPackage_i686 ../tools/compression/kzipmix { }; minidlna = callPackage ../tools/networking/minidlna { ffmpeg = ffmpeg_0_10; }; mmv = callPackage ../tools/misc/mmv { }; most = callPackage ../tools/misc/most { }; multitail = callPackage ../tools/misc/multitail { }; netperf = callPackage ../applications/networking/netperf { }; ninka = callPackage ../development/tools/misc/ninka { }; nodejs = callPackage ../development/web/nodejs { }; nodePackages = recurseIntoAttrs (import ./node-packages.nix { inherit pkgs stdenv nodejs fetchurl fetchgit; neededNatives = [ python ] ++ lib.optional (lib.elem system lib.platforms.linux) utillinux; self = pkgs.nodePackages; }); ldapvi = callPackage ../tools/misc/ldapvi { }; ldns = callPackage ../development/libraries/ldns { }; lftp = callPackage ../tools/networking/lftp { }; libconfig = callPackage ../development/libraries/libconfig { }; libee = callPackage ../development/libraries/libee { }; libestr = callPackage ../development/libraries/libestr { }; libevdev = callPackage ../development/libraries/libevdev { }; liboauth = callPackage ../development/libraries/liboauth { }; libtirpc = callPackage ../development/libraries/ti-rpc { }; libshout = callPackage ../development/libraries/libshout { }; libqmi = callPackage ../development/libraries/libqmi { }; libmbim = callPackage ../development/libraries/libmbim { }; libtorrent = callPackage ../tools/networking/p2p/libtorrent { }; logcheck = callPackage ../tools/system/logcheck { inherit (perlPackages) mimeConstruct; }; logrotate = callPackage ../tools/system/logrotate { }; logstalgia = callPackage ../tools/graphics/logstalgia { }; lout = callPackage ../tools/typesetting/lout { }; lrzip = callPackage ../tools/compression/lrzip { }; lsh = lowPrio (callPackage ../tools/networking/lsh { }); lshw = callPackage ../tools/system/lshw { }; lxc = callPackage ../os-specific/linux/lxc { }; lzip = callPackage ../tools/compression/lzip { }; lzma = xz; xz = callPackage ../tools/compression/xz { }; lzop = callPackage ../tools/compression/lzop { }; maildrop = callPackage ../tools/networking/maildrop { }; mailpile = callPackage ../applications/networking/mailreaders/mailpile { }; mailutils = callPackage ../tools/networking/mailutils { guile = guile_1_8; }; mairix = callPackage ../tools/text/mairix { }; makemkv = callPackage ../applications/video/makemkv { }; man = callPackage ../tools/misc/man { }; man_db = callPackage ../tools/misc/man-db { }; memtest86 = callPackage ../tools/misc/memtest86 { }; memtest86plus = callPackage ../tools/misc/memtest86+ { }; meo = callPackage ../tools/security/meo { }; mc = callPackage ../tools/misc/mc { }; mcabber = callPackage ../applications/networking/instant-messengers/mcabber { }; mcron = callPackage ../tools/system/mcron { guile = guile_1_8; }; mdbtools = callPackage ../tools/misc/mdbtools { }; mdbtools_git = callPackage ../tools/misc/mdbtools/git.nix { inherit (gnome) scrollkeeper; }; mednafen = callPackage ../misc/emulators/mednafen { }; mednafen-server = callPackage ../misc/emulators/mednafen/server.nix { }; megacli = callPackage ../tools/misc/megacli { }; megatools = callPackage ../tools/networking/megatools { }; mfcuk = callPackage ../tools/security/mfcuk { }; minecraft = callPackage ../games/minecraft { }; minecraft-server = callPackage ../games/minecraft-server { }; minetest = callPackage ../games/minetest { libpng = libpng12; }; miniupnpc = callPackage ../tools/networking/miniupnpc { }; miniupnpd = callPackage ../tools/networking/miniupnpd { }; minixml = callPackage ../development/libraries/minixml { }; mjpegtools = callPackage ../tools/video/mjpegtools { }; mkcue = callPackage ../tools/cd-dvd/mkcue { }; mkpasswd = callPackage ../tools/security/mkpasswd { }; mktemp = callPackage ../tools/security/mktemp { }; mktorrent = callPackage ../tools/misc/mktorrent { }; modemmanager = callPackage ../tools/networking/modemmanager { }; monit = callPackage ../tools/system/monit { }; mosh = callPackage ../tools/networking/mosh { boost = boostHeaders; inherit (perlPackages) IOTty; }; mpage = callPackage ../tools/text/mpage { }; mr = callPackage ../applications/version-management/mr { }; mscgen = callPackage ../tools/graphics/mscgen { }; msf = builderDefsPackage (import ../tools/security/metasploit/3.1.nix) { inherit ruby makeWrapper; }; mssys = callPackage ../tools/misc/mssys { }; mtdutils = callPackage ../tools/filesystems/mtdutils { }; mtools = callPackage ../tools/filesystems/mtools { }; mtr = callPackage ../tools/networking/mtr { }; multitran = recurseIntoAttrs (let callPackage = newScope pkgs.multitran; in rec { multitrandata = callPackage ../tools/text/multitran/data { }; libbtree = callPackage ../tools/text/multitran/libbtree { }; libmtsupport = callPackage ../tools/text/multitran/libmtsupport { }; libfacet = callPackage ../tools/text/multitran/libfacet { }; libmtquery = callPackage ../tools/text/multitran/libmtquery { }; mtutils = callPackage ../tools/text/multitran/mtutils { }; }); munge = callPackage ../tools/security/munge { }; muscleframework = callPackage ../tools/security/muscleframework { }; muscletool = callPackage ../tools/security/muscletool { }; mysql2pgsql = callPackage ../tools/misc/mysql2pgsql { }; namazu = callPackage ../tools/text/namazu { }; nbd = callPackage ../tools/networking/nbd { }; ndjbdns = callPackage ../tools/networking/ndjbdns { }; netatalk = callPackage ../tools/filesystems/netatalk { }; netcdf = callPackage ../development/libraries/netcdf { }; nc6 = callPackage ../tools/networking/nc6 { }; ncat = callPackage ../tools/networking/ncat { }; ncftp = callPackage ../tools/networking/ncftp { }; ncompress = callPackage ../tools/compression/ncompress { }; ndisc6 = callPackage ../tools/networking/ndisc6 { }; netboot = callPackage ../tools/networking/netboot { }; netcat = callPackage ../tools/networking/netcat { }; netcat-openbsd = callPackage ../tools/networking/netcat-openbsd { }; nethogs = callPackage ../tools/networking/nethogs { }; netkittftp = callPackage ../tools/networking/netkit/tftp { }; netpbm = callPackage ../tools/graphics/netpbm { }; netrw = callPackage ../tools/networking/netrw { }; netselect = callPackage ../tools/networking/netselect { }; networkmanager = callPackage ../tools/networking/network-manager { }; networkmanager_openvpn = callPackage ../tools/networking/network-manager/openvpn.nix { }; networkmanager_pptp = callPackage ../tools/networking/network-manager/pptp.nix { }; networkmanager_vpnc = callPackage ../tools/networking/network-manager/vpnc.nix { }; networkmanager_openconnect = callPackage ../tools/networking/network-manager/openconnect.nix { }; networkmanagerapplet = newScope gnome ../tools/networking/network-manager-applet { dconf = gnome3.dconf; }; newsbeuter = callPackage ../applications/networking/feedreaders/newsbeuter { }; newsbeuter-dev = callPackage ../applications/networking/feedreaders/newsbeuter/dev.nix { }; ngrep = callPackage ../tools/networking/ngrep { }; ngrok = callPackage ../tools/misc/ngrok { }; mpack = callPackage ../tools/networking/mpack { }; pa_applet = callPackage ../tools/audio/pa-applet { }; pnmixer = callPackage ../tools/audio/pnmixer { }; nifskope = callPackage ../tools/graphics/nifskope { }; nilfs_utils = callPackage ../tools/filesystems/nilfs-utils { }; nitrogen = callPackage ../tools/X11/nitrogen { }; nlopt = callPackage ../development/libraries/nlopt { }; npapi_sdk = callPackage ../development/libraries/npapi-sdk { }; npth = callPackage ../development/libraries/npth { }; nmap = callPackage ../tools/security/nmap { }; nmap_graphical = callPackage ../tools/security/nmap { inherit (pythonPackages) pysqlite; graphicalSupport = true; }; notbit = callPackage ../applications/networking/notbit { }; nox = callPackage ../tools/package-management/nox { pythonPackages = python3Packages; nix = nixUnstable; }; nss_pam_ldapd = callPackage ../tools/networking/nss-pam-ldapd { }; ntfs3g = callPackage ../tools/filesystems/ntfs-3g { }; ntfsprogs = pkgs.ntfs3g; ntop = callPackage ../tools/networking/ntop { }; ntopng = callPackage ../tools/networking/ntopng { }; ntp = callPackage ../tools/networking/ntp { }; numdiff = callPackage ../tools/text/numdiff { }; nssmdns = callPackage ../tools/networking/nss-mdns { }; nwdiag = pythonPackages.nwdiag; nylon = callPackage ../tools/networking/nylon { }; nzbget = callPackage ../tools/networking/nzbget { }; oathToolkit = callPackage ../tools/security/oath-toolkit { }; obex_data_server = callPackage ../tools/bluetooth/obex-data-server { }; obexd = callPackage ../tools/bluetooth/obexd { }; obexfs = callPackage ../tools/bluetooth/obexfs { }; obexftp = callPackage ../tools/bluetooth/obexftp { }; obnam = callPackage ../tools/backup/obnam { }; odt2txt = callPackage ../tools/text/odt2txt { }; offlineimap = callPackage ../tools/networking/offlineimap { inherit (pythonPackages) sqlite3; }; opendbx = callPackage ../development/libraries/opendbx { }; opendkim = callPackage ../development/libraries/opendkim { }; opendylan = callPackage ../development/compilers/opendylan { opendylan-bootstrap = opendylan_bin; }; opendylan_bin = callPackage ../development/compilers/opendylan/bin.nix { }; openjade = callPackage ../tools/text/sgml/openjade { }; openobex = callPackage ../tools/bluetooth/openobex { }; openopc = callPackage ../tools/misc/openopc { pythonFull = python27Full.override { extraLibs = [ python27Packages.pyro3 ]; }; }; openresolv = callPackage ../tools/networking/openresolv { }; opensc = callPackage ../tools/security/opensc { }; opensc_dnie_wrapper = callPackage ../tools/security/opensc-dnie-wrapper { }; openssh = callPackage ../tools/networking/openssh { hpnSupport = false; withKerberos = false; etcDir = "/etc/ssh"; pam = if stdenv.isLinux then pam else null; }; openssh_hpn = pkgs.appendToName "with-hpn" (openssh.override { hpnSupport = true; }); openssh_with_kerberos = pkgs.appendToName "with-kerberos" (openssh.override { withKerberos = true; }); opensp = callPackage ../tools/text/sgml/opensp { }; spCompat = callPackage ../tools/text/sgml/opensp/compat.nix { }; openvpn = callPackage ../tools/networking/openvpn { }; openvpn_learnaddress = callPackage ../tools/networking/openvpn/openvpn_learnaddress.nix { }; optipng = callPackage ../tools/graphics/optipng { libpng = libpng12; }; oslrd = callPackage ../tools/networking/oslrd { }; ossec = callPackage ../tools/security/ossec { }; otpw = callPackage ../os-specific/linux/otpw { }; p7zip = callPackage ../tools/archivers/p7zip { }; pal = callPackage ../tools/misc/pal { }; panomatic = callPackage ../tools/graphics/panomatic { }; par2cmdline = callPackage ../tools/networking/par2cmdline { }; parallel = callPackage ../tools/misc/parallel { }; parcellite = callPackage ../tools/misc/parcellite { }; patchutils = callPackage ../tools/text/patchutils { }; parted = callPackage ../tools/misc/parted { hurd = null; }; pitivi = callPackage ../applications/video/pitivi { gst = gst_all_1; clutter-gtk = clutter_gtk; inherit (gnome3) gnome_icon_theme gnome_icon_theme_symbolic; }; p0f = callPackage ../tools/security/p0f { }; pngout = callPackage ../tools/graphics/pngout { }; hurdPartedCross = if crossSystem != null && crossSystem.config == "i586-pc-gnu" then makeOverridable ({ hurd }: (parted.override { inherit hurd; enableStatic = true; gettext = null; readline = null; devicemapper = null; }).crossDrv) { hurd = gnu.hurdCrossIntermediate; } else null; ipsecTools = callPackage ../os-specific/linux/ipsec-tools { flex = flex_2_5_35; }; patch = gnupatch; pbzip2 = callPackage ../tools/compression/pbzip2 { }; pciutils = callPackage ../tools/system/pciutils { }; pcsclite = callPackage ../tools/security/pcsclite { }; pdf2djvu = callPackage ../tools/typesetting/pdf2djvu { }; pdfjam = callPackage ../tools/typesetting/pdfjam { }; jbig2enc = callPackage ../tools/graphics/jbig2enc { }; pdfread = callPackage ../tools/graphics/pdfread { }; briss = callPackage ../tools/graphics/briss { }; bully = callPackage ../tools/networking/bully { }; pdnsd = callPackage ../tools/networking/pdnsd { }; peco = callPackage ../tools/text/peco { }; pg_top = callPackage ../tools/misc/pg_top { }; pdsh = callPackage ../tools/networking/pdsh { rsh = true; ssh = openssh; }; pfstools = callPackage ../tools/graphics/pfstools { }; philter = callPackage ../tools/networking/philter { }; pinentry = callPackage ../tools/security/pinentry { }; pius = callPackage ../tools/security/pius { }; pk2cmd = callPackage ../tools/misc/pk2cmd { }; plantuml = callPackage ../tools/misc/plantuml { }; plan9port = callPackage ../tools/system/plan9port { }; ploticus = callPackage ../tools/graphics/ploticus { libpng = libpng12; }; plotutils = callPackage ../tools/graphics/plotutils { }; plowshare = callPackage ../tools/misc/plowshare { }; pngcrush = callPackage ../tools/graphics/pngcrush { }; pngnq = callPackage ../tools/graphics/pngnq { }; pngtoico = callPackage ../tools/graphics/pngtoico { libpng = libpng12; }; pngquant = callPackage ../tools/graphics/pngquant { }; podiff = callPackage ../tools/text/podiff { }; poedit = callPackage ../tools/text/poedit { }; polipo = callPackage ../servers/polipo { }; polkit_gnome = callPackage ../tools/security/polkit-gnome { }; ponysay = callPackage ../tools/misc/ponysay { }; povray = callPackage ../tools/graphics/povray { }; ppl = callPackage ../development/libraries/ppl { }; ppp = callPackage ../tools/networking/ppp { }; pptp = callPackage ../tools/networking/pptp { }; prey-bash-client = callPackage ../tools/security/prey { }; projectm = callPackage ../applications/audio/projectm { }; proxychains = callPackage ../tools/networking/proxychains { }; proxytunnel = callPackage ../tools/misc/proxytunnel { }; cntlm = callPackage ../tools/networking/cntlm { }; pastebinit = callPackage ../tools/misc/pastebinit { }; psmisc = callPackage ../os-specific/linux/psmisc { }; pstoedit = callPackage ../tools/graphics/pstoedit { }; pv = callPackage ../tools/misc/pv { }; pwgen = callPackage ../tools/security/pwgen { }; pwnat = callPackage ../tools/networking/pwnat { }; pycangjie = callPackage ../development/python-modules/pycangjie { }; pydb = callPackage ../development/tools/pydb { }; pystringtemplate = callPackage ../development/python-modules/stringtemplate { }; pythonDBus = dbus_python; pythonIRClib = builderDefsPackage (import ../development/python-modules/irclib) { inherit python; }; pythonSexy = builderDefsPackage (import ../development/python-modules/libsexy) { inherit python libsexy pkgconfig libxml2 pygtk pango gtk glib; }; openmpi = callPackage ../development/libraries/openmpi { }; qhull = callPackage ../development/libraries/qhull { }; qjoypad = callPackage ../tools/misc/qjoypad { }; qshowdiff = callPackage ../tools/text/qshowdiff { }; quilt = callPackage ../development/tools/quilt { }; radvd = callPackage ../tools/networking/radvd { }; ranger = callPackage ../applications/misc/ranger { }; privateer = callPackage ../games/privateer { }; rtmpdump = callPackage ../tools/video/rtmpdump { }; reaverwps = callPackage ../tools/networking/reaver-wps { }; recutils = callPackage ../tools/misc/recutils { }; recoll = callPackage ../applications/search/recoll { }; reiser4progs = callPackage ../tools/filesystems/reiser4progs { }; reiserfsprogs = callPackage ../tools/filesystems/reiserfsprogs { }; relfs = callPackage ../tools/filesystems/relfs { inherit (gnome) gnome_vfs GConf; }; remarkjs = callPackage ../development/web/remarkjs { }; remind = callPackage ../tools/misc/remind { }; remmina = callPackage ../applications/networking/remote/remmina { }; renameutils = callPackage ../tools/misc/renameutils { }; replace = callPackage ../tools/text/replace { }; reptyr = callPackage ../os-specific/linux/reptyr { }; rdiff_backup = callPackage ../tools/backup/rdiff-backup { }; rdmd = callPackage ../development/compilers/rdmd { }; rhash = callPackage ../tools/security/rhash { }; riemann_c_client = callPackage ../tools/misc/riemann-c-client { }; ripmime = callPackage ../tools/networking/ripmime { }; rkflashtool = callPackage ../tools/misc/rkflashtool { }; rmlint = callPackage ../tools/misc/rmlint { }; rng_tools = callPackage ../tools/security/rng-tools { }; rsnapshot = callPackage ../tools/backup/rsnapshot { logger = inetutils; }; rlwrap = callPackage ../tools/misc/rlwrap { }; rockbox_utility = callPackage ../tools/misc/rockbox-utility { }; rpPPPoE = builderDefsPackage (import ../tools/networking/rp-pppoe) { inherit ppp; }; rpm = callPackage ../tools/package-management/rpm { }; rrdtool = callPackage ../tools/misc/rrdtool { }; rtorrent = callPackage ../tools/networking/p2p/rtorrent { }; rubber = callPackage ../tools/typesetting/rubber { }; rxp = callPackage ../tools/text/xml/rxp { }; rzip = callPackage ../tools/compression/rzip { }; s3backer = callPackage ../tools/filesystems/s3backer { }; s3cmd = callPackage ../tools/networking/s3cmd { }; s3cmd_15_pre_81e3842f7a = lowPrio (callPackage ../tools/networking/s3cmd/git.nix { }); s3sync = callPackage ../tools/networking/s3sync { ruby = ruby18; }; sablotron = callPackage ../tools/text/xml/sablotron { }; safecopy = callPackage ../tools/system/safecopy { }; salut_a_toi = callPackage ../applications/networking/instant-messengers/salut-a-toi { }; samplicator = callPackage ../tools/networking/samplicator { }; screen = callPackage ../tools/misc/screen { }; scrot = callPackage ../tools/graphics/scrot { }; scrypt = callPackage ../tools/security/scrypt { }; sdcv = callPackage ../applications/misc/sdcv { }; sec = callPackage ../tools/admin/sec { }; seccure = callPackage ../tools/security/seccure { }; setserial = builderDefsPackage (import ../tools/system/setserial) { inherit groff; }; seqdiag = pythonPackages.seqdiag; screenfetch = callPackage ../tools/misc/screenfetch { }; sg3_utils = callPackage ../tools/system/sg3_utils { }; sharutils = callPackage ../tools/archivers/sharutils { }; shotwell = callPackage ../applications/graphics/shotwell { }; shebangfix = callPackage ../tools/misc/shebangfix { }; shellinabox = callPackage ../servers/shellinabox { }; siege = callPackage ../tools/networking/siege { }; silc_client = callPackage ../applications/networking/instant-messengers/silc-client { }; silc_server = callPackage ../servers/silc-server { }; silver-searcher = callPackage ../tools/text/silver-searcher { }; simplescreenrecorder = callPackage ../applications/video/simplescreenrecorder { }; sleuthkit = callPackage ../tools/system/sleuthkit { }; slimrat = callPackage ../tools/networking/slimrat { inherit (perlPackages) WWWMechanize LWP; }; slsnif = callPackage ../tools/misc/slsnif { }; smartmontools = callPackage ../tools/system/smartmontools { }; smbldaptools = callPackage ../tools/networking/smbldaptools { inherit (perlPackages) NetLDAP CryptSmbHash DigestSHA1; }; smbnetfs = callPackage ../tools/filesystems/smbnetfs { }; snort = callPackage ../applications/networking/ids/snort { }; snx = callPackage_i686 ../tools/networking/snx { inherit (pkgsi686Linux) pam gcc33; inherit (pkgsi686Linux.xlibs) libX11; }; solr = callPackage ../servers/search/solr { }; sparsehash = callPackage ../development/libraries/sparsehash { }; spiped = callPackage ../tools/networking/spiped { }; sproxy = haskellPackages.callPackage ../tools/networking/sproxy { }; sproxy-web = haskellPackages.callPackage ../tools/networking/sproxy-web { }; stardict = callPackage ../applications/misc/stardict/stardict.nix { inherit (gnome) libgnomeui scrollkeeper; }; storebrowse = callPackage ../tools/system/storebrowse { }; fusesmb = callPackage ../tools/filesystems/fusesmb { }; sl = callPackage ../tools/misc/sl { }; socat = callPackage ../tools/networking/socat { }; socat2pre = lowPrio (callPackage ../tools/networking/socat/2.x.nix { }); sourceHighlight = callPackage ../tools/text/source-highlight { boost = boost149; }; spaceFM = callPackage ../applications/misc/spacefm { }; squashfsTools = callPackage ../tools/filesystems/squashfs { }; sshfsFuse = callPackage ../tools/filesystems/sshfs-fuse { }; sshuttle = callPackage ../tools/security/sshuttle { }; sudo = callPackage ../tools/security/sudo { }; suidChroot = builderDefsPackage (import ../tools/system/suid-chroot) { }; super = callPackage ../tools/security/super { }; ssdeep = callPackage ../tools/security/ssdeep { }; ssmtp = callPackage ../tools/networking/ssmtp { tlsSupport = true; }; ssss = callPackage ../tools/security/ssss { }; storeBackup = callPackage ../tools/backup/store-backup { }; stow = callPackage ../tools/misc/stow { }; stun = callPackage ../tools/networking/stun { }; stunnel = callPackage ../tools/networking/stunnel { }; su = shadow.su; surfraw = callPackage ../tools/networking/surfraw { }; swec = callPackage ../tools/networking/swec { inherit (perlPackages) LWP URI HTMLParser HTTPServerSimple Parent; }; svnfs = callPackage ../tools/filesystems/svnfs { }; sysbench = callPackage ../development/tools/misc/sysbench { }; system_config_printer = callPackage ../tools/misc/system-config-printer { libxml2 = libxml2Python; }; sitecopy = callPackage ../tools/networking/sitecopy { }; stricat = callPackage ../tools/security/stricat { }; privoxy = callPackage ../tools/networking/privoxy { }; t1utils = callPackage ../tools/misc/t1utils { }; tarsnap = callPackage ../tools/backup/tarsnap { }; tcpcrypt = callPackage ../tools/security/tcpcrypt { }; tboot = callPackage ../tools/security/tboot { }; tcpdump = callPackage ../tools/networking/tcpdump { }; tcpflow = callPackage ../tools/networking/tcpflow { }; teamviewer = callPackage_i686 ../applications/networking/remote/teamviewer { }; teamviewer8 = lowPrio (callPackage_i686 ../applications/networking/remote/teamviewer/8.nix { }); telnet = callPackage ../tools/networking/telnet { }; texmacs = callPackage ../applications/editors/texmacs { tex = texLive; extraFonts = true; guile = guile_1_8; }; texmaker = callPackage ../applications/editors/texmaker { }; texstudio = callPackage ../applications/editors/texstudio { }; tiled-qt = callPackage ../applications/editors/tiled-qt { qt = qt4; }; tinc = callPackage ../tools/networking/tinc { }; tiny8086 = callPackage ../applications/virtualization/8086tiny { }; tmpwatch = callPackage ../tools/misc/tmpwatch { }; tmux = callPackage ../tools/misc/tmux { }; tor = callPackage ../tools/security/tor { }; torbutton = callPackage ../tools/security/torbutton { }; torbrowser = callPackage ../tools/security/tor/torbrowser.nix { }; torsocks = callPackage ../tools/security/tor/torsocks.nix { }; tpm-quote-tools = callPackage ../tools/security/tpm-quote-tools { }; tpm-tools = callPackage ../tools/security/tpm-tools { }; trickle = callPackage ../tools/networking/trickle { }; trousers = callPackage ../tools/security/trousers { }; ttf2pt1 = callPackage ../tools/misc/ttf2pt1 { }; ttysnoop = callPackage ../os-specific/linux/ttysnoop { }; twitterBootstrap = callPackage ../development/web/twitter-bootstrap { }; txt2man = callPackage ../tools/misc/txt2man { }; ucl = callPackage ../development/libraries/ucl { }; ucspi-tcp = callPackage ../tools/networking/ucspi-tcp { }; udftools = callPackage ../tools/filesystems/udftools { }; udptunnel = callPackage ../tools/networking/udptunnel { }; ufraw = callPackage ../applications/graphics/ufraw { }; unetbootin = callPackage ../tools/cd-dvd/unetbootin { }; unfs3 = callPackage ../servers/unfs3 { }; unoconv = callPackage ../tools/text/unoconv { }; upx = callPackage ../tools/compression/upx { }; urlview = callPackage ../applications/misc/urlview { }; usbmuxd = callPackage ../tools/misc/usbmuxd { }; vacuum = callPackage ../applications/networking/instant-messengers/vacuum { }; volatility = callPackage ../tools/security/volatility { }; vidalia = callPackage ../tools/security/vidalia { }; vbetool = builderDefsPackage ../tools/system/vbetool { inherit pciutils libx86 zlib; }; vde2 = callPackage ../tools/networking/vde2 { }; vboot_reference = callPackage ../tools/system/vboot_reference { }; vcsh = callPackage ../applications/version-management/vcsh { }; verilog = callPackage ../applications/science/electronics/verilog { }; vfdecrypt = callPackage ../tools/misc/vfdecrypt { }; vifm = callPackage ../applications/misc/vifm { }; viking = callPackage ../applications/misc/viking { inherit (gnome) scrollkeeper; }; vnc2flv = callPackage ../tools/video/vnc2flv { }; vncrec = builderDefsPackage ../tools/video/vncrec { inherit (xlibs) imake libX11 xproto gccmakedep libXt libXmu libXaw libXext xextproto libSM libICE libXpm libXp; }; vobcopy = callPackage ../tools/cd-dvd/vobcopy { }; vobsub2srt = callPackage ../tools/cd-dvd/vobsub2srt { }; vorbisgain = callPackage ../tools/misc/vorbisgain { }; vpnc = callPackage ../tools/networking/vpnc { }; openconnect = callPackage ../tools/networking/openconnect.nix { }; vtun = callPackage ../tools/networking/vtun { }; wal_e = callPackage ../tools/backup/wal-e { }; watchman = callPackage ../development/tools/watchman { }; wbox = callPackage ../tools/networking/wbox { }; welkin = callPackage ../tools/graphics/welkin { }; testdisk = callPackage ../tools/misc/testdisk { }; htmlTidy = callPackage ../tools/text/html-tidy { }; html-xml-utils = callPackage ../tools/text/xml/html-xml-utils { }; tftp_hpa = callPackage ../tools/networking/tftp-hpa { }; tigervnc = callPackage ../tools/admin/tigervnc { fontDirectories = [ xorg.fontadobe75dpi xorg.fontmiscmisc xorg.fontcursormisc xorg.fontbhlucidatypewriter75dpi ]; inherit (xorg) xorgserver; fltk = fltk13; }; tightvnc = callPackage ../tools/admin/tightvnc { fontDirectories = [ xorg.fontadobe75dpi xorg.fontmiscmisc xorg.fontcursormisc xorg.fontbhlucidatypewriter75dpi ]; }; time = callPackage ../tools/misc/time { }; tkabber = callPackage ../applications/networking/instant-messengers/tkabber { }; qfsm = callPackage ../applications/science/electronics/qfsm { }; tkgate = callPackage ../applications/science/electronics/tkgate/1.x.nix { inherit (xlibs) libX11 imake xproto gccmakedep; }; tkgate2 = lowPrio (callPackage ../applications/science/electronics/tkgate/2.x.nix { inherit (xlibs) libX11; }); tm = callPackage ../tools/system/tm { }; trang = callPackage ../tools/text/xml/trang { }; tre = callPackage ../development/libraries/tre { }; ts = callPackage ../tools/system/ts { }; transfig = callPackage ../tools/graphics/transfig { libpng = libpng12; }; truecrypt = callPackage ../applications/misc/truecrypt { wxGUI = config.truecrypt.wxGUI or true; }; ttmkfdir = callPackage ../tools/misc/ttmkfdir { }; unclutter = callPackage ../tools/misc/unclutter { }; unbound = callPackage ../tools/networking/unbound { }; units = callPackage ../tools/misc/units { }; unrar = callPackage ../tools/archivers/unrar { }; xarchive = callPackage ../tools/archivers/xarchive { }; xarchiver = callPackage ../tools/archivers/xarchiver { }; xcruiser = callPackage ../applications/misc/xcruiser { }; unarj = callPackage ../tools/archivers/unarj { }; unshield = callPackage ../tools/archivers/unshield { }; unzip = callPackage ../tools/archivers/unzip { }; unzipNLS = lowPrio (unzip.override { enableNLS = true; }); uptimed = callPackage ../tools/system/uptimed { }; varnish = callPackage ../servers/varnish { }; varnish2 = callPackage ../servers/varnish/2.1.nix { }; venus = callPackage ../tools/misc/venus { python = python27; }; vlan = callPackage ../tools/networking/vlan { }; wakelan = callPackage ../tools/networking/wakelan { }; wavemon = callPackage ../tools/networking/wavemon { }; w3cCSSValidator = callPackage ../tools/misc/w3c-css-validator { tomcat = tomcat6; }; wdfs = callPackage ../tools/filesystems/wdfs { }; wdiff = callPackage ../tools/text/wdiff { }; webalizer = callPackage ../tools/networking/webalizer { }; webdruid = builderDefsPackage ../tools/admin/webdruid { inherit zlib libpng freetype gd which libxml2 geoip; }; weighttp = callPackage ../tools/networking/weighttp { }; wget = callPackage ../tools/networking/wget { inherit (perlPackages) LWP; }; which = callPackage ../tools/system/which { }; wicd = callPackage ../tools/networking/wicd { }; wkhtmltopdf = callPackage ../tools/graphics/wkhtmltopdf { }; wv = callPackage ../tools/misc/wv { }; wv2 = callPackage ../tools/misc/wv2 { }; x86info = callPackage ../os-specific/linux/x86info { }; x11_ssh_askpass = callPackage ../tools/networking/x11-ssh-askpass { }; xbursttools = assert stdenv ? glibc; import ../tools/misc/xburst-tools { inherit stdenv fetchgit autoconf automake confuse pkgconfig libusb libusb1; gccCross = let pkgsCross = import ./all-packages.nix { inherit system; inherit bootStdenv noSysDirs gccWithCC gccWithProfiling config; crossSystem = { config = "mipsel-unknown-linux"; bigEndian = true; arch = "mips"; float = "soft"; withTLS = true; libc = "uclibc"; platform = { name = "ben_nanonote"; kernelMajor = "2.6"; kernelHeadersBaseConfig = "bcm47xx_defconfig"; kernelArch = "mips"; }; gcc = { arch = "mips32"; }; }; }; in pkgsCross.gccCrossStageStatic; }; xclip = callPackage ../tools/misc/xclip { }; xtitle = callPackage ../tools/misc/xtitle { }; xdelta = callPackage ../tools/compression/xdelta { }; xdummy = callPackage ../tools/misc/xdummy { }; xfsprogs = callPackage ../tools/filesystems/xfsprogs { }; xmlroff = callPackage ../tools/typesetting/xmlroff { inherit (gnome) libgnomeprint; }; xmlstarlet = callPackage ../tools/text/xml/xmlstarlet { }; xmlto = callPackage ../tools/typesetting/xmlto { }; xmltv = callPackage ../tools/misc/xmltv { }; xmpppy = builderDefsPackage (import ../development/python-modules/xmpppy) { inherit python setuptools; }; xorriso = callPackage ../tools/cd-dvd/xorriso { }; xpf = callPackage ../tools/text/xml/xpf { libxml2 = libxml2Python; }; xsel = callPackage ../tools/misc/xsel { }; xtreemfs = callPackage ../tools/filesystems/xtreemfs { }; xvfb_run = callPackage ../tools/misc/xvfb-run { inherit (texFunctions) fontsConf; }; youtubeDL = callPackage ../tools/misc/youtube-dl { }; zbar = callPackage ../tools/graphics/zbar { pygtk = lib.overrideDerivation pygtk (x: { gtk = gtk2; }); }; zdelta = callPackage ../tools/compression/zdelta { }; zfstools = callPackage ../tools/filesystems/zfstools { zfs = linuxPackages.zfs; }; zile = callPackage ../applications/editors/zile { }; zip = callPackage ../tools/archivers/zip { }; zpaq = callPackage ../tools/archivers/zpaq { }; zpaqd = callPackage ../tools/archivers/zpaq/zpaqd.nix { }; zsync = callPackage ../tools/compression/zsync { }; bash = lowPrio (callPackage ../shells/bash { texinfo = null; }); bashInteractive = appendToName "interactive" (callPackage ../shells/bash { interactive = true; readline = readline63; }); bashCompletion = callPackage ../shells/bash-completion { }; dash = callPackage ../shells/dash { }; fish = callPackage ../shells/fish { python = python27Full; }; tcsh = callPackage ../shells/tcsh { }; rush = callPackage ../shells/rush { }; zsh = callPackage ../shells/zsh { }; abc = abcPatchable [ ]; abcPatchable = patches: import ../development/compilers/abc/default.nix { inherit stdenv fetchurl patches jre apacheAnt; javaCup = callPackage ../development/libraries/java/cup { }; }; aldor = callPackage ../development/compilers/aldor { }; aliceml = callPackage ../development/compilers/aliceml { }; aspectj = callPackage ../development/compilers/aspectj { }; ats = callPackage ../development/compilers/ats { }; ats2 = callPackage ../development/compilers/ats2 { }; avra = callPackage ../development/compilers/avra { }; bigloo = callPackage ../development/compilers/bigloo { }; chicken = callPackage ../development/compilers/chicken { }; ccl = builderDefsPackage ../development/compilers/ccl { }; clang = wrapClang llvmPackages.clang; clang_34 = wrapClang llvmPackages_34.clang; clang_33 = wrapClang (clangUnwrapped llvm_33 ../development/compilers/llvm/3.3/clang.nix); clangAnalyzer = callPackage ../development/tools/analysis/clang-analyzer { clang = clang_34; llvmPackages = llvmPackages_34; }; clangUnwrapped = llvm: pkg: callPackage pkg { stdenv = if stdenv.isDarwin then stdenvApple else stdenv; inherit llvm; }; clangSelf = clangWrapSelf llvmPackagesSelf.clang; clangWrapSelf = build: import ../build-support/clang-wrapper { clang = build; stdenv = clangStdenv; libc = glibc; binutils = binutils; shell = bash; inherit libcxx coreutils zlib; nativeTools = false; nativeLibc = false; }; clangStdenv = lowPrio (stdenvAdapters.overrideGCC stdenv clang); libcxxStdenv = stdenvAdapters.overrideGCC stdenv (clangWrapSelf llvmPackages.clang); clean = callPackage ../development/compilers/clean { }; closurecompiler = callPackage ../development/compilers/closure { }; cmucl_binary = callPackage ../development/compilers/cmucl/binary.nix { }; compcert = callPackage ../development/compilers/compcert { }; cryptol1 = lowPrio (callPackage ../development/compilers/cryptol/1.8.x.nix { }); cryptol2 = with haskellPackages_ghc763; callPackage ../development/compilers/cryptol/2.0.x.nix { Cabal = Cabal_1_18_1_3; cabalInstall = cabalInstall_1_18_0_3; process = process_1_2_0_0; }; cython = pythonPackages.cython; cython3 = python3Packages.cython; dylan = callPackage ../development/compilers/gwydion-dylan { dylan = callPackage ../development/compilers/gwydion-dylan/binary.nix { }; }; ecl = callPackage ../development/compilers/ecl { }; eql = callPackage ../development/compilers/eql { }; adobe_flex_sdk = callPackage ../development/compilers/adobe-flex-sdk { }; fpc = callPackage ../development/compilers/fpc { }; fpc_2_4_0 = callPackage ../development/compilers/fpc/2.4.0.nix { }; gambit = callPackage ../development/compilers/gambit { }; gcc = gcc48; gcc33 = wrapGCC (import ../development/compilers/gcc/3.3 { inherit fetchurl stdenv noSysDirs; }); gcc34 = wrapGCC (import ../development/compilers/gcc/3.4 { inherit fetchurl stdenv noSysDirs; }); gcc48_realCross = lib.addMetaAttrs { hydraPlatforms = [ ]; } (callPackage ../development/compilers/gcc/4.8 { inherit noSysDirs; binutilsCross = binutilsCross; libcCross = libcCross; profiledCompiler = false; enableMultilib = false; crossStageStatic = false; cross = assert crossSystem != null; crossSystem; }); gcc_realCross = gcc48_realCross; gccCrossStageStatic = let libcCross1 = if stdenv.cross.libc == "msvcrt" then windows.mingw_w64_headers else if stdenv.cross.libc == "libSystem" then darwin.xcode else null; in wrapGCCCross { gcc = forceNativeDrv (lib.addMetaAttrs { hydraPlatforms = [ ]; } (gcc_realCross.override { crossStageStatic = true; langCC = false; libcCross = libcCross1; enableShared = false; })); libc = libcCross1; binutils = binutilsCross; cross = assert crossSystem != null; crossSystem; }; gccCrossMingw2 = wrapGCCCross { gcc = gccCrossStageStatic.gcc; libc = windows.mingw_headers2; binutils = binutilsCross; cross = assert crossSystem != null; crossSystem; }; gccCrossStageFinal = wrapGCCCross { gcc = forceNativeDrv (gcc_realCross.override { libpthreadCross = if crossSystem != null && crossSystem.config == "i586-pc-gnu" then gnu.libpthreadCross else null; langCC = crossSystem == null || crossSystem.config != "i686-pc-mingw32"; }); libc = libcCross; binutils = binutilsCross; cross = assert crossSystem != null; crossSystem; }; gcc44 = lowPrio (wrapGCC (makeOverridable (import ../development/compilers/gcc/4.4) { inherit fetchurl stdenv gmp mpfr gettext which noSysDirs; texinfo = texinfo4; profiledCompiler = true; })); gcc45 = lowPrio (wrapGCC (callPackage ../development/compilers/gcc/4.5 { inherit fetchurl stdenv gmp mpfr mpc libelf zlib perl gettext which noSysDirs; texinfo = texinfo4; ppl = null; cloogppl = null; profiledCompiler = !stdenv.isArm; cross = null; libcCross = if crossSystem != null then libcCross else null; libpthreadCross = if crossSystem != null && crossSystem.config == "i586-pc-gnu" then gnu.libpthreadCross else null; })); gcc46 = lowPrio (wrapGCC (callPackage ../development/compilers/gcc/4.6 { inherit noSysDirs; ppl = null; cloog = null; profiledCompiler = false; cross = null; libcCross = if crossSystem != null then libcCross else null; libpthreadCross = if crossSystem != null && crossSystem.config == "i586-pc-gnu" then gnu.libpthreadCross else null; texinfo = texinfo413; })); gcc48 = lowPrio (wrapGCC (callPackage ../development/compilers/gcc/4.8 { inherit noSysDirs; profiledCompiler = with stdenv; !isDarwin && (isi686 || isx86_64); cross = null; libcCross = if crossSystem != null then libcCross else null; libpthreadCross = if crossSystem != null && crossSystem.config == "i586-pc-gnu" then gnu.libpthreadCross else null; })); gcc48_multi = if system == "x86_64-linux" then lowPrio (wrapGCCWith (import ../build-support/gcc-wrapper) glibc_multi (gcc48.gcc.override { stdenv = overrideGCC stdenv (wrapGCCWith (import ../build-support/gcc-wrapper) glibc_multi gcc.gcc); profiledCompiler = false; enableMultilib = true; })) else throw "Multilib gcc not supported on ‘${system}’"; gcc48_debug = lowPrio (wrapGCC (callPackage ../development/compilers/gcc/4.8 { stripped = false; inherit noSysDirs; cross = null; libcCross = null; binutilsCross = null; })); gcc49 = lowPrio (wrapGCC (callPackage ../development/compilers/gcc/4.9 { inherit noSysDirs; profiledCompiler = with stdenv; !isDarwin && (isi686 || isx86_64); cross = null; libcCross = if crossSystem != null then libcCross else null; libpthreadCross = if crossSystem != null && crossSystem.config == "i586-pc-gnu" then gnu.libpthreadCross else null; })); gccApple = assert stdenv.isDarwin; wrapGCC (makeOverridable (import ../development/compilers/gcc/4.2-apple64) { inherit fetchurl noSysDirs; profiledCompiler = true; stdenv = allStdenvs.stdenvNative; }); gfortran = gfortran48; gfortran48 = wrapGCC (gcc48.gcc.override { name = "gfortran"; langFortran = true; langCC = false; langC = false; profiledCompiler = false; }); gcj = gcj48; gcj48 = wrapGCC (gcc48.gcc.override { name = "gcj"; langJava = true; langFortran = false; langCC = false; langC = false; profiledCompiler = false; inherit zip unzip zlib boehmgc gettext pkgconfig perl; inherit gtk; inherit (gnome) libart_lgpl; inherit (xlibs) libX11 libXt libSM libICE libXtst libXi libXrender libXrandr xproto renderproto xextproto inputproto randrproto; }); gnat = gnat45; gnat45 = wrapGCC (gcc45.gcc.override { name = "gnat"; langCC = false; langC = true; langAda = true; profiledCompiler = false; inherit gnatboot; cloogppl = null; ppl = null; }); gnat46 = wrapGCC (gcc46.gcc.override { name = "gnat"; langCC = false; langC = true; langAda = true; profiledCompiler = false; gnatboot = gnat45; ppl = null; cloog = null; }); gnatboot = wrapGCC (import ../development/compilers/gnatboot { inherit fetchurl stdenv; }); gccgo = gccgo48; gccgo48 = wrapGCC (gcc48.gcc.override { name = "gccgo"; langCC = true; langC = true; langGo = true; }); ghdl = wrapGCC (import ../development/compilers/gcc/4.3 { inherit stdenv fetchurl gmp mpfr noSysDirs gnat; texinfo = texinfo4; name = "ghdl"; langVhdl = true; langCC = false; langC = false; profiledCompiler = false; enableMultilib = false; }); ghdl_mcode = callPackage ../development/compilers/ghdl { }; gcl = builderDefsPackage ../development/compilers/gcl { inherit mpfr m4 binutils fetchcvs emacs zlib which texinfo; gmp = gmp4; inherit (xlibs) libX11 xproto inputproto libXi libXext xextproto libXt libXaw libXmu; inherit stdenv; texLive = texLiveAggregationFun { paths = [ texLive texLiveExtra ]; }; }; jhc = callPackage ../development/compilers/jhc { inherit (haskellPackages_ghc763) ghc binary zlib utf8String readline fgl regexCompat HsSyck random; }; gcc-arm-embedded-4_7 = callPackage_i686 ../development/compilers/gcc-arm-embedded { version = "4.7-2013q3-20130916"; releaseType = "update"; sha256 = "1bd9bi9q80xn2rpy0rn1vvj70rh15kb7dmah0qs4q2rv78fqj40d"; }; gcc-arm-embedded-4_8 = callPackage_i686 ../development/compilers/gcc-arm-embedded { version = "4.8-2014q1-20140314"; releaseType = "update"; sha256 = "ce92859550819d4a3d1a6e2672ea64882b30afa2c08cf67fa8e1d93788c2c577"; }; gcc-arm-embedded = gcc-arm-embedded-4_8; haskell = let pkgs_ = pkgs // { gmp = gmp.override { withStatic = true; }; }; callPackage = newScope pkgs_; newScope = extra: lib.callPackageWith (pkgs_ // pkgs_.xorg // extra); in callPackage ./haskell-defaults.nix { pkgs = pkgs_; inherit callPackage newScope; }; ghc = recurseIntoAttrs (lib.mapAttrs' (name: value: lib.nameValuePair (builtins.substring (builtins.stringLength "packages_") (builtins.stringLength name) name) value.ghc) (lib.filterAttrs (name: value: builtins.substring 0 (builtins.stringLength "packages_") name == "packages_") haskell)); haskellPackages = haskellPackages_ghc783; haskellPlatform = haskellPlatformPackages."2013_2_0_0"; haskellPackages_ghc6104 = haskell.packages_ghc6104; haskellPackages_ghc6123 = haskell.packages_ghc6123; haskellPackages_ghc704 = haskell.packages_ghc704; haskellPackages_ghc722 = haskell.packages_ghc722; haskellPackages_ghc742 = haskell.packages_ghc742; haskellPackages_ghc763 = haskell.packages_ghc763; haskellPackages_ghc783_no_profiling = recurseIntoAttrs haskell.packages_ghc783.noProfiling; haskellPackages_ghc783_profiling = recurseIntoAttrs haskell.packages_ghc783.profiling; haskellPackages_ghc783 = recurseIntoAttrs haskell.packages_ghc783.highPrio; haskellPackages_ghcHEAD = haskell.packages_ghcHEAD; haskellPlatformPackages = recurseIntoAttrs (import ../development/libraries/haskell/haskell-platform { inherit pkgs; }); haxe = callPackage ../development/compilers/haxe { }; hhvm = callPackage ../development/compilers/hhvm { }; hiphopvm = hhvm; falcon = builderDefsPackage (import ../development/interpreters/falcon) { inherit cmake; }; fsharp = callPackage ../development/compilers/fsharp { }; go_1_0 = callPackage ../development/compilers/go { }; go_1_1 = if stdenv.isDarwin then callPackage ../development/compilers/go/1.1-darwin.nix { } else callPackage ../development/compilers/go/1.1.nix { }; go_1_2 = callPackage ../development/compilers/go/1.2.nix { }; go_1_3 = callPackage ../development/compilers/go/1.3.nix { }; go = go_1_3; gox = callPackage ../development/compilers/go/gox.nix { }; gprolog = callPackage ../development/compilers/gprolog { }; gwt240 = callPackage ../development/compilers/gwt/2.4.0.nix { }; icedtea7_jdk = callPackage ../development/compilers/icedtea rec { jdk = openjdk; jdkPath = "${openjdk}/lib/openjdk"; } // { outputs = [ "out" ]; }; icedtea7_jre = lib.setName "icedtea7-${lib.getVersion pkgs.icedtea7_jdk.jre}" (lib.addMetaAttrs { description = "Free Java runtime environment based on OpenJDK 7.0 and the IcedTea project"; } pkgs.icedtea7_jdk.jre) // { outputs = [ "jre" ]; }; icedtea7_web = callPackage ../development/compilers/icedtea-web { jdk = "${icedtea7_jdk}/lib/icedtea"; }; ikarus = callPackage ../development/compilers/ikarus { }; hugs = callPackage ../development/compilers/hugs { }; path64 = callPackage ../development/compilers/path64 { }; openjdk = if stdenv.isDarwin then callPackage ../development/compilers/openjdk-darwin { } else let openjdkBootstrap = callPackage ../development/compilers/openjdk/bootstrap.nix { }; in callPackage ../development/compilers/openjdk { jdk = openjdkBootstrap; } // { outputs = [ "out" ]; }; openjre = lib.setName "openjre-${lib.getVersion pkgs.openjdk.jre}" (lib.addMetaAttrs { description = "The open-source Java Runtime Environment"; } pkgs.openjdk.jre) // { outputs = [ "jre" ]; }; jdk = if stdenv.isDarwin || stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux" then pkgs.openjdk else pkgs.oraclejdk; jre = if stdenv.isDarwin || stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux" then pkgs.openjre else pkgs.oraclejre; oraclejdk = pkgs.jdkdistro true false; oraclejdk7 = pkgs.oraclejdk7distro true false; oraclejdk8 = pkgs.oraclejdk8distro true false; oraclejre = lowPrio (pkgs.jdkdistro false false); oraclejre7 = lowPrio (pkgs.oraclejdk7distro false false); oraclejre8 = lowPrio (pkgs.oraclejdk8distro false false); jrePlugin = lowPrio (pkgs.jdkdistro false true); supportsJDK = system == "i686-linux" || system == "x86_64-linux"; jdkdistro = installjdk: pluginSupport: assert supportsJDK; (if pluginSupport then appendToName "with-plugin" else x: x) (callPackage ../development/compilers/oraclejdk/jdk6-linux.nix { }); oraclejdk7distro = installjdk: pluginSupport: assert supportsJDK; (if pluginSupport then appendToName "with-plugin" else x: x) (callPackage ../development/compilers/oraclejdk/jdk7-linux.nix { inherit installjdk; }); oraclejdk8distro = installjdk: pluginSupport: assert supportsJDK; (if pluginSupport then appendToName "with-plugin" else x: x) (callPackage ../development/compilers/oraclejdk/jdk8-linux.nix { inherit installjdk; }); jikes = callPackage ../development/compilers/jikes { }; juliaGit = callPackage ../development/compilers/julia/git-20131013.nix { liblapack = liblapack.override { shared = true; }; llvm = llvm_33; }; julia021 = callPackage ../development/compilers/julia/0.2.1.nix { liblapack = liblapack.override { shared = true; }; llvm = llvm_33; }; julia030 = let liblapack = liblapack_3_5_0.override { shared = true; }; in callPackage ../development/compilers/julia/0.3.0.nix { inherit liblapack; suitesparse = suitesparse.override { inherit liblapack; }; openblas = openblas_0_2_10; llvm = llvm_34; }; julia = julia021; lazarus = builderDefsPackage (import ../development/compilers/fpc/lazarus.nix) { inherit makeWrapper gtk glib pango atk gdk_pixbuf; inherit (xlibs) libXi inputproto libX11 xproto libXext xextproto; fpc = fpc; }; lessc = callPackage ../development/compilers/lessc { }; llvm = llvmPackages.llvm; llvm_34 = llvmPackages_34.llvm; llvm_33 = llvm_v ../development/compilers/llvm/3.3/llvm.nix; llvm_v = path: callPackage path { stdenv = if stdenv.isDarwin then stdenvApple else stdenv; }; llvmPackages = if !stdenv.isDarwin then llvmPackages_34 else llvmPackages_34 // { llvm = llvm_33; clang = clang_33; }; llvmPackages_34 = recurseIntoAttrs (import ../development/compilers/llvm/3.4 { inherit stdenv newScope fetchurl; isl = isl_0_12; }); llvmPackagesSelf = import ../development/compilers/llvm/3.4 { inherit newScope fetchurl; isl = isl_0_12; stdenv = libcxxStdenv; }; manticore = callPackage ../development/compilers/manticore { }; mentorToolchains = recurseIntoAttrs (callPackage_i686 ../development/compilers/mentor { }); mercury = callPackage ../development/compilers/mercury { }; mitscheme = callPackage ../development/compilers/mit-scheme { }; mlton = callPackage ../development/compilers/mlton { }; mono = callPackage ../development/compilers/mono { inherit (xlibs) libX11; }; monoDLLFixer = callPackage ../build-support/mono-dll-fixer { }; mozart = callPackage ../development/compilers/mozart { }; neko = callPackage ../development/compilers/neko { }; nasm = callPackage ../development/compilers/nasm { }; nvidia_cg_toolkit = callPackage ../development/compilers/nvidia-cg-toolkit { }; ocaml = ocamlPackages.ocaml; ocaml_3_08_0 = callPackage ../development/compilers/ocaml/3.08.0.nix { }; ocaml_3_10_0 = callPackage ../development/compilers/ocaml/3.10.0.nix { }; ocaml_3_11_2 = callPackage ../development/compilers/ocaml/3.11.2.nix { }; ocaml_3_12_1 = callPackage ../development/compilers/ocaml/3.12.1.nix { }; ocaml_4_00_1 = callPackage ../development/compilers/ocaml/4.00.1.nix { }; ocaml_4_01_0 = callPackage ../development/compilers/ocaml/4.01.0.nix { }; orc = callPackage ../development/compilers/orc { }; metaocaml_3_09 = callPackage ../development/compilers/ocaml/metaocaml-3.09.nix { }; ber_metaocaml_003 = callPackage ../development/compilers/ocaml/ber-metaocaml-003.nix { }; mkOcamlPackages = ocaml: self: let callPackage = newScope self; in rec { inherit ocaml; camlidl = callPackage ../development/tools/ocaml/camlidl { }; camlp5_5_strict = callPackage ../development/tools/ocaml/camlp5/5.15.nix { }; camlp5_5_transitional = callPackage ../development/tools/ocaml/camlp5/5.15.nix { transitional = true; }; camlp5_6_strict = callPackage ../development/tools/ocaml/camlp5 { }; camlp5_6_transitional = callPackage ../development/tools/ocaml/camlp5 { transitional = true; }; camlp5_strict = camlp5_6_strict; camlp5_transitional = camlp5_6_transitional; camlzip = callPackage ../development/ocaml-modules/camlzip { }; camomile_0_8_2 = callPackage ../development/ocaml-modules/camomile/0.8.2.nix { }; camomile = callPackage ../development/ocaml-modules/camomile { }; camlimages = callPackage ../development/ocaml-modules/camlimages { libpng = libpng12; giflib = giflib_4_1; }; biniou = callPackage ../development/ocaml-modules/biniou { }; ocaml_cairo = callPackage ../development/ocaml-modules/ocaml-cairo { }; cppo = callPackage ../development/tools/ocaml/cppo { }; cryptokit = callPackage ../development/ocaml-modules/cryptokit { }; csv = callPackage ../development/ocaml-modules/csv { }; deriving = callPackage ../development/tools/ocaml/deriving { }; easy-format = callPackage ../development/ocaml-modules/easy-format { }; findlib = callPackage ../development/tools/ocaml/findlib { }; javalib = callPackage ../development/ocaml-modules/javalib { extlib = ocaml_extlib_maximal; }; dypgen = callPackage ../development/ocaml-modules/dypgen { }; patoline = callPackage ../tools/typesetting/patoline { }; gmetadom = callPackage ../development/ocaml-modules/gmetadom { }; lablgl = callPackage ../development/ocaml-modules/lablgl { }; lablgtk = callPackage ../development/ocaml-modules/lablgtk { inherit (gnome) libgnomecanvas libglade gtksourceview; }; lablgtkmathview = callPackage ../development/ocaml-modules/lablgtkmathview { gtkmathview = callPackage ../development/libraries/gtkmathview { }; }; menhir = callPackage ../development/ocaml-modules/menhir { }; merlin = callPackage ../development/tools/ocaml/merlin { }; mldonkey = callPackage ../applications/networking/p2p/mldonkey { }; mlgmp = callPackage ../development/ocaml-modules/mlgmp { }; ocaml_batteries = callPackage ../development/ocaml-modules/batteries { }; ocaml_cryptgps = callPackage ../development/ocaml-modules/cryptgps { }; ocaml_data_notation = callPackage ../development/ocaml-modules/odn { }; ocaml_expat = callPackage ../development/ocaml-modules/expat { }; ocamlgraph = callPackage ../development/ocaml-modules/ocamlgraph { }; ocaml_http = callPackage ../development/ocaml-modules/http { }; ocamlify = callPackage ../development/tools/ocaml/ocamlify { }; ocaml_lwt = callPackage ../development/ocaml-modules/lwt { }; ocamlmod = callPackage ../development/tools/ocaml/ocamlmod { }; ocaml_mysql = callPackage ../development/ocaml-modules/mysql { }; ocamlnet = callPackage ../development/ocaml-modules/ocamlnet { }; ocaml_oasis = callPackage ../development/tools/ocaml/oasis { }; ocaml_pcre = callPackage ../development/ocaml-modules/pcre { inherit pcre; }; ocaml_react = callPackage ../development/ocaml-modules/react { }; ocamlsdl = callPackage ../development/ocaml-modules/ocamlsdl { }; ocaml_sqlite3 = callPackage ../development/ocaml-modules/sqlite3 { }; ocaml_ssl = callPackage ../development/ocaml-modules/ssl { }; ounit = callPackage ../development/ocaml-modules/ounit { }; ulex = callPackage ../development/ocaml-modules/ulex { }; ulex08 = callPackage ../development/ocaml-modules/ulex/0.8 { camlp5 = camlp5_transitional; }; ocaml_typeconv = callPackage ../development/ocaml-modules/typeconv { }; ocaml_typeconv_3_0_5 = callPackage ../development/ocaml-modules/typeconv/3.0.5.nix { }; ocaml_sexplib = callPackage ../development/ocaml-modules/sexplib { }; ocaml_extlib = callPackage ../development/ocaml-modules/extlib { }; ocaml_extlib_maximal = callPackage ../development/ocaml-modules/extlib { minimal = false; }; pycaml = callPackage ../development/ocaml-modules/pycaml { }; opam_1_0_0 = callPackage ../development/tools/ocaml/opam/1.0.0.nix { }; opam_1_1 = callPackage ../development/tools/ocaml/opam/1.1.nix { }; opam = opam_1_1; sawja = callPackage ../development/ocaml-modules/sawja { }; uucd = callPackage ../development/ocaml-modules/uucd { }; uunf = callPackage ../development/ocaml-modules/uunf { }; uutf = callPackage ../development/ocaml-modules/uutf { }; xmlm = callPackage ../development/ocaml-modules/xmlm { }; yojson = callPackage ../development/ocaml-modules/yojson { }; zarith = callPackage ../development/ocaml-modules/zarith { }; }; ocamlPackages = recurseIntoAttrs ocamlPackages_4_01_0; ocamlPackages_3_10_0 = mkOcamlPackages ocaml_3_10_0 pkgs.ocamlPackages_3_10_0; ocamlPackages_3_11_2 = mkOcamlPackages ocaml_3_11_2 pkgs.ocamlPackages_3_11_2; ocamlPackages_3_12_1 = mkOcamlPackages ocaml_3_12_1 pkgs.ocamlPackages_3_12_1; ocamlPackages_4_00_1 = mkOcamlPackages ocaml_4_00_1 pkgs.ocamlPackages_4_00_1; ocamlPackages_4_01_0 = mkOcamlPackages ocaml_4_01_0 pkgs.ocamlPackages_4_01_0; ocamlPackages_latest = ocamlPackages_4_01_0; ocaml_make = callPackage ../development/ocaml-modules/ocamlmake { }; opa = let callPackage = newScope pkgs.ocamlPackages_4_00_1; in callPackage ../development/compilers/opa { }; ocamlnat = let callPackage = newScope pkgs.ocamlPackages_3_12_1; in callPackage ../development/ocaml-modules/ocamlnat { }; qcmm = callPackage ../development/compilers/qcmm { lua = lua4; ocaml = ocaml_3_08_0; }; roadsend = callPackage ../development/compilers/roadsend { }; rustc = callPackage ../development/compilers/rustc/0.11.nix { }; rustcMaster = callPackage ../development/compilers/rustc/head.nix { }; rust = rustc; sbclBootstrap = callPackage ../development/compilers/sbcl/bootstrap.nix { }; sbcl = callPackage ../development/compilers/sbcl { clisp = clisp; }; scala_2_9 = callPackage ../development/compilers/scala/2.9.nix { }; scala_2_10 = callPackage ../development/compilers/scala/2.10.nix { }; scala_2_11 = callPackage ../development/compilers/scala { }; scala = scala_2_11; sdcc = callPackage ../development/compilers/sdcc { }; smlnjBootstrap = callPackage ../development/compilers/smlnj/bootstrap.nix { }; smlnj = callPackage_i686 ../development/compilers/smlnj { }; stalin = callPackage ../development/compilers/stalin { }; strategoPackages = recurseIntoAttrs strategoPackages018; strategoPackages016 = callPackage ../development/compilers/strategoxt/0.16.nix { stdenv = overrideInStdenv stdenv [ gnumake380 ]; }; strategoPackages017 = callPackage ../development/compilers/strategoxt/0.17.nix { readline = readline5; }; strategoPackages018 = callPackage ../development/compilers/strategoxt/0.18.nix { readline = readline5; }; metaBuildEnv = callPackage ../development/compilers/meta-environment/meta-build-env { }; swiProlog = callPackage ../development/compilers/swi-prolog { }; tbb = callPackage ../development/libraries/tbb { }; tinycc = callPackage ../development/compilers/tinycc { }; urweb = callPackage ../development/compilers/urweb { }; vala = callPackage ../development/compilers/vala/default.nix { }; visualcpp = callPackage ../development/compilers/visual-c++ { }; vs90wrapper = callPackage ../development/compilers/vs90wrapper { }; webdsl = callPackage ../development/compilers/webdsl { }; win32hello = callPackage ../development/compilers/visual-c++/test { }; wrapGCCWith = gccWrapper: glibc: baseGCC: gccWrapper { nativeTools = stdenv ? gcc && stdenv.gcc.nativeTools; nativeLibc = stdenv ? gcc && stdenv.gcc.nativeLibc; nativePrefix = if stdenv ? gcc then stdenv.gcc.nativePrefix else ""; gcc = baseGCC; libc = glibc; shell = bash; inherit stdenv binutils coreutils zlib; }; wrapClangWith = clangWrapper: glibc: baseClang: clangWrapper { nativeTools = stdenv.gcc.nativeTools or false; nativeLibc = stdenv.gcc.nativeLibc or false; nativePrefix = stdenv.gcc.nativePrefix or ""; clang = baseClang; libc = glibc; shell = bash; binutils = stdenv.gcc.binutils; inherit stdenv coreutils zlib; }; wrapClang = wrapClangWith (makeOverridable (import ../build-support/clang-wrapper)) glibc; wrapGCC = wrapGCCWith (makeOverridable (import ../build-support/gcc-wrapper)) glibc; wrapGCCCross = { binutils, cross, gcc, libc, name ? "gcc-cross-wrapper", shell ? "" }: forceNativeDrv (import ../build-support/gcc-cross-wrapper { nativeTools = false; nativeLibc = false; noLibc = libc == null; inherit stdenv gcc binutils libc shell name cross; }); yap = callPackage ../development/compilers/yap { }; yasm = callPackage ../development/compilers/yasm { }; acl2 = builderDefsPackage ../development/interpreters/acl2 { inherit sbcl; }; angelscript = callPackage ../development/interpreters/angelscript { }; clisp = callPackage ../development/interpreters/clisp { }; clisp_2_44_1 = callPackage ../development/interpreters/clisp/2.44.1.nix { libsigsegv = libsigsegv_25; }; clojure = callPackage ../development/interpreters/clojure { }; clooj = callPackage ../development/interpreters/clojure/clooj.nix { }; erlangR14 = callPackage ../development/interpreters/erlang/R14.nix { }; erlangR15 = callPackage ../development/interpreters/erlang/R15.nix { }; erlangR16 = callPackage ../development/interpreters/erlang/R16.nix { }; erlangR17 = callPackage ../development/interpreters/erlang/R17.nix { }; erlang = erlangR17; rebar = callPackage ../development/tools/build-managers/rebar { }; elixir = callPackage ../development/interpreters/elixir { }; groovy = callPackage ../development/interpreters/groovy { }; guile_1_8 = callPackage ../development/interpreters/guile/1.8.nix { }; guile_2_0 = callPackage ../development/interpreters/guile { }; guile = guile_2_0; hadoop = callPackage ../applications/networking/cluster/hadoop { }; io = callPackage ../development/interpreters/io { }; j = callPackage ../development/interpreters/j { }; jmeter = callPackage ../applications/networking/jmeter { }; davmail = callPackage ../applications/networking/davmail { }; lxappearance = callPackage ../applications/misc/lxappearance { }; kona = callPackage ../development/interpreters/kona { }; love = callPackage ../development/interpreters/love { lua = lua5; }; love_luajit = callPackage ../development/interpreters/love { lua = luajit; }; love_0_9 = callPackage ../development/interpreters/love/0.9.nix { }; lua4 = callPackage ../development/interpreters/lua-4 { }; lua5_0 = callPackage ../development/interpreters/lua-5/5.0.3.nix { }; lua5_1 = callPackage ../development/interpreters/lua-5/5.1.nix { }; lua5_2 = callPackage ../development/interpreters/lua-5/5.2.nix { }; lua5_2_compat = callPackage ../development/interpreters/lua-5/5.2.nix { compat = true; }; lua5 = lua5_1; lua = lua5; lua5_sockets = callPackage ../development/interpreters/lua-5/sockets.nix { }; lua5_expat = callPackage ../development/interpreters/lua-5/expat.nix { }; lua5_filesystem = callPackage ../development/interpreters/lua-5/filesystem.nix { }; lua5_sec = callPackage ../development/interpreters/lua-5/sec.nix { }; luarocks = callPackage ../development/tools/misc/luarocks { lua = lua5; }; luajit = callPackage ../development/interpreters/luajit { }; lush2 = callPackage ../development/interpreters/lush { }; maude = callPackage ../development/interpreters/maude { bison = bison2; flex = flex_2_5_35; }; mesos = callPackage ../applications/networking/cluster/mesos { sasl = cyrus_sasl; automake = automake114x; inherit (pythonPackages) python boto setuptools distutils-cfg wrapPython; pythonProtobuf = pythonPackages.protobuf; }; octave = callPackage ../development/interpreters/octave { fltk = fltk13; qt = null; ghostscript = null; llvm = null; hdf5 = null; glpk = null; suitesparse = null; openjdk = null; gnuplot = null; readline = readline63; }; octaveFull = lowPrio (callPackage ../development/interpreters/octave { fltk = fltk13; qt = qt4; }); octaveHG = callPackage ../development/interpreters/octave/hg.nix { }; ocropus = callPackage ../applications/misc/ocropus { }; perl514 = callPackage ../development/interpreters/perl/5.14 { }; perl516 = callPackage ../development/interpreters/perl/5.16 { fetchurl = fetchurlBoot; }; perl520 = callPackage ../development/interpreters/perl/5.20 { }; perl = if system != "i686-cygwin" then perl516 else sysPerl; php = php54; phpPackages = recurseIntoAttrs (import ./php-packages.nix { inherit php pkgs; }); php53 = callPackage ../development/interpreters/php/5.3.nix { }; php_fpm53 = callPackage ../development/interpreters/php/5.3.nix { config = config // { php = (config.php or { }) // { fpm = true; apxs2 = false; }; }; }; php54 = callPackage ../development/interpreters/php/5.4.nix { }; picolisp = callPackage ../development/interpreters/picolisp { }; pltScheme = racket; polyml = callPackage ../development/compilers/polyml { }; pure = callPackage ../development/interpreters/pure { llvm = llvm_33; }; python = python2; python2 = python27; python3 = python34; pythonPackages = python2Packages; python2Packages = python27Packages; python3Packages = python34Packages; pythonFull = python2Full; python2Full = python27Full; python26 = callPackage ../development/interpreters/python/2.6 { db = db47; }; python27 = callPackage ../development/interpreters/python/2.7 { }; python32 = callPackage ../development/interpreters/python/3.2 { }; python33 = callPackage ../development/interpreters/python/3.3 { }; python34 = hiPrio (callPackage ../development/interpreters/python/3.4 { }); pypy = callPackage ../development/interpreters/pypy/2.3 { }; python26Full = callPackage ../development/interpreters/python/wrapper.nix { extraLibs = [ ]; postBuild = ""; python = python26; inherit (python26Packages) recursivePthLoader; }; python27Full = callPackage ../development/interpreters/python/wrapper.nix { extraLibs = [ ]; postBuild = ""; python = python27; inherit (python27Packages) recursivePthLoader; }; pythonDocs = recurseIntoAttrs (import ../development/interpreters/python/docs { inherit stdenv fetchurl lib; }); pythonLinkmeWrapper = callPackage ../development/interpreters/python/python-linkme-wrapper.nix { }; pypi2nix = python27Packages.pypi2nix; pyrex = pyrex095; pyrex095 = callPackage ../development/interpreters/pyrex/0.9.5.nix { }; pyrex096 = callPackage ../development/interpreters/pyrex/0.9.6.nix { }; qi = callPackage ../development/compilers/qi { }; racket = callPackage ../development/interpreters/racket { }; rakudo = callPackage ../development/interpreters/rakudo { }; rascal = callPackage ../development/interpreters/rascal { }; regina = callPackage ../development/interpreters/regina { }; renpy = callPackage ../development/interpreters/renpy { wrapPython = pythonPackages.wrapPython; }; ruby18 = callPackage ../development/interpreters/ruby/ruby-18.nix { }; ruby19 = callPackage ../development/interpreters/ruby/ruby-19.nix { }; ruby2 = lowPrio (callPackage ../development/interpreters/ruby/ruby-2.0.nix { }); ruby = ruby19; rubyLibs = recurseIntoAttrs (callPackage ../development/interpreters/ruby/libs.nix { }); rake = rubyLibs.rake; rubySqlite3 = callPackage ../development/ruby-modules/sqlite3 { }; rubygemsFun = ruby: builderDefsPackage (import ../development/interpreters/ruby/rubygems.nix) { inherit ruby makeWrapper; }; rubygems = hiPrio (rubygemsFun ruby); rq = callPackage ../applications/networking/cluster/rq { }; scsh = callPackage ../development/interpreters/scsh { }; scheme48 = callPackage ../development/interpreters/scheme48 { }; spark = callPackage ../applications/networking/cluster/spark { }; spidermonkey = callPackage ../development/interpreters/spidermonkey { }; spidermonkey_1_8_0rc1 = callPackage ../development/interpreters/spidermonkey/1.8.0-rc1.nix { }; spidermonkey_185 = callPackage ../development/interpreters/spidermonkey/185-1.0.0.nix { }; spidermonkey_17 = callPackage ../development/interpreters/spidermonkey/17.0.nix { }; spidermonkey_24 = callPackage ../development/interpreters/spidermonkey/24.2.nix { }; supercollider = callPackage ../development/interpreters/supercollider { qt = qt4; fftw = fftwSinglePrec; }; supercollider_scel = supercollider.override { useSCEL = true; }; sysPerl = callPackage ../development/interpreters/perl/sys-perl { }; tcl = callPackage ../development/interpreters/tcl { }; xulrunner = callPackage ../development/interpreters/xulrunner { inherit (gnome) libIDL; inherit (pythonPackages) pysqlite; }; xulrunner_30 = firefox30Pkgs.xulrunner; amdadlsdk = callPackage ../development/misc/amdadl-sdk { }; amdappsdk26 = callPackage ../development/misc/amdapp-sdk { version = "2.6"; }; amdappsdk27 = callPackage ../development/misc/amdapp-sdk { version = "2.7"; }; amdappsdk28 = callPackage ../development/misc/amdapp-sdk { version = "2.8"; }; amdappsdk = amdappsdk28; amdappsdkFull = callPackage ../development/misc/amdapp-sdk { version = "2.8"; samples = true; }; avrgcclibc = callPackage ../development/misc/avr-gcc-with-avr-libc { gcc = gcc46; stdenv = overrideGCC stdenv gcc46; }; avr8burnomat = callPackage ../development/misc/avr8-burn-omat { }; sourceFromHead = import ../build-support/source-from-head-fun.nix { inherit config; }; ecj = callPackage ../development/eclipse/ecj { }; jdtsdk = callPackage ../development/eclipse/jdt-sdk { }; jruby165 = callPackage ../development/interpreters/jruby { }; guileCairo = callPackage ../development/guile-modules/guile-cairo { }; guileGnome = callPackage ../development/guile-modules/guile-gnome { gconf = gnome.GConf; inherit (gnome) gnome_vfs libglade libgnome libgnomecanvas libgnomeui; }; guile_lib = callPackage ../development/guile-modules/guile-lib { }; guile_ncurses = callPackage ../development/guile-modules/guile-ncurses { }; guile-xcb = callPackage ../development/guile-modules/guile-xcb { }; pharo-vm = callPackage_i686 ../development/pharo/vm { }; srecord = callPackage ../development/tools/misc/srecord { }; windowssdk = import ../development/misc/windows-sdk { inherit fetchurl stdenv cabextract; }; ansible = callPackage ../tools/system/ansible { }; antlr = callPackage ../development/tools/parsing/antlr/2.7.7.nix { }; antlr3 = callPackage ../development/tools/parsing/antlr { }; ant = apacheAnt; apacheAnt = callPackage ../development/tools/build-managers/apache-ant { }; astyle = callPackage ../development/tools/misc/astyle { }; autobuild = callPackage ../development/tools/misc/autobuild { }; autoconf = callPackage ../development/tools/misc/autoconf { }; autoconf213 = callPackage ../development/tools/misc/autoconf/2.13.nix { }; autocutsel = callPackage ../tools/X11/autocutsel { }; automake = automake112x; automake111x = callPackage ../development/tools/misc/automake/automake-1.11.x.nix { }; automake112x = callPackage ../development/tools/misc/automake/automake-1.12.x.nix { }; automake113x = callPackage ../development/tools/misc/automake/automake-1.13.x.nix { }; automake114x = callPackage ../development/tools/misc/automake/automake-1.14.x.nix { }; automoc4 = callPackage ../development/tools/misc/automoc4 { }; avrdude = callPackage ../development/tools/misc/avrdude { }; avarice = callPackage ../development/tools/misc/avarice { }; babeltrace = callPackage ../development/tools/misc/babeltrace { }; bam = callPackage ../development/tools/build-managers/bam { }; binutils = callPackage ../development/tools/misc/binutils { inherit noSysDirs; }; binutils_nogold = lowPrio (callPackage ../development/tools/misc/binutils { inherit noSysDirs; gold = false; }); binutilsCross = if crossSystem != null && crossSystem.libc == "libSystem" then darwin.cctools else lowPrio (forceNativeDrv (import ../development/tools/misc/binutils { inherit stdenv fetchurl zlib bison; noSysDirs = true; cross = assert crossSystem != null; crossSystem; })); bison2 = callPackage ../development/tools/parsing/bison/2.x.nix { }; bison3 = callPackage ../development/tools/parsing/bison/3.x.nix { }; bison = bison3; buildbot = callPackage ../development/tools/build-managers/buildbot { inherit (pythonPackages) twisted jinja2 sqlalchemy sqlalchemy_migrate; dateutil = pythonPackages.dateutil_1_5; }; buildbotSlave = callPackage ../development/tools/build-managers/buildbot-slave { inherit (pythonPackages) twisted; }; byacc = callPackage ../development/tools/parsing/byacc { }; casperjs = callPackage ../development/tools/casperjs { }; cbrowser = callPackage ../development/tools/misc/cbrowser { }; ccache = callPackage ../development/tools/misc/ccache { }; ccacheWrapper = makeOverridable ({ extraConfig ? "" }: wrapGCC (ccache.links extraConfig)) { }; ccacheStdenv = lowPrio (overrideGCC stdenv ccacheWrapper); cccc = callPackage ../development/tools/analysis/cccc { }; cgdb = callPackage ../development/tools/misc/cgdb { }; chromedriver = callPackage ../development/tools/selenium/chromedriver { gconf = gnome.GConf; }; chrpath = callPackage ../development/tools/misc/chrpath { }; "cl-launch" = callPackage ../development/tools/misc/cl-launch { }; complexity = callPackage ../development/tools/misc/complexity { }; ctags = callPackage ../development/tools/misc/ctags { }; ctagsWrapped = import ../development/tools/misc/ctags/wrapped.nix { inherit pkgs ctags writeScriptBin; }; cmake = callPackage ../development/tools/build-managers/cmake { }; cmake264 = callPackage ../development/tools/build-managers/cmake/264.nix { }; cmakeCurses = cmake.override { useNcurses = true; }; cmakeWithGui = cmakeCurses.override { useQt4 = true; }; coccinelle = callPackage ../development/tools/misc/coccinelle { }; framac = callPackage ../development/tools/analysis/frama-c { }; cppi = callPackage ../development/tools/misc/cppi { }; cproto = callPackage ../development/tools/misc/cproto { }; cflow = callPackage ../development/tools/misc/cflow { }; cov-build = callPackage ../development/tools/analysis/cov-build { }; cppcheck = callPackage ../development/tools/analysis/cppcheck { }; cscope = callPackage ../development/tools/misc/cscope { }; csslint = callPackage ../development/web/csslint { }; libcxx = callPackage ../development/libraries/libc++ { stdenv = pkgs.clangStdenv; }; libcxxabi = callPackage ../development/libraries/libc++abi { stdenv = pkgs.clangStdenv; }; libsigrok = callPackage ../development/tools/libsigrok { }; libsigrokdecode = callPackage ../development/tools/libsigrokdecode { }; dejagnu = callPackage ../development/tools/misc/dejagnu { }; dfeet = callPackage ../development/tools/misc/d-feet { inherit (pythonPackages) pep8; }; dfu-programmer = callPackage ../development/tools/misc/dfu-programmer { }; ddd = callPackage ../development/tools/misc/ddd { }; distcc = callPackage ../development/tools/misc/distcc { }; distccWrapper = makeOverridable ({ extraConfig ? "" }: wrapGCC (distcc.links extraConfig)) { }; distccStdenv = lowPrio (overrideGCC stdenv distccWrapper); distccMasquerade = callPackage ../development/tools/misc/distcc/masq.nix { gccRaw = gcc.gcc; binutils = binutils; }; docutils = builderDefsPackage (import ../development/tools/documentation/docutils) { inherit python pil makeWrapper; }; doxygen = callPackage ../development/tools/documentation/doxygen { qt4 = null; }; doxygen_gui = lowPrio (doxygen.override { inherit qt4; }); drush = callPackage ../development/tools/misc/drush { }; eggdbus = callPackage ../development/tools/misc/eggdbus { }; elfutils = callPackage ../development/tools/misc/elfutils { }; epm = callPackage ../development/tools/misc/epm { }; emma = callPackage ../development/tools/analysis/emma { }; findbugs = callPackage ../development/tools/analysis/findbugs { }; pmd = callPackage ../development/tools/analysis/pmd { }; jdepend = callPackage ../development/tools/analysis/jdepend { }; checkstyle = callPackage ../development/tools/analysis/checkstyle { }; flex_2_5_35 = callPackage ../development/tools/parsing/flex/2.5.35.nix { }; flex_2_5_39 = callPackage ../development/tools/parsing/flex/2.5.39.nix { }; flex = flex_2_5_39; m4 = gnum4; global = callPackage ../development/tools/misc/global { }; gnome_doc_utils = callPackage ../development/tools/documentation/gnome-doc-utils { }; gnum4 = callPackage ../development/tools/misc/gnum4 { }; gnumake380 = callPackage ../development/tools/build-managers/gnumake/3.80 { }; gnumake381 = callPackage ../development/tools/build-managers/gnumake/3.81 { }; gnumake382 = callPackage ../development/tools/build-managers/gnumake/3.82 { }; gnumake40 = callPackage ../development/tools/build-managers/gnumake/4.0 { }; gnumake = gnumake382; gob2 = callPackage ../development/tools/misc/gob2 { }; gradle = callPackage ../development/tools/build-managers/gradle { }; gperf = callPackage ../development/tools/misc/gperf { }; gtk_doc = callPackage ../development/tools/documentation/gtk-doc { }; gtkdialog = callPackage ../development/tools/misc/gtkdialog { }; guileLint = callPackage ../development/tools/guile/guile-lint { }; gwrap = callPackage ../development/tools/guile/g-wrap { }; help2man = callPackage ../development/tools/misc/help2man { inherit (perlPackages) LocaleGettext; }; hyenae = callPackage ../tools/networking/hyenae { }; ibus = callPackage ../development/libraries/ibus { }; iconnamingutils = callPackage ../development/tools/misc/icon-naming-utils { inherit (perlPackages) XMLSimple; }; indent = callPackage ../development/tools/misc/indent { }; ino = callPackage ../development/arduino/ino { }; inotifyTools = callPackage ../development/tools/misc/inotify-tools { }; intel-gpu-tools = callPackage ../development/tools/misc/intel-gpu-tools { inherit (xorg) libpciaccess dri2proto libX11 libXext libXv libXrandr; }; ired = callPackage ../development/tools/analysis/radare/ired.nix { }; itstool = callPackage ../development/tools/misc/itstool { }; jam = callPackage ../development/tools/build-managers/jam { }; jikespg = callPackage ../development/tools/parsing/jikespg { }; jenkins = callPackage ../development/tools/continuous-integration/jenkins { }; lcov = callPackage ../development/tools/analysis/lcov { }; leiningen = callPackage ../development/tools/build-managers/leiningen { }; libtool = libtool_2; libtool_1_5 = callPackage ../development/tools/misc/libtool { }; libtool_2 = callPackage ../development/tools/misc/libtool/libtool2.nix { }; lsof = callPackage ../development/tools/misc/lsof { }; ltrace = callPackage ../development/tools/misc/ltrace { }; lttng-tools = callPackage ../development/tools/misc/lttng-tools { }; lttng-ust = callPackage ../development/tools/misc/lttng-ust { }; lttv = callPackage ../development/tools/misc/lttv { }; mk = callPackage ../development/tools/build-managers/mk { }; neoload = callPackage ../development/tools/neoload { licenseAccepted = config.neoload.accept_license or false; }; ninja = callPackage ../development/tools/build-managers/ninja { }; nixbang = callPackage ../development/tools/misc/nixbang { pythonPackages = python3Packages; }; node_webkit = callPackage ../development/tools/node-webkit { gconf = pkgs.gnome.GConf; }; noweb = callPackage ../development/tools/literate-programming/noweb { }; omake = callPackage ../development/tools/ocaml/omake { }; omake_rc1 = callPackage ../development/tools/ocaml/omake/0.9.8.6-rc1.nix { }; opengrok = callPackage ../development/tools/misc/opengrok { }; openocd = callPackage ../development/tools/misc/openocd { }; oprofile = callPackage ../development/tools/profiling/oprofile { }; patchelf = callPackage ../development/tools/misc/patchelf { }; peg = callPackage ../development/tools/parsing/peg { }; phantomjs = callPackage ../development/tools/phantomjs { stdenv = if stdenv.isDarwin then overrideGCC stdenv gccApple else stdenv; }; pmccabe = callPackage ../development/tools/misc/pmccabe { }; pkgconfig = forceNativeDrv (callPackage ../development/tools/misc/pkgconfig { }); pkgconfigUpstream = lowPrio (pkgconfig.override { vanilla = true; }); prelink = callPackage ../development/tools/misc/prelink { }; premake3 = callPackage ../development/tools/misc/premake/3.nix { }; premake4 = callPackage ../development/tools/misc/premake { }; premake = premake4; pstack = callPackage ../development/tools/misc/gdb/pstack.nix { }; radare = callPackage ../development/tools/analysis/radare { inherit (gnome) vte; lua = lua5; useX11 = config.radare.useX11 or false; pythonBindings = config.radare.pythonBindings or false; rubyBindings = config.radare.rubyBindings or false; luaBindings = config.radare.luaBindings or false; }; ragel = callPackage ../development/tools/parsing/ragel { }; re2c = callPackage ../development/tools/parsing/re2c { }; remake = callPackage ../development/tools/build-managers/remake { }; saleae-logic = callPackage ../development/tools/misc/saleae-logic { }; seleniumRCBin = callPackage ../development/tools/selenium/remote-control { jre = jdk; }; selenium-server-standalone = callPackage ../development/tools/selenium/server { }; scons = callPackage ../development/tools/build-managers/scons { }; simpleBuildTool = callPackage ../development/tools/build-managers/simple-build-tool { }; sigrok-cli = callPackage ../development/tools/sigrok-cli { }; slimerjs = callPackage ../development/tools/slimerjs { }; sloccount = callPackage ../development/tools/misc/sloccount { }; smatch = callPackage ../development/tools/analysis/smatch { buildllvmsparse = false; buildc2xml = false; }; smc = callPackage ../tools/misc/smc { }; sparse = callPackage ../development/tools/analysis/sparse { }; speedtest_cli = callPackage ../tools/networking/speedtest-cli { }; spin = callPackage ../development/tools/analysis/spin { }; splint = callPackage ../development/tools/analysis/splint { flex = flex_2_5_35; }; stm32flash = callPackage ../development/tools/misc/stm32flash { }; strace = callPackage ../development/tools/misc/strace { }; swig = callPackage ../development/tools/misc/swig { }; swig2 = callPackage ../development/tools/misc/swig/2.x.nix { }; swig3 = callPackage ../development/tools/misc/swig/3.x.nix { }; swigWithJava = swig; swfmill = callPackage ../tools/video/swfmill { }; swftools = callPackage ../tools/video/swftools { }; tcptrack = callPackage ../development/tools/misc/tcptrack { }; teensy-loader = callPackage ../development/tools/misc/teensy { }; texinfo413 = callPackage ../development/tools/misc/texinfo/4.13a.nix { }; texinfo5 = callPackage ../development/tools/misc/texinfo/5.2.nix { }; texinfo4 = texinfo413; texinfo = texinfo5; texinfoInteractive = appendToName "interactive" (texinfo.override { interactive = true; }); texi2html = callPackage ../development/tools/misc/texi2html { }; uhd = callPackage ../development/tools/misc/uhd { }; uisp = callPackage ../development/tools/misc/uisp { }; uncrustify = callPackage ../development/tools/misc/uncrustify { }; vagrant = callPackage ../development/tools/vagrant { ruby = ruby2; }; gdb = callPackage ../development/tools/misc/gdb { hurd = gnu.hurdCross; readline = readline63; inherit (gnu) mig; }; gdbCross = lowPrio (callPackage ../development/tools/misc/gdb { target = crossSystem; }); valgrind = callPackage ../development/tools/analysis/valgrind { stdenv = if stdenv.isDarwin then overrideGCC stdenv gccApple else stdenv; }; valkyrie = callPackage ../development/tools/analysis/valkyrie { }; xc3sprog = callPackage ../development/tools/misc/xc3sprog { }; xmlindent = callPackage ../development/web/xmlindent { }; xpwn = callPackage ../development/mobile/xpwn { }; xxdiff = callPackage ../development/tools/misc/xxdiff { bison = bison2; }; yacc = bison; yodl = callPackage ../development/tools/misc/yodl { }; a52dec = callPackage ../development/libraries/a52dec { }; aacskeys = callPackage ../development/libraries/aacskeys { }; aalib = callPackage ../development/libraries/aalib { }; accountsservice = callPackage ../development/libraries/accountsservice { }; acl = callPackage ../development/libraries/acl { }; activemq = callPackage ../development/libraries/apache-activemq { }; adns = callPackage ../development/libraries/adns { }; afflib = callPackage ../development/libraries/afflib { }; agg = callPackage ../development/libraries/agg { }; allegro = callPackage ../development/libraries/allegro { }; allegro5 = callPackage ../development/libraries/allegro/5.nix { }; allegro5unstable = callPackage ../development/libraries/allegro/5-unstable.nix { }; amrnb = callPackage ../development/libraries/amrnb { }; amrwb = callPackage ../development/libraries/amrwb { }; apr = callPackage ../development/libraries/apr { }; aprutil = callPackage ../development/libraries/apr-util { bdbSupport = true; }; asio = callPackage ../development/libraries/asio { }; aspell = callPackage ../development/libraries/aspell { }; aspellDicts = recurseIntoAttrs (import ../development/libraries/aspell/dictionaries.nix { inherit fetchurl stdenv aspell which; }); aterm = aterm25; aterm25 = callPackage ../development/libraries/aterm/2.5.nix { }; aterm28 = lowPrio (callPackage ../development/libraries/aterm/2.8.nix { }); attica = callPackage ../development/libraries/attica { }; attr = callPackage ../development/libraries/attr { }; at_spi2_core = callPackage ../development/libraries/at-spi2-core { }; at_spi2_atk = callPackage ../development/libraries/at-spi2-atk { }; aqbanking = callPackage ../development/libraries/aqbanking { }; aubio = callPackage ../development/libraries/aubio { }; audiofile = callPackage ../development/libraries/audiofile { }; axis = callPackage ../development/libraries/axis { }; babl_0_0_22 = callPackage ../development/libraries/babl/0_0_22.nix { }; babl = callPackage ../development/libraries/babl { }; beecrypt = callPackage ../development/libraries/beecrypt { }; boehmgc = callPackage ../development/libraries/boehm-gc { }; boolstuff = callPackage ../development/libraries/boolstuff { }; boost144 = callPackage ../development/libraries/boost/1.44.nix { }; boost149 = callPackage ../development/libraries/boost/1.49.nix { }; boost155 = callPackage ../development/libraries/boost/1.55.nix { }; boost = boost155; boostHeaders = callPackage ../development/libraries/boost/header-only-wrapper.nix { }; botan = callPackage ../development/libraries/botan { }; botanUnstable = callPackage ../development/libraries/botan/unstable.nix { }; box2d = callPackage ../development/libraries/box2d { }; box2d_2_0_1 = callPackage ../development/libraries/box2d/2.0.1.nix { }; buddy = callPackage ../development/libraries/buddy { }; bwidget = callPackage ../development/libraries/bwidget { }; c-ares = callPackage ../development/libraries/c-ares { fetchurl = fetchurlBoot; }; caelum = callPackage ../development/libraries/caelum { }; capnproto = callPackage ../development/libraries/capnproto { }; scmccid = callPackage ../development/libraries/scmccid { }; ccrtp = callPackage ../development/libraries/ccrtp { }; ccrtp_1_8 = callPackage ../development/libraries/ccrtp/1.8.nix { }; celt = callPackage ../development/libraries/celt { }; celt_0_7 = callPackage ../development/libraries/celt/0.7.nix { }; celt_0_5_1 = callPackage ../development/libraries/celt/0.5.1.nix { }; cgal = callPackage ../development/libraries/CGAL { }; cgui = callPackage ../development/libraries/cgui { }; check = callPackage ../development/libraries/check { }; chipmunk = builderDefsPackage (import ../development/libraries/chipmunk) { inherit cmake freeglut mesa; inherit (xlibs) libX11 xproto inputproto libXi libXmu; }; chmlib = callPackage ../development/libraries/chmlib { }; chromaprint = callPackage ../development/libraries/chromaprint { }; cil = callPackage ../development/libraries/cil { }; cilaterm = callPackage ../development/libraries/cil-aterm { stdenv = overrideInStdenv stdenv [ gnumake380 ]; }; clanlib = callPackage ../development/libraries/clanlib { }; classads = callPackage ../development/libraries/classads { }; classpath = callPackage ../development/libraries/java/classpath { javac = gcj; jvm = gcj; gconf = gnome.GConf; }; clearsilver = callPackage ../development/libraries/clearsilver { }; cln = callPackage ../development/libraries/cln { }; clppcre = builderDefsPackage (import ../development/libraries/cl-ppcre) { }; clucene_core_2 = callPackage ../development/libraries/clucene-core/2.x.nix { }; clucene_core_1 = callPackage ../development/libraries/clucene-core { }; clucene_core = clucene_core_1; clutter = callPackage ../development/libraries/clutter { }; clutter_1_18 = callPackage ../development/libraries/clutter/1.18.nix { cogl = cogl_1_18; }; clutter-gst = callPackage ../development/libraries/clutter-gst { }; clutter_gtk = callPackage ../development/libraries/clutter-gtk { }; clutter_gtk_0_10 = callPackage ../development/libraries/clutter-gtk/0.10.8.nix { }; cminpack = callPackage ../development/libraries/cminpack { }; cogl = callPackage ../development/libraries/cogl { }; cogl_1_18 = callPackage ../development/libraries/cogl/1.18.nix { }; coin3d = callPackage ../development/libraries/coin3d { }; commoncpp2 = callPackage ../development/libraries/commoncpp2 { }; confuse = callPackage ../development/libraries/confuse { }; coredumper = callPackage ../development/libraries/coredumper { }; ctl = callPackage ../development/libraries/ctl { }; cpp-netlib = callPackage ../development/libraries/cpp-netlib { }; cppunit = callPackage ../development/libraries/cppunit { }; cppnetlib = callPackage ../development/libraries/cppnetlib { boost = boostHeaders; }; cracklib = callPackage ../development/libraries/cracklib { }; cryptopp = callPackage ../development/libraries/crypto++ { }; cyrus_sasl = callPackage ../development/libraries/cyrus-sasl { }; db = db5; db4 = db48; db44 = callPackage ../development/libraries/db/db-4.4.nix { }; db45 = callPackage ../development/libraries/db/db-4.5.nix { }; db47 = callPackage ../development/libraries/db/db-4.7.nix { }; db48 = callPackage ../development/libraries/db/db-4.8.nix { }; db5 = db53; db53 = callPackage ../development/libraries/db/db-5.3.nix { }; db6 = db60; db60 = callPackage ../development/libraries/db/db-6.0.nix { }; dbus = callPackage ../development/libraries/dbus { }; dbus_cplusplus = callPackage ../development/libraries/dbus-cplusplus { }; dbus_glib = callPackage ../development/libraries/dbus-glib { }; dbus_java = callPackage ../development/libraries/java/dbus-java { }; dbus_python = callPackage ../development/python-modules/dbus { }; dbus_tools = pkgs.dbus.tools; dbus_libs = pkgs.dbus.libs; dbus_daemon = pkgs.dbus.daemon; dhex = callPackage ../applications/editors/dhex { }; dclib = callPackage ../development/libraries/dclib { }; dillo = callPackage ../applications/networking/browsers/dillo { fltk = fltk13; }; directfb = callPackage ../development/libraries/directfb { }; dotconf = callPackage ../development/libraries/dotconf { }; dssi = callPackage ../development/libraries/dssi { }; dragonegg = llvmPackages.dragonegg; dxflib = callPackage ../development/libraries/dxflib { }; eigen = callPackage ../development/libraries/eigen { }; eigen2 = callPackage ../development/libraries/eigen/2.0.nix { }; enchant = callPackage ../development/libraries/enchant { }; enet = callPackage ../development/libraries/enet { }; enginepkcs11 = callPackage ../development/libraries/enginepkcs11 { }; epoxy = callPackage ../development/libraries/epoxy { inherit (xorg) utilmacros libX11; }; esdl = callPackage ../development/libraries/esdl { }; exiv2 = callPackage ../development/libraries/exiv2 { }; expat = callPackage ../development/libraries/expat { }; extremetuxracer = builderDefsPackage (import ../games/extremetuxracer) { inherit mesa tcl freeglut SDL SDL_mixer pkgconfig gettext intltool; inherit (xlibs) libX11 xproto libXi inputproto libXmu libXext xextproto libXt libSM libICE; libpng = libpng12; }; eventlog = callPackage ../development/libraries/eventlog { }; facile = callPackage ../development/libraries/facile { }; faac = callPackage ../development/libraries/faac { }; faad2 = callPackage ../development/libraries/faad2 { }; farsight2 = callPackage ../development/libraries/farsight2 { }; farstream = callPackage ../development/libraries/farstream { inherit (gst_all_1) gstreamer gst-plugins-base gst-python gst-plugins-good gst-plugins-bad gst-libav; }; fcgi = callPackage ../development/libraries/fcgi { }; ffmpeg_0_6 = callPackage ../development/libraries/ffmpeg/0.6.nix { vpxSupport = !stdenv.isMips; }; ffmpeg_0_6_90 = callPackage ../development/libraries/ffmpeg/0.6.90.nix { vpxSupport = !stdenv.isMips; }; ffmpeg_0_10 = callPackage ../development/libraries/ffmpeg/0.10.nix { vpxSupport = !stdenv.isMips; stdenv = if stdenv.isDarwin then overrideGCC stdenv gccApple else stdenv; }; ffmpeg_1 = callPackage ../development/libraries/ffmpeg/1.x.nix { vpxSupport = !stdenv.isMips; }; ffmpeg_2 = callPackage ../development/libraries/ffmpeg/2.x.nix { }; ffmpeg = ffmpeg_2; ffms = callPackage ../development/libraries/ffms { }; fftw = callPackage ../development/libraries/fftw { }; fftwSinglePrec = fftw.override { precision = "single"; }; fftwFloat = fftwSinglePrec; flann = callPackage ../development/libraries/flann { }; flite = callPackage ../development/libraries/flite { }; fltk13 = callPackage ../development/libraries/fltk/fltk13.nix { }; fltk20 = callPackage ../development/libraries/fltk { }; fmod = callPackage ../development/libraries/fmod { }; freeimage = callPackage ../development/libraries/freeimage { }; freetts = callPackage ../development/libraries/freetts { }; cfitsio = callPackage ../development/libraries/cfitsio { }; fontconfig = callPackage ../development/libraries/fontconfig { }; makeFontsConf = let fontconfig_ = fontconfig; in { fontDirectories, fontconfig ? fontconfig_ }: import ../development/libraries/fontconfig/make-fonts-conf.nix { inherit runCommand libxslt fontconfig fontDirectories; }; freealut = callPackage ../development/libraries/freealut { }; freeglut = callPackage ../development/libraries/freeglut { }; freetype = callPackage ../development/libraries/freetype { }; frei0r = callPackage ../development/libraries/frei0r { }; fribidi = callPackage ../development/libraries/fribidi { }; funambol = callPackage ../development/libraries/funambol { }; fam = gamin; gamin = callPackage ../development/libraries/gamin { }; ganv = callPackage ../development/libraries/ganv { }; gav = callPackage ../games/gav { }; gsb = callPackage ../games/gsb { }; gdome2 = callPackage ../development/libraries/gdome2 { inherit (gnome) gtkdoc; }; gdbm = callPackage ../development/libraries/gdbm { }; gegl = callPackage ../development/libraries/gegl { }; gegl_0_0_22 = callPackage ../development/libraries/gegl/0_0_22.nix { libpng = libpng12; }; geoclue = callPackage ../development/libraries/geoclue { }; geoclue2 = callPackage ../development/libraries/geoclue/2.0.nix { }; geoip = callPackage ../development/libraries/geoip { }; geoipjava = callPackage ../development/libraries/java/geoipjava { }; geos = callPackage ../development/libraries/geos { }; gettext = gettext_0_18; gettext_0_17 = callPackage ../development/libraries/gettext/0.17.nix { }; gettext_0_18 = callPackage ../development/libraries/gettext { }; gd = callPackage ../development/libraries/gd { }; gdal = callPackage ../development/libraries/gdal { }; ggz_base_libs = callPackage ../development/libraries/ggz_base_libs { }; giblib = callPackage ../development/libraries/giblib { }; libgit2 = callPackage ../development/libraries/git2 { }; glew = callPackage ../development/libraries/glew { }; glfw = glfw3; glfw2 = callPackage ../development/libraries/glfw/2.x.nix { }; glfw3 = callPackage ../development/libraries/glfw/3.x.nix { }; glibc = callPackage ../development/libraries/glibc/2.19 { kernelHeaders = linuxHeaders; installLocales = config.glibc.locales or false; machHeaders = null; hurdHeaders = null; gccCross = null; }; glibc_memusage = callPackage ../development/libraries/glibc/2.19 { kernelHeaders = linuxHeaders; installLocales = false; withGd = true; }; glibcCross = forceNativeDrv (makeOverridable (import ../development/libraries/glibc/2.19) (let crossGNU = crossSystem != null && crossSystem.config == "i586-pc-gnu"; in { inherit stdenv fetchurl; gccCross = gccCrossStageStatic; kernelHeaders = if crossGNU then gnu.hurdHeaders else linuxHeadersCross; installLocales = config.glibc.locales or false; } // lib.optionalAttrs crossGNU { inherit (gnu) machHeaders hurdHeaders libpthreadHeaders mig; inherit fetchgit; })); libcCrossChooser = name: if name == "glibc" then glibcCross else if name == "uclibc" then uclibcCross else if name == "msvcrt" then windows.mingw_w64 else if name == "libSystem" then darwin.xcode else throw "Unknown libc"; libcCross = assert crossSystem != null; libcCrossChooser crossSystem.libc; eglibc = callPackage ../development/libraries/eglibc { kernelHeaders = linuxHeaders; installLocales = config.glibc.locales or false; }; glibcLocales = callPackage ../development/libraries/glibc/2.19/locales.nix { }; glibcInfo = callPackage ../development/libraries/glibc/2.19/info.nix { }; glibc_multi = runCommand "${glibc.name}-multi" { glibc64 = glibc; glibc32 = (import ./all-packages.nix { system = "i686-linux"; }).glibc; } '' mkdir -p ''$out ln -s ''$glibc64/* ''$out/ rm ''$out/lib ''$out/lib64 mkdir -p ''$out/lib ln -s ''$glibc64/lib/* ''$out/lib ln -s ''$glibc32/lib ''$out/lib/32 ln -s lib ''$out/lib64 # fixing ldd RLTDLIST rm ''$out/bin cp -rs ''$glibc64/bin ''$out chmod u+w ''$out/bin rm ''$out/bin/ldd sed -e "s|^RTLDLIST=.*''$|RTLDLIST=\"''$out/lib/ld-2.19.so ''$out/lib/32/ld-linux.so.2\"|g" \ ''$glibc64/bin/ldd > ''$out/bin/ldd chmod 555 ''$out/bin/ldd rm ''$out/include cp -rs ''$glibc32/include ''$out chmod -R u+w ''$out/include cp -rsf ''$glibc64/include ''$out ''; glm = callPackage ../development/libraries/glm { }; glog = callPackage ../development/libraries/glog { }; gloox = callPackage ../development/libraries/gloox { }; glpk = callPackage ../development/libraries/glpk { }; glsurf = callPackage ../applications/science/math/glsurf { inherit (ocamlPackages) lablgl findlib camlimages ocaml_mysql mlgmp; libpng = libpng12; giflib = giflib_4_1; }; gmime = callPackage ../development/libraries/gmime { }; gmm = callPackage ../development/libraries/gmm { }; gmp = gmp5; gmp5 = gmp51; gmpxx = appendToName "with-cxx" (gmp.override { cxx = true; }); gmp4 = callPackage ../development/libraries/gmp/4.3.2.nix { }; gmp51 = callPackage ../development/libraries/gmp/5.1.x.nix { }; mpfr = callPackage ../development/libraries/mpfr/default.nix { }; gobjectIntrospection = callPackage ../development/libraries/gobject-introspection { }; goocanvas = callPackage ../development/libraries/goocanvas { }; google-gflags = callPackage ../development/libraries/google-gflags { }; gperftools = callPackage ../development/libraries/gperftools { }; gst_all_1 = recurseIntoAttrs (callPackage ../development/libraries/gstreamer { callPackage = pkgs.newScope (pkgs // { libav = pkgs.libav_10; }); }); gst_all = { inherit (pkgs) gstreamer gnonlin gst_python qt_gstreamer; gstPluginsBase = pkgs.gst_plugins_base; gstPluginsBad = pkgs.gst_plugins_bad; gstPluginsGood = pkgs.gst_plugins_good; gstPluginsUgly = pkgs.gst_plugins_ugly; gstFfmpeg = pkgs.gst_ffmpeg; }; gstreamer = callPackage ../development/libraries/gstreamer/legacy/gstreamer { bison = bison2; }; gst_plugins_base = callPackage ../development/libraries/gstreamer/legacy/gst-plugins-base { }; gst_plugins_good = callPackage ../development/libraries/gstreamer/legacy/gst-plugins-good { }; gst_plugins_bad = callPackage ../development/libraries/gstreamer/legacy/gst-plugins-bad { }; gst_plugins_ugly = callPackage ../development/libraries/gstreamer/legacy/gst-plugins-ugly { }; gst_ffmpeg = callPackage ../development/libraries/gstreamer/legacy/gst-ffmpeg { ffmpeg = ffmpeg_0_10; }; gst_python = callPackage ../development/libraries/gstreamer/legacy/gst-python { }; gstreamermm = callPackage ../development/libraries/gstreamer/legacy/gstreamermm { }; gnonlin = callPackage ../development/libraries/gstreamer/legacy/gnonlin { }; gusb = callPackage ../development/libraries/gusb { inherit (gnome) gtkdoc; }; qt_gstreamer = callPackage ../development/libraries/gstreamer/legacy/qt-gstreamer { }; gnet = callPackage ../development/libraries/gnet { }; gnu-efi = callPackage ../development/libraries/gnu-efi { }; gnutls = gnutls32; gnutls31 = callPackage ../development/libraries/gnutls/3.1.nix { guileBindings = config.gnutls.guile or false; }; gnutls32 = callPackage ../development/libraries/gnutls/3.2.nix { guileBindings = config.gnutls.guile or false; }; gnutls_with_guile = lowPrio (gnutls.override { guileBindings = true; }); gpac = callPackage ../applications/video/gpac { }; gpgme = callPackage ../development/libraries/gpgme { gnupg1 = gnupg1orig; }; grantlee = callPackage ../development/libraries/grantlee { }; gsasl = callPackage ../development/libraries/gsasl { }; gsl = callPackage ../development/libraries/gsl { }; gsm = callPackage ../development/libraries/gsm { }; gsoap = callPackage ../development/libraries/gsoap { }; gss = callPackage ../development/libraries/gss { }; gtkimageview = callPackage ../development/libraries/gtkimageview { }; gtkmathview = callPackage ../development/libraries/gtkmathview { }; gtkLibs = { inherit (pkgs) glib glibmm atk atkmm cairo pango pangomm gdk_pixbuf gtk gtkmm; }; glib = callPackage ../development/libraries/glib { }; glib-tested = glib.override { doCheck = true; }; glibmm = callPackage ../development/libraries/glibmm { }; glib_networking = callPackage ../development/libraries/glib-networking { }; atk = callPackage ../development/libraries/atk { }; atkmm = callPackage ../development/libraries/atkmm { }; pixman = callPackage ../development/libraries/pixman { }; cairo = callPackage ../development/libraries/cairo { glSupport = config.cairo.gl or stdenv.isLinux && !stdenv.isArm && !stdenv.isMips; }; cairomm = callPackage ../development/libraries/cairomm { }; pango = callPackage ../development/libraries/pango { }; pangomm = callPackage ../development/libraries/pangomm { }; pangox_compat = callPackage ../development/libraries/pangox-compat { }; gdk_pixbuf = callPackage ../development/libraries/gdk-pixbuf { stdenv = if stdenv.isDarwin then clangStdenv else stdenv; }; gtk2 = callPackage ../development/libraries/gtk+/2.x.nix { cupsSupport = config.gtk2.cups or stdenv.isLinux; }; gtk3 = callPackage ../development/libraries/gtk+/3.x.nix { }; gtk = pkgs.gtk2; gtkmm = callPackage ../development/libraries/gtkmm/2.x.nix { }; gtkmm3 = callPackage ../development/libraries/gtkmm/3.x.nix { }; gtkmozembedsharp = callPackage ../development/libraries/gtkmozembed-sharp { gtksharp = gtksharp2; }; gtksharp1 = callPackage ../development/libraries/gtk-sharp-1 { inherit (gnome) libglade libgtkhtml gtkhtml libgnomecanvas libgnomeui libgnomeprint libgnomeprintui GConf; }; gtksharp2 = callPackage ../development/libraries/gtk-sharp-2 { inherit (gnome) libglade libgtkhtml gtkhtml libgnomecanvas libgnomeui libgnomeprint libgnomeprintui GConf gnomepanel; }; gtksourceviewsharp = callPackage ../development/libraries/gtksourceview-sharp { inherit (gnome) gtksourceview; gtksharp = gtksharp2; }; gtkspell = callPackage ../development/libraries/gtkspell { }; gtkspell3 = callPackage ../development/libraries/gtkspell/3.nix { }; gts = callPackage ../development/libraries/gts { }; gvfs = callPackage ../development/libraries/gvfs { gconf = gnome.GConf; }; gwenhywfar = callPackage ../development/libraries/gwenhywfar { }; hamlib = callPackage ../development/libraries/hamlib { }; kerberos = heimdal; heimdal = callPackage ../development/libraries/kerberos/heimdal.nix { }; harfbuzz = callPackage ../development/libraries/harfbuzz { }; hawknl = callPackage ../development/libraries/hawknl { }; herqq = callPackage ../development/libraries/herqq { }; hspell = callPackage ../development/libraries/hspell { }; hspellDicts = callPackage ../development/libraries/hspell/dicts.nix { }; hsqldb = callPackage ../development/libraries/java/hsqldb { }; http-parser = callPackage ../development/libraries/http-parser { inherit (pythonPackages) gyp; }; hunspell = callPackage ../development/libraries/hunspell { }; hwloc = callPackage ../development/libraries/hwloc { inherit (xlibs) libX11; }; hydraAntLogger = callPackage ../development/libraries/java/hydra-ant-logger { }; icu = callPackage ../development/libraries/icu { }; id3lib = callPackage ../development/libraries/id3lib { }; iksemel = callPackage ../development/libraries/iksemel { }; ilbc = callPackage ../development/libraries/ilbc { }; ilixi = callPackage ../development/libraries/ilixi { }; ilmbase = callPackage ../development/libraries/ilmbase { }; imlib = callPackage ../development/libraries/imlib { libpng = libpng12; }; imlib2 = callPackage ../development/libraries/imlib2 { }; incrtcl = callPackage ../development/libraries/incrtcl { }; indilib = callPackage ../development/libraries/indilib { }; iniparser = callPackage ../development/libraries/iniparser { }; intltool = callPackage ../development/tools/misc/intltool { }; irrlicht3843 = callPackage ../development/libraries/irrlicht { }; isocodes = callPackage ../development/libraries/iso-codes { }; itk = callPackage ../development/libraries/itk { }; jamp = builderDefsPackage ../games/jamp { inherit mesa SDL SDL_image SDL_mixer; }; jasper = callPackage ../development/libraries/jasper { }; jama = callPackage ../development/libraries/jama { }; jansson = callPackage ../development/libraries/jansson { }; jbig2dec = callPackage ../development/libraries/jbig2dec { }; jetty_gwt = callPackage ../development/libraries/java/jetty-gwt { }; jetty_util = callPackage ../development/libraries/java/jetty-util { }; json_glib = callPackage ../development/libraries/json-glib { }; json-c-0-11 = callPackage ../development/libraries/json-c/0.11.nix { }; json_c = callPackage ../development/libraries/json-c { }; jsoncpp = callPackage ../development/libraries/jsoncpp { }; libjson = callPackage ../development/libraries/libjson { }; judy = callPackage ../development/libraries/judy { }; keybinder = callPackage ../development/libraries/keybinder { automake = automake111x; lua = lua5_1; }; keybinder3 = callPackage ../development/libraries/keybinder3 { automake = automake111x; lua = lua5_1; }; krb5 = callPackage ../development/libraries/kerberos/krb5.nix { }; lcms = lcms1; lcms1 = callPackage ../development/libraries/lcms { }; lcms2 = callPackage ../development/libraries/lcms2 { }; lensfun = callPackage ../development/libraries/lensfun { }; lesstif = callPackage ../development/libraries/lesstif { }; lesstif93 = callPackage ../development/libraries/lesstif-0.93 { }; leveldb = callPackage ../development/libraries/leveldb { }; levmar = callPackage ../development/libraries/levmar { }; leptonica = callPackage ../development/libraries/leptonica { libpng = libpng12; }; lgi = callPackage ../development/libraries/lgi { lua = lua5_1; }; lib3ds = callPackage ../development/libraries/lib3ds { }; libaacs = callPackage ../development/libraries/libaacs { }; libaal = callPackage ../development/libraries/libaal { }; libao = callPackage ../development/libraries/libao { usePulseAudio = config.pulseaudio or true; }; libarchive = callPackage ../development/libraries/libarchive { }; libass = callPackage ../development/libraries/libass { }; libassuan1 = callPackage ../development/libraries/libassuan1 { }; libassuan = callPackage ../development/libraries/libassuan { }; libassuan2_1 = callPackage ../development/libraries/libassuan/git.nix { }; libatomic_ops = callPackage ../development/libraries/libatomic_ops { }; libav = libav_10; libav_all = callPackage ../development/libraries/libav { }; inherit (libav_all) libav_0_8 libav_9 libav_10; libavc1394 = callPackage ../development/libraries/libavc1394 { }; libbluedevil = callPackage ../development/libraries/libbluedevil { }; libbluray = callPackage ../development/libraries/libbluray { }; libbs2b = callPackage ../development/libraries/audio/libbs2b { }; libcaca = callPackage ../development/libraries/libcaca { }; libcanberra = callPackage ../development/libraries/libcanberra { }; libcanberra_gtk3 = libcanberra.override { gtk = gtk3; }; libcanberra_kde = if config.kde_runtime.libcanberraWithoutGTK or true then libcanberra.override { gtk = null; } else libcanberra; libcello = callPackage ../development/libraries/libcello { }; libcdaudio = callPackage ../development/libraries/libcdaudio { }; libcddb = callPackage ../development/libraries/libcddb { }; libcdio = callPackage ../development/libraries/libcdio { }; libcdio082 = callPackage ../development/libraries/libcdio/0.82.nix { }; libcdr = callPackage ../development/libraries/libcdr { lcms = lcms2; }; libchamplain = callPackage ../development/libraries/libchamplain { inherit (gnome) libsoup; }; libchamplain_0_6 = callPackage ../development/libraries/libchamplain/0.6.nix { }; libchop = callPackage ../development/libraries/libchop { }; libcm = callPackage ../development/libraries/libcm { }; inherit (gnome3) libcroco; libcangjie = callPackage ../development/libraries/libcangjie { }; libcredis = callPackage ../development/libraries/libcredis { }; libctemplate = callPackage ../development/libraries/libctemplate { }; libcue = callPackage ../development/libraries/libcue { }; libdaemon = callPackage ../development/libraries/libdaemon { }; libdbi = callPackage ../development/libraries/libdbi { }; libdbiDriversBase = callPackage ../development/libraries/libdbi-drivers { mysql = null; sqlite = null; }; libdbiDrivers = libdbiDriversBase.override { inherit sqlite mysql; }; libdbusmenu_qt = callPackage ../development/libraries/libdbusmenu-qt { }; libdc1394 = callPackage ../development/libraries/libdc1394 { }; libdc1394avt = callPackage ../development/libraries/libdc1394avt { }; libdevil = callPackage ../development/libraries/libdevil { }; libdiscid = callPackage ../development/libraries/libdiscid { }; libdivsufsort = callPackage ../development/libraries/libdivsufsort { }; libdmtx = callPackage ../development/libraries/libdmtx { }; libdnet = callPackage ../development/libraries/libdnet { }; libdrm = callPackage ../development/libraries/libdrm { inherit fetchurl stdenv pkgconfig; inherit (xorg) libpthreadstubs; }; libdv = callPackage ../development/libraries/libdv { }; libdvbpsi = callPackage ../development/libraries/libdvbpsi { }; libdwg = callPackage ../development/libraries/libdwg { }; libdvdcss = callPackage ../development/libraries/libdvdcss { }; libdvdnav = callPackage ../development/libraries/libdvdnav { }; libdvdread = callPackage ../development/libraries/libdvdread { }; libdwarf = callPackage ../development/libraries/libdwarf { }; libeatmydata = callPackage ../development/libraries/libeatmydata { }; libebml = callPackage ../development/libraries/libebml { }; libedit = callPackage ../development/libraries/libedit { }; libelf = callPackage ../development/libraries/libelf { }; libfm = callPackage ../development/libraries/libfm { }; libgadu = callPackage ../development/libraries/libgadu { }; libgdata = gnome3.libgdata; libgig = callPackage ../development/libraries/libgig { }; libgnome_keyring = callPackage ../development/libraries/libgnome-keyring { }; libgnome_keyring3 = gnome3.libgnome_keyring; libgnurl = callPackage ../development/libraries/libgnurl { }; libseccomp = callPackage ../development/libraries/libseccomp { }; libsecret = callPackage ../development/libraries/libsecret { }; libserialport = callPackage ../development/libraries/libserialport { }; libgtop = callPackage ../development/libraries/libgtop { }; liblo = callPackage ../development/libraries/liblo { }; liblrdf = librdf; liblscp = callPackage ../development/libraries/liblscp { }; libe-book = callPackage ../development/libraries/libe-book { }; libe-book_00 = callPackage ../development/libraries/libe-book/0.0.nix { }; libev = builderDefsPackage ../development/libraries/libev { }; libevent14 = callPackage ../development/libraries/libevent/1.4.nix { }; libevent = callPackage ../development/libraries/libevent { }; libewf = callPackage ../development/libraries/libewf { }; libexif = callPackage ../development/libraries/libexif { }; libexosip = callPackage ../development/libraries/exosip { }; libexosip_3 = callPackage ../development/libraries/exosip/3.x.nix { libosip = libosip_3; }; libextractor = callPackage ../development/libraries/libextractor { libmpeg2 = mpeg2dec; }; libexttextcat = callPackage ../development/libraries/libexttextcat { }; libf2c = callPackage ../development/libraries/libf2c { }; libfixposix = callPackage ../development/libraries/libfixposix { }; libffcall = builderDefsPackage (import ../development/libraries/libffcall) { inherit fetchcvs; }; libffi = callPackage ../development/libraries/libffi { }; libftdi = callPackage ../development/libraries/libftdi { }; libftdi1 = callPackage ../development/libraries/libftdi/1.x.nix { }; libgcrypt = callPackage ../development/libraries/libgcrypt { }; libgcrypt_1_6 = lowPrio (callPackage ../development/libraries/libgcrypt/1.6.nix { }); libgdiplus = callPackage ../development/libraries/libgdiplus { }; libgksu = callPackage ../development/libraries/libgksu { }; libgpgerror = callPackage ../development/libraries/libgpg-error { }; libgphoto2 = callPackage ../development/libraries/libgphoto2 { }; libgphoto2_4 = callPackage ../development/libraries/libgphoto2/2.4.nix { }; libgpod = callPackage ../development/libraries/libgpod { inherit (pkgs.pythonPackages) mutagen; }; libharu = callPackage ../development/libraries/libharu { }; libical = callPackage ../development/libraries/libical { }; libicns = callPackage ../development/libraries/libicns { }; libimobiledevice = callPackage ../development/libraries/libimobiledevice { }; libiodbc = callPackage ../development/libraries/libiodbc { useGTK = config.libiodbc.gtk or false; }; libivykis = callPackage ../development/libraries/libivykis { }; liblastfmSF = callPackage ../development/libraries/liblastfmSF { }; liblastfm = callPackage ../development/libraries/liblastfm { }; liblqr1 = callPackage ../development/libraries/liblqr-1 { }; liblockfile = callPackage ../development/libraries/liblockfile { }; liblogging = callPackage ../development/libraries/liblogging { }; libmcrypt = callPackage ../development/libraries/libmcrypt { }; libmhash = callPackage ../development/libraries/libmhash { }; libmodbus = callPackage ../development/libraries/libmodbus { }; libmtp = callPackage ../development/libraries/libmtp { }; libmsgpack = callPackage ../development/libraries/libmsgpack { }; libnatspec = callPackage ../development/libraries/libnatspec { }; libnfc = callPackage ../development/libraries/libnfc { }; libnfsidmap = callPackage ../development/libraries/libnfsidmap { }; libnice = callPackage ../development/libraries/libnice { }; liboping = callPackage ../development/libraries/liboping { }; libplist = callPackage ../development/libraries/libplist { }; libQGLViewer = callPackage ../development/libraries/libqglviewer { }; libre = callPackage ../development/libraries/libre { }; librem = callPackage ../development/libraries/librem { }; libresample = callPackage ../development/libraries/libresample { }; librevenge = callPackage ../development/libraries/librevenge { }; librevisa = callPackage ../development/libraries/librevisa { }; libsamplerate = callPackage ../development/libraries/libsamplerate { }; libspectre = callPackage ../development/libraries/libspectre { }; libgsf = callPackage ../development/libraries/libgsf { }; libiconv = callPackage ../development/libraries/libiconv { }; libiconvOrEmpty = if libiconvOrNull == null then [ ] else [ libiconv ]; libiconvOrNull = if gcc.libc or null != null || stdenv.isGlibc then null else libiconv; libiconvOrLibc = if libiconvOrNull == null then gcc.libc else libiconv; libintlOrEmpty = stdenv.lib.optional (!stdenv.isLinux) gettext; libid3tag = callPackage ../development/libraries/libid3tag { }; libidn = callPackage ../development/libraries/libidn { }; libiec61883 = callPackage ../development/libraries/libiec61883 { }; libinfinity = callPackage ../development/libraries/libinfinity { inherit (gnome) gtkdoc; }; libiptcdata = callPackage ../development/libraries/libiptcdata { }; libjpeg_original = callPackage ../development/libraries/libjpeg { }; libjpeg_turbo = callPackage ../development/libraries/libjpeg-turbo { }; libjpeg = if stdenv.isLinux then libjpeg_turbo else libjpeg_original; libjpeg62 = callPackage ../development/libraries/libjpeg/62.nix { libtool = libtool_1_5; }; libjson_rpc_cpp = callPackage ../development/libraries/libjson-rpc-cpp { }; libkate = callPackage ../development/libraries/libkate { }; libksba = callPackage ../development/libraries/libksba { }; libmad = callPackage ../development/libraries/libmad { }; libmatchbox = callPackage ../development/libraries/libmatchbox { }; libmatthew_java = callPackage ../development/libraries/java/libmatthew-java { }; libmatroska = callPackage ../development/libraries/libmatroska { }; libmcs = callPackage ../development/libraries/libmcs { }; libmemcached = callPackage ../development/libraries/libmemcached { }; libmicrohttpd = callPackage ../development/libraries/libmicrohttpd { }; libmikmod = callPackage ../development/libraries/libmikmod { stdenv = if stdenv.isDarwin then overrideGCC stdenv gccApple else stdenv; }; libmilter = callPackage ../development/libraries/libmilter { }; libmkv = callPackage ../development/libraries/libmkv { }; libmms = callPackage ../development/libraries/libmms { }; libmowgli = callPackage ../development/libraries/libmowgli { }; libmng = callPackage ../development/libraries/libmng { }; libmnl = callPackage ../development/libraries/libmnl { }; libmodplug = callPackage ../development/libraries/libmodplug { }; libmpcdec = callPackage ../development/libraries/libmpcdec { }; libmp3splt = callPackage ../development/libraries/libmp3splt { }; libmrss = callPackage ../development/libraries/libmrss { }; libmsn = callPackage ../development/libraries/libmsn { }; libmspack = callPackage ../development/libraries/libmspack { }; libmusclecard = callPackage ../development/libraries/libmusclecard { }; libmusicbrainz2 = callPackage ../development/libraries/libmusicbrainz/2.x.nix { }; libmusicbrainz3 = callPackage ../development/libraries/libmusicbrainz { }; libmusicbrainz5 = callPackage ../development/libraries/libmusicbrainz/5.x.nix { }; libmusicbrainz = libmusicbrainz3; libmwaw = callPackage ../development/libraries/libmwaw { }; libmwaw_02 = callPackage ../development/libraries/libmwaw/0.2.nix { }; libmx = callPackage ../development/libraries/libmx { }; libnet = callPackage ../development/libraries/libnet { }; libnetfilter_conntrack = callPackage ../development/libraries/libnetfilter_conntrack { }; libnetfilter_queue = callPackage ../development/libraries/libnetfilter_queue { }; libnfnetlink = callPackage ../development/libraries/libnfnetlink { }; libnftnl = callPackage ../development/libraries/libnftnl { }; libnih = callPackage ../development/libraries/libnih { }; libnova = callPackage ../development/libraries/libnova { }; libnxml = callPackage ../development/libraries/libnxml { }; libodfgen = callPackage ../development/libraries/libodfgen { }; libofa = callPackage ../development/libraries/libofa { }; libofx = callPackage ../development/libraries/libofx { }; libogg = callPackage ../development/libraries/libogg { }; liboggz = callPackage ../development/libraries/liboggz { }; liboil = callPackage ../development/libraries/liboil { }; liboop = callPackage ../development/libraries/liboop { }; libopus = callPackage ../development/libraries/libopus { }; libosinfo = callPackage ../development/libraries/libosinfo { }; libosip = callPackage ../development/libraries/osip { }; libosip_3 = callPackage ../development/libraries/osip/3.nix { }; libotr = callPackage ../development/libraries/libotr { libgcrypt = libgcrypt_1_6; }; libotr_3_2 = callPackage ../development/libraries/libotr/3.2.nix { }; libp11 = callPackage ../development/libraries/libp11 { }; libpar2 = callPackage ../development/libraries/libpar2 { }; libpcap = callPackage ../development/libraries/libpcap { }; libpipeline = callPackage ../development/libraries/libpipeline { }; libpng = callPackage ../development/libraries/libpng { }; libpng_apng = libpng.override { apngSupport = true; }; libpng12 = callPackage ../development/libraries/libpng/12.nix { }; libpng15 = callPackage ../development/libraries/libpng/15.nix { }; libpaper = callPackage ../development/libraries/libpaper { }; libproxy = callPackage ../development/libraries/libproxy { stdenv = if stdenv.isDarwin then overrideGCC stdenv gcc else stdenv; }; libpseudo = callPackage ../development/libraries/libpseudo { }; libpwquality = callPackage ../development/libraries/libpwquality { }; libqalculate = callPackage ../development/libraries/libqalculate { }; librsvg = callPackage ../development/libraries/librsvg { gtk2 = null; gtk3 = null; }; librsync = callPackage ../development/libraries/librsync { }; libsearpc = callPackage ../development/libraries/libsearpc { }; libsigcxx = callPackage ../development/libraries/libsigcxx { }; libsigcxx12 = callPackage ../development/libraries/libsigcxx/1.2.nix { }; libsigsegv = callPackage ../development/libraries/libsigsegv { }; libsigsegv_25 = callPackage ../development/libraries/libsigsegv/2.5.nix { }; libsndfile = callPackage ../development/libraries/libsndfile { }; libsodium = callPackage ../development/libraries/libsodium { }; libsoup = callPackage ../development/libraries/libsoup { }; libssh = callPackage ../development/libraries/libssh { }; libssh2 = callPackage ../development/libraries/libssh2 { }; libstartup_notification = callPackage ../development/libraries/startup-notification { }; libspatialindex = callPackage ../development/libraries/libspatialindex { }; libspatialite = callPackage ../development/libraries/libspatialite { }; libtar = callPackage ../development/libraries/libtar { }; libtasn1 = callPackage ../development/libraries/libtasn1 { }; libtheora = callPackage ../development/libraries/libtheora { }; libtiff = callPackage ../development/libraries/libtiff { }; libtiger = callPackage ../development/libraries/libtiger { }; libtommath = callPackage ../development/libraries/libtommath { }; libtorrentRasterbar = callPackage ../development/libraries/libtorrent-rasterbar { stdenv = if stdenv.isDarwin then clangStdenv else stdenv; }; libtoxcore = callPackage ../development/libraries/libtoxcore { }; libtsm = callPackage ../development/libraries/libtsm { }; libtunepimp = callPackage ../development/libraries/libtunepimp { }; libtxc_dxtn = callPackage ../development/libraries/libtxc_dxtn { }; libtxc_dxtn_s2tc = callPackage ../development/libraries/libtxc_dxtn_s2tc { }; libgeotiff = callPackage ../development/libraries/libgeotiff { }; libunistring = callPackage ../development/libraries/libunistring { }; libupnp = callPackage ../development/libraries/pupnp { }; giflib = callPackage ../development/libraries/giflib { }; giflib_4_1 = callPackage ../development/libraries/giflib/4.1.nix { }; libungif = callPackage ../development/libraries/giflib/libungif.nix { }; libunibreak = callPackage ../development/libraries/libunibreak { }; libunique = callPackage ../development/libraries/libunique/default.nix { }; liburcu = callPackage ../development/libraries/liburcu { }; libusb = callPackage ../development/libraries/libusb { }; libusb1 = callPackage ../development/libraries/libusb1 { stdenv = if stdenv.isDarwin then clangStdenv else stdenv; }; libunwind = callPackage ../development/libraries/libunwind { }; libuvVersions = callPackage ../development/libraries/libuv { }; libv4l = lowPrio (v4l_utils.override { withQt4 = false; }); libva = callPackage ../development/libraries/libva { }; libvdpau = callPackage ../development/libraries/libvdpau { }; libvirt = callPackage ../development/libraries/libvirt { }; libvirt-glib = callPackage ../development/libraries/libvirt-glib { }; libvisio = callPackage ../development/libraries/libvisio { }; libvisual = callPackage ../development/libraries/libvisual { }; libvncserver = callPackage ../development/libraries/libvncserver { }; libviper = callPackage ../development/libraries/libviper { }; libvpx = callPackage ../development/libraries/libvpx { }; libvterm = callPackage ../development/libraries/libvterm { }; libvorbis = callPackage ../development/libraries/libvorbis { }; libwebp = callPackage ../development/libraries/libwebp { }; libwmf = callPackage ../development/libraries/libwmf { }; libwnck = libwnck2; libwnck2 = callPackage ../development/libraries/libwnck { }; libwnck3 = callPackage ../development/libraries/libwnck/3.x.nix { }; libwpd = callPackage ../development/libraries/libwpd { }; libwpd_08 = callPackage ../development/libraries/libwpd/0.8.nix { }; libwpg = callPackage ../development/libraries/libwpg { }; libx86 = builderDefsPackage ../development/libraries/libx86 { }; libxdg_basedir = callPackage ../development/libraries/libxdg-basedir { }; libxkbcommon = callPackage ../development/libraries/libxkbcommon { }; libxklavier = callPackage ../development/libraries/libxklavier { }; libxmi = callPackage ../development/libraries/libxmi { }; libxml2 = callPackage ../development/libraries/libxml2 { pythonSupport = false; }; libxml2Python = lowPrio (libxml2.override { pythonSupport = true; }); libxmlxx = callPackage ../development/libraries/libxmlxx { }; libxmp = callPackage ../development/libraries/libxmp { }; libxslt = callPackage ../development/libraries/libxslt { }; libixp_for_wmii = lowPrio (import ../development/libraries/libixp_for_wmii { inherit fetchurl stdenv; }); libyaml = callPackage ../development/libraries/libyaml { }; libyamlcpp = callPackage ../development/libraries/libyaml-cpp { }; libyamlcpp03 = callPackage ../development/libraries/libyaml-cpp/0.3.x.nix { }; libyubikey = callPackage ../development/libraries/libyubikey { }; libzip = callPackage ../development/libraries/libzip { }; libzdb = callPackage ../development/libraries/libzdb { }; libzrtpcpp = callPackage ../development/libraries/libzrtpcpp { }; libzrtpcpp_1_6 = callPackage ../development/libraries/libzrtpcpp/1.6.nix { ccrtp = ccrtp_1_8; }; libwacom = callPackage ../development/libraries/libwacom { }; lightning = callPackage ../development/libraries/lightning { }; lirc = callPackage ../development/libraries/lirc { }; liquidwar = builderDefsPackage ../games/liquidwar { inherit (xlibs) xproto libX11 libXrender; inherit gmp mesa libjpeg expat gettext perl SDL SDL_image SDL_mixer SDL_ttf curl sqlite libogg libvorbis libcaca csound cunit; guile = guile_1_8; libpng = libpng15; }; log4cpp = callPackage ../development/libraries/log4cpp { }; log4cxx = callPackage ../development/libraries/log4cxx { }; log4cplus = callPackage ../development/libraries/log4cplus { }; loudmouth = callPackage ../development/libraries/loudmouth { }; lzo = callPackage ../development/libraries/lzo { }; mdds_0_7_1 = callPackage ../development/libraries/mdds/0.7.1.nix { }; mdds = callPackage ../development/libraries/mdds { }; mediastreamer = callPackage ../development/libraries/mediastreamer { }; menu-cache = callPackage ../development/libraries/menu-cache { }; mesaSupported = lib.elem system lib.platforms.mesaPlatforms; mesaDarwinOr = alternative: if stdenv.isDarwin then callPackage ../development/libraries/mesa-darwin { } else alternative; mesa_noglu = mesaDarwinOr (callPackage ../development/libraries/mesa { grsecEnabled = true; }); mesa_glu = mesaDarwinOr (callPackage ../development/libraries/mesa-glu { }); mesa_drivers = mesaDarwinOr (let mo = mesa_noglu.override { grsecEnabled = config.grsecurity or false; }; in mo.drivers); mesa = mesaDarwinOr (buildEnv { name = "mesa-${mesa_noglu.version}"; paths = [ mesa_noglu mesa_glu ]; }); metaEnvironment = recurseIntoAttrs (let callPackage = newScope pkgs.metaEnvironment; in rec { sdfLibrary = callPackage ../development/libraries/sdf-library { aterm = aterm28; }; toolbuslib = callPackage ../development/libraries/toolbuslib { aterm = aterm28; inherit (windows) w32api; }; cLibrary = callPackage ../development/libraries/c-library { aterm = aterm28; }; errorSupport = callPackage ../development/libraries/error-support { aterm = aterm28; }; ptSupport = callPackage ../development/libraries/pt-support { aterm = aterm28; }; ptableSupport = callPackage ../development/libraries/ptable-support { aterm = aterm28; }; configSupport = callPackage ../development/libraries/config-support { aterm = aterm28; }; asfSupport = callPackage ../development/libraries/asf-support { aterm = aterm28; }; tideSupport = callPackage ../development/libraries/tide-support { aterm = aterm28; }; rstoreSupport = callPackage ../development/libraries/rstore-support { aterm = aterm28; }; sdfSupport = callPackage ../development/libraries/sdf-support { aterm = aterm28; }; sglr = callPackage ../development/libraries/sglr { aterm = aterm28; }; ascSupport = callPackage ../development/libraries/asc-support { aterm = aterm28; }; pgen = callPackage ../development/libraries/pgen { aterm = aterm28; }; }); ming = callPackage ../development/libraries/ming { }; minizip = callPackage ../development/libraries/minizip { }; minmay = callPackage ../development/libraries/minmay { }; miro = callPackage ../applications/video/miro { inherit (pythonPackages) pywebkitgtk pysqlite pycurl mutagen; }; mkvtoolnix = callPackage ../applications/video/mkvtoolnix { }; mlt-qt4 = callPackage ../development/libraries/mlt { qt = qt4; SDL = SDL_pulseaudio; }; mlt-qt5 = callPackage ../development/libraries/mlt { qt = qt5; SDL = SDL_pulseaudio; }; movit = callPackage ../development/libraries/movit { }; mps = callPackage ../development/libraries/mps { }; libmpeg2 = callPackage ../development/libraries/libmpeg2 { }; mpeg2dec = libmpeg2; msilbc = callPackage ../development/libraries/msilbc { }; mp4v2 = callPackage ../development/libraries/mp4v2 { }; mpc = callPackage ../development/libraries/mpc { }; mpich2 = callPackage ../development/libraries/mpich2 { }; mtdev = callPackage ../development/libraries/mtdev { }; mtpfs = callPackage ../tools/filesystems/mtpfs { }; mu = callPackage ../tools/networking/mu { texinfo = texinfo4; }; muparser = callPackage ../development/libraries/muparser { }; mygpoclient = callPackage ../development/python-modules/mygpoclient { }; mygui = callPackage ../development/libraries/mygui { }; myguiSvn = callPackage ../development/libraries/mygui/svn.nix { }; mysocketw = callPackage ../development/libraries/mysocketw { }; mythes = callPackage ../development/libraries/mythes { }; nanomsg = callPackage ../development/libraries/nanomsg { }; ncurses = callPackage ../development/libraries/ncurses { unicode = system != "i686-cygwin"; }; neon = callPackage ../development/libraries/neon { compressionSupport = true; sslSupport = true; }; nethack = builderDefsPackage (import ../games/nethack) { inherit ncurses flex bison; }; nettle = callPackage ../development/libraries/nettle { }; newt = callPackage ../development/libraries/newt { }; nix-plugins = callPackage ../development/libraries/nix-plugins { nix = pkgs.nixUnstable; }; nspr = callPackage ../development/libraries/nspr { }; nss = lowPrio (callPackage ../development/libraries/nss { }); nssTools = callPackage ../development/libraries/nss { includeTools = true; }; ntrack = callPackage ../development/libraries/ntrack { }; nvidia-texture-tools = callPackage ../development/libraries/nvidia-texture-tools { }; ode = builderDefsPackage (import ../development/libraries/ode) { }; ogre = callPackage ../development/libraries/ogre { }; ogrepaged = callPackage ../development/libraries/ogrepaged { }; oniguruma = callPackage ../development/libraries/oniguruma { }; openal = callPackage ../development/libraries/openal { }; openalSoft = callPackage ../development/libraries/openal-soft { }; openbabel = callPackage ../development/libraries/openbabel { }; opencascade = callPackage ../development/libraries/opencascade { }; opencascade_6_5 = callPackage ../development/libraries/opencascade/6.5.nix { automake = automake111x; ftgl = ftgl212; }; opencascade_oce = callPackage ../development/libraries/opencascade/oce.nix { }; opencsg = callPackage ../development/libraries/opencsg { }; openct = callPackage ../development/libraries/openct { }; opencv = callPackage ../development/libraries/opencv { }; opencv_2_1 = callPackage ../development/libraries/opencv/2.1.nix { libpng = libpng12; }; openexr_ctl = callPackage ../development/libraries/openexr_ctl { }; openexr = callPackage ../development/libraries/openexr { }; openldap = callPackage ../development/libraries/openldap { }; openlierox = callPackage ../games/openlierox { }; libopensc_dnie = callPackage ../development/libraries/libopensc-dnie { }; opencolorio = callPackage ../development/libraries/opencolorio { }; ois = callPackage ../development/libraries/ois { }; opal = callPackage ../development/libraries/opal { }; openjpeg = callPackage ../development/libraries/openjpeg { lcms = lcms2; }; openscenegraph = callPackage ../development/libraries/openscenegraph { giflib = giflib_4_1; ffmpeg = ffmpeg_0_10; }; openspades = callPackage ../games/openspades { }; libressl = callPackage ../development/libraries/libressl { }; boringssl = callPackage ../development/libraries/boringssl { }; openssl = callPackage ../development/libraries/openssl { fetchurl = fetchurlBoot; cryptodevHeaders = linuxPackages.cryptodev.override { fetchurl = fetchurlBoot; onlyHeaders = true; }; }; ortp = callPackage ../development/libraries/ortp { srtp = srtp_linphone; }; p11_kit = callPackage ../development/libraries/p11-kit { }; paperkey = callPackage ../tools/security/paperkey { }; pangoxsl = callPackage ../development/libraries/pangoxsl { }; pcl = callPackage ../development/libraries/pcl { vtk = vtkWithQt4; }; pcre = callPackage ../development/libraries/pcre { unicodeSupport = config.pcre.unicode or true; }; pdf2xml = callPackage ../development/libraries/pdf2xml { }; phonon = callPackage ../development/libraries/phonon { }; phonon_backend_gstreamer = callPackage ../development/libraries/phonon-backend-gstreamer { }; phonon_backend_vlc = callPackage ../development/libraries/phonon-backend-vlc { }; physfs = callPackage ../development/libraries/physfs { }; pkcs11helper = callPackage ../development/libraries/pkcs11helper { }; plib = callPackage ../development/libraries/plib { }; pocketsphinx = callPackage ../development/libraries/pocketsphinx { }; podofo = callPackage ../development/libraries/podofo { }; polkit = callPackage ../development/libraries/polkit { spidermonkey = spidermonkey_185; }; polkit_qt_1 = callPackage ../development/libraries/polkit-qt-1 { }; policykit = callPackage ../development/libraries/policykit { }; poppler = callPackage ../development/libraries/poppler { lcms = lcms2; }; popplerQt4 = poppler.poppler_qt4; popt = callPackage ../development/libraries/popt { }; portaudio = callPackage ../development/libraries/portaudio { stdenv = if stdenv.isDarwin then clangStdenv else stdenv; }; portaudioSVN = callPackage ../development/libraries/portaudio/svn-head.nix { }; portmidi = callPackage ../development/libraries/portmidi { }; prison = callPackage ../development/libraries/prison { }; proj = callPackage ../development/libraries/proj { }; postgis = callPackage ../development/libraries/postgis { }; protobuf = callPackage ../development/libraries/protobuf { }; protobufc = callPackage ../development/libraries/protobufc { }; pth = callPackage ../development/libraries/pth { }; ptlib = callPackage ../development/libraries/ptlib { }; re2 = callPackage ../development/libraries/re2 { }; qca2 = callPackage ../development/libraries/qca2 { }; qca2_ossl = callPackage ../development/libraries/qca2/ossl.nix { }; qimageblitz = callPackage ../development/libraries/qimageblitz { }; qjson = callPackage ../development/libraries/qjson { }; qoauth = callPackage ../development/libraries/qoauth { }; qt3 = callPackage ../development/libraries/qt-3 { openglSupport = mesaSupported; libpng = libpng12; }; qt4 = pkgs.kde4.qt4; qt48 = callPackage ../development/libraries/qt-4.x/4.8 { mesa = mesa_noglu; inherit (pkgs.gnome) libgnomeui GConf gnome_vfs; cups = if stdenv.isLinux then cups else null; stdenv = if stdenv.isDarwin then clangStdenv else stdenv; }; qt48Full = qt48.override { docs = true; demos = true; examples = true; developerBuild = true; }; qt4SDK = qtcreator.override { sdkBuild = true; qtLib = qt48Full; }; qt53Full = qt53.override { buildDocs = true; buildExamples = true; buildTests = true; developerBuild = true; }; qt53 = callPackage ../development/libraries/qt-5/qt-5.3.nix { mesa = mesa_noglu; cups = if stdenv.isLinux then cups else null; inherit (gnome) libgnomeui GConf gnome_vfs; bison = bison2; }; qt5 = callPackage ../development/libraries/qt-5 { mesa = mesa_noglu; cups = if stdenv.isLinux then cups else null; inherit (gnome) libgnomeui GConf gnome_vfs; bison = bison2; }; qt5Full = qt5.override { buildDocs = true; buildExamples = true; buildTests = true; developerBuild = true; }; qt5SDK = qtcreator.override { sdkBuild = true; qtLib = qt5Full; }; qtcreator = callPackage ../development/qtcreator { qtLib = qt48.override { developerBuild = true; }; }; qtscriptgenerator = callPackage ../development/libraries/qtscriptgenerator { }; quesoglc = callPackage ../development/libraries/quesoglc { }; qwt = callPackage ../development/libraries/qwt { }; qwt6 = callPackage ../development/libraries/qwt/6.nix { }; rabbitmq-c = callPackage ../development/libraries/rabbitmq-c { }; rabbitmq-java-client = callPackage ../development/libraries/rabbitmq-java-client { }; raul = callPackage ../development/libraries/audio/raul { }; readline = readline6; readline4 = callPackage ../development/libraries/readline/readline4.nix { }; readline5 = callPackage ../development/libraries/readline/readline5.nix { }; readline6 = callPackage ../development/libraries/readline/readline6.nix { }; readline63 = callPackage ../development/libraries/readline/readline6.3.nix { }; librdf_raptor = callPackage ../development/libraries/librdf/raptor.nix { }; librdf_raptor2 = callPackage ../development/libraries/librdf/raptor2.nix { }; librdf_rasqal = callPackage ../development/libraries/librdf/rasqal.nix { }; librdf_redland = callPackage ../development/libraries/librdf/redland.nix { }; librdf = callPackage ../development/libraries/librdf { }; lilv = callPackage ../development/libraries/audio/lilv { }; lv2 = callPackage ../development/libraries/audio/lv2 { }; lvtk = callPackage ../development/libraries/audio/lvtk { }; qrupdate = callPackage ../development/libraries/qrupdate { }; redland = pkgs.librdf_redland; rhino = callPackage ../development/libraries/java/rhino { javac = gcj; jvm = gcj; }; rlog = callPackage ../development/libraries/rlog { }; rubberband = callPackage ../development/libraries/rubberband { fftw = fftwSinglePrec; inherit (vamp) vampSDK; }; sbc = callPackage ../development/libraries/sbc { }; schroedinger = callPackage ../development/libraries/schroedinger { }; SDL = callPackage ../development/libraries/SDL { openglSupport = mesaSupported; alsaSupport = !stdenv.isDarwin; x11Support = true; pulseaudioSupport = stdenv.isDarwin; stdenv = if stdenv.isDarwin then clangStdenv else stdenv; }; SDL_pulseaudio = SDL.override { pulseaudioSupport = true; }; SDL_gfx = callPackage ../development/libraries/SDL_gfx { }; SDL_image = callPackage ../development/libraries/SDL_image { stdenv = if stdenv.isDarwin then clangStdenv else stdenv; }; SDL_mixer = callPackage ../development/libraries/SDL_mixer { }; SDL_net = callPackage ../development/libraries/SDL_net { }; SDL_sound = callPackage ../development/libraries/SDL_sound { }; SDL_ttf = callPackage ../development/libraries/SDL_ttf { }; SDL2 = callPackage ../development/libraries/SDL2 { openglSupport = mesaSupported; alsaSupport = true; x11Support = true; pulseaudioSupport = false; }; SDL2_image = callPackage ../development/libraries/SDL2_image { }; SDL2_mixer = callPackage ../development/libraries/SDL2_mixer { }; SDL2_net = callPackage ../development/libraries/SDL2_net { }; SDL2_gfx = callPackage ../development/libraries/SDL2_gfx { }; serd = callPackage ../development/libraries/serd { }; serf = callPackage ../development/libraries/serf { }; silgraphite = callPackage ../development/libraries/silgraphite { }; graphite2 = callPackage ../development/libraries/silgraphite/graphite2.nix { }; simgear = callPackage ../development/libraries/simgear { }; sfml_git = callPackage ../development/libraries/sfml { }; skalibs = callPackage ../development/libraries/skalibs { }; slang = callPackage ../development/libraries/slang { }; slibGuile = callPackage ../development/libraries/slib { scheme = guile_1_8; texinfo = texinfo4; }; smpeg = callPackage ../development/libraries/smpeg { }; snack = callPackage ../development/libraries/snack { }; snappy = callPackage ../development/libraries/snappy { }; sodium = callPackage ../development/libraries/sodium { }; sofia_sip = callPackage ../development/libraries/sofia-sip { }; soprano = callPackage ../development/libraries/soprano { }; soqt = callPackage ../development/libraries/soqt { }; sord = callPackage ../development/libraries/sord { }; spandsp = callPackage ../development/libraries/spandsp { }; speechd = callPackage ../development/libraries/speechd { }; speech_tools = callPackage ../development/libraries/speech-tools { }; speex = callPackage ../development/libraries/speex { }; sphinxbase = callPackage ../development/libraries/sphinxbase { }; spice = callPackage ../development/libraries/spice { celt = celt_0_5_1; inherit (xlibs) libXrandr libXfixes libXext libXrender libXinerama; inherit (pythonPackages) pyparsing; }; spice_gtk = callPackage ../development/libraries/spice-gtk { }; spice_protocol = callPackage ../development/libraries/spice-protocol { }; sratom = callPackage ../development/libraries/audio/sratom { }; srtp = callPackage ../development/libraries/srtp { }; srtp_linphone = callPackage ../development/libraries/srtp/linphone.nix { }; sqlite = lowPrio (callPackage ../development/libraries/sqlite { readline = null; ncurses = null; }); sqliteInteractive = appendToName "interactive" (sqlite.override { inherit readline ncurses; }); sqlcipher = lowPrio (callPackage ../development/libraries/sqlcipher { readline = null; ncurses = null; }); stfl = callPackage ../development/libraries/stfl { stdenv = if stdenv.isDarwin then overrideGCC stdenv gccApple else stdenv; }; stlink = callPackage ../development/tools/misc/stlink { }; steghide = callPackage ../tools/security/steghide { }; stepmania = callPackage ../games/stepmania { }; stlport = callPackage ../development/libraries/stlport { }; strigi = callPackage ../development/libraries/strigi { clucene_core = clucene_core_2; }; subtitleeditor = callPackage ../applications/video/subtitleeditor { }; suil = callPackage ../development/libraries/audio/suil { }; suitesparse = callPackage ../development/libraries/suitesparse { }; sutils = callPackage ../tools/misc/sutils { }; sword = callPackage ../development/libraries/sword { }; szip = callPackage ../development/libraries/szip { }; t1lib = callPackage ../development/libraries/t1lib { }; taglib = callPackage ../development/libraries/taglib { }; taglib_extras = callPackage ../development/libraries/taglib-extras { }; talloc = callPackage ../development/libraries/talloc { }; tclap = callPackage ../development/libraries/tclap { }; tclgpg = callPackage ../development/libraries/tclgpg { }; tcllib = callPackage ../development/libraries/tcllib { }; tcltls = callPackage ../development/libraries/tcltls { }; tdb = callPackage ../development/libraries/tdb { }; tecla = callPackage ../development/libraries/tecla { }; telepathy_glib = callPackage ../development/libraries/telepathy/glib { }; telepathy_farstream = callPackage ../development/libraries/telepathy/farstream { }; telepathy_qt = callPackage ../development/libraries/telepathy/qt { }; thrift = callPackage ../development/libraries/thrift { }; tinyxml = tinyxml2; tinyxml2 = callPackage ../development/libraries/tinyxml/2.6.2.nix { }; tk = callPackage ../development/libraries/tk { }; tnt = callPackage ../development/libraries/tnt { }; tokyocabinet = callPackage ../development/libraries/tokyo-cabinet { }; tokyotyrant = callPackage ../development/libraries/tokyo-tyrant { }; tremor = callPackage ../development/libraries/tremor { }; unicap = callPackage ../development/libraries/unicap { }; tsocks = callPackage ../development/libraries/tsocks { }; unixODBC = callPackage ../development/libraries/unixODBC { }; unixODBCDrivers = recurseIntoAttrs (import ../development/libraries/unixODBCDrivers { inherit fetchurl stdenv unixODBC glibc libtool openssl zlib; inherit postgresql mysql sqlite; }); urt = callPackage ../development/libraries/urt { }; ustr = callPackage ../development/libraries/ustr { }; usbredir = callPackage ../development/libraries/usbredir { libusb = libusb1; }; ucommon = callPackage ../development/libraries/ucommon { }; v8 = callPackage ../development/libraries/v8 { inherit (pythonPackages) gyp; }; vaapiIntel = callPackage ../development/libraries/vaapi-intel { }; vaapiVdpau = callPackage ../development/libraries/vaapi-vdpau { }; vamp = callPackage ../development/libraries/audio/vamp { }; vcdimager = callPackage ../development/libraries/vcdimager { }; vigra = callPackage ../development/libraries/vigra { inherit (pkgs.pythonPackages) numpy; }; vlock = callPackage ../misc/screensavers/vlock { }; vmime = callPackage ../development/libraries/vmime { }; vrpn = callPackage ../development/libraries/vrpn { }; vtk = callPackage ../development/libraries/vtk { }; vtkWithQt4 = vtk.override { qtLib = qt4; }; vxl = callPackage ../development/libraries/vxl { libpng = libpng12; }; wayland = callPackage ../development/libraries/wayland { }; webkit = webkitgtk; webkitgtk = callPackage ../development/libraries/webkitgtk { harfbuzz = harfbuzz.override { withIcu = true; }; gst-plugins-base = gst_all_1.gst-plugins-base; }; webkitgtk2 = webkitgtk.override { withGtk2 = true; enableIntrospection = false; }; wildmidi = callPackage ../development/libraries/wildmidi { }; wvstreams = callPackage ../development/libraries/wvstreams { }; wxGTK = wxGTK28; wxGTK28 = callPackage ../development/libraries/wxGTK-2.8 { inherit (gnome) GConf; withMesa = lib.elem system lib.platforms.mesaPlatforms; }; wxGTK29 = callPackage ../development/libraries/wxGTK-2.9/default.nix { inherit (gnome) GConf; withMesa = lib.elem system lib.platforms.mesaPlatforms; stdenv = if stdenv.isDarwin then clangStdenv else stdenv; }; wxGTK30 = callPackage ../development/libraries/wxGTK-3.0/default.nix { inherit (gnome) GConf; withMesa = lib.elem system lib.platforms.mesaPlatforms; stdenv = if stdenv.isDarwin then clangStdenv else stdenv; }; wtk = callPackage ../development/libraries/wtk { }; x264 = callPackage ../development/libraries/x264 { }; xapian = callPackage ../development/libraries/xapian { }; xapianBindings = callPackage ../development/libraries/xapian/bindings { }; xapian10 = callPackage ../development/libraries/xapian/1.0.x.nix { }; xapianBindings10 = callPackage ../development/libraries/xapian/bindings/1.0.x.nix { }; Xaw3d = callPackage ../development/libraries/Xaw3d { }; xbase = callPackage ../development/libraries/xbase { }; xcb-util-cursor = callPackage ../development/libraries/xcb-util-cursor { }; xdo = callPackage ../tools/misc/xdo { }; xineLib = callPackage ../development/libraries/xine-lib { ffmpeg = ffmpeg_1; }; xautolock = callPackage ../misc/screensavers/xautolock { }; xercesc = callPackage ../development/libraries/xercesc { }; xlibsWrapper = callPackage ../development/libraries/xlibs-wrapper { packages = [ freetype fontconfig xlibs.xproto xlibs.libX11 xlibs.libXt xlibs.libXft xlibs.libXext xlibs.libSM xlibs.libICE xlibs.xextproto ]; }; xmlrpc_c = callPackage ../development/libraries/xmlrpc-c { }; xmlsec = callPackage ../development/libraries/xmlsec { }; xvidcore = callPackage ../development/libraries/xvidcore { }; xylib = callPackage ../development/libraries/xylib { }; yajl = callPackage ../development/libraries/yajl { }; zangband = builderDefsPackage (import ../games/zangband) { inherit ncurses flex bison autoconf automake m4 coreutils; }; zeitgeist = callPackage ../development/libraries/zeitgeist { }; zlib = callPackage ../development/libraries/zlib { fetchurl = fetchurlBoot; }; zlibStatic = lowPrio (appendToName "static" (callPackage ../development/libraries/zlib { static = true; })); zeromq2 = callPackage ../development/libraries/zeromq/2.x.nix { }; zeromq3 = callPackage ../development/libraries/zeromq/3.x.nix { }; zeromq4 = callPackage ../development/libraries/zeromq/4.x.nix { }; zziplib = callPackage ../development/libraries/zziplib { }; atermjava = callPackage ../development/libraries/java/aterm { stdenv = overrideInStdenv stdenv [ gnumake380 ]; }; commonsFileUpload = callPackage ../development/libraries/java/jakarta-commons/file-upload { }; fastjar = callPackage ../development/tools/java/fastjar { }; httpunit = callPackage ../development/libraries/java/httpunit { }; gwtdragdrop = callPackage ../development/libraries/java/gwt-dragdrop { }; gwtwidgets = callPackage ../development/libraries/java/gwt-widgets { }; jakartabcel = callPackage ../development/libraries/java/jakarta-bcel { regexp = jakartaregexp; }; jakartaregexp = callPackage ../development/libraries/java/jakarta-regexp { }; javaCup = callPackage ../development/libraries/java/cup { }; javasvn = callPackage ../development/libraries/java/javasvn { }; jclasslib = callPackage ../development/tools/java/jclasslib { }; jdom = callPackage ../development/libraries/java/jdom { }; jflex = callPackage ../development/libraries/java/jflex { }; jjtraveler = callPackage ../development/libraries/java/jjtraveler { stdenv = overrideInStdenv stdenv [ gnumake380 ]; }; junit = callPackage ../development/libraries/java/junit { antBuild = releaseTools.antBuild; }; junixsocket = callPackage ../development/libraries/java/junixsocket { }; jzmq = callPackage ../development/libraries/java/jzmq { }; lucene = callPackage ../development/libraries/java/lucene { }; mockobjects = callPackage ../development/libraries/java/mockobjects { }; saxon = callPackage ../development/libraries/java/saxon { }; saxonb = callPackage ../development/libraries/java/saxon/default8.nix { }; sharedobjects = callPackage ../development/libraries/java/shared-objects { stdenv = overrideInStdenv stdenv [ gnumake380 ]; }; smack = callPackage ../development/libraries/java/smack { }; swt = callPackage ../development/libraries/java/swt { inherit (gnome) libsoup; }; jquery_ui = callPackage ../development/libraries/javascript/jquery-ui { }; yuicompressor = callPackage ../development/tools/yuicompressor { }; asdf = callPackage ../development/lisp-modules/asdf { texLive = null; }; clwrapperFunction = callPackage ../development/lisp-modules/clwrapper; wrapLisp = lisp: clwrapperFunction { inherit lisp; }; lispPackagesFor = clwrapper: callPackage ../development/lisp-modules/lisp-packages.nix { inherit clwrapper; }; lispPackagesClisp = lispPackagesFor (wrapLisp clisp); lispPackagesSBCL = lispPackagesFor (wrapLisp sbcl); lispPackages = recurseIntoAttrs lispPackagesSBCL; buildPerlPackage = import ../development/perl-modules/generic perl; perlPackages = recurseIntoAttrs (import ./perl-packages.nix { inherit pkgs; overrides = (config.perlPackageOverrides or p: { }) pkgs; }); perl514Packages = import ./perl-packages.nix { pkgs = pkgs // { perl = perl514; buildPerlPackage = import ../development/perl-modules/generic perl514; }; overrides = (config.perl514PackageOverrides or p: { }) pkgs; }; perlXMLParser = perlPackages.XMLParser; ack = perlPackages.ack; perlArchiveCpio = perlPackages.ArchiveCpio; perlcritic = perlPackages.PerlCritic; planetary_annihilation = callPackage ../games/planetaryannihilation { }; buildPythonPackage = pythonPackages.buildPythonPackage; python26Packages = import ./python-packages.nix { inherit pkgs; python = python26; }; python27Packages = lib.hiPrioSet (recurseIntoAttrs (import ./python-packages.nix { inherit pkgs; python = python27; })); python32Packages = import ./python-packages.nix { inherit pkgs; python = python32; }; python33Packages = recurseIntoAttrs (import ./python-packages.nix { inherit pkgs; python = python33; }); python34Packages = recurseIntoAttrs (import ./python-packages.nix { inherit pkgs; python = python34; }); pypyPackages = recurseIntoAttrs (import ./python-packages.nix { inherit pkgs; python = pypy; }); foursuite = callPackage ../development/python-modules/4suite { }; bsddb3 = callPackage ../development/python-modules/bsddb3 { }; ecdsa = callPackage ../development/python-modules/ecdsa { }; numeric = callPackage ../development/python-modules/numeric { }; pil = pythonPackages.pil; psyco = callPackage ../development/python-modules/psyco { }; pycairo = pythonPackages.pycairo; pycapnp = pythonPackages.pycapnp; pycrypto = pythonPackages.pycrypto; pycups = callPackage ../development/python-modules/pycups { }; pyexiv2 = callPackage ../development/python-modules/pyexiv2 { }; pygame = callPackage ../development/python-modules/pygame { }; pygobject = pythonPackages.pygobject; pygobject3 = pythonPackages.pygobject3; pygtk = pythonPackages.pygtk; pyGtkGlade = pythonPackages.pyGtkGlade; pylint = callPackage ../development/python-modules/pylint { }; pyopenssl = builderDefsPackage (import ../development/python-modules/pyopenssl) { inherit python openssl; }; rhpl = callPackage ../development/python-modules/rhpl { }; sip = callPackage ../development/python-modules/sip { }; pyqt4 = callPackage ../development/python-modules/pyqt/4.x.nix { stdenv = if stdenv.isDarwin then clangStdenv else stdenv; }; pysideApiextractor = callPackage ../development/python-modules/pyside/apiextractor.nix { }; pysideGeneratorrunner = callPackage ../development/python-modules/pyside/generatorrunner.nix { }; pyside = callPackage ../development/python-modules/pyside { }; pysideTools = callPackage ../development/python-modules/pyside/tools.nix { }; pysideShiboken = callPackage ../development/python-modules/pyside/shiboken.nix { }; pyx = callPackage ../development/python-modules/pyx { }; pyxml = callPackage ../development/python-modules/pyxml { }; rbtools = callPackage ../development/python-modules/rbtools { }; setuptools = pythonPackages.setuptools; slowaes = callPackage ../development/python-modules/slowaes { }; wxPython = pythonPackages.wxPython; wxPython28 = pythonPackages.wxPython28; twisted = pythonPackages.twisted; ZopeInterface = pythonPackages.zope_interface; R = callPackage ../applications/science/math/R { inherit (xlibs) libX11 libXt; texLive = texLiveAggregationFun { paths = [ texLive texLiveExtra ]; }; withRecommendedPackages = false; }; rWrapper = callPackage ../development/r-modules/wrapper.nix { recommendedPackages = with rPackages; [ MASS lattice Matrix nlme survival boot cluster codetools foreign KernSmooth rpart class nnet spatial mgcv ]; packages = [ ]; }; rPackages = import ../development/r-modules/cran-packages.nix { inherit pkgs; overrides = (config.rPackageOverrides or p: { }) pkgs; }; rdf4store = callPackage ../servers/http/4store { }; apacheHttpd = pkgs.apacheHttpd_2_2; apacheHttpd_2_2 = callPackage ../servers/http/apache-httpd/2.2.nix { sslSupport = true; }; apacheHttpd_2_4 = lowPrio (callPackage ../servers/http/apache-httpd/2.4.nix { sslSupport = true; }); apcupsd = callPackage ../servers/apcupsd { }; sabnzbd = callPackage ../servers/sabnzbd { }; bind = callPackage ../servers/dns/bind { }; bird = callPackage ../servers/bird { }; couchdb = callPackage ../servers/http/couchdb { spidermonkey = spidermonkey_185; python = python27; sphinx = python27Packages.sphinx; erlang = erlangR16; }; dico = callPackage ../servers/dico { }; dict = callPackage ../servers/dict { libmaa = callPackage ../servers/dict/libmaa.nix { }; }; dictdDBs = recurseIntoAttrs (import ../servers/dict/dictd-db.nix { inherit builderDefs; }); dictDBCollector = import ../servers/dict/dictd-db-collector.nix { inherit stdenv lib dict; }; dictdWiktionary = callPackage ../servers/dict/dictd-wiktionary.nix { }; dictdWordnet = callPackage ../servers/dict/dictd-wordnet.nix { }; diod = callPackage ../servers/diod { }; dovecot = dovecot21; dovecot21 = callPackage ../servers/mail/dovecot { }; dovecot22 = callPackage ../servers/mail/dovecot/2.2.x.nix { }; dovecot_pigeonhole = callPackage ../servers/mail/dovecot-pigeonhole { }; etcd = callPackage ../servers/etcd { }; ejabberd = callPackage ../servers/xmpp/ejabberd { erlang = erlangR16; }; elasticmq = callPackage ../servers/elasticmq { }; etcdctl = callPackage ../development/tools/etcdctl { }; fcgiwrap = callPackage ../servers/fcgiwrap { }; felix = callPackage ../servers/felix { }; felix_remoteshell = callPackage ../servers/felix/remoteshell.nix { }; fingerd_bsd = callPackage ../servers/fingerd/bsd-fingerd { }; firebird = callPackage ../servers/firebird { icu = null; }; firebirdSuper = callPackage ../servers/firebird { superServer = true; }; fleet = callPackage ../servers/fleet { }; freepops = callPackage ../servers/mail/freepops { }; freeswitch = callPackage ../servers/sip/freeswitch { }; ghostOne = callPackage ../servers/games/ghost-one { boost = boost144.override { taggedLayout = true; }; }; ircdHybrid = callPackage ../servers/irc/ircd-hybrid { }; jboss = callPackage ../servers/http/jboss { }; jboss_mysql_jdbc = callPackage ../servers/http/jboss/jdbc/mysql { }; jetty = callPackage ../servers/http/jetty { }; jetty61 = callPackage ../servers/http/jetty/6.1 { }; joseki = callPackage ../servers/http/joseki { }; leafnode = callPackage ../servers/news/leafnode { }; lighttpd = callPackage ../servers/http/lighttpd { }; mailman = callPackage ../servers/mail/mailman { }; mediatomb = callPackage ../servers/mediatomb { }; memcached = callPackage ../servers/memcached { }; mod_dnssd = callPackage ../servers/http/apache-modules/mod_dnssd/default.nix { }; mod_evasive = callPackage ../servers/http/apache-modules/mod_evasive { }; mod_python = callPackage ../servers/http/apache-modules/mod_python { }; mod_fastcgi = callPackage ../servers/http/apache-modules/mod_fastcgi { }; mod_wsgi = callPackage ../servers/http/apache-modules/mod_wsgi { }; mpd = callPackage ../servers/mpd { aacSupport = config.mpd.aacSupport or true; ffmpegSupport = config.mpd.ffmpegSupport or true; }; mpd_clientlib = callPackage ../servers/mpd/clientlib.nix { }; miniHttpd = callPackage ../servers/http/mini-httpd { }; mlmmj = callPackage ../servers/mail/mlmmj { }; myserver = callPackage ../servers/http/myserver { }; nginx = callPackage ../servers/http/nginx { rtmp = true; fullWebDAV = true; syslog = true; moreheaders = true; }; ngircd = callPackage ../servers/irc/ngircd { }; nix-binary-cache = callPackage ../servers/http/nix-binary-cache { }; nsd = callPackage ../servers/dns/nsd { }; nsq = callPackage ../servers/nsq { }; openresty = callPackage ../servers/http/openresty { }; opensmtpd = callPackage ../servers/mail/opensmtpd { }; petidomo = callPackage ../servers/mail/petidomo { }; popa3d = callPackage ../servers/mail/popa3d { }; postfix = callPackage ../servers/mail/postfix { }; postfix211 = callPackage ../servers/mail/postfix/2.11.nix { }; pulseaudio = callPackage ../servers/pulseaudio { gconf = gnome.GConf; bluez = null; avahi = null; }; pulseaudioFull = pulseaudio.override { bluez = bluez5; avahi = avahi; jackaudioSupport = true; x11Support = true; }; tomcat_connectors = callPackage ../servers/http/apache-modules/tomcat-connectors { }; pies = callPackage ../servers/pies { }; portmap = callPackage ../servers/portmap { }; rpcbind = callPackage ../servers/rpcbind { }; mariadb = callPackage ../servers/sql/mariadb { }; mongodb = callPackage ../servers/nosql/mongodb { }; riak = callPackage ../servers/nosql/riak/1.3.1.nix { }; influxdb = callPackage ../servers/nosql/influxdb { }; mysql51 = import ../servers/sql/mysql/5.1.x.nix { inherit fetchurl ncurses zlib perl openssl stdenv; ps = procps; }; mysql55 = callPackage ../servers/sql/mysql/5.5.x.nix { }; mysql = mysql51; mysql_jdbc = callPackage ../servers/sql/mysql/jdbc { }; nagios = callPackage ../servers/monitoring/nagios { }; munin = callPackage ../servers/monitoring/munin { }; nagiosPluginsOfficial = callPackage ../servers/monitoring/nagios/plugins/official-2.x.nix { }; neo4j = callPackage ../servers/nosql/neo4j { }; net_snmp = callPackage ../servers/monitoring/net-snmp { }; riemann = callPackage ../servers/monitoring/riemann { }; oidentd = callPackage ../servers/identd/oidentd { }; openfire = callPackage ../servers/xmpp/openfire { }; oracleXE = callPackage ../servers/sql/oracle-xe { }; OVMF = callPackage ../applications/virtualization/OVMF { }; postgresql = postgresql92; postgresql84 = callPackage ../servers/sql/postgresql/8.4.x.nix { }; postgresql90 = callPackage ../servers/sql/postgresql/9.0.x.nix { }; postgresql91 = callPackage ../servers/sql/postgresql/9.1.x.nix { }; postgresql92 = callPackage ../servers/sql/postgresql/9.2.x.nix { }; postgresql93 = callPackage ../servers/sql/postgresql/9.3.x.nix { }; postgresql_jdbc = callPackage ../servers/sql/postgresql/jdbc { }; psqlodbc = callPackage ../servers/sql/postgresql/psqlodbc { }; pyIRCt = builderDefsPackage (import ../servers/xmpp/pyIRCt) { inherit xmpppy pythonIRClib python makeWrapper; }; pyMAILt = builderDefsPackage (import ../servers/xmpp/pyMAILt) { inherit xmpppy python makeWrapper fetchcvs; }; qpid-cpp = callPackage ../servers/amqp/qpid-cpp { }; rabbitmq_server = callPackage ../servers/amqp/rabbitmq-server { }; radius = callPackage ../servers/radius { }; redis = callPackage ../servers/nosql/redis { }; redstore = callPackage ../servers/http/redstore { }; restund = callPackage ../servers/restund { }; rethinkdb = callPackage ../servers/nosql/rethinkdb { }; rippled = callPackage ../servers/rippled { }; s6 = callPackage ../servers/s6 { }; spamassassin = callPackage ../servers/mail/spamassassin { inherit (perlPackages) HTMLParser NetDNS NetAddrIP DBFile HTTPDate MailDKIM LWP IOSocketSSL; }; samba = callPackage ../servers/samba { }; samba_light = lowPrio (callPackage ../servers/samba { pam = null; fam = null; cups = null; acl = null; openldap = null; libunwind = null; }); serfdom = callPackage ../servers/serfdom { }; seyren = callPackage ../servers/monitoring/seyren { }; shishi = callPackage ../servers/shishi { }; sipwitch = callPackage ../servers/sip/sipwitch { }; spawn_fcgi = callPackage ../servers/http/spawn-fcgi { }; squids = recurseIntoAttrs (import ../servers/squid/squids.nix { inherit fetchurl stdenv perl lib composableDerivation openldap pam db cyrus_sasl kerberos libcap expat libxml2 libtool openssl; }); squid = squids.squid31; thttpd = callPackage ../servers/http/thttpd { }; storm = callPackage ../servers/computing/storm { }; tomcat5 = callPackage ../servers/http/tomcat/5.0.nix { }; tomcat6 = callPackage ../servers/http/tomcat/6.0.nix { }; tomcat_mysql_jdbc = callPackage ../servers/http/tomcat/jdbc/mysql { }; axis2 = callPackage ../servers/http/tomcat/axis2 { }; unifi = callPackage ../servers/unifi { }; virtuoso6 = callPackage ../servers/sql/virtuoso/6.x.nix { }; virtuoso7 = callPackage ../servers/sql/virtuoso/7.x.nix { }; virtuoso = virtuoso6; vsftpd = callPackage ../servers/ftp/vsftpd { }; winstone = callPackage ../servers/http/winstone { }; xinetd = callPackage ../servers/xinetd { }; xquartz = callPackage ../servers/x11/xquartz { }; quartz-wm = callPackage ../servers/x11/quartz-wm { stdenv = clangStdenv; }; xorg = recurseIntoAttrs (import ../servers/x11/xorg/default.nix { inherit clangStdenv fetchurl fetchgit fetchpatch stdenv pkgconfig intltool freetype fontconfig libxslt expat libpng zlib perl mesa_drivers spice_protocol dbus libuuid openssl gperf m4 autoconf automake libtool xmlto asciidoc flex bison python mtdev pixman; mesa = mesa_noglu; udev = if stdenv.isLinux then udev else null; libdrm = if stdenv.isLinux then libdrm else null; } // { xf86videointel-testing = callPackage ../servers/x11/xorg/xf86-video-intel-testing.nix { }; }); xorgReplacements = callPackage ../servers/x11/xorg/replacements.nix { }; xorgVideoUnichrome = callPackage ../servers/x11/xorg/unichrome/default.nix { }; yaws = callPackage ../servers/http/yaws { }; zabbix = recurseIntoAttrs (import ../servers/monitoring/zabbix { inherit fetchurl stdenv pkgconfig postgresql curl openssl zlib; }); zabbix20 = callPackage ../servers/monitoring/zabbix/2.0.nix { }; zabbix22 = callPackage ../servers/monitoring/zabbix/2.2.nix { }; afuse = callPackage ../os-specific/linux/afuse { }; amdUcode = callPackage ../os-specific/linux/microcode/amd.nix { }; autofs5 = callPackage ../os-specific/linux/autofs/autofs-v5.nix { }; _915resolution = callPackage ../os-specific/linux/915resolution { }; nfsUtils = callPackage ../os-specific/linux/nfs-utils { }; acpi = callPackage ../os-specific/linux/acpi { }; acpid = callPackage ../os-specific/linux/acpid { }; acpitool = callPackage ../os-specific/linux/acpitool { }; alienfx = callPackage ../os-specific/linux/alienfx { }; alsaLib = callPackage ../os-specific/linux/alsa-lib { }; alsaPlugins = callPackage ../os-specific/linux/alsa-plugins { jack2 = null; }; alsaPluginWrapper = callPackage ../os-specific/linux/alsa-plugins/wrapper.nix { }; alsaUtils = callPackage ../os-specific/linux/alsa-utils { }; alsaOss = callPackage ../os-specific/linux/alsa-oss { }; microcode2ucode = callPackage ../os-specific/linux/microcode/converter.nix { }; microcodeIntel = callPackage ../os-specific/linux/microcode/intel.nix { }; apparmor = callPackage ../os-specific/linux/apparmor { inherit (perlPackages) LocaleGettext TermReadKey RpcXML; bison = bison2; }; atop = callPackage ../os-specific/linux/atop { }; audit = callPackage ../os-specific/linux/audit { }; b43Firmware_5_1_138 = callPackage ../os-specific/linux/firmware/b43-firmware/5.1.138.nix { }; b43FirmwareCutter = callPackage ../os-specific/linux/firmware/b43-firmware-cutter { }; batctl = callPackage ../os-specific/linux/batman-adv/batctl.nix { }; bluez4 = callPackage ../os-specific/linux/bluez { pygobject = pygobject3; }; bluez5 = lowPrio (callPackage ../os-specific/linux/bluez/bluez5.nix { }); bluez = bluez4; inherit (pythonPackages) bedup; beret = callPackage ../games/beret { }; bridge_utils = callPackage ../os-specific/linux/bridge-utils { }; busybox = callPackage ../os-specific/linux/busybox { }; checkpolicy = callPackage ../os-specific/linux/checkpolicy { }; checksec = callPackage ../os-specific/linux/checksec { }; cifs_utils = callPackage ../os-specific/linux/cifs-utils { }; conky = callPackage ../os-specific/linux/conky { mpdSupport = config.conky.mpdSupport or true; x11Support = config.conky.x11Support or false; xdamage = config.conky.xdamage or false; wireless = config.conky.wireless or false; luaSupport = config.conky.luaSupport or false; rss = config.conky.rss or false; weatherMetar = config.conky.weatherMetar or false; weatherXoap = config.conky.weatherXoap or false; }; cpufrequtils = callPackage ../os-specific/linux/cpufrequtils { }; cryopid = callPackage ../os-specific/linux/cryopid { }; criu = callPackage ../os-specific/linux/criu { }; cryptsetup = callPackage ../os-specific/linux/cryptsetup { }; cramfsswap = callPackage ../os-specific/linux/cramfsswap { }; darwin = rec { cctools = forceNativeDrv (callPackage ../os-specific/darwin/cctools-port { cross = assert crossSystem != null; crossSystem; inherit maloader; xctoolchain = xcode.toolchain; }); maloader = callPackage ../os-specific/darwin/maloader { inherit opencflite; }; opencflite = callPackage ../os-specific/darwin/opencflite { }; xcode = callPackage ../os-specific/darwin/xcode { }; }; devicemapper = lvm2; disk_indicator = callPackage ../os-specific/linux/disk-indicator { }; dmidecode = callPackage ../os-specific/linux/dmidecode { }; dmtcp = callPackage ../os-specific/linux/dmtcp { }; dietlibc = callPackage ../os-specific/linux/dietlibc { }; directvnc = builderDefsPackage ../os-specific/linux/directvnc { inherit libjpeg pkgconfig zlib directfb; inherit (xlibs) xproto; }; dmraid = callPackage ../os-specific/linux/dmraid { }; drbd = callPackage ../os-specific/linux/drbd { }; dstat = callPackage ../os-specific/linux/dstat { python = pythonFull; }; libossp_uuid = callPackage ../development/libraries/libossp-uuid { }; libuuid = if crossSystem != null && crossSystem.config == "i586-pc-gnu" then utillinux // { crossDrv = lib.overrideDerivation utillinux.crossDrv (args: { configureFlags = args.configureFlags + " --disable-libblkid --disable-mount --disable-libmount" + " --disable-fsck --enable-static --disable-partx"; doCheck = false; CPPFLAGS = lib.concatStringsSep " " (map (v: "-D${v}=4096") [ "PATH_MAX" "MAXPATHLEN" "MAXHOSTNAMELEN" ]); }); } else if stdenv.isLinux then utillinux else null; e3cfsprogs = callPackage ../os-specific/linux/e3cfsprogs { }; ebtables = callPackage ../os-specific/linux/ebtables { }; eject = utillinux; ffado = callPackage ../os-specific/linux/ffado { }; fbterm = callPackage ../os-specific/linux/fbterm { }; firejail = callPackage ../os-specific/linux/firejail { }; fuse = callPackage ../os-specific/linux/fuse { }; fxload = callPackage ../os-specific/linux/fxload { }; gfxtablet = callPackage ../os-specific/linux/gfxtablet { }; gpm = callPackage ../servers/gpm { }; gradm = callPackage ../os-specific/linux/gradm { flex = flex_2_5_35; }; hdparm = callPackage ../os-specific/linux/hdparm { }; hibernate = callPackage ../os-specific/linux/hibernate { }; hostapd = callPackage ../os-specific/linux/hostapd { }; htop = if stdenv.isLinux then callPackage ../os-specific/linux/htop { } else if stdenv.isDarwin then callPackage ../os-specific/darwin/htop { } else null; gnu = recurseIntoAttrs (callPackage ../os-specific/gnu { inherit platform crossSystem; }); hwdata = callPackage ../os-specific/linux/hwdata { }; i7z = callPackage ../os-specific/linux/i7z { }; ifplugd = callPackage ../os-specific/linux/ifplugd { }; iomelt = callPackage ../os-specific/linux/iomelt { }; iotop = callPackage ../os-specific/linux/iotop { }; iproute = callPackage ../os-specific/linux/iproute { }; iputils = callPackage ../os-specific/linux/iputils { sp = spCompat; inherit (perlPackages) SGMLSpm; }; iptables = callPackage ../os-specific/linux/iptables { }; iw = callPackage ../os-specific/linux/iw { }; jujuutils = callPackage ../os-specific/linux/jujuutils { }; kbd = callPackage ../os-specific/linux/kbd { }; kmscon = callPackage ../os-specific/linux/kmscon { }; latencytop = callPackage ../os-specific/linux/latencytop { }; ldm = callPackage ../os-specific/linux/ldm { }; libaio = callPackage ../os-specific/linux/libaio { }; libatasmart = callPackage ../os-specific/linux/libatasmart { }; libcgroup = callPackage ../os-specific/linux/libcgroup { }; libnl = callPackage ../os-specific/linux/libnl { }; libnl_3_2_19 = callPackage ../os-specific/linux/libnl/3.2.19.nix { }; linuxConsoleTools = callPackage ../os-specific/linux/consoletools { }; linuxHeaders = linuxHeaders_3_7; linuxHeaders24Cross = forceNativeDrv (import ../os-specific/linux/kernel-headers/2.4.nix { inherit stdenv fetchurl perl; cross = assert crossSystem != null; crossSystem; }); linuxHeaders26Cross = forceNativeDrv (import ../os-specific/linux/kernel-headers/2.6.32.nix { inherit stdenv fetchurl perl; cross = assert crossSystem != null; crossSystem; }); linuxHeaders_3_7 = callPackage ../os-specific/linux/kernel-headers/3.7.nix { }; linuxHeaders_3_14 = callPackage ../os-specific/linux/kernel-headers/3.14.nix { }; linuxHeadersCrossChooser = ver: if ver == "2.4" then linuxHeaders24Cross else if ver == "2.6" then linuxHeaders26Cross else throw "Unknown linux kernel version"; linuxHeadersCross = assert crossSystem != null; linuxHeadersCrossChooser crossSystem.platform.kernelMajor; kernelPatches = callPackage ../os-specific/linux/kernel/patches.nix { }; linux_3_2 = makeOverridable (import ../os-specific/linux/kernel/linux-3.2.nix) { inherit fetchurl stdenv perl buildLinux; kernelPatches = [ ]; }; linux_3_2_xen = lowPrio (linux_3_2.override { extraConfig = ''XEN_DOM0 y''; }); linux_3_4 = makeOverridable (import ../os-specific/linux/kernel/linux-3.4.nix) { inherit fetchurl stdenv perl buildLinux; kernelPatches = lib.optionals ((platform.kernelArch or null) == "mips") [ kernelPatches.mips_fpureg_emu kernelPatches.mips_fpu_sigill ]; }; linux_3_6_rpi = makeOverridable (import ../os-specific/linux/kernel/linux-rpi-3.6.nix) { inherit fetchurl stdenv perl buildLinux; }; linux_3_10 = makeOverridable (import ../os-specific/linux/kernel/linux-3.10.nix) { inherit fetchurl stdenv perl buildLinux; kernelPatches = lib.optionals ((platform.kernelArch or null) == "mips") [ kernelPatches.mips_fpureg_emu kernelPatches.mips_fpu_sigill kernelPatches.mips_ext3_n32 ]; }; linux_3_12 = makeOverridable (import ../os-specific/linux/kernel/linux-3.12.nix) { inherit fetchurl stdenv perl buildLinux; kernelPatches = lib.optionals ((platform.kernelArch or null) == "mips") [ kernelPatches.mips_fpureg_emu kernelPatches.mips_fpu_sigill kernelPatches.mips_ext3_n32 ]; }; linux_3_14 = makeOverridable (import ../os-specific/linux/kernel/linux-3.14.nix) { inherit fetchurl stdenv perl buildLinux; kernelPatches = lib.optionals ((platform.kernelArch or null) == "mips") [ kernelPatches.mips_fpureg_emu kernelPatches.mips_fpu_sigill kernelPatches.mips_ext3_n32 ]; }; linux_3_15 = makeOverridable (import ../os-specific/linux/kernel/linux-3.15.nix) { inherit fetchurl stdenv perl buildLinux; kernelPatches = lib.optionals ((platform.kernelArch or null) == "mips") [ kernelPatches.mips_fpureg_emu kernelPatches.mips_fpu_sigill kernelPatches.mips_ext3_n32 ]; }; linux_3_16 = makeOverridable (import ../os-specific/linux/kernel/linux-3.16.nix) { inherit fetchurl stdenv perl buildLinux; kernelPatches = lib.optionals ((platform.kernelArch or null) == "mips") [ kernelPatches.mips_fpureg_emu kernelPatches.mips_fpu_sigill kernelPatches.mips_ext3_n32 ]; }; linux_testing = makeOverridable (import ../os-specific/linux/kernel/linux-testing.nix) { inherit fetchurl stdenv perl buildLinux; kernelPatches = lib.optionals ((platform.kernelArch or null) == "mips") [ kernelPatches.mips_fpureg_emu kernelPatches.mips_fpu_sigill kernelPatches.mips_ext3_n32 ]; }; grFlavors = import ../build-support/grsecurity/flavors.nix; mkGrsecurity = opts: import ../build-support/grsecurity { grsecOptions = opts; inherit pkgs lib; }; grKernel = opts: (mkGrsecurity opts).grsecKernel; grPackage = opts: recurseIntoAttrs (mkGrsecurity opts).grsecPackage; linux_grsec_stable_desktop = grKernel grFlavors.linux_grsec_stable_desktop; linux_grsec_stable_server = grKernel grFlavors.linux_grsec_stable_server; linux_grsec_stable_server_xen = grKernel grFlavors.linux_grsec_stable_server_xen; linux_grsec_testing_desktop = grKernel grFlavors.linux_grsec_testing_desktop; linux_grsec_testing_server = grKernel grFlavors.linux_grsec_testing_server; linux_grsec_testing_server_xen = grKernel grFlavors.linux_grsec_testing_server_xen; linuxPackagesFor = kernel: self: let callPackage = newScope self; in { inherit kernel; acpi_call = callPackage ../os-specific/linux/acpi-call { }; batman_adv = callPackage ../os-specific/linux/batman-adv { }; bbswitch = callPackage ../os-specific/linux/bbswitch { }; ati_drivers_x11 = callPackage ../os-specific/linux/ati-drivers { }; blcr = callPackage ../os-specific/linux/blcr { }; cryptodev = callPackage ../os-specific/linux/cryptodev { }; cpupower = callPackage ../os-specific/linux/cpupower { }; e1000e = callPackage ../os-specific/linux/e1000e { }; v4l2loopback = callPackage ../os-specific/linux/v4l2loopback { }; frandom = callPackage ../os-specific/linux/frandom { }; ktap = callPackage ../os-specific/linux/ktap { }; lttng-modules = callPackage ../os-specific/linux/lttng-modules { }; broadcom_sta = callPackage ../os-specific/linux/broadcom-sta/default.nix { }; nvidiabl = callPackage ../os-specific/linux/nvidiabl { }; nvidia_x11 = callPackage ../os-specific/linux/nvidia-x11 { }; nvidia_x11_legacy173 = callPackage ../os-specific/linux/nvidia-x11/legacy173.nix { }; nvidia_x11_legacy304 = callPackage ../os-specific/linux/nvidia-x11/legacy304.nix { }; openafsClient = callPackage ../servers/openafs-client { }; openiscsi = callPackage ../os-specific/linux/open-iscsi { }; wis_go7007 = callPackage ../os-specific/linux/wis-go7007 { }; kernelHeaders = callPackage ../os-specific/linux/kernel-headers { }; klibc = callPackage ../os-specific/linux/klibc { }; klibcShrunk = lowPrio (callPackage ../os-specific/linux/klibc/shrunk.nix { }); ndiswrapper = callPackage ../os-specific/linux/ndiswrapper { }; netatop = callPackage ../os-specific/linux/netatop { }; perf = callPackage ../os-specific/linux/kernel/perf.nix { }; psmouse_alps = callPackage ../os-specific/linux/psmouse-alps { }; spl = callPackage ../os-specific/linux/spl { }; spl_git = callPackage ../os-specific/linux/spl/git.nix { }; sysdig = callPackage ../os-specific/linux/sysdig { }; tp_smapi = callPackage ../os-specific/linux/tp_smapi { }; v86d = callPackage ../os-specific/linux/v86d { }; virtualbox = callPackage ../applications/virtualization/virtualbox { stdenv = stdenv_32bit; inherit (gnome) libIDL; enableExtensionPack = config.virtualbox.enableExtensionPack or false; }; virtualboxGuestAdditions = callPackage ../applications/virtualization/virtualbox/guest-additions { }; zfs = callPackage ../os-specific/linux/zfs { }; zfs_git = callPackage ../os-specific/linux/zfs/git.nix { }; }; linux = linuxPackages.kernel; linuxPackages = linuxPackages_3_12; linux_latest = pkgs.linux_3_16; linuxPackages_latest = pkgs.linuxPackages_3_16; linuxPackages_3_2 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_2 linuxPackages_3_2); linuxPackages_3_2_xen = linuxPackagesFor pkgs.linux_3_2_xen linuxPackages_3_2_xen; linuxPackages_3_4 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_4 linuxPackages_3_4); linuxPackages_3_6_rpi = linuxPackagesFor pkgs.linux_3_6_rpi linuxPackages_3_6_rpi; linuxPackages_3_10 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_10 linuxPackages_3_10); linuxPackages_3_10_tuxonice = linuxPackagesFor pkgs.linux_3_10_tuxonice linuxPackages_3_10_tuxonice; linuxPackages_3_12 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_12 linuxPackages_3_12); linuxPackages_3_14 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_14 linuxPackages_3_14); linuxPackages_3_15 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_15 linuxPackages_3_15); linuxPackages_3_16 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_16 linuxPackages_3_16); linuxPackages_testing = recurseIntoAttrs (linuxPackagesFor pkgs.linux_testing linuxPackages_testing); linuxPackages_grsec_stable_desktop = grPackage grFlavors.linux_grsec_stable_desktop; linuxPackages_grsec_stable_server = grPackage grFlavors.linux_grsec_stable_server; linuxPackages_grsec_stable_server_xen = grPackage grFlavors.linux_grsec_stable_server_xen; linuxPackages_grsec_testing_desktop = grPackage grFlavors.linux_grsec_testing_desktop; linuxPackages_grsec_testing_server = grPackage grFlavors.linux_grsec_testing_server; linuxPackages_grsec_testing_server_xen = grPackage grFlavors.linux_grsec_testing_server_xen; linuxManualConfig = pkgs.buildLinux; buildLinux = import ../os-specific/linux/kernel/manual-config.nix { inherit (pkgs) stdenv runCommand nettools bc perl kmod writeTextFile ubootChooser; }; keyutils = callPackage ../os-specific/linux/keyutils { }; libselinux = callPackage ../os-specific/linux/libselinux { }; libsemanage = callPackage ../os-specific/linux/libsemanage { }; libraw = callPackage ../development/libraries/libraw { }; libraw1394 = callPackage ../development/libraries/libraw1394 { }; libsexy = callPackage ../development/libraries/libsexy { }; libsepol = callPackage ../os-specific/linux/libsepol { }; libsmbios = callPackage ../os-specific/linux/libsmbios { }; lm_sensors = callPackage ../os-specific/linux/lm-sensors { }; lockdep = callPackage ../os-specific/linux/lockdep { }; lsiutil = callPackage ../os-specific/linux/lsiutil { }; kmod = callPackage ../os-specific/linux/kmod { }; kmod-blacklist-ubuntu = callPackage ../os-specific/linux/kmod-blacklist-ubuntu { }; kvm = qemu_kvm; libcap = callPackage ../os-specific/linux/libcap { }; libcap_progs = callPackage ../os-specific/linux/libcap/progs.nix { }; libcap_pam = callPackage ../os-specific/linux/libcap/pam.nix { }; libcap_manpages = callPackage ../os-specific/linux/libcap/man.nix { }; libcap_ng = callPackage ../os-specific/linux/libcap-ng { }; libnscd = callPackage ../os-specific/linux/libnscd { }; libnotify = callPackage ../development/libraries/libnotify { }; libvolume_id = callPackage ../os-specific/linux/libvolume_id { }; lsscsi = callPackage ../os-specific/linux/lsscsi { }; lvm2 = callPackage ../os-specific/linux/lvm2 { }; mdadm = callPackage ../os-specific/linux/mdadm { }; mingetty = callPackage ../os-specific/linux/mingetty { }; module_init_tools = callPackage ../os-specific/linux/module-init-tools { }; aggregateModules = modules: callPackage ../os-specific/linux/kmod/aggregator.nix { inherit modules; }; multipath_tools = callPackage ../os-specific/linux/multipath-tools { }; musl = callPackage ../os-specific/linux/musl { }; nettools = callPackage ../os-specific/linux/net-tools { }; neverball = callPackage ../games/neverball { libpng = libpng15; }; nftables = callPackage ../os-specific/linux/nftables { }; numactl = callPackage ../os-specific/linux/numactl { }; gocode = callPackage ../development/tools/gocode { }; gogoclient = callPackage ../os-specific/linux/gogoclient { }; nss_ldap = callPackage ../os-specific/linux/nss_ldap { }; pam = callPackage ../os-specific/linux/pam { }; pam_ccreds = callPackage ../os-specific/linux/pam_ccreds { }; pam_console = callPackage ../os-specific/linux/pam_console { libtool = libtool_1_5; }; pam_devperm = callPackage ../os-specific/linux/pam_devperm { }; pam_krb5 = callPackage ../os-specific/linux/pam_krb5 { }; pam_ldap = callPackage ../os-specific/linux/pam_ldap { }; pam_login = callPackage ../os-specific/linux/pam_login { }; pam_ssh_agent_auth = callPackage ../os-specific/linux/pam_ssh_agent_auth { }; pam_usb = callPackage ../os-specific/linux/pam_usb { }; paxctl = callPackage ../os-specific/linux/paxctl { }; pax-utils = callPackage ../os-specific/linux/pax-utils { }; pcmciaUtils = callPackage ../os-specific/linux/pcmciautils { firmware = config.pcmciaUtils.firmware or [ ]; config = config.pcmciaUtils.config or null; }; plymouth = callPackage ../os-specific/linux/plymouth { automake = automake113x; }; pmount = callPackage ../os-specific/linux/pmount { }; pmutils = callPackage ../os-specific/linux/pm-utils { }; pmtools = callPackage ../os-specific/linux/pmtools { }; policycoreutils = callPackage ../os-specific/linux/policycoreutils { }; powertop = callPackage ../os-specific/linux/powertop { }; prayer = callPackage ../servers/prayer { }; procps = procps-ng; procps-old = lowPrio (callPackage ../os-specific/linux/procps { }); procps-ng = callPackage ../os-specific/linux/procps-ng { }; watch = callPackage ../os-specific/linux/procps/watch.nix { }; qemu_kvm = lowPrio (qemu.override { x86Only = true; }); firmwareLinuxNonfree = callPackage ../os-specific/linux/firmware/firmware-linux-nonfree { }; radeontools = callPackage ../os-specific/linux/radeontools { }; raspberrypifw = callPackage ../os-specific/linux/firmware/raspberrypi { }; regionset = callPackage ../os-specific/linux/regionset { }; rfkill = callPackage ../os-specific/linux/rfkill { }; rfkill_udev = callPackage ../os-specific/linux/rfkill/udev.nix { }; rtkit = callPackage ../os-specific/linux/rtkit { }; sdparm = callPackage ../os-specific/linux/sdparm { }; sepolgen = callPackage ../os-specific/linux/sepolgen { }; setools = callPackage ../os-specific/linux/setools { }; shadow = callPackage ../os-specific/linux/shadow { }; statifier = builderDefsPackage (import ../os-specific/linux/statifier) { }; sysdig = callPackage ../os-specific/linux/sysdig { kernel = null; }; sysfsutils = callPackage ../os-specific/linux/sysfsutils { }; sysprof = callPackage ../development/tools/profiling/sysprof { inherit (gnome) libglade; }; libsysfs = sysfsutils; systool = sysfsutils; sysklogd = callPackage ../os-specific/linux/sysklogd { }; syslinux = callPackage ../os-specific/linux/syslinux { }; sysstat = callPackage ../os-specific/linux/sysstat { }; systemd = callPackage ../os-specific/linux/systemd { linuxHeaders = linuxHeaders_3_14; }; systemtap = callPackage ../development/tools/profiling/systemtap { inherit (gnome) libglademm; }; systemd_with_lvm2 = pkgs.lib.overrideDerivation pkgs.systemd (p: { name = p.name + "-with-lvm2"; postInstall = p.postInstall + '' cp "${pkgs.lvm2}/lib/systemd/system-generators/"* ''$out/lib/systemd/system-generators ''; }); sysvinit = callPackage ../os-specific/linux/sysvinit { }; sysvtools = callPackage ../os-specific/linux/sysvinit { withoutInitTools = true; }; tcp_wrappers = callPackage ../os-specific/linux/tcp-wrappers { }; trackballs = callPackage ../games/trackballs { debug = false; guile = guile_1_8; }; tunctl = callPackage ../os-specific/linux/tunctl { }; ubootChooser = name: if name == "upstream" then ubootUpstream else if name == "sheevaplug" then ubootSheevaplug else if name == "guruplug" then ubootGuruplug else if name == "nanonote" then ubootNanonote else throw "Unknown uboot"; ubootUpstream = callPackage ../misc/uboot { }; ubootSheevaplug = callPackage ../misc/uboot/sheevaplug.nix { }; ubootNanonote = callPackage ../misc/uboot/nanonote.nix { }; ubootGuruplug = callPackage ../misc/uboot/guruplug.nix { }; uclibc = callPackage ../os-specific/linux/uclibc { }; uclibcCross = lowPrio (callPackage ../os-specific/linux/uclibc { inherit fetchurl stdenv libiconv; linuxHeaders = linuxHeadersCross; gccCross = gccCrossStageStatic; cross = assert crossSystem != null; crossSystem; }); udev145 = callPackage ../os-specific/linux/udev/145.nix { }; udev = pkgs.systemd; udisks1 = callPackage ../os-specific/linux/udisks/1-default.nix { }; udisks2 = callPackage ../os-specific/linux/udisks/2-default.nix { }; udisks = udisks1; udisks_glue = callPackage ../os-specific/linux/udisks-glue { }; untie = callPackage ../os-specific/linux/untie { }; upower = callPackage ../os-specific/linux/upower { }; upower_99 = callPackage ../os-specific/linux/upower/0.99.nix { }; upstart = callPackage ../os-specific/linux/upstart { }; usbutils = callPackage ../os-specific/linux/usbutils { }; usermount = callPackage ../os-specific/linux/usermount { }; utillinux = lowPrio (callPackage ../os-specific/linux/util-linux { ncurses = null; perl = null; }); utillinuxCurses = utillinux.override { inherit ncurses perl; }; v4l_utils = callPackage ../os-specific/linux/v4l-utils { withQt4 = true; }; windows = rec { cygwinSetup = callPackage ../os-specific/windows/cygwin-setup { }; jom = callPackage ../os-specific/windows/jom { }; w32api = callPackage ../os-specific/windows/w32api { gccCross = gccCrossStageStatic; binutilsCross = binutilsCross; }; w32api_headers = w32api.override { onlyHeaders = true; }; mingw_runtime = callPackage ../os-specific/windows/mingwrt { gccCross = gccCrossMingw2; binutilsCross = binutilsCross; }; mingw_runtime_headers = mingw_runtime.override { onlyHeaders = true; }; mingw_headers1 = buildEnv { name = "mingw-headers-1"; paths = [ w32api_headers mingw_runtime_headers ]; }; mingw_headers2 = buildEnv { name = "mingw-headers-2"; paths = [ w32api mingw_runtime_headers ]; }; mingw_headers3 = buildEnv { name = "mingw-headers-3"; paths = [ w32api mingw_runtime ]; }; mingw_w64 = callPackage ../os-specific/windows/mingw-w64 { gccCross = gccCrossStageStatic; binutilsCross = binutilsCross; }; mingw_w64_headers = callPackage ../os-specific/windows/mingw-w64 { onlyHeaders = true; }; mingw_w64_pthreads = callPackage ../os-specific/windows/mingw-w64 { onlyPthreads = true; }; pthreads = callPackage ../os-specific/windows/pthread-w32 { mingw_headers = mingw_headers3; }; wxMSW = callPackage ../os-specific/windows/wxMSW-2.8 { }; }; wesnoth = callPackage ../games/wesnoth { lua = lua5; }; wirelesstools = callPackage ../os-specific/linux/wireless-tools { }; wpa_supplicant = callPackage ../os-specific/linux/wpa_supplicant { }; wpa_supplicant_gui = callPackage ../os-specific/linux/wpa_supplicant/gui.nix { }; xf86_input_mtrack = callPackage ../os-specific/linux/xf86-input-mtrack { inherit (xorg) utilmacros xproto inputproto xorgserver; }; xf86_input_multitouch = callPackage ../os-specific/linux/xf86-input-multitouch { }; xf86_input_wacom = callPackage ../os-specific/linux/xf86-input-wacom { }; xf86_video_nested = callPackage ../os-specific/linux/xf86-video-nested { inherit (xorg) fontsproto renderproto utilmacros xorgserver; }; xf86_video_nouveau = xorg.xf86videonouveau; xmoto = builderDefsPackage (import ../games/xmoto) { inherit chipmunk sqlite curl zlib bzip2 libjpeg libpng freeglut mesa SDL SDL_mixer SDL_image SDL_net SDL_ttf lua5 ode libxdg_basedir libxml2; }; xorg_sys_opengl = callPackage ../os-specific/linux/opengl/xorg-sys { }; zd1211fw = callPackage ../os-specific/linux/firmware/zd1211 { }; andagii = callPackage ../data/fonts/andagii { }; anonymousPro = callPackage ../data/fonts/anonymous-pro { }; arkpandora_ttf = builderDefsPackage (import ../data/fonts/arkpandora) { }; aurulent-sans = callPackage ../data/fonts/aurulent-sans { }; bakoma_ttf = callPackage ../data/fonts/bakoma-ttf { }; cacert = callPackage ../data/misc/cacert { }; cantarell_fonts = callPackage ../data/fonts/cantarell-fonts { }; corefonts = callPackage ../data/fonts/corefonts { }; wrapFonts = paths: import ../data/fonts/fontWrap { inherit fetchurl stdenv builderDefs paths; inherit (xorg) mkfontdir mkfontscale; }; clearlyU = callPackage ../data/fonts/clearlyU { }; cm_unicode = callPackage ../data/fonts/cm-unicode { }; dejavu_fonts = callPackage ../data/fonts/dejavu-fonts { inherit (perlPackages) FontTTF; }; docbook5 = callPackage ../data/sgml+xml/schemas/docbook-5.0 { }; docbook_sgml_dtd_31 = callPackage ../data/sgml+xml/schemas/sgml-dtd/docbook/3.1.nix { }; docbook_sgml_dtd_41 = callPackage ../data/sgml+xml/schemas/sgml-dtd/docbook/4.1.nix { }; docbook_xml_dtd_412 = callPackage ../data/sgml+xml/schemas/xml-dtd/docbook/4.1.2.nix { }; docbook_xml_dtd_42 = callPackage ../data/sgml+xml/schemas/xml-dtd/docbook/4.2.nix { }; docbook_xml_dtd_43 = callPackage ../data/sgml+xml/schemas/xml-dtd/docbook/4.3.nix { }; docbook_xml_dtd_45 = callPackage ../data/sgml+xml/schemas/xml-dtd/docbook/4.5.nix { }; docbook_xml_ebnf_dtd = callPackage ../data/sgml+xml/schemas/xml-dtd/docbook-ebnf { }; docbook_xml_xslt = docbook_xsl; docbook_xsl = callPackage ../data/sgml+xml/stylesheets/xslt/docbook-xsl { }; docbook5_xsl = docbook_xsl_ns; docbook_xsl_ns = callPackage ../data/sgml+xml/stylesheets/xslt/docbook-xsl-ns { }; dosemu_fonts = callPackage ../data/fonts/dosemu-fonts { }; eb-garamond = callPackage ../data/fonts/eb-garamond { }; fira = callPackage ../data/fonts/fira { }; freefont_ttf = callPackage ../data/fonts/freefont-ttf { }; freepats = callPackage ../data/misc/freepats { }; gentium = callPackage ../data/fonts/gentium { }; gnome_user_docs = callPackage ../data/documentation/gnome-user-docs { }; inherit (gnome3) gsettings_desktop_schemas; hicolor_icon_theme = callPackage ../data/icons/hicolor-icon-theme { }; inconsolata = callPackage ../data/fonts/inconsolata { }; ipafont = callPackage ../data/fonts/ipafont { }; junicode = callPackage ../data/fonts/junicode { }; kochi-substitute = callPackage ../data/fonts/kochi-substitute { }; kochi-substitute-naga10 = callPackage ../data/fonts/kochi-substitute-naga10 { }; liberation_ttf = callPackage ../data/fonts/redhat-liberation-fonts { }; libertine = builderDefsPackage (import ../data/fonts/libertine) { inherit fetchurl fontforge lib; }; lmmath = callPackage ../data/fonts/lmodern/lmmath.nix { }; lmodern = callPackage ../data/fonts/lmodern { }; lohit-fonts = callPackage ../data/fonts/lohit-fonts { }; manpages = callPackage ../data/documentation/man-pages { }; miscfiles = callPackage ../data/misc/miscfiles { }; mobile_broadband_provider_info = callPackage ../data/misc/mobile-broadband-provider-info { }; mph_2b_damase = callPackage ../data/fonts/mph-2b-damase { }; nafees = callPackage ../data/fonts/nafees { }; oldstandard = callPackage ../data/fonts/oldstandard { }; opensans-ttf = callPackage ../data/fonts/opensans-ttf { }; poly = callPackage ../data/fonts/poly { }; posix_man_pages = callPackage ../data/documentation/man-pages-posix { }; pthreadmanpages = callPackage ../data/documentation/pthread-man-pages { }; shared_mime_info = callPackage ../data/misc/shared-mime-info { }; shared_desktop_ontologies = callPackage ../data/misc/shared-desktop-ontologies { }; stdmanpages = callPackage ../data/documentation/std-man-pages { }; symbola = callPackage ../data/fonts/symbola { }; iana_etc = callPackage ../data/misc/iana-etc { }; poppler_data = callPackage ../data/misc/poppler-data { }; r3rs = callPackage ../data/documentation/rnrs/r3rs.nix { }; r4rs = callPackage ../data/documentation/rnrs/r4rs.nix { }; r5rs = callPackage ../data/documentation/rnrs/r5rs.nix { }; source-code-pro = callPackage ../data/fonts/source-code-pro { }; source-sans-pro = callPackage ../data/fonts/source-sans-pro { }; source-serif-pro = callPackage ../data/fonts/source-serif-pro { }; source-han-sans-japanese = callPackage ../data/fonts/source-han-sans/japanese.nix { }; source-han-sans-korean = callPackage ../data/fonts/source-han-sans/korean.nix { }; source-han-sans-simplified-chinese = callPackage ../data/fonts/source-han-sans/simplified-chinese.nix { }; source-han-sans-traditional-chinese = callPackage ../data/fonts/source-han-sans/traditional-chinese.nix { }; tango-icon-theme = callPackage ../data/icons/tango-icon-theme { }; themes = name: import (../data/misc/themes + ("/" + name + ".nix")) { inherit fetchurl; }; theano = callPackage ../data/fonts/theano { }; tempora_lgc = callPackage ../data/fonts/tempora-lgc { }; terminus_font = callPackage ../data/fonts/terminus-font { }; tipa = callPackage ../data/fonts/tipa { }; ttf_bitstream_vera = callPackage ../data/fonts/ttf-bitstream-vera { }; tzdata = callPackage ../data/misc/tzdata { }; ubuntu_font_family = callPackage ../data/fonts/ubuntu-font-family { }; ucsFonts = callPackage ../data/fonts/ucs-fonts { }; unifont = callPackage ../data/fonts/unifont { }; vistafonts = callPackage ../data/fonts/vista-fonts { }; wqy_microhei = callPackage ../data/fonts/wqy-microhei { }; wqy_zenhei = callPackage ../data/fonts/wqy-zenhei { }; xhtml1 = callPackage ../data/sgml+xml/schemas/xml-dtd/xhtml1 { }; xkeyboard_config = xorg.xkeyboardconfig; a2jmidid = callPackage ../applications/audio/a2jmidid { }; aangifte2006 = callPackage_i686 ../applications/taxes/aangifte-2006 { }; aangifte2007 = callPackage_i686 ../applications/taxes/aangifte-2007 { }; aangifte2008 = callPackage_i686 ../applications/taxes/aangifte-2008 { }; aangifte2009 = callPackage_i686 ../applications/taxes/aangifte-2009 { }; aangifte2010 = callPackage_i686 ../applications/taxes/aangifte-2010 { }; aangifte2011 = callPackage_i686 ../applications/taxes/aangifte-2011 { }; aangifte2012 = callPackage_i686 ../applications/taxes/aangifte-2012 { }; aangifte2013 = callPackage_i686 ../applications/taxes/aangifte-2013 { }; abcde = callPackage ../applications/audio/abcde { inherit (perlPackages) DigestSHA MusicBrainz MusicBrainzDiscID; libcdio = libcdio082; }; abiword = callPackage ../applications/office/abiword { inherit (gnome) libglade libgnomecanvas; }; abook = callPackage ../applications/misc/abook { }; adobe-reader = callPackage_i686 ../applications/misc/adobe-reader { }; aewan = callPackage ../applications/editors/aewan { }; alchemy = callPackage ../applications/graphics/alchemy { }; ams-lv2 = callPackage ../applications/audio/ams-lv2 { }; amsn = callPackage ../applications/networking/instant-messengers/amsn { }; antiword = callPackage ../applications/office/antiword { }; ardour = ardour3; ardour3 = lowPrio (callPackage ../applications/audio/ardour { inherit (gnome) libgnomecanvas libgnomecanvasmm; }); arora = callPackage ../applications/networking/browsers/arora { }; atom = callPackage ../applications/editors/atom { gconf = gnome.GConf; }; aseprite = callPackage ../applications/editors/aseprite { giflib = giflib_4_1; }; audacious = callPackage ../applications/audio/audacious { }; audacity = callPackage ../applications/audio/audacity { ffmpeg = ffmpeg_0_10; }; milkytracker = callPackage ../applications/audio/milkytracker { }; aumix = callPackage ../applications/audio/aumix { gtkGUI = false; }; autopanosiftc = callPackage ../applications/graphics/autopanosiftc { }; avidemux = callPackage ../applications/video/avidemux { }; avogadro = callPackage ../applications/science/chemistry/avogadro { eigen = eigen2; }; avrdudess = callPackage ../applications/misc/avrdudess { }; avxsynth = callPackage ../applications/video/avxsynth { }; awesome-3-4 = callPackage ../applications/window-managers/awesome/3.4.nix { lua = lua5; cairo = cairo.override { xcbSupport = true; }; }; awesome-3-5 = callPackage ../applications/window-managers/awesome { lua = lua5_1; cairo = cairo.override { xcbSupport = true; }; }; awesome = awesome-3-5; inherit (gnome3) baobab; bar = callPackage ../applications/window-managers/bar { }; baresip = callPackage ../applications/networking/instant-messengers/baresip { ffmpeg = ffmpeg_1; }; batik = callPackage ../applications/graphics/batik { }; bazaar = callPackage ../applications/version-management/bazaar { }; bazaarTools = builderDefsPackage (import ../applications/version-management/bazaar/tools.nix) { inherit bazaar; }; beast = callPackage ../applications/audio/beast { inherit (gnome) libgnomecanvas libart_lgpl; guile = guile_1_8; }; bibletime = callPackage ../applications/misc/bibletime { }; bitcoin = callPackage ../applications/misc/bitcoin { }; bitlbee = callPackage ../applications/networking/instant-messengers/bitlbee { gnutls = gnutls; libotr = libotr_3_2; }; blender = callPackage ../applications/misc/blender { python = python34; }; bristol = callPackage ../applications/audio/bristol { }; bspwm = callPackage ../applications/window-managers/bspwm { }; bvi = callPackage ../applications/editors/bvi { }; calf = callPackage ../applications/audio/calf { inherit (gnome) libglade; }; calibre = callPackage ../applications/misc/calibre { inherit (pythonPackages) pyqt5 sip_4_16; }; camlistore = callPackage ../applications/misc/camlistore { }; carrier = builderDefsPackage (import ../applications/networking/instant-messengers/carrier/2.5.0.nix) { inherit fetchurl stdenv pkgconfig perl perlXMLParser libxml2 openssl nss gtkspell aspell gettext ncurses avahi dbus dbus_glib python libtool automake autoconf gstreamer; inherit gtk glib; inherit (gnome) startupnotification GConf; inherit (xlibs) libXScrnSaver scrnsaverproto libX11 xproto kbproto; }; funpidgin = carrier; cc1394 = callPackage ../applications/video/cc1394 { }; cddiscid = callPackage ../applications/audio/cd-discid { }; cdparanoia = cdparanoiaIII; cdparanoiaIII = callPackage ../applications/audio/cdparanoia { }; cdrtools = callPackage ../applications/misc/cdrtools { }; centerim = callPackage ../applications/networking/instant-messengers/centerim { }; cgit = callPackage ../applications/version-management/git-and-tools/cgit { }; cgminer = callPackage ../applications/misc/cgminer { amdappsdk = amdappsdk28; }; chatzilla = callPackage ../applications/networking/irc/chatzilla { }; chromium = lowPrio (callPackage ../applications/networking/browsers/chromium { channel = "stable"; pulseSupport = config.pulseaudio or true; enablePepperFlash = config.chromium.enablePepperFlash or false; enablePepperPDF = config.chromium.enablePepperPDF or false; }); chromiumBeta = lowPrio (chromium.override { channel = "beta"; }); chromiumBetaWrapper = lowPrio (wrapChromium chromiumBeta); chromiumDev = lowPrio (chromium.override { channel = "dev"; }); chromiumDevWrapper = lowPrio (wrapChromium chromiumDev); chromiumWrapper = wrapChromium chromium; cinelerra = callPackage ../applications/video/cinelerra { }; clipit = callPackage ../applications/misc/clipit { }; cmus = callPackage ../applications/audio/cmus { }; compiz = callPackage ../applications/window-managers/compiz { inherit (gnome) GConf ORBit2 metacity; boost = boost149; }; coriander = callPackage ../applications/video/coriander { inherit (gnome) libgnomeui GConf; }; csound = callPackage ../applications/audio/csound { }; cinepaint = callPackage ../applications/graphics/cinepaint { fltk = fltk13; libpng = libpng12; }; codeblocks = callPackage ../applications/editors/codeblocks { }; codeblocksFull = callPackage ../applications/editors/codeblocks { contribPlugins = true; }; codeville = builderDefsPackage (import ../applications/version-management/codeville/0.8.0.nix) { inherit makeWrapper; python = pythonFull; }; comical = callPackage ../applications/graphics/comical { }; conkeror = callPackage ../applications/networking/browsers/conkeror { }; conkerorWrapper = wrapFirefox { browser = conkeror; browserName = "conkeror"; desktopName = "Conkeror"; }; cuneiform = builderDefsPackage (import ../tools/graphics/cuneiform) { inherit cmake patchelf; imagemagick = imagemagick; }; cvs = callPackage ../applications/version-management/cvs { }; cvsps = callPackage ../applications/version-management/cvsps { }; cvs2svn = callPackage ../applications/version-management/cvs2svn { }; d4x = callPackage ../applications/misc/d4x { }; darcs = with haskellPackages_ghc783; callPackage ../applications/version-management/darcs { cabal = cabal.override { extension = self: super: { isLibrary = false; configureFlags = "-f-library " + (super.configureFlags or ""); }; }; }; darktable = callPackage ../applications/graphics/darktable { inherit (gnome) GConf libglade; }; dd-agent = callPackage ../tools/networking/dd-agent { inherit (pythonPackages) tornado; }; dia = callPackage ../applications/graphics/dia { inherit (pkgs.gnome) libart_lgpl libgnomeui; }; diffuse = callPackage ../applications/version-management/diffuse { }; distrho = callPackage ../applications/audio/distrho { }; djvulibre = callPackage ../applications/misc/djvulibre { }; djvu2pdf = callPackage ../tools/typesetting/djvu2pdf { }; djview = callPackage ../applications/graphics/djview { }; djview4 = pkgs.djview; dmenu = callPackage ../applications/misc/dmenu { enableXft = config.dmenu.enableXft or false; }; dmtx = builderDefsPackage (import ../tools/graphics/dmtx) { inherit libpng libtiff libjpeg imagemagick librsvg pkgconfig bzip2 zlib libtool freetype fontconfig ghostscript jasper xz; inherit (xlibs) libX11; }; docker = callPackage ../applications/virtualization/docker { }; doodle = callPackage ../applications/search/doodle { }; dunst = callPackage ../applications/misc/dunst { }; dvb_apps = callPackage ../applications/video/dvb-apps { }; dvdauthor = callPackage ../applications/video/dvdauthor { }; dwb = callPackage ../applications/networking/browsers/dwb { dconf = gnome3.dconf; }; dwbWrapper = wrapFirefox { browser = dwb; browserName = "dwb"; desktopName = "dwb"; }; dwm = callPackage ../applications/window-managers/dwm { patches = config.dwm.patches or [ ]; }; dzen2 = callPackage ../applications/window-managers/dzen2 { }; eaglemode = callPackage ../applications/misc/eaglemode { }; eclipses = recurseIntoAttrs (callPackage ../applications/editors/eclipse { }); ed = callPackage ../applications/editors/ed { }; ekho = callPackage ../applications/audio/ekho { }; electrum = callPackage ../applications/misc/electrum { }; elinks = callPackage ../applications/networking/browsers/elinks { }; elvis = callPackage ../applications/editors/elvis { }; emacs = emacs24; emacs24 = callPackage ../applications/editors/emacs-24 { libXaw = xlibs.libXaw; Xaw3d = null; gconf = null; librsvg = null; alsaLib = null; imagemagick = null; }; emacs24-nox = lowPrio (appendToName "nox" (emacs24.override { withX = false; })); emacs24Macport = lowPrio (callPackage ../applications/editors/emacs-24/macport.nix { stdenv = pkgs.clangStdenv; }); emacsPackages = emacs: self: let callPackage = newScope self; in rec { inherit emacs; autoComplete = callPackage ../applications/editors/emacs-modes/auto-complete { }; bbdb = callPackage ../applications/editors/emacs-modes/bbdb { }; bbdb3 = callPackage ../applications/editors/emacs-modes/bbdb/3.nix { }; cedet = callPackage ../applications/editors/emacs-modes/cedet { }; calfw = callPackage ../applications/editors/emacs-modes/calfw { }; coffee = callPackage ../applications/editors/emacs-modes/coffee { }; colorTheme = callPackage ../applications/editors/emacs-modes/color-theme { }; colorThemeSolarized = callPackage ../applications/editors/emacs-modes/color-theme-solarized { }; cryptol = callPackage ../applications/editors/emacs-modes/cryptol { }; cua = callPackage ../applications/editors/emacs-modes/cua { }; darcsum = callPackage ../applications/editors/emacs-modes/darcsum { }; jabber = callPackage ../applications/editors/emacs-modes/jabber { }; emacsClangCompleteAsync = callPackage ../applications/editors/emacs-modes/emacs-clang-complete-async { }; emacsSessionManagement = callPackage ../applications/editors/emacs-modes/session-management-for-emacs { }; emacsw3m = callPackage ../applications/editors/emacs-modes/emacs-w3m { }; emms = callPackage ../applications/editors/emacs-modes/emms { }; ess = callPackage ../applications/editors/emacs-modes/ess { }; flymakeCursor = callPackage ../applications/editors/emacs-modes/flymake-cursor { }; gh = callPackage ../applications/editors/emacs-modes/gh { }; graphvizDot = callPackage ../applications/editors/emacs-modes/graphviz-dot { }; gist = callPackage ../applications/editors/emacs-modes/gist { }; idris = callPackage ../applications/editors/emacs-modes/idris { }; jade = callPackage ../applications/editors/emacs-modes/jade { }; jdee = callPackage ../applications/editors/emacs-modes/jdee { }; js2 = callPackage ../applications/editors/emacs-modes/js2 { }; stratego = callPackage ../applications/editors/emacs-modes/stratego { }; haskellMode = callPackage ../applications/editors/emacs-modes/haskell { }; ocamlMode = callPackage ../applications/editors/emacs-modes/ocaml { }; structuredHaskellMode = callPackage ../applications/editors/emacs-modes/structured-haskell-mode { inherit (haskellPackages) cabal haskellSrcExts; }; tuaregMode = callPackage ../applications/editors/emacs-modes/tuareg { }; hol_light_mode = callPackage ../applications/editors/emacs-modes/hol_light { }; htmlize = callPackage ../applications/editors/emacs-modes/htmlize { }; logito = callPackage ../applications/editors/emacs-modes/logito { }; loremIpsum = callPackage ../applications/editors/emacs-modes/lorem-ipsum { }; magit = callPackage ../applications/editors/emacs-modes/magit { }; maudeMode = callPackage ../applications/editors/emacs-modes/maude { }; metaweblog = callPackage ../applications/editors/emacs-modes/metaweblog { }; notmuch = lowPrio (callPackage ../applications/networking/mailreaders/notmuch { }); offlineimap = callPackage ../applications/editors/emacs-modes/offlineimap { }; org = hiPrio (callPackage ../applications/editors/emacs-modes/org { }); org2blog = callPackage ../applications/editors/emacs-modes/org2blog { }; pcache = callPackage ../applications/editors/emacs-modes/pcache { }; phpMode = callPackage ../applications/editors/emacs-modes/php { }; prologMode = callPackage ../applications/editors/emacs-modes/prolog { }; proofgeneral_4_2 = callPackage ../applications/editors/emacs-modes/proofgeneral/4.2.nix { texinfo = texinfo4; texLive = pkgs.texLiveAggregationFun { paths = [ pkgs.texLive pkgs.texLiveCMSuper ]; }; }; proofgeneral_4_3_pre = callPackage ../applications/editors/emacs-modes/proofgeneral/4.3pre.nix { texinfo = texinfo4; texLive = pkgs.texLiveAggregationFun { paths = [ pkgs.texLive pkgs.texLiveCMSuper ]; }; }; proofgeneral = self.proofgeneral_4_2; quack = callPackage ../applications/editors/emacs-modes/quack { }; rectMark = callPackage ../applications/editors/emacs-modes/rect-mark { }; remember = callPackage ../applications/editors/emacs-modes/remember { }; rudel = callPackage ../applications/editors/emacs-modes/rudel { }; sbtMode = callPackage ../applications/editors/emacs-modes/sbt-mode { }; scalaMode1 = callPackage ../applications/editors/emacs-modes/scala-mode/v1.nix { }; scalaMode2 = callPackage ../applications/editors/emacs-modes/scala-mode/v2.nix { }; sunriseCommander = callPackage ../applications/editors/emacs-modes/sunrise-commander { }; writeGood = callPackage ../applications/editors/emacs-modes/writegood { }; xmlRpc = callPackage ../applications/editors/emacs-modes/xml-rpc { }; }; emacs24Packages = recurseIntoAttrs (emacsPackages emacs24 pkgs.emacs24Packages); inherit (gnome3) empathy; epdfview = callPackage ../applications/misc/epdfview { }; inherit (gnome3) epiphany; espeak = callPackage ../applications/audio/espeak { }; espeakedit = callPackage ../applications/audio/espeak/edit.nix { }; esniper = callPackage ../applications/networking/esniper { }; etherape = callPackage ../applications/networking/sniffers/etherape { inherit (gnome) gnomedocutils libgnome libglade libgnomeui scrollkeeper; }; evopedia = callPackage ../applications/misc/evopedia { }; keepassx = callPackage ../applications/misc/keepassx { }; keepassx2 = callPackage ../applications/misc/keepassx/2.0.nix { }; inherit (gnome3) evince; evolution_data_server = gnome3.evolution_data_server; keepass = callPackage ../applications/misc/keepass { }; exrdisplay = callPackage ../applications/graphics/exrdisplay { fltk = fltk20; }; fbpanel = callPackage ../applications/window-managers/fbpanel { }; fbreader = callPackage ../applications/misc/fbreader { }; fetchmail = import ../applications/misc/fetchmail { inherit stdenv fetchurl openssl; }; fldigi = callPackage ../applications/audio/fldigi { }; fluidsynth = callPackage ../applications/audio/fluidsynth { }; fossil = callPackage ../applications/version-management/fossil { }; fribid = callPackage ../applications/networking/browsers/mozilla-plugins/fribid { }; fvwm = callPackage ../applications/window-managers/fvwm { }; geany = callPackage ../applications/editors/geany { }; gksu = callPackage ../applications/misc/gksu { }; gnuradio = callPackage ../applications/misc/gnuradio { inherit (pythonPackages) lxml numpy scipy matplotlib pyopengl; fftw = fftwFloat; }; gnuradio-osmosdr = callPackage ../applications/misc/gnuradio-osmosdr { }; goldendict = callPackage ../applications/misc/goldendict { }; google-musicmanager = callPackage ../applications/audio/google-musicmanager { }; gpicview = callPackage ../applications/graphics/gpicview { }; gqrx = callPackage ../applications/misc/gqrx { }; grass = import ../applications/misc/grass { inherit (xlibs) libXmu libXext libXp libX11 libXt libSM libICE libXpm libXaw libXrender; inherit config composableDerivation stdenv fetchurl lib flex bison cairo fontconfig gdal zlib ncurses gdbm proj pkgconfig swig blas liblapack libjpeg libpng mysql unixODBC mesa postgresql python readline sqlite tcl tk libtiff freetype makeWrapper wxGTK; fftw = fftwSinglePrec; ffmpeg = ffmpeg_0_10; motif = lesstif; opendwg = libdwg; wxPython = wxPython28; }; grip = callPackage ../applications/misc/grip { inherit (gnome) libgnome libgnomeui vte; }; gtimelog = pythonPackages.gtimelog; inherit (gnome3) gucharmap; guitarix = callPackage ../applications/audio/guitarix { fftw = fftwSinglePrec; }; photivo = callPackage ../applications/graphics/photivo { }; wavesurfer = callPackage ../applications/misc/audio/wavesurfer { }; wireshark = callPackage ../applications/networking/sniffers/wireshark { }; wvdial = callPackage ../os-specific/linux/wvdial { }; fbida = callPackage ../applications/graphics/fbida { }; fdupes = callPackage ../tools/misc/fdupes { }; feh = callPackage ../applications/graphics/feh { }; filezilla = callPackage ../applications/networking/ftp/filezilla { }; firefox13Pkgs = callPackage ../applications/networking/browsers/firefox/13.0.nix { inherit (gnome) libIDL; }; firefox13Wrapper = wrapFirefox { browser = firefox13Pkgs.firefox; }; firefox30Pkgs = callPackage ../applications/networking/browsers/firefox/30.nix { inherit (gnome) libIDL; inherit (pythonPackages) pysqlite; libpng = libpng_apng; }; firefox = callPackage ../applications/networking/browsers/firefox { inherit (gnome) libIDL; inherit (pythonPackages) pysqlite; }; firefoxWrapper = wrapFirefox { browser = pkgs.firefox; }; firefox-bin = callPackage ../applications/networking/browsers/firefox-bin { gconf = pkgs.gnome.GConf; inherit (pkgs.gnome) libgnome libgnomeui; inherit (pkgs.xlibs) libX11 libXScrnSaver libXext libXinerama libXrender libXt; }; flac = callPackage ../applications/audio/flac { }; flashplayer = callPackage ../applications/networking/browsers/mozilla-plugins/flashplayer-11 { debug = config.flashplayer.debug or false; }; fluxbox = callPackage ../applications/window-managers/fluxbox { }; freecad = callPackage ../applications/graphics/freecad { opencascade = opencascade_6_5; inherit (pythonPackages) matplotlib pycollada; }; freemind = callPackage ../applications/misc/freemind { jdk = jdk; jre = jdk; }; freenet = callPackage ../applications/networking/p2p/freenet { }; freepv = callPackage ../applications/graphics/freepv { }; xfontsel = callPackage ../applications/misc/xfontsel { }; xlsfonts = callPackage ../applications/misc/xlsfonts { }; freerdp = callPackage ../applications/networking/remote/freerdp { ffmpeg = ffmpeg_1; }; freerdpUnstable = callPackage ../applications/networking/remote/freerdp/unstable.nix { }; freicoin = callPackage ../applications/misc/freicoin { }; fspot = callPackage ../applications/graphics/f-spot { inherit (gnome) libgnome libgnomeui; gtksharp = gtksharp1; }; fuze = callPackage ../applications/networking/instant-messengers/fuze { }; gcolor2 = callPackage ../applications/graphics/gcolor2 { }; get_iplayer = callPackage ../applications/misc/get_iplayer { }; gimp_2_8 = callPackage ../applications/graphics/gimp/2.8.nix { inherit (gnome) libart_lgpl; webkit = null; lcms = lcms2; wrapPython = pythonPackages.wrapPython; }; gimp = gimp_2_8; gimpPlugins = recurseIntoAttrs (import ../applications/graphics/gimp/plugins { inherit pkgs gimp; }); gitAndTools = recurseIntoAttrs (import ../applications/version-management/git-and-tools { inherit pkgs; }); git = gitAndTools.git; gitFull = gitAndTools.gitFull; gitSVN = gitAndTools.gitSVN; gitRepo = callPackage ../applications/version-management/git-repo { python = python27; }; gitolite = callPackage ../applications/version-management/gitolite { }; inherit (gnome3) gitg; giv = callPackage ../applications/graphics/giv { pcre = pcre.override { unicodeSupport = true; }; }; gmrun = callPackage ../applications/misc/gmrun { }; gnucash = callPackage ../applications/office/gnucash { inherit (gnome2) libgnomeui libgtkhtml gtkhtml libbonoboui libgnomeprint libglade libart_lgpl; gconf = gnome2.GConf; guile = guile_1_8; slibGuile = slibGuile.override { scheme = guile_1_8; }; goffice = goffice_0_8; }; goffice_0_8 = callPackage ../desktops/gnome-3/3.10/misc/goffice/0.8.nix { inherit (gnome2) libglade libgnomeui; gconf = gnome2.GConf; libart = gnome2.libart_lgpl; }; ideas = recurseIntoAttrs (callPackage ../applications/editors/idea { } // callPackage ../applications/editors/idea/pycharm.nix { }); libquvi = callPackage ../applications/video/quvi/library.nix { }; mi2ly = callPackage ../applications/audio/mi2ly { }; praat = callPackage ../applications/audio/praat { }; quvi = callPackage ../applications/video/quvi/tool.nix { }; quvi_scripts = callPackage ../applications/video/quvi/scripts.nix { }; qjackctl = callPackage ../applications/audio/qjackctl { }; gkrellm = callPackage ../applications/misc/gkrellm { }; gmu = callPackage ../applications/audio/gmu { }; gnash = callPackage ../applications/video/gnash { inherit (gnome) gtkglext; }; gnome_mplayer = callPackage ../applications/video/gnome-mplayer { inherit (gnome) GConf; }; gnumeric = callPackage ../applications/office/gnumeric { inherit (gnome3) goffice gnome_icon_theme; }; gnunet = callPackage ../applications/networking/p2p/gnunet { libgcrypt = libgcrypt_1_6; }; gnunet_svn = lowPrio (callPackage ../applications/networking/p2p/gnunet/svn.nix { libgcrypt = libgcrypt_1_6; }); gocr = callPackage ../applications/graphics/gocr { }; gobby5 = callPackage ../applications/editors/gobby { inherit (gnome) gtksourceview; }; gphoto2 = callPackage ../applications/misc/gphoto2 { }; gphoto2fs = builderDefsPackage ../applications/misc/gphoto2/gphotofs.nix { inherit libgphoto2 fuse pkgconfig glib libtool; }; graphicsmagick = callPackage ../applications/graphics/graphicsmagick { }; graphicsmagick_q16 = callPackage ../applications/graphics/graphicsmagick { quantumdepth = 16; }; graphicsmagick137 = callPackage ../applications/graphics/graphicsmagick/1.3.7.nix { libpng = libpng12; }; gtkpod = callPackage ../applications/audio/gtkpod { inherit (gnome) libglade; }; jbidwatcher = callPackage ../applications/misc/jbidwatcher { java = if stdenv.isLinux then jre else jdk; }; qrdecode = builderDefsPackage (import ../tools/graphics/qrdecode) { libpng = libpng12; opencv = opencv_2_1; }; qrencode = callPackage ../tools/graphics/qrencode { }; gecko_mediaplayer = callPackage ../applications/networking/browsers/mozilla-plugins/gecko-mediaplayer { inherit (gnome) GConf; browser = firefox; }; geeqie = callPackage ../applications/graphics/geeqie { }; gigedit = callPackage ../applications/audio/gigedit { }; gqview = callPackage ../applications/graphics/gqview { }; gmpc = callPackage ../applications/audio/gmpc { }; gmtk = callPackage ../applications/networking/browsers/mozilla-plugins/gmtk { inherit (gnome) GConf; }; googleearth = callPackage_i686 ../applications/misc/googleearth { }; google_talk_plugin = callPackage ../applications/networking/browsers/mozilla-plugins/google-talk-plugin { libpng = libpng12; }; gosmore = builderDefsPackage ../applications/misc/gosmore { inherit fetchsvn curl pkgconfig libxml2 gtk; }; gpsbabel = callPackage ../applications/misc/gpsbabel { }; gpscorrelate = callPackage ../applications/misc/gpscorrelate { }; gpsd = callPackage ../servers/gpsd { }; guitone = callPackage ../applications/version-management/guitone { }; gv = callPackage ../applications/misc/gv { }; guvcview = callPackage ../os-specific/linux/guvcview { }; hello = callPackage ../applications/misc/hello/ex-2 { }; herbstluftwm = callPackage ../applications/window-managers/herbstluftwm { }; hexchat = callPackage ../applications/networking/irc/hexchat { }; hexedit = callPackage ../applications/editors/hexedit { }; hipchat = callPackage ../applications/networking/instant-messengers/hipchat { }; homebank = callPackage ../applications/office/homebank { }; htmldoc = callPackage ../applications/misc/htmldoc { fltk = fltk13; }; hugin = callPackage ../applications/graphics/hugin { }; hydrogen = callPackage ../applications/audio/hydrogen { }; i3 = callPackage ../applications/window-managers/i3 { }; i3lock = callPackage ../applications/window-managers/i3/lock.nix { inherit (xorg) libxkbfile; cairo = cairo.override { xcbSupport = true; }; }; i3minator = callPackage ../tools/misc/i3minator { }; i3status = callPackage ../applications/window-managers/i3/status.nix { }; i810switch = callPackage ../os-specific/linux/i810switch { }; icewm = callPackage ../applications/window-managers/icewm { }; id3v2 = callPackage ../applications/audio/id3v2 { }; ifenslave = callPackage ../os-specific/linux/ifenslave { }; ii = callPackage ../applications/networking/irc/ii { }; ike = callPackage ../applications/ike { }; ikiwiki = callPackage ../applications/misc/ikiwiki { inherit (perlPackages) TextMarkdown URI HTMLParser HTMLScrubber HTMLTemplate TimeDate CGISession DBFile CGIFormBuilder LocaleGettext RpcXML XMLSimple PerlMagick YAML YAMLLibYAML HTMLTree Filechdir AuthenPassphrase NetOpenIDConsumer LWPxParanoidAgent CryptSSLeay; }; imagemagick = callPackage ../applications/graphics/ImageMagick { tetex = null; librsvg = null; }; imagemagickBig = lowPrio (callPackage ../applications/graphics/ImageMagick { }); impressive = callPackage ../applications/office/impressive { inherit (pythonPackages) pyopengl; }; inferno = callPackage_i686 ../applications/inferno { }; inkscape = callPackage ../applications/graphics/inkscape { inherit (pythonPackages) lxml; lcms = lcms2; }; ion3 = callPackage ../applications/window-managers/ion-3 { lua = lua5; }; ipe = callPackage ../applications/graphics/ipe { }; iptraf = callPackage ../applications/networking/iptraf { }; irssi = callPackage ../applications/networking/irc/irssi { stdenv = if stdenv.isDarwin then stdenvAdapters.overrideGCC stdenv gccApple else stdenv; }; irssi_fish = callPackage ../applications/networking/irc/irssi/fish { }; irssi_otr = callPackage ../applications/networking/irc/irssi/otr { }; bip = callPackage ../applications/networking/irc/bip { }; jack_capture = callPackage ../applications/audio/jack-capture { }; jack_oscrolloscope = callPackage ../applications/audio/jack-oscrolloscope { }; jack_rack = callPackage ../applications/audio/jack-rack { }; jackmeter = callPackage ../applications/audio/jackmeter { }; jalv = callPackage ../applications/audio/jalv { }; jedit = callPackage ../applications/editors/jedit { }; jigdo = callPackage ../applications/misc/jigdo { }; jitsi = callPackage ../applications/networking/instant-messengers/jitsi { }; joe = callPackage ../applications/editors/joe { }; jbrout = callPackage ../applications/graphics/jbrout { inherit (pythonPackages) lxml; }; jwm = callPackage ../applications/window-managers/jwm { }; k3d = callPackage ../applications/graphics/k3d { inherit (pkgs.gnome2) gtkglext; }; keepnote = callPackage ../applications/office/keepnote { pygtk = pyGtkGlade; }; kermit = callPackage ../tools/misc/kermit { }; keymon = callPackage ../applications/video/key-mon { }; kino = callPackage ../applications/video/kino { inherit (gnome) libglade; }; lame = callPackage ../applications/audio/lame { }; larswm = callPackage ../applications/window-managers/larswm { }; lash = callPackage ../applications/audio/lash { }; ladspaH = callPackage ../applications/audio/ladspa-plugins/ladspah.nix { }; ladspaPlugins = callPackage ../applications/audio/ladspa-plugins { fftw = fftwSinglePrec; }; caps = callPackage ../applications/audio/caps { }; lastwatch = callPackage ../applications/audio/lastwatch { }; lastfmsubmitd = callPackage ../applications/audio/lastfmsubmitd { }; lbdb = callPackage ../tools/misc/lbdb { }; lci = callPackage ../applications/science/logic/lci { }; ldcpp = callPackage ../applications/networking/p2p/ldcpp { inherit (gnome) libglade; }; librecad = callPackage ../applications/misc/librecad { }; librecad2 = callPackage ../applications/misc/librecad/2.0.nix { }; libreoffice = callPackage ../applications/office/libreoffice { inherit (perlPackages) ArchiveZip CompressZlib; inherit (gnome) GConf ORBit2 gnome_vfs; zip = zip.override { enableNLS = false; }; boost = boost155; jdk = openjdk; fontsConf = makeFontsConf { fontDirectories = [ freefont_ttf xorg.fontmiscmisc xorg.fontbhttf ]; }; clucene_core = clucene_core_2; lcms = lcms2; harfbuzz = harfbuzz.override { withIcu = true; withGraphite2 = true; }; }; liferea = callPackage ../applications/networking/newsreaders/liferea { }; lingot = callPackage ../applications/audio/lingot { inherit (gnome) libglade; }; links = callPackage ../applications/networking/browsers/links { }; ledger = callPackage ../applications/office/ledger/2.6.3.nix { }; ledger3 = callPackage ../applications/office/ledger/3.0.nix { }; lighttable = callPackage ../applications/editors/lighttable { }; links2 = callPackage ../applications/networking/browsers/links2 { }; linphone = callPackage ../applications/networking/instant-messengers/linphone rec { inherit (gnome) libglade; libexosip = libexosip_3; libosip = libosip_3; }; linuxsampler = callPackage ../applications/audio/linuxsampler { bison = bison2; }; llpp = callPackage ../applications/misc/llpp { inherit (ocamlPackages) lablgl; }; lmms = callPackage ../applications/audio/lmms { }; lrzsz = callPackage ../tools/misc/lrzsz { }; luminanceHDR = callPackage ../applications/graphics/luminance-hdr { }; lxdvdrip = callPackage ../applications/video/lxdvdrip { }; handbrake = callPackage ../applications/video/handbrake { }; lynx = callPackage ../applications/networking/browsers/lynx { }; lyx = callPackage ../applications/misc/lyx { }; makeself = callPackage ../applications/misc/makeself { }; matchbox = callPackage ../applications/window-managers/matchbox { }; mcpp = callPackage ../development/compilers/mcpp { }; mda_lv2 = callPackage ../applications/audio/mda-lv2 { }; meld = callPackage ../applications/version-management/meld { inherit (gnome) scrollkeeper; pygtk = pyGtkGlade; }; mcomix = callPackage ../applications/graphics/mcomix { }; mercurial = callPackage ../applications/version-management/mercurial { inherit (pythonPackages) curses docutils; guiSupport = false; }; mercurialFull = appendToName "full" (pkgs.mercurial.override { guiSupport = true; }); merkaartor = callPackage ../applications/misc/merkaartor { }; meshlab = callPackage ../applications/graphics/meshlab { }; mhwaveedit = callPackage ../applications/audio/mhwaveedit { }; mid2key = callPackage ../applications/audio/mid2key { }; midori = callPackage ../applications/networking/browsers/midori { }; midoriWrapper = wrapFirefox { browser = midori; browserName = "midori"; desktopName = "Midori"; icon = "${midori}/share/icons/hicolor/22x22/apps/midori.png"; }; mikmod = callPackage ../applications/audio/mikmod { }; minicom = callPackage ../tools/misc/minicom { }; minimodem = callPackage ../applications/audio/minimodem { }; minidjvu = callPackage ../applications/graphics/minidjvu { }; mirage = callPackage ../applications/graphics/mirage { }; mixxx = callPackage ../applications/audio/mixxx { inherit (vamp) vampSDK; }; mmex = callPackage ../applications/office/mmex { }; moc = callPackage ../applications/audio/moc { }; monkeysAudio = callPackage ../applications/audio/monkeys-audio { }; monodevelop = callPackage ../applications/editors/monodevelop { inherit (gnome) gnome_vfs libbonobo libglade libgnome GConf; mozilla = firefox; gtksharp = gtksharp2; }; monodoc = callPackage ../applications/editors/monodoc { gtksharp = gtksharp1; }; monotone = callPackage ../applications/version-management/monotone { lua = lua5; boost = boost149; }; monotoneViz = builderDefsPackage (import ../applications/version-management/monotone-viz/mtn-head.nix) { inherit ocaml graphviz pkgconfig autoconf automake libtool glib gtk; inherit (ocamlPackages) lablgtk; inherit (gnome) libgnomecanvas; }; mopidy = callPackage ../applications/audio/mopidy { }; mopidy-spotify = callPackage ../applications/audio/mopidy-spotify { }; mopidy-moped = callPackage ../applications/audio/mopidy-moped { }; mozilla = callPackage ../applications/networking/browsers/mozilla { inherit (gnome) libIDL; }; mozplugger = builderDefsPackage (import ../applications/networking/browsers/mozilla-plugins/mozplugger) { inherit firefox; inherit (xlibs) libX11 xproto; }; easytag = callPackage ../applications/audio/easytag { }; mp3info = callPackage ../applications/audio/mp3info { }; mp3splt = callPackage ../applications/audio/mp3splt { }; mpc123 = callPackage ../applications/audio/mpc123 { }; mpg123 = callPackage ../applications/audio/mpg123 { }; mpg321 = callPackage ../applications/audio/mpg321 { }; mpc_cli = callPackage ../applications/audio/mpc { }; ncmpc = callPackage ../applications/audio/ncmpc { }; ncmpcpp = callPackage ../applications/audio/ncmpcpp { }; normalize = callPackage ../applications/audio/normalize { }; mplayer = callPackage ../applications/video/mplayer { pulseSupport = config.pulseaudio or false; vdpauSupport = config.mplayer.vdpauSupport or false; }; mplayer2 = callPackage ../applications/video/mplayer2 { ffmpeg = libav_9; }; MPlayerPlugin = browser: import ../applications/networking/browsers/mozilla-plugins/mplayerplug-in { inherit browser; inherit fetchurl stdenv pkgconfig gettext; inherit (xlibs) libXpm; }; mpv = callPackage ../applications/video/mpv { lua = lua5_1; bs2bSupport = true; quviSupport = true; cacaSupport = true; }; mrxvt = callPackage ../applications/misc/mrxvt { }; multisync = callPackage ../applications/misc/multisync { inherit (gnome) ORBit2 libbonobo libgnomeui GConf; }; mumble = callPackage ../applications/networking/mumble { avahi = avahi.override { withLibdnssdCompat = true; }; jackSupport = config.mumble.jackSupport or false; speechdSupport = config.mumble.speechdSupport or false; }; murmur = callPackage ../applications/networking/mumble/murmur.nix { avahi = avahi.override { withLibdnssdCompat = true; }; iceSupport = config.murmur.iceSupport or true; }; mutt = callPackage ../applications/networking/mailreaders/mutt { }; pcmanfm = callPackage ../applications/misc/pcmanfm { }; ruby_gpgme = callPackage ../development/libraries/ruby_gpgme { ruby = ruby19; hoe = rubyLibs.hoe; }; ruby_ncursesw_sup = callPackage ../development/libraries/ruby_ncursesw_sup { }; shotcut = callPackage ../applications/video/shotcut { mlt = mlt-qt5; }; smplayer = callPackage ../applications/video/smplayer { }; sup = with rubyLibs; callPackage ../applications/networking/mailreaders/sup { ruby = ruby19.override { cursesSupport = true; }; inherit gettext highline iconv locale lockfile text trollop xapian_ruby which; rmail_sup = ""; unicode = ""; bundler = pkgs.lib.overrideDerivation pkgs.rubyLibs.bundler (oldAttrs: { dontPatchShebangs = 1; }); chronic = chronic; gpgme = ruby_gpgme; mime_types = mime_types; ncursesw_sup = ruby_ncursesw_sup; rake = rake; }; synfigstudio = callPackage ../applications/graphics/synfigstudio { fontsConf = makeFontsConf { fontDirectories = [ freefont_ttf ]; }; }; sxhkd = callPackage ../applications/window-managers/sxhkd { }; msmtp = callPackage ../applications/networking/msmtp { }; imapfilter = callPackage ../applications/networking/mailreaders/imapfilter.nix { lua = lua5; }; mupdf = callPackage ../applications/misc/mupdf { }; mypaint = callPackage ../applications/graphics/mypaint { }; mythtv = callPackage ../applications/video/mythtv { }; tvtime = callPackage ../applications/video/tvtime { kernel = linux; }; nano = callPackage ../applications/editors/nano { }; navipowm = callPackage ../applications/misc/navipowm { }; navit = callPackage ../applications/misc/navit { }; netbeans = callPackage ../applications/editors/netbeans { }; ncdu = callPackage ../tools/misc/ncdu { }; ncdc = callPackage ../applications/networking/p2p/ncdc { }; nedit = callPackage ../applications/editors/nedit { motif = lesstif; }; netsurfBrowser = netsurf.browser; netsurf = recurseIntoAttrs (import ../applications/networking/browsers/netsurf { inherit pkgs; }); notmuch = callPackage ../applications/networking/mailreaders/notmuch { emacs = null; }; nova = callPackage ../applications/virtualization/nova { }; novaclient = callPackage ../applications/virtualization/nova/client.nix { }; nspluginwrapper = callPackage ../applications/networking/browsers/mozilla-plugins/nspluginwrapper { }; nvi = callPackage ../applications/editors/nvi { }; nvpy = callPackage ../applications/editors/nvpy { }; obconf = callPackage ../tools/X11/obconf { inherit (gnome) libglade; }; ocrad = callPackage ../applications/graphics/ocrad { }; offrss = callPackage ../applications/networking/offrss { }; ogmtools = callPackage ../applications/video/ogmtools { }; omxplayer = callPackage ../applications/video/omxplayer { }; oneteam = callPackage ../applications/networking/instant-messengers/oneteam { }; openbox = callPackage ../applications/window-managers/openbox { }; openimageio = callPackage ../applications/graphics/openimageio { }; openjump = callPackage ../applications/misc/openjump { }; openscad = callPackage ../applications/graphics/openscad { }; opera = callPackage ../applications/networking/browsers/opera { inherit (pkgs.kde4) kdelibs; }; opusfile = callPackage ../applications/audio/opusfile { }; opusTools = callPackage ../applications/audio/opus-tools { }; pamixer = callPackage ../applications/audio/pamixer { }; pan = callPackage ../applications/networking/newsreaders/pan { spellChecking = false; }; panotools = callPackage ../applications/graphics/panotools { }; pavucontrol = callPackage ../applications/audio/pavucontrol { }; paraview = callPackage ../applications/graphics/paraview { }; pencil = callPackage ../applications/graphics/pencil { }; petrifoo = callPackage ../applications/audio/petrifoo { inherit (gnome) libgnomecanvas; }; pdftk = callPackage ../tools/typesetting/pdftk { }; pdfgrep = callPackage ../tools/typesetting/pdfgrep { }; pianobar = callPackage ../applications/audio/pianobar { }; pianobooster = callPackage ../applications/audio/pianobooster { }; picard = callPackage ../applications/audio/picard { }; picocom = callPackage ../tools/misc/picocom { }; pidgin = callPackage ../applications/networking/instant-messengers/pidgin { openssl = if config.pidgin.openssl or true then openssl else null; gnutls = if config.pidgin.gnutls or false then gnutls else null; libgcrypt = if config.pidgin.gnutls or false then libgcrypt else null; startupnotification = libstartup_notification; }; pidginlatex = callPackage ../applications/networking/instant-messengers/pidgin-plugins/pidgin-latex { imagemagick = imagemagickBig; }; pidginlatexSF = builderDefsPackage (import ../applications/networking/instant-messengers/pidgin-plugins/pidgin-latex/pidgin-latex-sf.nix) { inherit pkgconfig pidgin texLive imagemagick which glib gtk; }; pidginmsnpecan = callPackage ../applications/networking/instant-messengers/pidgin-plugins/msn-pecan { }; pidginotr = callPackage ../applications/networking/instant-messengers/pidgin-plugins/otr { }; pidginsipe = callPackage ../applications/networking/instant-messengers/pidgin-plugins/sipe { }; toxprpl = callPackage ../applications/networking/instant-messengers/pidgin-plugins/tox-prpl { }; pinfo = callPackage ../applications/misc/pinfo { }; pinta = callPackage ../applications/graphics/pinta { gtksharp = gtksharp2; }; pommed = callPackage ../os-specific/linux/pommed { inherit (xorg) libXpm; }; potrace = callPackage ../applications/graphics/potrace { }; posterazor = callPackage ../applications/misc/posterazor { }; pqiv = callPackage ../applications/graphics/pqiv { }; qiv = callPackage ../applications/graphics/qiv { }; procmail = callPackage ../applications/misc/procmail { }; pstree = callPackage ../applications/misc/pstree { }; pulseview = callPackage ../applications/science/electronics/pulseview { }; puredata = callPackage ../applications/audio/puredata { }; pythonmagick = callPackage ../applications/graphics/PythonMagick { }; qbittorrent = callPackage ../applications/networking/p2p/qbittorrent { }; eiskaltdcpp = callPackage ../applications/networking/p2p/eiskaltdcpp { }; qemu = callPackage ../applications/virtualization/qemu { }; qmmp = callPackage ../applications/audio/qmmp { }; qsampler = callPackage ../applications/audio/qsampler { }; qsynth = callPackage ../applications/audio/qsynth { }; qtpfsgui = callPackage ../applications/graphics/qtpfsgui { }; qtractor = callPackage ../applications/audio/qtractor { }; quodlibet = callPackage ../applications/audio/quodlibet { inherit (pythonPackages) mutagen; }; quodlibet-with-gst-plugins = callPackage ../applications/audio/quodlibet { inherit (pythonPackages) mutagen; withGstPlugins = true; gst_plugins_bad = null; }; rakarrack = callPackage ../applications/audio/rakarrack { inherit (xorg) libXpm libXft; fltk = fltk13; }; rapcad = callPackage ../applications/graphics/rapcad { }; rapidsvn = callPackage ../applications/version-management/rapidsvn { }; ratpoison = callPackage ../applications/window-managers/ratpoison { }; rawtherapee = callPackage ../applications/graphics/rawtherapee { fftw = fftwSinglePrec; }; rcs = callPackage ../applications/version-management/rcs { }; rdesktop = callPackage ../applications/networking/remote/rdesktop { }; recode = callPackage ../tools/text/recode { }; retroshare = callPackage ../applications/networking/p2p/retroshare { qt = qt4; }; retroshare06 = lowPrio (callPackage ../applications/networking/p2p/retroshare/0.6.nix { qt = qt4; }); rsync = callPackage ../applications/networking/sync/rsync { enableACLs = !(stdenv.isDarwin || stdenv.isSunOS || stdenv.isFreeBSD); enableCopyDevicesPatch = config.rsync.enableCopyDevicesPatch or false; }; rtl-sdr = callPackage ../applications/misc/rtl-sdr { }; rubyripper = callPackage ../applications/audio/rubyripper { }; rxvt = callPackage ../applications/misc/rxvt { }; rxvt_unicode = callPackage ../applications/misc/rxvt_unicode { perlSupport = true; gdkPixbufSupport = true; unicode3Support = true; }; sakura = callPackage ../applications/misc/sakura { inherit (gnome) vte; }; sbagen = callPackage ../applications/misc/sbagen { }; scite = callPackage ../applications/editors/scite { }; scribus = callPackage ../applications/office/scribus { inherit (gnome) libart_lgpl; }; seafile-client = callPackage ../applications/networking/seafile-client { }; seeks = callPackage ../tools/networking/p2p/seeks { opencv = opencv_2_1; }; seg3d = callPackage ../applications/graphics/seg3d { wxGTK = wxGTK28.override { unicode = false; }; }; seq24 = callPackage ../applications/audio/seq24 { }; setbfree = callPackage ../applications/audio/setbfree { }; sflphone = callPackage ../applications/networking/instant-messengers/sflphone { gtk = gtk3; }; siproxd = callPackage ../applications/networking/siproxd { }; skype = callPackage_i686 ../applications/networking/instant-messengers/skype { }; skype4pidgin = callPackage ../applications/networking/instant-messengers/pidgin-plugins/skype4pidgin { }; skype_call_recorder = callPackage ../applications/networking/instant-messengers/skype-call-recorder { }; slrn = callPackage ../applications/networking/newsreaders/slrn { }; spideroak = callPackage ../applications/networking/spideroak { }; ssvnc = callPackage ../applications/networking/remote/ssvnc { }; st = callPackage ../applications/misc/st { conf = config.st.conf or null; }; linuxstopmotion = callPackage ../applications/video/linuxstopmotion { }; sweethome3d = recurseIntoAttrs (callPackage ../applications/misc/sweethome3d { } // callPackage ../applications/misc/sweethome3d/editors.nix { sweethome3dApp = sweethome3d.application; }); sxiv = callPackage ../applications/graphics/sxiv { }; bittorrentSync = callPackage ../applications/networking/bittorrentsync { }; dropbox = callPackage ../applications/networking/dropbox { }; dropbox-cli = callPackage ../applications/networking/dropbox-cli { }; lightdm = callPackage ../applications/display-managers/lightdm { }; lightdm_gtk_greeter = callPackage ../applications/display-managers/lightdm-gtk-greeter { }; slic3r = callPackage ../applications/misc/slic3r { perlPackages = perl514Packages; perl = perl514; }; curaengine = callPackage ../applications/misc/curaengine { }; cura = callPackage ../applications/misc/cura { }; printrun = callPackage ../applications/misc/printrun { }; slim = callPackage ../applications/display-managers/slim { libpng = libpng12; }; smartdeblur = callPackage ../applications/graphics/smartdeblur { }; snd = callPackage ../applications/audio/snd { }; shntool = callPackage ../applications/audio/shntool { }; sonic_visualiser = callPackage ../applications/audio/sonic-visualiser { inherit (pkgs.vamp) vampSDK; inherit (pkgs.xlibs) libX11; fftw = pkgs.fftwSinglePrec; }; sox = callPackage ../applications/misc/audio/sox { }; soxr = callPackage ../applications/misc/audio/soxr { }; spotify = callPackage ../applications/audio/spotify { inherit (gnome) GConf; libpng = libpng12; }; libspotify = callPackage ../development/libraries/libspotify { apiKey = config.libspotify.apiKey or null; }; stalonetray = callPackage ../applications/window-managers/stalonetray { }; stp = callPackage ../applications/science/logic/stp { }; stumpwm = lispPackages.stumpwm; sublime = callPackage ../applications/editors/sublime { }; sublime3 = lowPrio (callPackage ../applications/editors/sublime3 { }); subversion = callPackage ../applications/version-management/subversion/default.nix { bdbSupport = true; httpServer = false; httpSupport = true; pythonBindings = false; perlBindings = false; javahlBindings = false; saslSupport = false; httpd = apacheHttpd; sasl = cyrus_sasl; }; subversionClient = appendToName "client" (subversion.override { bdbSupport = false; perlBindings = true; pythonBindings = true; }); surf = callPackage ../applications/misc/surf { webkit = webkitgtk2; }; svk = perlPackages.SVK; swh_lv2 = callPackage ../applications/audio/swh-lv2 { }; sylpheed = callPackage ../applications/networking/mailreaders/sylpheed { sslSupport = true; gpgSupport = true; }; symlinks = callPackage ../tools/system/symlinks { }; syncthing = callPackage ../applications/networking/syncthing { }; synergy = callPackage ../applications/misc/synergy { }; tabbed = callPackage ../applications/window-managers/tabbed { }; tahoelafs = callPackage ../tools/networking/p2p/tahoe-lafs { inherit (pythonPackages) twisted foolscap simplejson nevow zfec pycryptopp sqlite3 darcsver setuptoolsTrial setuptoolsDarcs numpy pyasn1 mock; }; tailor = builderDefsPackage (import ../applications/version-management/tailor) { inherit makeWrapper python; }; tangogps = callPackage ../applications/misc/tangogps { gconf = gnome.GConf; }; teamspeak_client = callPackage ../applications/networking/instant-messengers/teamspeak/client.nix { }; teamspeak_server = callPackage ../applications/networking/instant-messengers/teamspeak/server.nix { }; taskjuggler = callPackage ../applications/misc/taskjuggler { }; taskwarrior = callPackage ../applications/misc/taskwarrior { }; taskserver = callPackage ../servers/misc/taskserver { }; telegram-cli = callPackage ../applications/networking/instant-messengers/telegram-cli/default.nix { }; telepathy_gabble = callPackage ../applications/networking/instant-messengers/telepathy/gabble { }; telepathy_haze = callPackage ../applications/networking/instant-messengers/telepathy/haze { }; telepathy_logger = callPackage ../applications/networking/instant-messengers/telepathy/logger { }; telepathy_mission_control = callPackage ../applications/networking/instant-messengers/telepathy/mission-control { }; telepathy_rakia = callPackage ../applications/networking/instant-messengers/telepathy/rakia { }; telepathy_salut = callPackage ../applications/networking/instant-messengers/telepathy/salut { }; terminator = callPackage ../applications/misc/terminator { vte = gnome.vte.override { pythonSupport = true; }; inherit (pythonPackages) notify; }; tesseract = callPackage ../applications/graphics/tesseract { }; thinkingRock = callPackage ../applications/misc/thinking-rock { }; thunderbird = callPackage ../applications/networking/mailreaders/thunderbird { inherit (gnome) libIDL; inherit (pythonPackages) pysqlite; libpng = libpng_apng; }; thunderbird-bin = callPackage ../applications/networking/mailreaders/thunderbird-bin { gconf = pkgs.gnome.GConf; inherit (pkgs.gnome) libgnome libgnomeui; inherit (pkgs.xlibs) libX11 libXScrnSaver libXext libXinerama libXrender libXt; }; tig = gitAndTools.tig; timidity = callPackage ../tools/misc/timidity { }; tint2 = callPackage ../applications/misc/tint2 { }; tkcvs = callPackage ../applications/version-management/tkcvs { }; tla = callPackage ../applications/version-management/arch { }; todo-txt-cli = callPackage ../applications/office/todo.txt-cli { }; torchat = callPackage ../applications/networking/instant-messengers/torchat { wrapPython = pythonPackages.wrapPython; }; toxic = callPackage ../applications/networking/instant-messengers/toxic { }; transcode = callPackage ../applications/audio/transcode { }; transmission = callPackage ../applications/networking/p2p/transmission { }; transmission_gtk = transmission.override { enableGTK3 = true; }; transmission_remote_gtk = callPackage ../applications/networking/p2p/transmission-remote-gtk { }; trayer = callPackage ../applications/window-managers/trayer { }; tree = callPackage ../tools/system/tree { }; tribler = callPackage ../applications/networking/p2p/tribler { }; twister = callPackage ../applications/networking/p2p/twister { }; twmn = callPackage ../applications/misc/twmn { }; twinkle = callPackage ../applications/networking/instant-messengers/twinkle { }; umurmur = callPackage ../applications/networking/umurmur { }; unison = callPackage ../applications/networking/sync/unison { inherit (ocamlPackages) lablgtk; enableX11 = config.unison.enableX11 or true; }; uucp = callPackage ../tools/misc/uucp { }; uvccapture = callPackage ../applications/video/uvccapture { }; uwimap = callPackage ../tools/networking/uwimap { }; uzbl = callPackage ../applications/networking/browsers/uzbl { webkit = webkitgtk2; }; uTox = callPackage ../applications/networking/instant-messengers/utox { }; vanitygen = callPackage ../applications/misc/vanitygen { }; vbindiff = callPackage ../applications/editors/vbindiff { }; vcprompt = callPackage ../applications/version-management/vcprompt { }; vdpauinfo = callPackage ../tools/X11/vdpauinfo { }; veracity = callPackage ../applications/version-management/veracity { }; viewMtn = builderDefsPackage (import ../applications/version-management/viewmtn/0.10.nix) { inherit monotone cheetahTemplate highlight ctags makeWrapper graphviz which python; flup = pythonPackages.flup; }; vim = callPackage ../applications/editors/vim { }; macvim = callPackage ../applications/editors/vim/macvim.nix { }; vimHugeX = vim_configurable; vim_configurable = callPackage ../applications/editors/vim/configurable.nix { inherit (pkgs) fetchurl fetchhg stdenv ncurses pkgconfig gettext composableDerivation lib config glib gtk python perl tcl ruby; inherit (pkgs.xlibs) libX11 libXext libSM libXpm libXt libXaw libXau libXmu libICE; features = "huge"; lua = pkgs.lua5; gui = config.vim.gui or "auto"; flags = [ "python" "X11" ]; inherit stdenvAdapters gccApple; }; vimNox = lowPrio (vim_configurable.override { source = "vim-nox"; }); qvim = lowPrio (callPackage ../applications/editors/vim/qvim.nix { inherit (pkgs) fetchgit stdenv ncurses pkgconfig gettext composableDerivation lib config python perl tcl ruby qt4; inherit (pkgs.xlibs) libX11 libXext libSM libXpm libXt libXaw libXau libXmu libICE; inherit (pkgs) stdenvAdapters gccApple; features = "huge"; lua = pkgs.lua5; flags = [ "python" "X11" ]; }); vimpc = callPackage ../applications/audio/vimpc { }; virtviewer = callPackage ../applications/virtualization/virt-viewer { gtkvnc = gtkvnc.override { enableGTK3 = true; }; spice_gtk = spice_gtk.override { enableGTK3 = true; }; }; virtmanager = callPackage ../applications/virtualization/virt-manager { inherit (gnome) gnome_python; vte = gnome3.vte; dconf = gnome3.dconf; gtkvnc = gtkvnc.override { enableGTK3 = true; }; spice_gtk = spice_gtk.override { enableGTK3 = true; }; }; virtinst = callPackage ../applications/virtualization/virtinst { }; virtualgl = callPackage ../tools/X11/virtualgl { }; bumblebee = callPackage ../tools/X11/bumblebee { }; vkeybd = callPackage ../applications/audio/vkeybd { inherit (xlibs) libX11; }; vlc = callPackage ../applications/video/vlc { }; vmpk = callPackage ../applications/audio/vmpk { }; vnstat = callPackage ../applications/networking/vnstat { }; vorbisTools = callPackage ../applications/audio/vorbis-tools { }; vue = callPackage ../applications/misc/vue { jre = icedtea7_jre; }; vwm = callPackage ../applications/window-managers/vwm { }; vym = callPackage ../applications/misc/vym { }; w3m = callPackage ../applications/networking/browsers/w3m { graphicsSupport = false; }; weechat = callPackage ../applications/networking/irc/weechat { }; weechatDevel = lowPrio (callPackage ../applications/networking/irc/weechat/devel.nix { }); weston = callPackage ../applications/window-managers/weston { }; windowmaker = callPackage ../applications/window-managers/windowmaker { }; winswitch = callPackage ../tools/X11/winswitch { }; wings = callPackage ../applications/graphics/wings { erlang = erlangR14; esdl = esdl.override { erlang = erlangR14; }; }; wmname = callPackage ../applications/misc/wmname { }; wmctrl = callPackage ../tools/X11/wmctrl { }; wmiimenu = import ../applications/window-managers/wmii31 { libixp = libixp_for_wmii; inherit fetchurl stdenv gawk; inherit (xlibs) libX11; }; wmiiSnap = import ../applications/window-managers/wmii { libixp = libixp_for_wmii; inherit fetchurl stdenv gawk; inherit (xlibs) libX11 xextproto libXt libXext; includeUnpack = config.stdenv.includeUnpack or false; }; wordnet = callPackage ../applications/misc/wordnet { }; wrapChromium = browser: wrapFirefox { inherit browser; browserName = browser.packageName; desktopName = "Chromium"; icon = "${browser}/share/icons/hicolor/48x48/apps/${browser.packageName}.png"; }; wrapFirefox = { browser, browserName ? "firefox", desktopName ? "Firefox", icon ? "${browser}/lib/${browser.name}/browser/icons/mozicon128.png", nameSuffix ? "" }: let cfg = stdenv.lib.attrByPath [ browserName ] { } config; enableAdobeFlash = cfg.enableAdobeFlash or false; enableGnash = cfg.enableGnash or false; in import ../applications/networking/browsers/firefox/wrapper.nix { inherit stdenv lib makeWrapper makeDesktopItem browser browserName desktopName nameSuffix icon; plugins = assert !(enableGnash && enableAdobeFlash); [ ] ++ lib.optional enableGnash gnash ++ lib.optional enableAdobeFlash flashplayer ++ lib.optional (cfg.enableDjvu or false) djview4 ++ lib.optional (cfg.enableMPlayer or false) (MPlayerPlugin browser) ++ lib.optional (cfg.enableGeckoMediaPlayer or false) gecko_mediaplayer ++ lib.optional (supportsJDK && (cfg.jre or false && jrePlugin ? mozillaPlugin)) jrePlugin ++ lib.optional (cfg.enableGoogleTalkPlugin or false) google_talk_plugin ++ lib.optional (cfg.enableFriBIDPlugin or false) fribid ++ lib.optional (cfg.enableGnomeExtensions or false) gnome3.gnome_shell; libs = [ gstreamer gst_plugins_base ] ++ lib.optionals (cfg.enableQuakeLive or false) (with xlibs; [ stdenv.gcc libX11 libXxf86dga libXxf86vm libXext libXt alsaLib zlib ]); gtk_modules = [ libcanberra ]; }; x11vnc = callPackage ../tools/X11/x11vnc { }; x2vnc = callPackage ../tools/X11/x2vnc { }; xaos = builderDefsPackage (import ../applications/graphics/xaos) { inherit (xlibs) libXt libX11 libXext xextproto xproto; inherit gsl aalib zlib intltool gettext perl; libpng = libpng12; }; xara = callPackage ../applications/graphics/xara { }; xawtv = callPackage ../applications/video/xawtv { }; xbindkeys = callPackage ../tools/X11/xbindkeys { }; xbmc = callPackage ../applications/video/xbmc { ffmpeg = ffmpeg_1; }; xca = callPackage ../applications/misc/xca { }; xcalib = callPackage ../tools/X11/xcalib { }; xcape = callPackage ../tools/X11/xcape { }; xchainkeys = callPackage ../tools/X11/xchainkeys { }; xchat = callPackage ../applications/networking/irc/xchat { }; xchm = callPackage ../applications/misc/xchm { }; xcompmgr = callPackage ../applications/window-managers/xcompmgr { }; compton = callPackage ../applications/window-managers/compton { }; xdaliclock = callPackage ../tools/misc/xdaliclock { }; xdg-user-dirs = callPackage ../tools/X11/xdg-user-dirs { }; xdg_utils = callPackage ../tools/X11/xdg-utils { }; xdotool = callPackage ../tools/X11/xdotool { }; xen = callPackage ../applications/virtualization/xen { stdenv = overrideGCC stdenv gcc45; }; xfe = callPackage ../applications/misc/xfe { fox = fox_1_6; }; xfig = callPackage ../applications/graphics/xfig { }; xineUI = callPackage ../applications/video/xine-ui { }; xneur_0_13 = callPackage ../applications/misc/xneur { }; xneur_0_8 = callPackage ../applications/misc/xneur/0.8.nix { }; xneur = xneur_0_13; gxneur = callPackage ../applications/misc/gxneur { inherit (gnome) libglade GConf; }; xournal = callPackage ../applications/graphics/xournal { inherit (gnome) libgnomeprint libgnomeprintui libgnomecanvas; }; xpdf = callPackage ../applications/misc/xpdf { motif = lesstif; base14Fonts = "${ghostscript}/share/ghostscript/fonts"; }; xkb_switch = callPackage ../tools/X11/xkb-switch { }; libxpdf = callPackage ../applications/misc/xpdf/libxpdf.nix { }; xpra = callPackage ../tools/X11/xpra { }; xrestop = callPackage ../tools/X11/xrestop { }; xscreensaver = callPackage ../misc/screensavers/xscreensaver { inherit (gnome) libglade; }; xsynth_dssi = callPackage ../applications/audio/xsynth-dssi { }; xterm = callPackage ../applications/misc/xterm { }; finalterm = callPackage ../applications/misc/finalterm { }; xtrace = callPackage ../tools/X11/xtrace { }; xlaunch = callPackage ../tools/X11/xlaunch { }; xmacro = callPackage ../tools/X11/xmacro { }; xmove = callPackage ../applications/misc/xmove { }; xmp = callPackage ../applications/audio/xmp { }; xnee = callPackage ../tools/X11/xnee { stdenv = overrideInStdenv stdenv [ gnumake381 ]; }; xvidcap = callPackage ../applications/video/xvidcap { inherit (gnome) scrollkeeper libglade; }; yate = callPackage ../applications/misc/yate { }; inherit (gnome3) yelp; qgis = callPackage ../applications/misc/qgis { }; qtbitcointrader = callPackage ../applications/misc/qtbitcointrader { }; ykpers = callPackage ../applications/misc/ykpers { }; yoshimi = callPackage ../applications/audio/yoshimi { fltk = fltk13; }; zathuraCollection = recurseIntoAttrs (let callPackage = newScope pkgs.zathuraCollection; in import ../applications/misc/zathura { inherit callPackage pkgs fetchurl; useMupdf = config.zathura.useMupdf or false; }); zathura = zathuraCollection.zathuraWrapper; zed = callPackage ../applications/editors/zed { }; zeroc_ice = callPackage ../development/libraries/zeroc-ice { }; girara = callPackage ../applications/misc/girara { gtk = gtk3; }; zgrviewer = callPackage ../applications/graphics/zgrviewer { }; zotero = callPackage ../applications/office/zotero { xulrunner = xulrunner_30; }; zynaddsubfx = callPackage ../applications/audio/zynaddsubfx { }; alienarena = callPackage ../games/alienarena { }; andyetitmoves = if stdenv.isLinux then callPackage ../games/andyetitmoves { } else null; anki = callPackage ../games/anki { }; asc = callPackage ../games/asc { lua = lua5; libsigcxx = libsigcxx12; }; astromenace = callPackage ../games/astromenace { }; atanks = callPackage ../games/atanks { }; ballAndPaddle = callPackage ../games/ball-and-paddle { guile = guile_1_8; }; bitsnbots = callPackage ../games/bitsnbots { lua = lua5; }; blackshades = callPackage ../games/blackshades { }; blackshadeselite = callPackage ../games/blackshadeselite { }; blobby = callPackage ../games/blobby { }; bsdgames = callPackage ../games/bsdgames { }; btanks = callPackage ../games/btanks { }; bzflag = callPackage ../games/bzflag { }; castle_combat = callPackage ../games/castle-combat { }; chessdb = callPackage ../games/chessdb { }; construoBase = lowPrio (callPackage ../games/construo { mesa = null; freeglut = null; }); construo = construoBase.override { inherit mesa freeglut; }; crack_attack = callPackage ../games/crack-attack { }; crafty = callPackage ../games/crafty { }; craftyFull = appendToName "full" (crafty.override { fullVariant = true; }); crrcsim = callPackage ../games/crrcsim { }; dhewm3 = callPackage ../games/dhewm3 { }; drumkv1 = callPackage ../applications/audio/drumkv1 { }; dwarf_fortress = callPackage_i686 ../games/dwarf-fortress { SDL_image = pkgsi686Linux.SDL_image.override { libpng = pkgsi686Linux.libpng12; }; }; dwarf_fortress_2014 = callPackage_i686 ../games/dwarf-fortress/df2014.nix { SDL_image = pkgsi686Linux.SDL_image.override { libpng = pkgsi686Linux.libpng12; }; }; dwarf_fortress_modable = appendToName "moddable" (dwarf_fortress.override { copyDataDirectory = true; }); dwarf_fortress_2014_modable = appendToName "moddable" (dwarf_fortress_2014.override { copyDataDirectory = true; }); dwarf-therapist = callPackage ../games/dwarf-therapist { }; d1x_rebirth = callPackage ../games/d1x-rebirth { }; d2x_rebirth = callPackage ../games/d2x-rebirth { }; eboard = callPackage ../games/eboard { }; eduke32 = callPackage ../games/eduke32 { }; egoboo = callPackage ../games/egoboo { }; exult = callPackage ../games/exult { }; flightgear = callPackage ../games/flightgear { }; freeciv = callPackage ../games/freeciv { }; freeciv_gtk = callPackage ../games/freeciv { gtkClient = true; sdlClient = false; }; freedink = callPackage ../games/freedink { }; fsg = callPackage ../games/fsg { wxGTK = wxGTK28.override { unicode = false; }; }; gemrb = callPackage ../games/gemrb { }; gl117 = callPackage ../games/gl-117 { }; glestae = callPackage ../games/glestae { }; globulation2 = callPackage ../games/globulation { }; gltron = callPackage ../games/gltron { }; gnuchess = callPackage ../games/gnuchess { }; gnugo = callPackage ../games/gnugo { }; gparted = callPackage ../tools/misc/gparted { }; gsmartcontrol = callPackage ../tools/misc/gsmartcontrol { inherit (gnome) libglademm; }; gtypist = callPackage ../games/gtypist { }; hexen = callPackage ../games/hexen { }; icbm3d = callPackage ../games/icbm3d { }; ingen = callPackage ../applications/audio/ingen { }; instead = callPackage ../games/instead { lua = lua5; }; kobodeluxe = callPackage ../games/kobodeluxe { }; lincity = builderDefsPackage (import ../games/lincity) { inherit (xlibs) libX11 libXext xextproto libICE libSM xproto; inherit libpng zlib; }; lincity_ng = callPackage ../games/lincity/ng.nix { }; mars = callPackage ../games/mars { }; micropolis = callPackage ../games/micropolis { }; mnemosyne = callPackage ../games/mnemosyne { inherit (pythonPackages) matplotlib cherrypy sqlite3; }; naev = callPackage ../games/naev { }; nexuiz = callPackage ../games/nexuiz { }; njam = callPackage ../games/njam { }; oilrush = callPackage ../games/oilrush { }; openra = callPackage ../games/openra { }; openttd = callPackage ../games/openttd { zlib = zlibStatic; }; opentyrian = callPackage ../games/opentyrian { }; openxcom = callPackage ../games/openxcom { }; pingus = callPackage ../games/pingus { }; pioneers = callPackage ../games/pioneers { }; pong3d = callPackage ../games/pong3d { }; prboom = callPackage ../games/prboom { }; quake3demo = callPackage ../games/quake3/wrapper { name = "quake3-demo-${quake3game.name}"; description = "Demo of Quake 3 Arena, a classic first-person shooter"; game = quake3game; paks = [ quake3demodata ]; }; quake3demodata = callPackage ../games/quake3/demo { }; quake3game = callPackage ../games/quake3/game { }; quantumminigolf = callPackage ../games/quantumminigolf { }; racer = callPackage ../games/racer { }; residualvm = callPackage ../games/residualvm { openglSupport = mesaSupported; }; rigsofrods = callPackage ../games/rigsofrods { mygui = myguiSvn; }; rili = callPackage ../games/rili { }; rogue = callPackage ../games/rogue { }; samplv1 = callPackage ../applications/audio/samplv1 { }; sauerbraten = callPackage ../games/sauerbraten { }; scid = callPackage ../games/scid { }; scummvm = callPackage ../games/scummvm { }; scorched3d = callPackage ../games/scorched3d { }; sdlmame = callPackage ../games/sdlmame { }; sgtpuzzles = builderDefsPackage (import ../games/sgt-puzzles) { inherit pkgconfig fetchsvn perl gtk; inherit (xlibs) libX11; }; simutrans = callPackage ../games/simutrans { }; soi = callPackage ../games/soi { }; spaceOrbit = callPackage ../games/orbit { }; spring = callPackage ../games/spring { }; springLobby = callPackage ../games/spring/springlobby.nix { }; stardust = callPackage ../games/stardust { }; steam = callPackage_i686 ../games/steam { }; steamChrootEnv = callPackage_i686 ../games/steam/chrootenv.nix { zenity = gnome2.zenity; }; stuntrally = callPackage ../games/stuntrally { }; superTux = callPackage ../games/super-tux { }; superTuxKart = callPackage ../games/super-tux-kart { }; synthv1 = callPackage ../applications/audio/synthv1 { }; tbe = callPackage ../games/the-butterfly-effect { }; teetertorture = callPackage ../games/teetertorture { }; teeworlds = callPackage ../games/teeworlds { }; tennix = callPackage ../games/tennix { }; tibia = callPackage ../games/tibia { }; tintin = callPackage ../games/tintin { }; tpm = callPackage ../games/thePenguinMachine { }; tremulous = callPackage ../games/tremulous { }; speed_dreams = callPackage ../games/speed-dreams { plib = plib.override { enablePIC = !stdenv.isi686; }; libpng = libpng12; }; torcs = callPackage ../games/torcs { plib = plib.override { enablePIC = !stdenv.isi686; }; }; trigger = callPackage ../games/trigger { }; typespeed = callPackage ../games/typespeed { }; ufoai = callPackage ../games/ufoai { }; ultimatestunts = callPackage ../games/ultimatestunts { }; ultrastardx = callPackage ../games/ultrastardx { ffmpeg = ffmpeg_0_6; lua = lua5; }; unvanquished = callPackage ../games/unvanquished { }; uqm = callPackage ../games/uqm { }; urbanterror = callPackage ../games/urbanterror { }; ut2004demo = callPackage ../games/ut2004demo { }; vdrift = callPackage ../games/vdrift { }; vectoroids = callPackage ../games/vectoroids { }; vessel = callPackage_i686 ../games/vessel { }; warmux = callPackage ../games/warmux { }; warsow = callPackage ../games/warsow { libjpeg = libjpeg62; }; warzone2100 = callPackage ../games/warzone2100 { }; widelands = callPackage ../games/widelands { lua = lua5_1; }; worldofgoo_demo = callPackage ../games/worldofgoo { demo = true; }; worldofgoo = callPackage ../games/worldofgoo { }; xboard = callPackage ../games/xboard { }; xconq = callPackage ../games/xconq { }; xonotic = callPackage ../games/xonotic { }; xskat = callPackage ../games/xskat { }; xsokoban = builderDefsPackage (import ../games/xsokoban) { inherit (xlibs) libX11 xproto libXpm libXt; }; zdoom = callPackage ../games/zdoom { }; zod = callPackage ../games/zod { }; zoom = callPackage ../games/zoom { }; keen4 = callPackage ../games/keen4 { }; zeroad = callPackage ../games/0ad { }; cinnamon = recurseIntoAttrs rec { callPackage = newScope pkgs.cinnamon; inherit (gnome3) gnome_common libgnomekbd gnome-menus zenity; muffin = callPackage ../desktops/cinnamon/muffin.nix { }; cinnamon-control-center = callPackage ../desktops/cinnamon/cinnamon-control-center.nix { }; cinnamon-settings-daemon = callPackage ../desktops/cinnamon/cinnamon-settings-daemon.nix { }; cinnamon-session = callPackage ../desktops/cinnamon/cinnamon-session.nix { }; cinnamon-desktop = callPackage ../desktops/cinnamon/cinnamon-desktop.nix { }; cinnamon-translations = callPackage ../desktops/cinnamon/cinnamon-translations.nix { }; cjs = callPackage ../desktops/cinnamon/cjs.nix { }; }; enlightenment = callPackage ../desktops/enlightenment { }; e17 = recurseIntoAttrs (let callPackage = newScope pkgs.e17; in import ../desktops/e17 { inherit callPackage pkgs; }); e18 = recurseIntoAttrs (let callPackage = newScope pkgs.e18; in import ../desktops/e18 { inherit callPackage pkgs; }); gnome2 = callPackage ../desktops/gnome-2 { callPackage = pkgs.newScope pkgs.gnome2; self = pkgs.gnome2; } // pkgs.gtkLibs // { inherit (pkgs) libsoup libwnck gtk_doc gnome_doc_utils; }; gnome3 = recurseIntoAttrs (callPackage ../desktops/gnome-3/3.10 { callPackage = pkgs.newScope pkgs.gnome3; self = pkgs.gnome3; }); gnome3_12 = recurseIntoAttrs (callPackage ../desktops/gnome-3/3.12 { callPackage = pkgs.newScope pkgs.gnome3_12; }); gnome = recurseIntoAttrs gnome2; hsetroot = callPackage ../tools/X11/hsetroot { }; kakasi = callPackage ../tools/text/kakasi { }; kde4 = recurseIntoAttrs pkgs.kde412; kde4_next = recurseIntoAttrs (lib.lowPrioSet pkgs.kde412); kde412 = kdePackagesFor (pkgs.kde412 // { eigen = eigen2; libusb = libusb1; libcanberra = libcanberra_kde; }) ../desktops/kde-4.12; kdePackagesFor = self: dir: let callPackageOrig = callPackage; in let callPackage = newScope self; kde4 = callPackageOrig dir { inherit callPackage callPackageOrig; }; in kde4 // { inherit kde4; wrapper = callPackage ../build-support/kdewrapper { }; recurseForRelease = true; akunambol = callPackage ../applications/networking/sync/akunambol { }; amarok = callPackage ../applications/audio/amarok { }; bangarang = callPackage ../applications/video/bangarang { }; basket = callPackage ../applications/office/basket { }; bluedevil = callPackage ../tools/bluetooth/bluedevil { }; calligra = callPackage ../applications/office/calligra { }; colord-kde = callPackage ../tools/misc/colord-kde { }; digikam = if builtins.compareVersions "4.9" kde4.release == 1 then callPackage ../applications/graphics/digikam/2.nix { } else callPackage ../applications/graphics/digikam { }; eventlist = callPackage ../applications/office/eventlist { }; k3b = callPackage ../applications/misc/k3b { }; kadu = callPackage ../applications/networking/instant-messengers/kadu { }; kbibtex = callPackage ../applications/office/kbibtex { }; kde_gtk_config = callPackage ../tools/misc/kde-gtk-config { }; kde_wacomtablet = callPackage ../applications/misc/kde-wacomtablet { }; kdeconnect = callPackage ../applications/misc/kdeconnect { }; kdenlive = callPackage ../applications/video/kdenlive { mlt = mlt-qt4; }; kdesvn = callPackage ../applications/version-management/kdesvn { }; kdevelop = callPackage ../applications/editors/kdevelop { }; kdevplatform = callPackage ../development/libraries/kdevplatform { }; kdiff3 = callPackage ../tools/text/kdiff3 { }; kile = callPackage ../applications/editors/kile { }; kmplayer = callPackage ../applications/video/kmplayer { }; kmymoney = callPackage ../applications/office/kmymoney { }; kipi_plugins = callPackage ../applications/graphics/kipi-plugins { }; konversation = callPackage ../applications/networking/irc/konversation { }; kvirc = callPackage ../applications/networking/irc/kvirc { }; krename = callPackage ../applications/misc/krename { }; krusader = callPackage ../applications/misc/krusader { }; ksshaskpass = callPackage ../tools/security/ksshaskpass { }; ktorrent = callPackage ../applications/networking/p2p/ktorrent { }; kuickshow = callPackage ../applications/graphics/kuickshow { }; libalkimia = callPackage ../development/libraries/libalkimia { }; libktorrent = callPackage ../development/libraries/libktorrent { }; libkvkontakte = callPackage ../development/libraries/libkvkontakte { }; liblikeback = callPackage ../development/libraries/liblikeback { }; libmm-qt = callPackage ../development/libraries/libmm-qt { }; libnm-qt = callPackage ../development/libraries/libnm-qt { }; networkmanagement = callPackage ../tools/networking/networkmanagement { }; partitionManager = callPackage ../tools/misc/partition-manager { }; plasma-nm = callPackage ../tools/networking/plasma-nm { }; polkit_kde_agent = callPackage ../tools/security/polkit-kde-agent { }; psi = callPackage ../applications/networking/instant-messengers/psi { }; qtcurve = callPackage ../misc/themes/qtcurve { }; quassel = callPackage ../applications/networking/irc/quassel { dconf = gnome3.dconf; }; quasselWithoutKDE = self.quassel.override { withKDE = false; tag = "-without-kde"; }; quasselDaemon = self.quassel.override { monolithic = false; daemon = true; tag = "-daemon"; }; quasselClient = self.quassel.override { monolithic = false; client = true; tag = "-client"; }; quasselClientWithoutKDE = self.quasselClient.override { withKDE = false; tag = "-client-without-kde"; }; rekonq = callPackage ../applications/networking/browsers/rekonq { }; kwebkitpart = callPackage ../applications/networking/browsers/kwebkitpart { }; rsibreak = callPackage ../applications/misc/rsibreak { }; semnotes = callPackage ../applications/misc/semnotes { }; skrooge = callPackage ../applications/office/skrooge { }; telepathy = callPackage ../applications/networking/instant-messengers/telepathy/kde { }; yakuake = callPackage ../applications/misc/yakuake { }; zanshin = callPackage ../applications/office/zanshin { }; kwooty = callPackage ../applications/networking/newsreaders/kwooty { }; }; redshift = callPackage ../applications/misc/redshift { inherit (xorg) libX11 libXrandr libxcb randrproto libXxf86vm xf86vidmodeproto; inherit (gnome) GConf; inherit (pythonPackages) pyxdg; geoclue = geoclue2; }; oxygen_gtk = callPackage ../misc/themes/gtk2/oxygen-gtk { }; gtk_engines = callPackage ../misc/themes/gtk2/gtk-engines { }; gtk-engine-murrine = callPackage ../misc/themes/gtk2/gtk-engine-murrine { }; gnome_themes_standard = gnome3.gnome_themes_standard; mate-icon-theme = callPackage ../misc/themes/mate-icon-theme { }; mate-themes = callPackage ../misc/themes/mate-themes { }; xfce = xfce4_10; xfce4_10 = recurseIntoAttrs (import ../desktops/xfce { inherit pkgs newScope; }); drgeo = builderDefsPackage (import ../applications/science/geometry/drgeo) { inherit (gnome) libglade; inherit libxml2 perl intltool libtool pkgconfig gtk; guile = guile_1_8; }; tetgen = callPackage ../applications/science/geometry/tetgen { }; alliance = callPackage ../applications/science/electronics/alliance { motif = lesstif; }; arb = callPackage ../applications/science/biology/arb { lesstif = lesstif93; }; archimedes = callPackage ../applications/science/electronics/archimedes { }; biolib = callPackage ../development/libraries/science/biology/biolib { }; emboss = callPackage ../applications/science/biology/emboss { }; mrbayes = callPackage ../applications/science/biology/mrbayes { }; ncbiCTools = builderDefsPackage ../development/libraries/ncbi { inherit tcsh mesa lesstif; inherit (xlibs) libX11 libXaw xproto libXt libSM libICE libXmu libXext; }; ncbi_tools = callPackage ../applications/science/biology/ncbi-tools { }; paml = callPackage ../applications/science/biology/paml { }; pal2nal = callPackage ../applications/science/biology/pal2nal { }; plink = callPackage ../applications/science/biology/plink/default.nix { }; arpack = callPackage ../development/libraries/science/math/arpack { }; atlas = callPackage ../development/libraries/science/math/atlas { tolerateCpuTimingInaccuracy = true; }; blas = callPackage ../development/libraries/science/math/blas { }; content = builderDefsPackage ../applications/science/math/content { inherit mesa lesstif; inherit (xlibs) libX11 libXaw xproto libXt libSM libICE libXmu libXext libXcursor; }; jags = callPackage ../applications/science/math/jags { }; liblapack = callPackage ../development/libraries/science/math/liblapack { }; liblapack_3_5_0 = callPackage ../development/libraries/science/math/liblapack/3.5.0.nix { }; liblbfgs = callPackage ../development/libraries/science/math/liblbfgs { }; openblas = callPackage ../development/libraries/science/math/openblas { }; openblas_0_2_10 = callPackage ../development/libraries/science/math/openblas/0.2.10.nix { liblapack = liblapack_3_5_0; }; mathematica = callPackage ../applications/science/math/mathematica { }; sage = callPackage ../applications/science/math/sage { }; gromacs = callPackage ../applications/science/molecular-dynamics/gromacs { singlePrec = true; fftw = fftwSinglePrec; cmake = cmakeCurses; }; gromacsDouble = lowPrio (callPackage ../applications/science/molecular-dynamics/gromacs { singlePrec = false; fftw = fftw; cmake = cmakeCurses; }); abc-verifier = callPackage ../applications/science/logic/abc { }; alt-ergo = callPackage ../applications/science/logic/alt-ergo { }; coq = callPackage ../applications/science/logic/coq { inherit (ocamlPackages) findlib lablgtk; camlp5 = ocamlPackages.camlp5_transitional; }; coq_HEAD = callPackage ../applications/science/logic/coq/HEAD.nix { inherit (ocamlPackages) findlib lablgtk; camlp5 = ocamlPackages.camlp5_transitional; }; coq_8_3 = callPackage ../applications/science/logic/coq/8.3.nix { inherit (ocamlPackages) findlib lablgtk; camlp5 = ocamlPackages.camlp5_transitional; }; cvc3 = callPackage ../applications/science/logic/cvc3 { }; ekrhyper = callPackage ../applications/science/logic/ekrhyper { }; eprover = callPackage ../applications/science/logic/eprover { texLive = texLiveAggregationFun { paths = [ texLive texLiveExtra ]; }; }; ginac = callPackage ../applications/science/math/ginac { }; hol = callPackage ../applications/science/logic/hol { }; hol_light = callPackage ../applications/science/logic/hol_light { inherit (ocamlPackages) findlib; camlp5 = ocamlPackages.camlp5_strict; }; isabelle = import ../applications/science/logic/isabelle { inherit (pkgs) stdenv fetchurl nettools perl polyml; inherit (pkgs.emacs24Packages) proofgeneral; }; iprover = callPackage ../applications/science/logic/iprover { }; leo2 = callPackage ../applications/science/logic/leo2 { }; logisim = callPackage ../applications/science/logic/logisim { }; ltl2ba = callPackage ../applications/science/logic/ltl2ba { }; matita = callPackage ../applications/science/logic/matita { ocaml = ocaml_3_11_2; inherit (ocamlPackages_3_11_2) findlib lablgtk ocaml_expat gmetadom ocaml_http lablgtkmathview ocaml_mysql ocaml_sqlite3 ocamlnet camlzip ocaml_pcre; ulex08 = ocamlPackages_3_11_2.ulex08.override { camlp5 = ocamlPackages_3_11_2.camlp5_5_transitional; }; }; matita_130312 = lowPrio (callPackage ../applications/science/logic/matita/130312.nix { inherit (ocamlPackages) findlib lablgtk ocaml_expat gmetadom ocaml_http ocaml_mysql ocamlnet ulex08 camlzip ocaml_pcre; }); minisat = callPackage ../applications/science/logic/minisat { }; opensmt = callPackage ../applications/science/logic/opensmt { }; otter = callPackage ../applications/science/logic/otter { }; picosat = callPackage ../applications/science/logic/picosat { }; prooftree = callPackage ../applications/science/logic/prooftree { inherit (ocamlPackages) findlib lablgtk; camlp5 = ocamlPackages.camlp5_transitional; }; prover9 = callPackage ../applications/science/logic/prover9 { }; satallax = callPackage ../applications/science/logic/satallax { }; spass = callPackage ../applications/science/logic/spass { }; ssreflect = callPackage ../applications/science/logic/ssreflect { camlp5 = ocamlPackages.camlp5_transitional; }; tptp = callPackage ../applications/science/logic/tptp { }; twelf = callPackage ../applications/science/logic/twelf { smlnj = if stdenv.isDarwin then smlnjBootstrap else smlnj; }; verifast = callPackage ../applications/science/logic/verifast { }; why3 = callPackage ../applications/science/logic/why3 { }; yices = callPackage ../applications/science/logic/yices { }; z3 = callPackage ../applications/science/logic/z3 { }; boolector = boolector15; boolector15 = callPackage ../applications/science/logic/boolector { }; boolector16 = lowPrio (callPackage ../applications/science/logic/boolector { useV16 = true; }); eagle = callPackage_i686 ../applications/science/electronics/eagle { }; caneda = callPackage ../applications/science/electronics/caneda { }; gtkwave = callPackage ../applications/science/electronics/gtkwave { }; kicad = callPackage ../applications/science/electronics/kicad { wxGTK = wxGTK29; }; ngspice = callPackage ../applications/science/electronics/ngspice { }; qucs = callPackage ../applications/science/electronics/qucs { }; xoscope = callPackage ../applications/science/electronics/xoscope { }; ecm = callPackage ../applications/science/math/ecm { }; eukleides = callPackage ../applications/science/math/eukleides { texinfo = texinfo4; }; fricas = callPackage ../applications/science/math/fricas { }; gap = callPackage ../applications/science/math/gap { }; maxima = callPackage ../applications/science/math/maxima { }; wxmaxima = callPackage ../applications/science/math/wxmaxima { }; pari = callPackage ../applications/science/math/pari { }; pspp = callPackage ../applications/science/math/pssp { inherit (gnome) libglade gtksourceview; }; singular = callPackage ../applications/science/math/singular { }; scilab = callPackage ../applications/science/math/scilab { withXaw3d = false; withTk = true; withGtk = false; withOCaml = true; withX = true; }; msieve = callPackage ../applications/science/math/msieve { }; weka = callPackage ../applications/science/math/weka { }; yad = callPackage ../tools/misc/yad { }; yacas = callPackage ../applications/science/math/yacas { }; speedcrunch = callPackage ../applications/science/math/speedcrunch { qt = qt4; cmake = cmakeCurses; }; boinc = callPackage ../applications/science/misc/boinc { }; celestia = callPackage ../applications/science/astronomy/celestia { lua = lua5_1; inherit (xlibs) libXmu; inherit (pkgs.gnome) gtkglext; }; fityk = callPackage ../applications/science/misc/fityk { }; gravit = callPackage ../applications/science/astronomy/gravit { }; golly = callPackage ../applications/science/misc/golly { }; megam = callPackage ../applications/science/misc/megam { }; root = callPackage ../applications/science/misc/root { }; simgrid = callPackage ../applications/science/misc/simgrid { }; spyder = callPackage ../applications/science/spyder { inherit (pythonPackages) pyflakes rope sphinx numpy scipy matplotlib; inherit (pythonPackages) ipython pep8; inherit pylint; }; stellarium = callPackage ../applications/science/astronomy/stellarium { }; tulip = callPackage ../applications/science/misc/tulip { }; vite = callPackage ../applications/science/misc/vite { }; xplanet = callPackage ../applications/science/astronomy/xplanet { }; atari800 = callPackage ../misc/emulators/atari800 { }; ataripp = callPackage ../misc/emulators/atari++ { }; auctex = callPackage ../tools/typesetting/tex/auctex { }; beep = callPackage ../misc/beep { }; cups = callPackage ../misc/cups { libusb = libusb1; }; cups_pdf_filter = callPackage ../misc/cups/pdf-filter.nix { }; gutenprint = callPackage ../misc/drivers/gutenprint { }; gutenprintBin = callPackage ../misc/drivers/gutenprint/bin.nix { }; cupsBjnp = callPackage ../misc/cups/drivers/cups-bjnp { }; darcnes = callPackage ../misc/emulators/darcnes { }; dbacl = callPackage ../tools/misc/dbacl { }; dblatex = callPackage ../tools/typesetting/tex/dblatex { enableAllFeatures = false; }; dblatexFull = appendToName "full" (dblatex.override { enableAllFeatures = true; }); dosbox = callPackage ../misc/emulators/dosbox { }; dpkg = callPackage ../tools/package-management/dpkg { }; ekiga = newScope pkgs.gnome ../applications/networking/instant-messengers/ekiga { }; emulationstation = callPackage ../misc/emulators/emulationstation { }; electricsheep = callPackage ../misc/screensavers/electricsheep { }; fakenes = callPackage ../misc/emulators/fakenes { }; fceux = callPackage ../misc/emulators/fceux { }; foldingathome = callPackage ../misc/foldingathome { }; foo2zjs = callPackage ../misc/drivers/foo2zjs { }; foomatic_filters = callPackage ../misc/drivers/foomatic-filters { }; freestyle = callPackage ../misc/freestyle { }; gajim = callPackage ../applications/networking/instant-messengers/gajim { }; gammu = callPackage ../applications/misc/gammu { }; gensgs = callPackage_i686 ../misc/emulators/gens-gs { }; ghostscript = callPackage ../misc/ghostscript { x11Support = false; cupsSupport = config.ghostscript.cups or !stdenv.isDarwin; gnuFork = config.ghostscript.gnu or false; }; ghostscriptX = appendToName "with-X" (ghostscript.override { x11Support = true; }); guix = callPackage ../tools/package-management/guix { }; gxemul = callPackage ../misc/gxemul { }; hatari = callPackage ../misc/emulators/hatari { }; hplip = callPackage ../misc/drivers/hplip { }; hplipWithPlugin = hplip.override { withPlugin = true; }; jack1 = callPackage ../misc/jackaudio/jack1.nix { }; jack2 = callPackage ../misc/jackaudio { }; keynav = callPackage ../tools/X11/keynav { }; lazylist = callPackage ../tools/typesetting/tex/lazylist { }; lilypond = callPackage ../misc/lilypond { guile = guile_1_8; }; martyr = callPackage ../development/libraries/martyr { }; maven = maven3; maven3 = callPackage ../misc/maven { jdk = openjdk; }; mess = callPackage ../misc/emulators/mess { inherit (pkgs.gnome) GConf; }; mupen64plus = callPackage ../misc/emulators/mupen64plus { }; mupen64plus1_5 = callPackage ../misc/emulators/mupen64plus/1.5.nix { }; nix = nixStable; nixStable = callPackage ../tools/package-management/nix { storeDir = config.nix.storeDir or "/nix/store"; stateDir = config.nix.stateDir or "/nix/var"; }; nixUnstable = callPackage ../tools/package-management/nix/unstable.nix { storeDir = config.nix.storeDir or "/nix/store"; stateDir = config.nix.stateDir or "/nix/var"; }; nixops = callPackage ../tools/package-management/nixops { }; nix-prefetch-scripts = callPackage ../tools/package-management/nix-prefetch-scripts { }; nix-repl = callPackage ../tools/package-management/nix-repl { }; nut = callPackage ../applications/misc/nut { }; solfege = callPackage ../misc/solfege { pysqlite = pkgs.pythonPackages.sqlite3; }; disnix = callPackage ../tools/package-management/disnix { }; dysnomia = callPackage ../tools/package-management/disnix/dysnomia { enableApacheWebApplication = config.disnix.enableApacheWebApplication or false; enableAxis2WebService = config.disnix.enableAxis2WebService or false; enableEjabberdDump = config.disnix.enableEjabberdDump or false; enableMySQLDatabase = config.disnix.enableMySQLDatabase or false; enablePostgreSQLDatabase = config.disnix.enablePostgreSQLDatabase or false; enableSubversionRepository = config.disnix.enableSubversionRepository or false; enableTomcatWebApplication = config.disnix.enableTomcatWebApplication or false; }; disnixos = callPackage ../tools/package-management/disnix/disnixos { }; DisnixWebService = callPackage ../tools/package-management/disnix/DisnixWebService { }; latex2html = callPackage ../tools/typesetting/tex/latex2html/default.nix { tex = tetex; }; lkproof = callPackage ../tools/typesetting/tex/lkproof { }; mysqlWorkbench = newScope gnome ../applications/misc/mysql-workbench { lua = lua5; inherit (pythonPackages) pexpect paramiko; }; robomongo = callPackage ../applications/misc/robomongo { }; opkg = callPackage ../tools/package-management/opkg { }; pgadmin = callPackage ../applications/misc/pgadmin { }; pgf = pgf2; pgf1 = callPackage ../tools/typesetting/tex/pgf/1.x.nix { }; pgf2 = callPackage ../tools/typesetting/tex/pgf/2.x.nix { }; pgfplots = callPackage ../tools/typesetting/tex/pgfplots { }; pjsip = callPackage ../applications/networking/pjsip { }; polytable = callPackage ../tools/typesetting/tex/polytable { }; PPSSPP = callPackage ../misc/emulators/ppsspp { }; uae = callPackage ../misc/emulators/uae { }; putty = callPackage ../applications/networking/remote/putty { }; retroarch = callPackage ../misc/emulators/retroarch { }; rssglx = callPackage ../misc/screensavers/rss-glx { }; xlockmore = callPackage ../misc/screensavers/xlockmore { }; samsungUnifiedLinuxDriver = import ../misc/cups/drivers/samsung { inherit fetchurl stdenv; inherit cups ghostscript glibc patchelf; gcc = import ../development/compilers/gcc/4.4 { inherit stdenv fetchurl gmp mpfr noSysDirs gettext which; texinfo = texinfo4; profiledCompiler = true; }; }; saneBackends = callPackage ../applications/graphics/sane/backends.nix { gt68xxFirmware = config.sane.gt68xxFirmware or null; snapscanFirmware = config.sane.snapscanFirmware or null; hotplugSupport = config.sane.hotplugSupport or true; libusb = libusb1; }; saneBackendsGit = callPackage ../applications/graphics/sane/backends-git.nix { gt68xxFirmware = config.sane.gt68xxFirmware or null; snapscanFirmware = config.sane.snapscanFirmware or null; hotplugSupport = config.sane.hotplugSupport or true; }; mkSaneConfig = callPackage ../applications/graphics/sane/config.nix { }; saneFrontends = callPackage ../applications/graphics/sane/frontends.nix { }; seafile-shared = callPackage ../misc/seafile-shared { }; slock = callPackage ../misc/screensavers/slock { }; sourceAndTags = import ../misc/source-and-tags { inherit pkgs stdenv unzip lib ctags; hasktags = haskellPackages.hasktags; }; splix = callPackage ../misc/cups/drivers/splix { }; streamripper = callPackage ../applications/audio/streamripper { }; sqsh = callPackage ../development/tools/sqsh { }; tetex = callPackage ../tools/typesetting/tex/tetex { libpng = libpng12; }; tex4ht = callPackage ../tools/typesetting/tex/tex4ht { }; texFunctions = import ../tools/typesetting/tex/nix pkgs; texLive = builderDefsPackage (import ../tools/typesetting/tex/texlive) { inherit builderDefs zlib bzip2 ncurses libpng ed lesstif ruby potrace gd t1lib freetype icu perl expat curl xz pkgconfig zziplib texinfo libjpeg bison python fontconfig flex poppler libpaper graphite2 makeWrapper; inherit (xlibs) libXaw libX11 xproto libXt libXpm libXmu libXext xextproto libSM libICE; ghostscript = ghostscriptX; harfbuzz = harfbuzz.override { withIcu = true; withGraphite2 = true; }; }; texLiveFull = lib.setName "texlive-full" (texLiveAggregationFun { paths = [ texLive texLiveExtra lmodern texLiveCMSuper texLiveLatexXColor texLivePGF texLiveBeamer texLiveModerncv tipa tex4ht texinfo texLiveModerntimeline ]; }); texLiveAggregationFun = params: builderDefsPackage (import ../tools/typesetting/tex/texlive/aggregate.nix) ({ inherit poppler perl makeWrapper; } // params); texDisser = callPackage ../tools/typesetting/tex/disser { }; texLiveContext = builderDefsPackage (import ../tools/typesetting/tex/texlive/context.nix) { inherit texLive; }; texLiveExtra = builderDefsPackage (import ../tools/typesetting/tex/texlive/extra.nix) { inherit texLive xz; }; texLiveCMSuper = builderDefsPackage (import ../tools/typesetting/tex/texlive/cm-super.nix) { inherit texLive; }; texLiveLatexXColor = builderDefsPackage (import ../tools/typesetting/tex/texlive/xcolor.nix) { inherit texLive; }; texLivePGF = builderDefsPackage (import ../tools/typesetting/tex/texlive/pgf.nix) { inherit texLiveLatexXColor texLive; }; texLiveBeamer = builderDefsPackage (import ../tools/typesetting/tex/texlive/beamer.nix) { inherit texLiveLatexXColor texLivePGF texLive; }; texLiveModerncv = builderDefsPackage (import ../tools/typesetting/tex/texlive/moderncv.nix) { inherit texLive unzip; }; texLiveModerntimeline = builderDefsPackage (import ../tools/typesetting/tex/texlive/moderntimeline.nix) { inherit texLive unzip; }; thermald = callPackage ../tools/system/thermald { }; thinkfan = callPackage ../tools/system/thinkfan { }; vice = callPackage ../misc/emulators/vice { libX11 = xlibs.libX11; giflib = giflib_4_1; }; viewnior = callPackage ../applications/graphics/viewnior { }; vimPlugins = recurseIntoAttrs (callPackage ../misc/vim-plugins { }); vimprobable2 = callPackage ../applications/networking/browsers/vimprobable2 { webkit = webkitgtk2; }; vimprobable2Wrapper = wrapFirefox { browser = vimprobable2; browserName = "vimprobable2"; desktopName = "Vimprobable2"; }; vimb = callPackage ../applications/networking/browsers/vimb { webkit = webkitgtk2; }; vimbWrapper = wrapFirefox { browser = vimb; browserName = "vimb"; desktopName = "Vimb"; }; VisualBoyAdvance = callPackage ../misc/emulators/VisualBoyAdvance { }; wineStable = callPackage_i686 ../misc/emulators/wine/stable.nix { bison = bison2; }; wineUnstable = lowPrio (callPackage_i686 ../misc/emulators/wine/unstable.nix { bison = bison2; }); wine = wineStable; winetricks = callPackage ../misc/emulators/wine/winetricks.nix { inherit (gnome2) zenity; }; wxmupen64plus = callPackage ../misc/emulators/wxmupen64plus { }; x2x = callPackage ../tools/X11/x2x { }; xboxdrv = callPackage ../misc/drivers/xboxdrv { }; xinput_calibrator = callPackage ../tools/X11/xinput_calibrator { inherit (xlibs) libXi inputproto; }; xosd = callPackage ../misc/xosd { }; xsane = callPackage ../applications/graphics/sane/xsane.nix { libpng = libpng12; saneBackends = saneBackends; }; yafc = callPackage ../applications/networking/yafc { }; yandex-disk = callPackage ../tools/filesystems/yandex-disk { }; myEnvFun = import ../misc/my-env { inherit substituteAll pkgs; inherit (stdenv) mkDerivation; }; PatolineEnv = pack: myEnvFun { name = "patoline"; buildInputs = [ stdenv ncurses mesa freeglut libzip gcc pack.ocaml pack.findlib pack.camomile pack.dypgen pack.ocaml_sqlite3 pack.camlzip pack.lablgtk pack.camlimages pack.ocaml_cairo pack.lablgl pack.ocamlnet pack.cryptokit pack.ocaml_pcre pack.patoline ]; extraCmds = '' LD_LIBRARY_PATH=\''$LD_LIBRARY_PATH:${gcc.gcc}/lib export LD_LIBRARY_PATH ''; }; patoline = PatolineEnv ocamlPackages_4_00_1; znc = callPackage ../applications/networking/znc { }; zncModules = recurseIntoAttrs (callPackage ../applications/networking/znc/modules.nix { }); zsnes = callPackage_i686 ../misc/emulators/zsnes { }; snes9x-gtk = callPackage ../misc/emulators/snes9x-gtk { }; misc = import ../misc/misc.nix { inherit pkgs stdenv; }; bullet = callPackage ../development/libraries/bullet { }; dart = callPackage ../development/interpreters/dart { }; httrack = callPackage ../tools/backup/httrack { }; mg = callPackage ../applications/editors/mg { }; adobeReader = adobe-reader; asciidocFull = asciidoc-full; lttngTools = lttng-tools; lttngUst = lttng-ust; }; in self; in pkgs ================================================ FILE: data/nixpkgs-all-packages.nix ================================================ /* This file composes the Nix Packages collection. That is, it imports the functions that build the various packages, and calls them with appropriate arguments. The result is a set of all the packages in the Nix Packages collection for some particular platform. */ { # The system (e.g., `i686-linux') for which to build the packages. system ? builtins.currentSystem , # The standard environment to use. Only used for bootstrapping. If # null, the default standard environment is used. bootStdenv ? null , # Non-GNU/Linux OSes are currently "impure" platforms, with their libc # outside of the store. Thus, GCC, GFortran, & co. must always look for # files in standard system directories (/usr/include, etc.) noSysDirs ? (system != "x86_64-darwin" && system != "x86_64-freebsd" && system != "i686-freebsd" && system != "x86_64-kfreebsd-gnu") # More flags for the bootstrapping of stdenv. , gccWithCC ? true , gccWithProfiling ? true , # Allow a configuration attribute set to be passed in as an # argument. Otherwise, it's read from $NIXPKGS_CONFIG or # ~/.nixpkgs/config.nix. config ? null , crossSystem ? null , platform ? null }: let config_ = config; platform_ = platform; in # rename the function arguments let lib = import ../../lib; # The contents of the configuration file found at $NIXPKGS_CONFIG or # $HOME/.nixpkgs/config.nix. # for NIXOS (nixos-rebuild): use nixpkgs.config option config = let toPath = builtins.toPath; getEnv = x: if builtins ? getEnv then builtins.getEnv x else ""; pathExists = name: builtins ? pathExists && builtins.pathExists (toPath name); configFile = getEnv "NIXPKGS_CONFIG"; homeDir = getEnv "HOME"; configFile2 = homeDir + "/.nixpkgs/config.nix"; configExpr = if config_ != null then config_ else if configFile != "" && pathExists configFile then import (toPath configFile) else if homeDir != "" && pathExists configFile2 then import (toPath configFile2) else {}; in # allow both: # { /* the config */ } and # { pkgs, ... } : { /* the config */ } if builtins.isFunction configExpr then configExpr { inherit pkgs; } else configExpr; # Allow setting the platform in the config file. Otherwise, let's use a reasonable default (pc) platformAuto = let platforms = (import ./platforms.nix); in if system == "armv6l-linux" then platforms.raspberrypi else if system == "armv5tel-linux" then platforms.sheevaplug else if system == "mips64el-linux" then platforms.fuloong2f_n32 else if system == "x86_64-linux" then platforms.pc64 else if system == "i686-linux" then platforms.pc32 else platforms.pcBase; platform = if platform_ != null then platform_ else config.platform or platformAuto; # Helper functions that are exported through `pkgs'. helperFunctions = stdenvAdapters // (import ../build-support/trivial-builders.nix { inherit (pkgs) stdenv; inherit (pkgs.xorg) lndir; }); stdenvAdapters = import ../stdenv/adapters.nix pkgs; # Allow packages to be overriden globally via the `packageOverrides' # configuration option, which must be a function that takes `pkgs' # as an argument and returns a set of new or overriden packages. # The `packageOverrides' function is called with the *original* # (un-overriden) set of packages, allowing packageOverrides # attributes to refer to the original attributes (e.g. "foo = # ... pkgs.foo ..."). pkgs = applyGlobalOverrides (config.packageOverrides or (pkgs: {})); # Return the complete set of packages, after applying the overrides # returned by the `overrider' function (see above). Warning: this # function is very expensive! applyGlobalOverrides = overrider: let # Call the overrider function. We don't want stdenv overrides # in the case of cross-building, or otherwise the basic # overrided packages will not be built with the crossStdenv # adapter. overrides = overrider pkgsOrig // (lib.optionalAttrs (pkgsOrig.stdenv ? overrides && crossSystem == null) (pkgsOrig.stdenv.overrides pkgsOrig)); # The un-overriden packages, passed to `overrider'. pkgsOrig = pkgsFun pkgs {}; # The overriden, final packages. pkgs = pkgsFun pkgs overrides; in pkgs; # The package compositions. Yes, this isn't properly indented. pkgsFun = pkgs: overrides: with helperFunctions; let defaultScope = pkgs // pkgs.xorg; self = self_ // overrides; self_ = with self; helperFunctions // { # Make some arguments passed to all-packages.nix available inherit system platform; # Allow callPackage to fill in the pkgs argument inherit pkgs; # We use `callPackage' to be able to omit function arguments that # can be obtained from `pkgs' or `pkgs.xorg' (i.e. `defaultScope'). # Use `newScope' for sets of packages in `pkgs' (see e.g. `gnome' # below). callPackage = newScope {}; newScope = extra: lib.callPackageWith (defaultScope // extra); # Override system. This is useful to build i686 packages on x86_64-linux. forceSystem = system: kernel: (import ./all-packages.nix) { inherit system; platform = platform // { kernelArch = kernel; }; inherit bootStdenv noSysDirs gccWithCC gccWithProfiling config crossSystem; }; # Used by wine, firefox with debugging version of Flash, ... pkgsi686Linux = forceSystem "i686-linux" "i386"; callPackage_i686 = lib.callPackageWith (pkgsi686Linux // pkgsi686Linux.xorg); # For convenience, allow callers to get the path to Nixpkgs. path = ../..; ### Symbolic names. x11 = xlibsWrapper; # `xlibs' is the set of X library components. This used to be the # old modular X llibraries project (called `xlibs') but now it's just # the set of packages in the modular X.org tree (which also includes # non-library components like the server, drivers, fonts, etc.). xlibs = xorg // {xlibs = xlibsWrapper;}; ### Helper functions. inherit lib config stdenvAdapters; inherit (lib) lowPrio hiPrio appendToName makeOverridable; inherit (misc) versionedDerivation; # Applying this to an attribute set will cause nix-env to look # inside the set for derivations. recurseIntoAttrs = attrs: attrs // { recurseForDerivations = true; }; builderDefs = lib.composedArgsAndFun (import ../build-support/builder-defs/builder-defs.nix) { inherit stringsWithDeps lib stdenv writeScript fetchurl fetchmtn fetchgit; }; builderDefsPackage = builderDefs.builderDefsPackage builderDefs; stringsWithDeps = lib.stringsWithDeps; ### Nixpkgs maintainer tools nix-generate-from-cpan = callPackage ../../maintainers/scripts/nix-generate-from-cpan.nix { }; nixpkgs-lint = callPackage ../../maintainers/scripts/nixpkgs-lint.nix { }; ### STANDARD ENVIRONMENT allStdenvs = import ../stdenv { inherit system platform config; allPackages = args: import ./all-packages.nix ({ inherit config system; } // args); }; defaultStdenv = allStdenvs.stdenv // { inherit platform; }; stdenvCross = lowPrio (makeStdenvCross defaultStdenv crossSystem binutilsCross gccCrossStageFinal); stdenv = if bootStdenv != null then (bootStdenv // {inherit platform;}) else if crossSystem != null then stdenvCross else let changer = config.replaceStdenv or null; in if changer != null then changer { # We import again all-packages to avoid recursivities. pkgs = import ./all-packages.nix { # We remove packageOverrides to avoid recursivities config = removeAttrs config [ "replaceStdenv" ]; }; } else defaultStdenv; stdenvApple = stdenvAdapters.overrideGCC allStdenvs.stdenvNative gccApple; forceNativeDrv = drv : if crossSystem == null then drv else (drv // { crossDrv = drv.nativeDrv; }); # A stdenv capable of building 32-bit binaries. On x86_64-linux, # it uses GCC compiled with multilib support; on i686-linux, it's # just the plain stdenv. stdenv_32bit = lowPrio ( if system == "x86_64-linux" then overrideGCC stdenv gcc48_multi else stdenv); ### BUILD SUPPORT attrSetToDir = arg: import ../build-support/upstream-updater/attrset-to-dir.nix { inherit writeTextFile stdenv lib; theAttrSet = arg; }; autoreconfHook = makeSetupHook { substitutions = { inherit autoconf automake libtool; }; } ../build-support/setup-hooks/autoreconf.sh; buildEnv = import ../build-support/buildenv { inherit (pkgs) runCommand perl; }; buildFHSChrootEnv = import ../build-support/build-fhs-chrootenv { inherit stdenv glibc glibcLocales gcc coreutils diffutils findutils; inherit gnused gnugrep gnutar gzip bzip2 bashInteractive xz shadow gawk; inherit less buildEnv; }; dotnetenv = import ../build-support/dotnetenv { inherit stdenv; dotnetfx = dotnetfx40; }; scatterOutputHook = makeSetupHook {} ../build-support/setup-hooks/scatter_output.sh; vsenv = callPackage ../build-support/vsenv { vs = vs90wrapper; }; fetchbower = import ../build-support/fetchbower { inherit stdenv git; inherit (nodePackages) fetch-bower; }; fetchbzr = import ../build-support/fetchbzr { inherit stdenv bazaar; }; fetchcvs = import ../build-support/fetchcvs { inherit stdenv cvs; }; fetchdarcs = import ../build-support/fetchdarcs { inherit stdenv darcs nix; }; fetchgit = import ../build-support/fetchgit { inherit stdenv git cacert; }; fetchgitPrivate = import ../build-support/fetchgit/private.nix { inherit fetchgit writeScript openssh stdenv; }; fetchgitrevision = import ../build-support/fetchgitrevision runCommand git; fetchmtn = callPackage ../build-support/fetchmtn (config.fetchmtn or {}); packer = callPackage ../development/tools/packer { }; fetchpatch = callPackage ../build-support/fetchpatch { }; fetchsvn = import ../build-support/fetchsvn { inherit stdenv subversion openssh; sshSupport = true; }; fetchsvnrevision = import ../build-support/fetchsvnrevision runCommand subversion; fetchsvnssh = import ../build-support/fetchsvnssh { inherit stdenv subversion openssh expect; sshSupport = true; }; fetchhg = import ../build-support/fetchhg { inherit stdenv mercurial nix; }; # `fetchurl' downloads a file from the network. fetchurl = import ../build-support/fetchurl { inherit curl stdenv; }; # A wrapper around fetchurl that generates miror://gnome URLs automatically fetchurlGnome = callPackage ../build-support/fetchurl/gnome.nix { }; # fetchurlBoot is used for curl and its dependencies in order to # prevent a cyclic dependency (curl depends on curl.tar.bz2, # curl.tar.bz2 depends on fetchurl, fetchurl depends on curl). It # uses the curl from the previous bootstrap phase (e.g. a statically # linked curl in the case of stdenv-linux). fetchurlBoot = stdenv.fetchurlBoot; fetchzip = import ../build-support/fetchzip { inherit lib fetchurl unzip; }; fetchFromGitHub = { owner, repo, rev, sha256 }: fetchzip { name = "${repo}-${rev}-src"; url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; inherit sha256; }; resolveMirrorURLs = {url}: fetchurl { showURLs = true; inherit url; }; libredirect = callPackage ../build-support/libredirect { }; makeDesktopItem = import ../build-support/make-desktopitem { inherit stdenv; }; makeAutostartItem = import ../build-support/make-startupitem { inherit stdenv; inherit lib; }; makeInitrd = {contents, compressor ? "gzip -9"}: import ../build-support/kernel/make-initrd.nix { inherit stdenv perl perlArchiveCpio cpio contents ubootChooser compressor; }; makeWrapper = makeSetupHook { } ../build-support/setup-hooks/make-wrapper.sh; makeModulesClosure = { kernel, rootModules, allowMissing ? false }: import ../build-support/kernel/modules-closure.nix { inherit stdenv kmod kernel nukeReferences rootModules allowMissing; }; pathsFromGraph = ../build-support/kernel/paths-from-graph.pl; srcOnly = args: (import ../build-support/src-only) ({inherit stdenv; } // args); substituteAll = import ../build-support/substitute/substitute-all.nix { inherit stdenv; }; replaceDependency = import ../build-support/replace-dependency.nix { inherit runCommand nix lib; }; nukeReferences = callPackage ../build-support/nuke-references/default.nix { }; vmTools = import ../build-support/vm/default.nix { inherit pkgs; }; releaseTools = import ../build-support/release/default.nix { inherit pkgs; }; composableDerivation = (import ../../lib/composable-derivation.nix) { inherit pkgs lib; }; platforms = import ./platforms.nix; setJavaClassPath = makeSetupHook { } ../build-support/setup-hooks/set-java-classpath.sh; fixDarwinDylibNames = makeSetupHook { } ../build-support/setup-hooks/fix-darwin-dylib-names.sh; keepBuildTree = makeSetupHook { } ../build-support/setup-hooks/keep-build-tree.sh; enableGCOVInstrumentation = makeSetupHook { } ../build-support/setup-hooks/enable-coverage-instrumentation.sh; makeGCOVReport = makeSetupHook { deps = [ pkgs.lcov pkgs.enableGCOVInstrumentation ]; } ../build-support/setup-hooks/make-coverage-analysis-report.sh; ### TOOLS abduco = callPackage ../tools/misc/abduco { }; acct = callPackage ../tools/system/acct { }; acoustidFingerprinter = callPackage ../tools/audio/acoustid-fingerprinter { ffmpeg = ffmpeg_1; }; actdiag = pythonPackages.actdiag; adom = callPackage ../games/adom { }; aefs = callPackage ../tools/filesystems/aefs { }; aegisub = callPackage ../applications/video/aegisub { wxGTK = wxGTK30; lua = lua5_1; }; aespipe = callPackage ../tools/security/aespipe { }; aescrypt = callPackage ../tools/misc/aescrypt { }; ahcpd = callPackage ../tools/networking/ahcpd { }; aircrackng = callPackage ../tools/networking/aircrack-ng { }; analog = callPackage ../tools/admin/analog {}; apktool = callPackage ../development/tools/apktool { buildTools = androidenv.buildTools; }; apt-offline = callPackage ../tools/misc/apt-offline { }; archivemount = callPackage ../tools/filesystems/archivemount { }; arandr = callPackage ../tools/X11/arandr { }; arcanist = callPackage ../development/tools/misc/arcanist {}; arduino_core = callPackage ../development/arduino/arduino-core { jdk = jdk; jre = jdk; }; argyllcms = callPackage ../tools/graphics/argyllcms {}; arp-scan = callPackage ../tools/misc/arp-scan { }; ascii = callPackage ../tools/text/ascii { }; asymptote = builderDefsPackage ../tools/graphics/asymptote { inherit freeglut ghostscriptX imagemagick fftw boehmgc mesa ncurses readline gsl libsigsegv python zlib perl texinfo xz; texLive = texLiveAggregationFun { paths = [ texLive texLiveExtra texLiveCMSuper ]; }; }; awscli = callPackage ../tools/admin/awscli { }; ec2_api_tools = callPackage ../tools/virtualization/ec2-api-tools { }; ec2_ami_tools = callPackage ../tools/virtualization/ec2-ami-tools { }; altermime = callPackage ../tools/networking/altermime {}; amule = callPackage ../tools/networking/p2p/amule { }; amuleDaemon = appendToName "daemon" (amule.override { monolithic = false; daemon = true; }); amuleGui = appendToName "gui" (amule.override { monolithic = false; client = true; }); androidenv = import ../development/mobile/androidenv { inherit pkgs; pkgs_i686 = pkgsi686Linux; }; apg = callPackage ../tools/security/apg { }; grc = callPackage ../tools/misc/grc { }; otool = callPackage ../os-specific/darwin/otool { }; pass = callPackage ../tools/security/pass { gnupg = gnupg1compat; }; setfile = callPackage ../os-specific/darwin/setfile { }; install_name_tool = callPackage ../os-specific/darwin/install_name_tool { }; xcodeenv = callPackage ../development/mobile/xcodeenv { }; titaniumenv = callPackage ../development/mobile/titaniumenv { inherit pkgs; pkgs_i686 = pkgsi686Linux; }; inherit (androidenv) androidsdk_4_1; aria2 = callPackage ../tools/networking/aria2 { }; aria = aria2; at = callPackage ../tools/system/at { }; atftp = callPackage ../tools/networking/atftp {}; autogen = callPackage ../development/tools/misc/autogen { }; autojump = callPackage ../tools/misc/autojump { }; autorandr = callPackage ../tools/misc/autorandr { inherit (xorg) xrandr xdpyinfo; }; avahi = callPackage ../development/libraries/avahi { qt4Support = config.avahi.qt4Support or false; }; aws = callPackage ../tools/virtualization/aws { }; aws_mturk_clt = callPackage ../tools/misc/aws-mturk-clt { }; axel = callPackage ../tools/networking/axel { }; azureus = callPackage ../tools/networking/p2p/azureus { }; basex = callPackage ../tools/text/xml/basex { }; babeld = callPackage ../tools/networking/babeld { }; badvpn = callPackage ../tools/networking/badvpn {}; banner = callPackage ../games/banner {}; barcode = callPackage ../tools/graphics/barcode {}; bc = callPackage ../tools/misc/bc { }; bcache-tools = callPackage ../tools/filesystems/bcache-tools { }; bchunk = callPackage ../tools/cd-dvd/bchunk { }; bfr = callPackage ../tools/misc/bfr { }; bindfs = callPackage ../tools/filesystems/bindfs { }; bitbucket-cli = pythonPackages.bitbucket-cli; blockdiag = pythonPackages.blockdiag; bmon = callPackage ../tools/misc/bmon { }; bochs = callPackage ../applications/virtualization/bochs { wxSupport = false; }; boomerang = callPackage ../development/tools/boomerang { }; bootchart = callPackage ../tools/system/bootchart { }; bro = callPackage ../applications/networking/ids/bro { }; bsod = callPackage ../misc/emulators/bsod { }; btrfsProgs = callPackage ../tools/filesystems/btrfsprogs { }; bwm_ng = callPackage ../tools/networking/bwm-ng { }; byobu = callPackage ../tools/misc/byobu { }; capstone = callPackage ../development/libraries/capstone { }; catdoc = callPackage ../tools/text/catdoc { }; ccnet = callPackage ../tools/networking/ccnet { }; consul = callPackage ../servers/consul { }; consul_ui = callPackage ../servers/consul/ui.nix { }; chntpw = callPackage ../tools/security/chntpw { }; coprthr = callPackage ../development/libraries/coprthr { flex = flex_2_5_35; }; crawl = callPackage ../games/crawl { lua = lua5; }; cv = callPackage ../tools/misc/cv { }; direnv = callPackage ../tools/misc/direnv { }; ditaa = callPackage ../tools/graphics/ditaa { }; dlx = callPackage ../misc/emulators/dlx { }; eggdrop = callPackage ../tools/networking/eggdrop { }; enca = callPackage ../tools/text/enca { }; fasd = callPackage ../tools/misc/fasd { inherit (haskellPackages) pandoc; }; fop = callPackage ../tools/typesetting/fop { }; mcrl = callPackage ../tools/misc/mcrl { }; mcrl2 = callPackage ../tools/misc/mcrl2 { }; mpdcron = callPackage ../tools/audio/mpdcron { }; syslogng = callPackage ../tools/system/syslog-ng { }; syslogng_incubator = callPackage ../tools/system/syslog-ng-incubator { }; rsyslog = callPackage ../tools/system/rsyslog { }; mcrypt = callPackage ../tools/misc/mcrypt { }; mcelog = callPackage ../os-specific/linux/mcelog { }; apparix = callPackage ../tools/misc/apparix { }; appdata-tools = callPackage ../tools/misc/appdata-tools { }; asciidoc = callPackage ../tools/typesetting/asciidoc { inherit (pythonPackages) matplotlib numpy aafigure recursivePthLoader; enableStandardFeatures = false; }; asciidoc-full = appendToName "full" (asciidoc.override { inherit (pythonPackages) pygments; enableStandardFeatures = true; }); autossh = callPackage ../tools/networking/autossh { }; bacula = callPackage ../tools/backup/bacula { }; beanstalkd = callPackage ../servers/beanstalkd { }; bgs = callPackage ../tools/X11/bgs { }; biber = callPackage ../tools/typesetting/biber { inherit (perlPackages) autovivification BusinessISBN BusinessISMN BusinessISSN ConfigAutoConf DataCompare DataDump DateSimple EncodeEUCJPASCII EncodeHanExtra EncodeJIS2K ExtUtilsLibBuilder FileSlurp IPCRun3 Log4Perl LWPProtocolHttps ListAllUtils ListMoreUtils ModuleBuild MozillaCA ReadonlyXS RegexpCommon TextBibTeX UnicodeCollate UnicodeLineBreak URI XMLLibXMLSimple XMLLibXSLT XMLWriter; }; bibtextools = callPackage ../tools/typesetting/bibtex-tools { inherit (strategoPackages016) strategoxt sdf; }; bittorrent = callPackage ../tools/networking/p2p/bittorrent { gui = true; }; bittornado = callPackage ../tools/networking/p2p/bit-tornado { }; blueman = callPackage ../tools/bluetooth/blueman { inherit (pythonPackages) notify; }; bmrsa = builderDefsPackage (import ../tools/security/bmrsa/11.nix) { inherit unzip; }; bogofilter = callPackage ../tools/misc/bogofilter { }; bsdiff = callPackage ../tools/compression/bsdiff { }; btar = callPackage ../tools/backup/btar { }; bud = callPackage ../tools/networking/bud { inherit (pythonPackages) gyp; }; bup = callPackage ../tools/backup/bup { inherit (pythonPackages) pyxattr pylibacl setuptools fuse; inherit (haskellPackages) pandoc; par2Support = (config.bup.par2Support or false); }; ori = callPackage ../tools/backup/ori { }; atool = callPackage ../tools/archivers/atool { }; bzip2 = callPackage ../tools/compression/bzip2 { }; cabextract = callPackage ../tools/archivers/cabextract { }; cadaver = callPackage ../tools/networking/cadaver { }; cantata = callPackage ../applications/audio/cantata { }; can-utils = callPackage ../os-specific/linux/can-utils { }; ccid = callPackage ../tools/security/ccid { }; ccrypt = callPackage ../tools/security/ccrypt { }; cdecl = callPackage ../development/tools/cdecl { }; cdrdao = callPackage ../tools/cd-dvd/cdrdao { }; cdrkit = callPackage ../tools/cd-dvd/cdrkit { }; ceph = callPackage ../tools/filesystems/ceph { }; cfdg = builderDefsPackage ../tools/graphics/cfdg { inherit libpng bison flex ffmpeg; }; checkinstall = callPackage ../tools/package-management/checkinstall { }; cheetahTemplate = builderDefsPackage (import ../tools/text/cheetah-template/2.0.1.nix) { inherit makeWrapper python; }; chkrootkit = callPackage ../tools/security/chkrootkit { }; chrony = callPackage ../tools/networking/chrony { }; chunkfs = callPackage ../tools/filesystems/chunkfs { }; chunksync = callPackage ../tools/backup/chunksync { }; cjdns = callPackage ../tools/networking/cjdns { }; cksfv = callPackage ../tools/networking/cksfv { }; clementine = callPackage ../applications/audio/clementine { }; ciopfs = callPackage ../tools/filesystems/ciopfs { }; colord = callPackage ../tools/misc/colord { }; colord-gtk = callPackage ../tools/misc/colord-gtk { }; colordiff = callPackage ../tools/text/colordiff { }; concurrencykit = callPackage ../development/libraries/concurrencykit { }; connect = callPackage ../tools/networking/connect { }; conspy = callPackage ../os-specific/linux/conspy {}; connman = callPackage ../tools/networking/connman { }; connmanui = callPackage ../tools/networking/connmanui { }; convertlit = callPackage ../tools/text/convertlit { }; collectd = callPackage ../tools/system/collectd { }; colormake = callPackage ../development/tools/build-managers/colormake { }; cowsay = callPackage ../tools/misc/cowsay { }; cpuminer = callPackage ../tools/misc/cpuminer { }; cuetools = callPackage ../tools/cd-dvd/cuetools { }; unifdef = callPackage ../development/tools/misc/unifdef { }; "unionfs-fuse" = callPackage ../tools/filesystems/unionfs-fuse { }; usb_modeswitch = callPackage ../development/tools/misc/usb-modeswitch { }; biosdevname = callPackage ../tools/networking/biosdevname { }; clamav = callPackage ../tools/security/clamav { }; cloc = callPackage ../tools/misc/cloc { inherit (perlPackages) perl AlgorithmDiff RegexpCommon; }; cloog = callPackage ../development/libraries/cloog { }; cloogppl = callPackage ../development/libraries/cloog-ppl { }; convmv = callPackage ../tools/misc/convmv { }; cool-old-term = callPackage ../applications/misc/cool-old-term { }; coreutils = callPackage ../tools/misc/coreutils { # TODO: Add ACL support for cross-Linux. aclSupport = crossSystem == null && stdenv.isLinux; }; cpio = callPackage ../tools/archivers/cpio { }; cromfs = callPackage ../tools/archivers/cromfs { }; cron = callPackage ../tools/system/cron { }; cudatoolkit5 = callPackage ../development/compilers/cudatoolkit/5.5.nix { python = python26; }; cudatoolkit6 = callPackage ../development/compilers/cudatoolkit/6.0.nix { python = python26; }; cudatoolkit = cudatoolkit5; curl = callPackage ../tools/networking/curl rec { fetchurl = fetchurlBoot; zlibSupport = true; sslSupport = zlibSupport; scpSupport = zlibSupport && !stdenv.isSunOS && !stdenv.isCygwin; }; curl3 = callPackage ../tools/networking/curl/7.15.nix rec { zlibSupport = true; sslSupport = zlibSupport; }; cunit = callPackage ../tools/misc/cunit { }; curlftpfs = callPackage ../tools/filesystems/curlftpfs { }; cutter = callPackage ../tools/networking/cutter { }; dadadodo = builderDefsPackage (import ../tools/text/dadadodo) { }; daq = callPackage ../applications/networking/ids/daq { }; dar = callPackage ../tools/archivers/dar { }; davfs2 = callPackage ../tools/filesystems/davfs2 { }; dbench = callPackage ../development/tools/misc/dbench { }; dcraw = callPackage ../tools/graphics/dcraw { }; debian_devscripts = callPackage ../tools/misc/debian-devscripts { inherit (perlPackages) CryptSSLeay LWP TimeDate DBFile FileDesktopEntry; }; debootstrap = callPackage ../tools/misc/debootstrap { }; detox = callPackage ../tools/misc/detox { }; ddclient = callPackage ../tools/networking/ddclient { }; dd_rescue = callPackage ../tools/system/dd_rescue { }; ddrescue = callPackage ../tools/system/ddrescue { }; deluge = pythonPackages.deluge; desktop_file_utils = callPackage ../tools/misc/desktop-file-utils { }; despotify = callPackage ../development/libraries/despotify { }; dev86 = callPackage ../development/compilers/dev86 { }; dnsmasq = callPackage ../tools/networking/dnsmasq { }; dnstop = callPackage ../tools/networking/dnstop { }; dhcp = callPackage ../tools/networking/dhcp { }; dhcpcd = callPackage ../tools/networking/dhcpcd { }; diffstat = callPackage ../tools/text/diffstat { }; diffutils = callPackage ../tools/text/diffutils { }; wgetpaste = callPackage ../tools/text/wgetpaste { }; dirmngr = callPackage ../tools/security/dirmngr { }; disper = callPackage ../tools/misc/disper { }; dmd = callPackage ../development/compilers/dmd { }; dmg2img = callPackage ../tools/misc/dmg2img { }; docbook2odf = callPackage ../tools/typesetting/docbook2odf { inherit (perlPackages) PerlMagick; }; docbook2x = callPackage ../tools/typesetting/docbook2x { inherit (perlPackages) XMLSAX XMLParser XMLNamespaceSupport; }; dosfstools = callPackage ../tools/filesystems/dosfstools { }; dotnetfx35 = callPackage ../development/libraries/dotnetfx35 { }; dotnetfx40 = callPackage ../development/libraries/dotnetfx40 { }; dropbear = callPackage ../tools/networking/dropbear { }; dtach = callPackage ../tools/misc/dtach { }; duo-unix = callPackage ../tools/security/duo-unix { }; duplicity = callPackage ../tools/backup/duplicity { inherit (pythonPackages) boto lockfile; gnupg = gnupg1; }; duply = callPackage ../tools/backup/duply { }; dvdplusrwtools = callPackage ../tools/cd-dvd/dvd+rw-tools { }; dvgrab = callPackage ../tools/video/dvgrab { }; dvtm = callPackage ../tools/misc/dvtm { }; e2fsprogs = callPackage ../tools/filesystems/e2fsprogs { }; easyrsa = callPackage ../tools/networking/easyrsa { }; ebook_tools = callPackage ../tools/text/ebook-tools { }; ecryptfs = callPackage ../tools/security/ecryptfs { }; editres = callPackage ../tools/graphics/editres { inherit (xlibs) libXt libXaw; inherit (xorg) utilmacros; }; edk2 = callPackage ../development/compilers/edk2 { }; efibootmgr = callPackage ../tools/system/efibootmgr { }; efivar = callPackage ../tools/system/efivar { }; evemu = callPackage ../tools/system/evemu { }; elasticsearch = callPackage ../servers/search/elasticsearch { }; elasticsearchPlugins = recurseIntoAttrs ( callPackage ../servers/search/elasticsearch/plugins.nix { } ); emv = callPackage ../tools/misc/emv { }; enblendenfuse = callPackage ../tools/graphics/enblend-enfuse { }; encfs = callPackage ../tools/filesystems/encfs { }; enscript = callPackage ../tools/text/enscript { }; ethtool = callPackage ../tools/misc/ethtool { }; ettercap = callPackage ../applications/networking/sniffers/ettercap { }; euca2ools = callPackage ../tools/virtualization/euca2ools { pythonPackages = python26Packages; }; evtest = callPackage ../applications/misc/evtest { }; exempi = callPackage ../development/libraries/exempi { }; execline = callPackage ../tools/misc/execline { }; exercism = callPackage ../development/tools/exercism { }; exif = callPackage ../tools/graphics/exif { }; exiftags = callPackage ../tools/graphics/exiftags { }; extundelete = callPackage ../tools/filesystems/extundelete { }; expect = callPackage ../tools/misc/expect { }; f2fs-tools = callPackage ../tools/filesystems/f2fs-tools { }; fabric = pythonPackages.fabric; fail2ban = callPackage ../tools/security/fail2ban { systemd = systemd.override { pythonSupport = true; }; }; fakeroot = callPackage ../tools/system/fakeroot { }; fakechroot = callPackage ../tools/system/fakechroot { }; fcitx = callPackage ../tools/inputmethods/fcitx { }; fcron = callPackage ../tools/system/fcron { }; fdm = callPackage ../tools/networking/fdm {}; figlet = callPackage ../tools/misc/figlet { }; file = callPackage ../tools/misc/file { }; filegive = callPackage ../tools/networking/filegive { }; fileschanged = callPackage ../tools/misc/fileschanged { }; findutils = callPackage ../tools/misc/findutils { }; finger_bsd = callPackage ../tools/networking/bsd-finger { }; fio = callPackage ../tools/system/fio { }; flashtool = callPackage_i686 ../development/mobile/flashtool { platformTools = androidenv.platformTools; }; flpsed = callPackage ../applications/editors/flpsed { }; flvstreamer = callPackage ../tools/networking/flvstreamer { }; libbsd = callPackage ../development/libraries/libbsd { }; lprof = callPackage ../tools/graphics/lprof { }; fdk_aac = callPackage ../development/libraries/fdk-aac { }; flvtool2 = callPackage ../tools/video/flvtool2 { }; fontforge = lowPrio (callPackage ../tools/misc/fontforge { }); fontforgeX = callPackage ../tools/misc/fontforge { withX11 = true; }; forktty = callPackage ../os-specific/linux/forktty {}; fortune = callPackage ../tools/misc/fortune { }; fox = callPackage ../development/libraries/fox/default.nix { libpng = libpng12; }; fox_1_6 = callPackage ../development/libraries/fox/fox-1.6.nix { }; fping = callPackage ../tools/networking/fping {}; fprot = callPackage ../tools/security/fprot { }; freeipmi = callPackage ../tools/system/freeipmi {}; freetalk = callPackage ../applications/networking/instant-messengers/freetalk { guile = guile_1_8; }; freetds = callPackage ../development/libraries/freetds { }; ftgl = callPackage ../development/libraries/ftgl { }; ftgl212 = callPackage ../development/libraries/ftgl/2.1.2.nix { }; fuppes = callPackage ../tools/networking/fuppes { ffmpeg = ffmpeg_0_6_90; }; fsfs = callPackage ../tools/filesystems/fsfs { }; fuse_zip = callPackage ../tools/filesystems/fuse-zip { }; fuse_exfat = callPackage ../tools/filesystems/fuse-exfat { }; dos2unix = callPackage ../tools/text/dos2unix { }; uni2ascii = callPackage ../tools/text/uni2ascii { }; g500-control = callPackage ../tools/misc/g500-control { }; galculator = callPackage ../applications/misc/galculator { gtk = gtk3; }; gawk = callPackage ../tools/text/gawk { }; gawkInteractive = appendToName "interactive" (gawk.override { readlineSupport = true; }); gbdfed = callPackage ../tools/misc/gbdfed { gtk = gtk2; }; gdmap = callPackage ../tools/system/gdmap { }; genext2fs = callPackage ../tools/filesystems/genext2fs { }; gengetopt = callPackage ../development/tools/misc/gengetopt { }; getmail = callPackage ../tools/networking/getmail { }; getopt = callPackage ../tools/misc/getopt { }; gftp = callPackage ../tools/networking/gftp { }; gifsicle = callPackage ../tools/graphics/gifsicle { }; glusterfs = callPackage ../tools/filesystems/glusterfs { }; glmark2 = callPackage ../tools/graphics/glmark2 { }; glxinfo = callPackage ../tools/graphics/glxinfo { }; gmvault = callPackage ../tools/networking/gmvault { }; gnokii = builderDefsPackage (import ../tools/misc/gnokii) { inherit intltool perl gettext libusb pkgconfig bluez readline pcsclite libical gtk glib; inherit (xorg) libXpm; }; gnufdisk = callPackage ../tools/system/fdisk { guile = guile_1_8; }; gnugrep = callPackage ../tools/text/gnugrep { libiconv = libiconvOrNull; }; gnulib = callPackage ../development/tools/gnulib { }; gnupatch = callPackage ../tools/text/gnupatch { }; gnupg1orig = callPackage ../tools/security/gnupg1 { }; gnupg1compat = callPackage ../tools/security/gnupg1compat { }; # use config.packageOverrides if you prefer original gnupg1 gnupg1 = gnupg1compat; gnupg = callPackage ../tools/security/gnupg { libusb = libusb1; }; gnupg2_1 = lowPrio (callPackage ../tools/security/gnupg/git.nix { libassuan = libassuan2_1; }); gnuplot = callPackage ../tools/graphics/gnuplot { }; gnuplot_qt = gnuplot.override { withQt = true; }; # must have AquaTerm installed separately gnuplot_aquaterm = gnuplot.override { aquaterm = true; }; gnused = callPackage ../tools/text/gnused { }; gnutar = callPackage ../tools/archivers/gnutar { }; gnuvd = callPackage ../tools/misc/gnuvd { }; goaccess = callPackage ../tools/misc/goaccess { }; googleAuthenticator = callPackage ../os-specific/linux/google-authenticator { }; gource = callPackage ../applications/version-management/gource {}; gpodder = callPackage ../applications/audio/gpodder { }; gptfdisk = callPackage ../tools/system/gptfdisk { }; grafana = callPackage ../development/tools/misc/grafana { }; grafx2 = callPackage ../applications/graphics/grafx2 {}; graphviz = callPackage ../tools/graphics/graphviz { }; /* Readded by Michael Raskin. There are programs in the wild * that do want 2.0 but not 2.22. Please give a day's notice for * objections before removal. */ graphviz_2_0 = callPackage ../tools/graphics/graphviz/2.0.nix { }; grive = callPackage ../tools/filesystems/grive { json_c = json-c-0-11; # won't configure with 0.12; others are vulnerable }; groff = callPackage ../tools/text/groff { ghostscript = null; }; grub = callPackage_i686 ../tools/misc/grub { buggyBiosCDSupport = config.grub.buggyBiosCDSupport or true; }; grub2 = callPackage ../tools/misc/grub/2.0x.nix { libusb = libusb1; flex = flex_2_5_35; }; grub2_efi = grub2.override { EFIsupport = true; }; gssdp = callPackage ../development/libraries/gssdp { inherit (gnome) libsoup; }; gt5 = callPackage ../tools/system/gt5 { }; gtest = callPackage ../development/libraries/gtest {}; gtkdatabox = callPackage ../development/libraries/gtkdatabox {}; gtkgnutella = callPackage ../tools/networking/p2p/gtk-gnutella { }; gtkvnc = callPackage ../tools/admin/gtk-vnc {}; gtmess = callPackage ../applications/networking/instant-messengers/gtmess { }; gummiboot = callPackage ../tools/misc/gummiboot { }; gupnp = callPackage ../development/libraries/gupnp { inherit (gnome) libsoup; }; gupnp_av = callPackage ../development/libraries/gupnp-av {}; gupnp_igd = callPackage ../development/libraries/gupnp-igd {}; gupnptools = callPackage ../tools/networking/gupnp-tools {}; gvpe = builderDefsPackage ../tools/networking/gvpe { inherit openssl gmp nettools iproute; }; gvolicon = callPackage ../tools/audio/gvolicon {}; gzip = callPackage ../tools/compression/gzip { }; gzrt = callPackage ../tools/compression/gzrt { }; partclone = callPackage ../tools/backup/partclone { }; partimage = callPackage ../tools/backup/partimage { }; pigz = callPackage ../tools/compression/pigz { }; haproxy = callPackage ../tools/networking/haproxy { }; haveged = callPackage ../tools/security/haveged { }; hardlink = callPackage ../tools/system/hardlink { }; hashcat = callPackage ../tools/security/hashcat { }; halibut = callPackage ../tools/typesetting/halibut { }; hddtemp = callPackage ../tools/misc/hddtemp { }; hdf5 = callPackage ../tools/misc/hdf5 { szip = null; }; heimdall = callPackage ../tools/misc/heimdall { }; hevea = callPackage ../tools/typesetting/hevea { }; highlight = callPackage ../tools/text/highlight { lua = lua5; }; host = callPackage ../tools/networking/host { }; hping = callPackage ../tools/networking/hping { }; httpie = callPackage ../tools/networking/httpie { }; httpfs2 = callPackage ../tools/filesystems/httpfs { }; # FIXME: This Hydra snapshot is outdated and depends on the `nixPerl', # which no longer exists. # # hydra = callPackage ../development/tools/misc/hydra { # nix = nixUnstable; # }; iasl = callPackage ../development/compilers/iasl { }; icecast = callPackage ../servers/icecast { }; icoutils = callPackage ../tools/graphics/icoutils { }; idutils = callPackage ../tools/misc/idutils { }; idle3tools = callPackage ../tools/system/idle3tools { }; iftop = callPackage ../tools/networking/iftop { }; imapproxy = callPackage ../tools/networking/imapproxy { }; imapsync = callPackage ../tools/networking/imapsync { inherit (perlPackages) MailIMAPClient; }; inadyn = callPackage ../tools/networking/inadyn { }; inetutils = callPackage ../tools/networking/inetutils { }; ioping = callPackage ../tools/system/ioping {}; iodine = callPackage ../tools/networking/iodine { }; iperf = callPackage ../tools/networking/iperf { }; ipmitool = callPackage ../tools/system/ipmitool { static = false; }; ipmiutil = callPackage ../tools/system/ipmiutil {}; ised = callPackage ../tools/misc/ised {}; isl = callPackage ../development/libraries/isl { }; isl_0_12 = callPackage ../development/libraries/isl/0.12.2.nix { }; isync = callPackage ../tools/networking/isync { }; jd-gui = callPackage_i686 ../tools/security/jd-gui { }; jdiskreport = callPackage ../tools/misc/jdiskreport { }; jfsrec = callPackage ../tools/filesystems/jfsrec { boost = boost144; }; jfsutils = callPackage ../tools/filesystems/jfsutils { }; jhead = callPackage ../tools/graphics/jhead { }; jing = callPackage ../tools/text/xml/jing { }; jmtpfs = callPackage ../tools/filesystems/jmtpfs { }; jnettop = callPackage ../tools/networking/jnettop { }; jq = callPackage ../development/tools/jq {}; jscoverage = callPackage ../development/tools/misc/jscoverage { }; jwhois = callPackage ../tools/networking/jwhois { }; kazam = callPackage ../applications/video/kazam { }; kalibrate-rtl = callPackage ../tools/misc/kalibrate-rtl { }; kexectools = callPackage ../os-specific/linux/kexectools { }; keychain = callPackage ../tools/misc/keychain { }; kismet = callPackage ../applications/networking/sniffers/kismet { }; less = callPackage ../tools/misc/less { }; lockfileProgs = callPackage ../tools/misc/lockfile-progs { }; logstash = callPackage ../tools/misc/logstash { }; logstash-forwarder = callPackage ../tools/misc/logstash-forwarder { }; kippo = callPackage ../servers/kippo { }; klavaro = callPackage ../games/klavaro {}; kzipmix = callPackage_i686 ../tools/compression/kzipmix { }; minidlna = callPackage ../tools/networking/minidlna { ffmpeg = ffmpeg_0_10; }; mmv = callPackage ../tools/misc/mmv { }; most = callPackage ../tools/misc/most { }; multitail = callPackage ../tools/misc/multitail { }; netperf = callPackage ../applications/networking/netperf { }; ninka = callPackage ../development/tools/misc/ninka { }; nodejs = callPackage ../development/web/nodejs {}; nodePackages = recurseIntoAttrs (import ./node-packages.nix { inherit pkgs stdenv nodejs fetchurl fetchgit; neededNatives = [python] ++ lib.optional (lib.elem system lib.platforms.linux) utillinux; self = pkgs.nodePackages; }); ldapvi = callPackage ../tools/misc/ldapvi { }; ldns = callPackage ../development/libraries/ldns { }; lftp = callPackage ../tools/networking/lftp { }; libconfig = callPackage ../development/libraries/libconfig { }; libee = callPackage ../development/libraries/libee { }; libestr = callPackage ../development/libraries/libestr { }; libevdev = callPackage ../development/libraries/libevdev { }; liboauth = callPackage ../development/libraries/liboauth { }; libtirpc = callPackage ../development/libraries/ti-rpc { }; libshout = callPackage ../development/libraries/libshout { }; libqmi = callPackage ../development/libraries/libqmi { }; libmbim = callPackage ../development/libraries/libmbim { }; libtorrent = callPackage ../tools/networking/p2p/libtorrent { }; logcheck = callPackage ../tools/system/logcheck { inherit (perlPackages) mimeConstruct; }; logrotate = callPackage ../tools/system/logrotate { }; logstalgia = callPackage ../tools/graphics/logstalgia {}; lout = callPackage ../tools/typesetting/lout { }; lrzip = callPackage ../tools/compression/lrzip { }; # lsh installs `bin/nettle-lfib-stream' and so does Nettle. Give the # former a lower priority than Nettle. lsh = lowPrio (callPackage ../tools/networking/lsh { }); lshw = callPackage ../tools/system/lshw { }; lxc = callPackage ../os-specific/linux/lxc { }; lzip = callPackage ../tools/compression/lzip { }; lzma = xz; xz = callPackage ../tools/compression/xz { }; lzop = callPackage ../tools/compression/lzop { }; maildrop = callPackage ../tools/networking/maildrop { }; mailpile = callPackage ../applications/networking/mailreaders/mailpile { }; mailutils = callPackage ../tools/networking/mailutils { guile = guile_1_8; }; mairix = callPackage ../tools/text/mairix { }; makemkv = callPackage ../applications/video/makemkv { }; man = callPackage ../tools/misc/man { }; man_db = callPackage ../tools/misc/man-db { }; memtest86 = callPackage ../tools/misc/memtest86 { }; memtest86plus = callPackage ../tools/misc/memtest86+ { }; meo = callPackage ../tools/security/meo { }; mc = callPackage ../tools/misc/mc { }; mcabber = callPackage ../applications/networking/instant-messengers/mcabber { }; mcron = callPackage ../tools/system/mcron { guile = guile_1_8; }; mdbtools = callPackage ../tools/misc/mdbtools { }; mdbtools_git = callPackage ../tools/misc/mdbtools/git.nix { inherit (gnome) scrollkeeper; }; mednafen = callPackage ../misc/emulators/mednafen { }; mednafen-server = callPackage ../misc/emulators/mednafen/server.nix { }; megacli = callPackage ../tools/misc/megacli { }; megatools = callPackage ../tools/networking/megatools { }; mfcuk = callPackage ../tools/security/mfcuk { }; minecraft = callPackage ../games/minecraft { }; minecraft-server = callPackage ../games/minecraft-server { }; minetest = callPackage ../games/minetest { libpng = libpng12; }; miniupnpc = callPackage ../tools/networking/miniupnpc { }; miniupnpd = callPackage ../tools/networking/miniupnpd { }; minixml = callPackage ../development/libraries/minixml { }; mjpegtools = callPackage ../tools/video/mjpegtools { }; mkcue = callPackage ../tools/cd-dvd/mkcue { }; mkpasswd = callPackage ../tools/security/mkpasswd { }; mktemp = callPackage ../tools/security/mktemp { }; mktorrent = callPackage ../tools/misc/mktorrent { }; modemmanager = callPackage ../tools/networking/modemmanager {}; monit = callPackage ../tools/system/monit { }; mosh = callPackage ../tools/networking/mosh { boost = boostHeaders; inherit (perlPackages) IOTty; }; mpage = callPackage ../tools/text/mpage { }; mr = callPackage ../applications/version-management/mr { }; mscgen = callPackage ../tools/graphics/mscgen { }; msf = builderDefsPackage (import ../tools/security/metasploit/3.1.nix) { inherit ruby makeWrapper; }; mssys = callPackage ../tools/misc/mssys { }; mtdutils = callPackage ../tools/filesystems/mtdutils { }; mtools = callPackage ../tools/filesystems/mtools { }; mtr = callPackage ../tools/networking/mtr {}; multitran = recurseIntoAttrs (let callPackage = newScope pkgs.multitran; in rec { multitrandata = callPackage ../tools/text/multitran/data { }; libbtree = callPackage ../tools/text/multitran/libbtree { }; libmtsupport = callPackage ../tools/text/multitran/libmtsupport { }; libfacet = callPackage ../tools/text/multitran/libfacet { }; libmtquery = callPackage ../tools/text/multitran/libmtquery { }; mtutils = callPackage ../tools/text/multitran/mtutils { }; }); munge = callPackage ../tools/security/munge { }; muscleframework = callPackage ../tools/security/muscleframework { }; muscletool = callPackage ../tools/security/muscletool { }; mysql2pgsql = callPackage ../tools/misc/mysql2pgsql { }; namazu = callPackage ../tools/text/namazu { }; nbd = callPackage ../tools/networking/nbd { }; ndjbdns = callPackage ../tools/networking/ndjbdns { }; netatalk = callPackage ../tools/filesystems/netatalk { }; netcdf = callPackage ../development/libraries/netcdf { }; nc6 = callPackage ../tools/networking/nc6 { }; ncat = callPackage ../tools/networking/ncat { }; ncftp = callPackage ../tools/networking/ncftp { }; ncompress = callPackage ../tools/compression/ncompress { }; ndisc6 = callPackage ../tools/networking/ndisc6 { }; netboot = callPackage ../tools/networking/netboot {}; netcat = callPackage ../tools/networking/netcat { }; netcat-openbsd = callPackage ../tools/networking/netcat-openbsd { }; nethogs = callPackage ../tools/networking/nethogs { }; netkittftp = callPackage ../tools/networking/netkit/tftp { }; netpbm = callPackage ../tools/graphics/netpbm { }; netrw = callPackage ../tools/networking/netrw { }; netselect = callPackage ../tools/networking/netselect { }; networkmanager = callPackage ../tools/networking/network-manager { }; networkmanager_openvpn = callPackage ../tools/networking/network-manager/openvpn.nix { }; networkmanager_pptp = callPackage ../tools/networking/network-manager/pptp.nix { }; networkmanager_vpnc = callPackage ../tools/networking/network-manager/vpnc.nix { }; networkmanager_openconnect = callPackage ../tools/networking/network-manager/openconnect.nix { }; networkmanagerapplet = newScope gnome ../tools/networking/network-manager-applet { dconf = gnome3.dconf; }; newsbeuter = callPackage ../applications/networking/feedreaders/newsbeuter { }; newsbeuter-dev = callPackage ../applications/networking/feedreaders/newsbeuter/dev.nix { }; ngrep = callPackage ../tools/networking/ngrep { }; ngrok = callPackage ../tools/misc/ngrok { }; mpack = callPackage ../tools/networking/mpack { }; pa_applet = callPackage ../tools/audio/pa-applet { }; pnmixer = callPackage ../tools/audio/pnmixer { }; nifskope = callPackage ../tools/graphics/nifskope { }; nilfs_utils = callPackage ../tools/filesystems/nilfs-utils {}; nitrogen = callPackage ../tools/X11/nitrogen {}; nlopt = callPackage ../development/libraries/nlopt {}; npapi_sdk = callPackage ../development/libraries/npapi-sdk {}; npth = callPackage ../development/libraries/npth {}; nmap = callPackage ../tools/security/nmap { }; nmap_graphical = callPackage ../tools/security/nmap { inherit (pythonPackages) pysqlite; graphicalSupport = true; }; notbit = callPackage ../applications/networking/notbit { }; nox = callPackage ../tools/package-management/nox { pythonPackages = python3Packages; nix = nixUnstable; }; nss_pam_ldapd = callPackage ../tools/networking/nss-pam-ldapd {}; ntfs3g = callPackage ../tools/filesystems/ntfs-3g { }; # ntfsprogs are merged into ntfs-3g ntfsprogs = pkgs.ntfs3g; ntop = callPackage ../tools/networking/ntop { }; ntopng = callPackage ../tools/networking/ntopng { }; ntp = callPackage ../tools/networking/ntp { }; numdiff = callPackage ../tools/text/numdiff { }; nssmdns = callPackage ../tools/networking/nss-mdns { }; nwdiag = pythonPackages.nwdiag; nylon = callPackage ../tools/networking/nylon { }; nzbget = callPackage ../tools/networking/nzbget { }; oathToolkit = callPackage ../tools/security/oath-toolkit { }; obex_data_server = callPackage ../tools/bluetooth/obex-data-server { }; obexd = callPackage ../tools/bluetooth/obexd { }; obexfs = callPackage ../tools/bluetooth/obexfs { }; obexftp = callPackage ../tools/bluetooth/obexftp { }; obnam = callPackage ../tools/backup/obnam { }; odt2txt = callPackage ../tools/text/odt2txt { }; offlineimap = callPackage ../tools/networking/offlineimap { inherit (pythonPackages) sqlite3; }; opendbx = callPackage ../development/libraries/opendbx { }; opendkim = callPackage ../development/libraries/opendkim { }; opendylan = callPackage ../development/compilers/opendylan { opendylan-bootstrap = opendylan_bin; }; opendylan_bin = callPackage ../development/compilers/opendylan/bin.nix { }; openjade = callPackage ../tools/text/sgml/openjade { }; openobex = callPackage ../tools/bluetooth/openobex { }; openopc = callPackage ../tools/misc/openopc { pythonFull = python27Full.override { extraLibs = [ python27Packages.pyro3 ]; }; }; openresolv = callPackage ../tools/networking/openresolv { }; opensc = callPackage ../tools/security/opensc { }; opensc_dnie_wrapper = callPackage ../tools/security/opensc-dnie-wrapper { }; openssh = callPackage ../tools/networking/openssh { hpnSupport = false; withKerberos = false; etcDir = "/etc/ssh"; pam = if stdenv.isLinux then pam else null; }; openssh_hpn = pkgs.appendToName "with-hpn" (openssh.override { hpnSupport = true; }); openssh_with_kerberos = pkgs.appendToName "with-kerberos" (openssh.override { withKerberos = true; }); opensp = callPackage ../tools/text/sgml/opensp { }; spCompat = callPackage ../tools/text/sgml/opensp/compat.nix { }; openvpn = callPackage ../tools/networking/openvpn { }; openvpn_learnaddress = callPackage ../tools/networking/openvpn/openvpn_learnaddress.nix { }; optipng = callPackage ../tools/graphics/optipng { libpng = libpng12; }; oslrd = callPackage ../tools/networking/oslrd { }; ossec = callPackage ../tools/security/ossec {}; otpw = callPackage ../os-specific/linux/otpw { }; p7zip = callPackage ../tools/archivers/p7zip { }; pal = callPackage ../tools/misc/pal { }; panomatic = callPackage ../tools/graphics/panomatic { }; par2cmdline = callPackage ../tools/networking/par2cmdline { }; parallel = callPackage ../tools/misc/parallel { }; parcellite = callPackage ../tools/misc/parcellite { }; patchutils = callPackage ../tools/text/patchutils { }; parted = callPackage ../tools/misc/parted { hurd = null; }; pitivi = callPackage ../applications/video/pitivi { gst = gst_all_1; clutter-gtk = clutter_gtk; inherit (gnome3) gnome_icon_theme gnome_icon_theme_symbolic; }; p0f = callPackage ../tools/security/p0f { }; pngout = callPackage ../tools/graphics/pngout { }; hurdPartedCross = if crossSystem != null && crossSystem.config == "i586-pc-gnu" then (makeOverridable ({ hurd }: (parted.override { # Needs the Hurd's libstore. inherit hurd; # The Hurd wants a libparted.a. enableStatic = true; gettext = null; readline = null; devicemapper = null; }).crossDrv) { hurd = gnu.hurdCrossIntermediate; }) else null; ipsecTools = callPackage ../os-specific/linux/ipsec-tools { flex = flex_2_5_35; }; patch = gnupatch; pbzip2 = callPackage ../tools/compression/pbzip2 { }; pciutils = callPackage ../tools/system/pciutils { }; pcsclite = callPackage ../tools/security/pcsclite { }; pdf2djvu = callPackage ../tools/typesetting/pdf2djvu { }; pdfjam = callPackage ../tools/typesetting/pdfjam { }; jbig2enc = callPackage ../tools/graphics/jbig2enc { }; pdfread = callPackage ../tools/graphics/pdfread { }; briss = callPackage ../tools/graphics/briss { }; bully = callPackage ../tools/networking/bully { }; pdnsd = callPackage ../tools/networking/pdnsd { }; peco = callPackage ../tools/text/peco { }; pg_top = callPackage ../tools/misc/pg_top { }; pdsh = callPackage ../tools/networking/pdsh { rsh = true; # enable internal rsh implementation ssh = openssh; }; pfstools = callPackage ../tools/graphics/pfstools { }; philter = callPackage ../tools/networking/philter { }; pinentry = callPackage ../tools/security/pinentry { }; pius = callPackage ../tools/security/pius { }; pk2cmd = callPackage ../tools/misc/pk2cmd { }; plantuml = callPackage ../tools/misc/plantuml { }; plan9port = callPackage ../tools/system/plan9port { }; ploticus = callPackage ../tools/graphics/ploticus { libpng = libpng12; }; plotutils = callPackage ../tools/graphics/plotutils { }; plowshare = callPackage ../tools/misc/plowshare { }; pngcrush = callPackage ../tools/graphics/pngcrush { }; pngnq = callPackage ../tools/graphics/pngnq { }; pngtoico = callPackage ../tools/graphics/pngtoico { libpng = libpng12; }; pngquant = callPackage ../tools/graphics/pngquant { }; podiff = callPackage ../tools/text/podiff { }; poedit = callPackage ../tools/text/poedit { }; polipo = callPackage ../servers/polipo { }; polkit_gnome = callPackage ../tools/security/polkit-gnome { }; ponysay = callPackage ../tools/misc/ponysay { }; povray = callPackage ../tools/graphics/povray { }; ppl = callPackage ../development/libraries/ppl { }; ppp = callPackage ../tools/networking/ppp { }; pptp = callPackage ../tools/networking/pptp {}; prey-bash-client = callPackage ../tools/security/prey { }; projectm = callPackage ../applications/audio/projectm { }; proxychains = callPackage ../tools/networking/proxychains { }; proxytunnel = callPackage ../tools/misc/proxytunnel { }; cntlm = callPackage ../tools/networking/cntlm { }; pastebinit = callPackage ../tools/misc/pastebinit { }; psmisc = callPackage ../os-specific/linux/psmisc { }; pstoedit = callPackage ../tools/graphics/pstoedit { }; pv = callPackage ../tools/misc/pv { }; pwgen = callPackage ../tools/security/pwgen { }; pwnat = callPackage ../tools/networking/pwnat { }; pycangjie = callPackage ../development/python-modules/pycangjie { }; pydb = callPackage ../development/tools/pydb { }; pystringtemplate = callPackage ../development/python-modules/stringtemplate { }; pythonDBus = dbus_python; pythonIRClib = builderDefsPackage (import ../development/python-modules/irclib) { inherit python; }; pythonSexy = builderDefsPackage (import ../development/python-modules/libsexy) { inherit python libsexy pkgconfig libxml2 pygtk pango gtk glib; }; openmpi = callPackage ../development/libraries/openmpi { }; qhull = callPackage ../development/libraries/qhull { }; qjoypad = callPackage ../tools/misc/qjoypad { }; qshowdiff = callPackage ../tools/text/qshowdiff { }; quilt = callPackage ../development/tools/quilt { }; radvd = callPackage ../tools/networking/radvd { }; ranger = callPackage ../applications/misc/ranger { }; privateer = callPackage ../games/privateer { }; rtmpdump = callPackage ../tools/video/rtmpdump { }; reaverwps = callPackage ../tools/networking/reaver-wps {}; recutils = callPackage ../tools/misc/recutils { }; recoll = callPackage ../applications/search/recoll { }; reiser4progs = callPackage ../tools/filesystems/reiser4progs { }; reiserfsprogs = callPackage ../tools/filesystems/reiserfsprogs { }; relfs = callPackage ../tools/filesystems/relfs { inherit (gnome) gnome_vfs GConf; }; remarkjs = callPackage ../development/web/remarkjs { }; remind = callPackage ../tools/misc/remind { }; remmina = callPackage ../applications/networking/remote/remmina {}; renameutils = callPackage ../tools/misc/renameutils { }; replace = callPackage ../tools/text/replace { }; reptyr = callPackage ../os-specific/linux/reptyr {}; rdiff_backup = callPackage ../tools/backup/rdiff-backup { }; rdmd = callPackage ../development/compilers/rdmd { }; rhash = callPackage ../tools/security/rhash { }; riemann_c_client = callPackage ../tools/misc/riemann-c-client { }; ripmime = callPackage ../tools/networking/ripmime {}; rkflashtool = callPackage ../tools/misc/rkflashtool { }; rmlint = callPackage ../tools/misc/rmlint {}; rng_tools = callPackage ../tools/security/rng-tools { }; rsnapshot = callPackage ../tools/backup/rsnapshot { # For the `logger' command, we can use either `utillinux' or # GNU Inetutils. The latter is more portable. logger = inetutils; }; rlwrap = callPackage ../tools/misc/rlwrap { }; rockbox_utility = callPackage ../tools/misc/rockbox-utility { }; rpPPPoE = builderDefsPackage (import ../tools/networking/rp-pppoe) { inherit ppp; }; rpm = callPackage ../tools/package-management/rpm { }; rrdtool = callPackage ../tools/misc/rrdtool { }; rtorrent = callPackage ../tools/networking/p2p/rtorrent { }; rubber = callPackage ../tools/typesetting/rubber { }; rxp = callPackage ../tools/text/xml/rxp { }; rzip = callPackage ../tools/compression/rzip { }; s3backer = callPackage ../tools/filesystems/s3backer { }; s3cmd = callPackage ../tools/networking/s3cmd { }; s3cmd_15_pre_81e3842f7a = lowPrio (callPackage ../tools/networking/s3cmd/git.nix { }); s3sync = callPackage ../tools/networking/s3sync { ruby = ruby18; }; sablotron = callPackage ../tools/text/xml/sablotron { }; safecopy = callPackage ../tools/system/safecopy { }; salut_a_toi = callPackage ../applications/networking/instant-messengers/salut-a-toi {}; samplicator = callPackage ../tools/networking/samplicator { }; screen = callPackage ../tools/misc/screen { }; scrot = callPackage ../tools/graphics/scrot { }; scrypt = callPackage ../tools/security/scrypt { }; sdcv = callPackage ../applications/misc/sdcv { }; sec = callPackage ../tools/admin/sec { }; seccure = callPackage ../tools/security/seccure { }; setserial = builderDefsPackage (import ../tools/system/setserial) { inherit groff; }; seqdiag = pythonPackages.seqdiag; screenfetch = callPackage ../tools/misc/screenfetch { }; sg3_utils = callPackage ../tools/system/sg3_utils { }; sharutils = callPackage ../tools/archivers/sharutils { }; shotwell = callPackage ../applications/graphics/shotwell { }; shebangfix = callPackage ../tools/misc/shebangfix { }; shellinabox = callPackage ../servers/shellinabox { }; siege = callPackage ../tools/networking/siege {}; silc_client = callPackage ../applications/networking/instant-messengers/silc-client { }; silc_server = callPackage ../servers/silc-server { }; silver-searcher = callPackage ../tools/text/silver-searcher { }; simplescreenrecorder = callPackage ../applications/video/simplescreenrecorder { }; sleuthkit = callPackage ../tools/system/sleuthkit {}; slimrat = callPackage ../tools/networking/slimrat { inherit (perlPackages) WWWMechanize LWP; }; slsnif = callPackage ../tools/misc/slsnif { }; smartmontools = callPackage ../tools/system/smartmontools { }; smbldaptools = callPackage ../tools/networking/smbldaptools { inherit (perlPackages) NetLDAP CryptSmbHash DigestSHA1; }; smbnetfs = callPackage ../tools/filesystems/smbnetfs {}; snort = callPackage ../applications/networking/ids/snort { }; snx = callPackage_i686 ../tools/networking/snx { inherit (pkgsi686Linux) pam gcc33; inherit (pkgsi686Linux.xlibs) libX11; }; solr = callPackage ../servers/search/solr { }; sparsehash = callPackage ../development/libraries/sparsehash { }; spiped = callPackage ../tools/networking/spiped { }; sproxy = haskellPackages.callPackage ../tools/networking/sproxy { }; sproxy-web = haskellPackages.callPackage ../tools/networking/sproxy-web { }; stardict = callPackage ../applications/misc/stardict/stardict.nix { inherit (gnome) libgnomeui scrollkeeper; }; storebrowse = callPackage ../tools/system/storebrowse { }; fusesmb = callPackage ../tools/filesystems/fusesmb { }; sl = callPackage ../tools/misc/sl { }; socat = callPackage ../tools/networking/socat { }; socat2pre = lowPrio (callPackage ../tools/networking/socat/2.x.nix { }); sourceHighlight = callPackage ../tools/text/source-highlight { # Boost 1.54 causes the "test_regexranges" test to fail boost = boost149; }; spaceFM = callPackage ../applications/misc/spacefm { }; squashfsTools = callPackage ../tools/filesystems/squashfs { }; sshfsFuse = callPackage ../tools/filesystems/sshfs-fuse { }; sshuttle = callPackage ../tools/security/sshuttle { }; sudo = callPackage ../tools/security/sudo { }; suidChroot = builderDefsPackage (import ../tools/system/suid-chroot) { }; super = callPackage ../tools/security/super { }; ssdeep = callPackage ../tools/security/ssdeep { }; ssmtp = callPackage ../tools/networking/ssmtp { tlsSupport = true; }; ssss = callPackage ../tools/security/ssss { }; storeBackup = callPackage ../tools/backup/store-backup { }; stow = callPackage ../tools/misc/stow { }; stun = callPackage ../tools/networking/stun { }; stunnel = callPackage ../tools/networking/stunnel { }; su = shadow.su; surfraw = callPackage ../tools/networking/surfraw { }; swec = callPackage ../tools/networking/swec { inherit (perlPackages) LWP URI HTMLParser HTTPServerSimple Parent; }; svnfs = callPackage ../tools/filesystems/svnfs { }; sysbench = callPackage ../development/tools/misc/sysbench {}; system_config_printer = callPackage ../tools/misc/system-config-printer { libxml2 = libxml2Python; }; sitecopy = callPackage ../tools/networking/sitecopy { }; stricat = callPackage ../tools/security/stricat { }; privoxy = callPackage ../tools/networking/privoxy { }; t1utils = callPackage ../tools/misc/t1utils { }; tarsnap = callPackage ../tools/backup/tarsnap { }; tcpcrypt = callPackage ../tools/security/tcpcrypt { }; tboot = callPackage ../tools/security/tboot { }; tcpdump = callPackage ../tools/networking/tcpdump { }; tcpflow = callPackage ../tools/networking/tcpflow { }; teamviewer = callPackage_i686 ../applications/networking/remote/teamviewer { }; # Work In Progress: it doesn't start unless running a daemon as root teamviewer8 = lowPrio (callPackage_i686 ../applications/networking/remote/teamviewer/8.nix { }); telnet = callPackage ../tools/networking/telnet { }; texmacs = callPackage ../applications/editors/texmacs { tex = texLive; /* tetex is also an option */ extraFonts = true; guile = guile_1_8; }; texmaker = callPackage ../applications/editors/texmaker { }; texstudio = callPackage ../applications/editors/texstudio { }; tiled-qt = callPackage ../applications/editors/tiled-qt { qt = qt4; }; tinc = callPackage ../tools/networking/tinc { }; tiny8086 = callPackage ../applications/virtualization/8086tiny { }; tmpwatch = callPackage ../tools/misc/tmpwatch { }; tmux = callPackage ../tools/misc/tmux { }; tor = callPackage ../tools/security/tor { }; torbutton = callPackage ../tools/security/torbutton { }; torbrowser = callPackage ../tools/security/tor/torbrowser.nix { }; torsocks = callPackage ../tools/security/tor/torsocks.nix { }; tpm-quote-tools = callPackage ../tools/security/tpm-quote-tools { }; tpm-tools = callPackage ../tools/security/tpm-tools { }; trickle = callPackage ../tools/networking/trickle {}; trousers = callPackage ../tools/security/trousers { }; ttf2pt1 = callPackage ../tools/misc/ttf2pt1 { }; ttysnoop = callPackage ../os-specific/linux/ttysnoop {}; twitterBootstrap = callPackage ../development/web/twitter-bootstrap {}; txt2man = callPackage ../tools/misc/txt2man { }; ucl = callPackage ../development/libraries/ucl { }; ucspi-tcp = callPackage ../tools/networking/ucspi-tcp { }; udftools = callPackage ../tools/filesystems/udftools {}; udptunnel = callPackage ../tools/networking/udptunnel { }; ufraw = callPackage ../applications/graphics/ufraw { }; unetbootin = callPackage ../tools/cd-dvd/unetbootin { }; unfs3 = callPackage ../servers/unfs3 { }; unoconv = callPackage ../tools/text/unoconv { }; upx = callPackage ../tools/compression/upx { }; urlview = callPackage ../applications/misc/urlview {}; usbmuxd = callPackage ../tools/misc/usbmuxd {}; vacuum = callPackage ../applications/networking/instant-messengers/vacuum {}; volatility = callPackage ../tools/security/volatility { }; vidalia = callPackage ../tools/security/vidalia { }; vbetool = builderDefsPackage ../tools/system/vbetool { inherit pciutils libx86 zlib; }; vde2 = callPackage ../tools/networking/vde2 { }; vboot_reference = callPackage ../tools/system/vboot_reference { }; vcsh = callPackage ../applications/version-management/vcsh { }; verilog = callPackage ../applications/science/electronics/verilog {}; vfdecrypt = callPackage ../tools/misc/vfdecrypt { }; vifm = callPackage ../applications/misc/vifm { }; viking = callPackage ../applications/misc/viking { inherit (gnome) scrollkeeper; }; vnc2flv = callPackage ../tools/video/vnc2flv {}; vncrec = builderDefsPackage ../tools/video/vncrec { inherit (xlibs) imake libX11 xproto gccmakedep libXt libXmu libXaw libXext xextproto libSM libICE libXpm libXp; }; vobcopy = callPackage ../tools/cd-dvd/vobcopy { }; vobsub2srt = callPackage ../tools/cd-dvd/vobsub2srt { }; vorbisgain = callPackage ../tools/misc/vorbisgain { }; vpnc = callPackage ../tools/networking/vpnc { }; openconnect = callPackage ../tools/networking/openconnect.nix { }; vtun = callPackage ../tools/networking/vtun { }; wal_e = callPackage ../tools/backup/wal-e { }; watchman = callPackage ../development/tools/watchman { }; wbox = callPackage ../tools/networking/wbox {}; welkin = callPackage ../tools/graphics/welkin {}; testdisk = callPackage ../tools/misc/testdisk { }; htmlTidy = callPackage ../tools/text/html-tidy { }; html-xml-utils = callPackage ../tools/text/xml/html-xml-utils { }; tftp_hpa = callPackage ../tools/networking/tftp-hpa {}; tigervnc = callPackage ../tools/admin/tigervnc { fontDirectories = [ xorg.fontadobe75dpi xorg.fontmiscmisc xorg.fontcursormisc xorg.fontbhlucidatypewriter75dpi ]; inherit (xorg) xorgserver; fltk = fltk13; }; tightvnc = callPackage ../tools/admin/tightvnc { fontDirectories = [ xorg.fontadobe75dpi xorg.fontmiscmisc xorg.fontcursormisc xorg.fontbhlucidatypewriter75dpi ]; }; time = callPackage ../tools/misc/time { }; tkabber = callPackage ../applications/networking/instant-messengers/tkabber { }; qfsm = callPackage ../applications/science/electronics/qfsm { }; tkgate = callPackage ../applications/science/electronics/tkgate/1.x.nix { inherit (xlibs) libX11 imake xproto gccmakedep; }; # The newer package is low-priority because it segfaults at startup. tkgate2 = lowPrio (callPackage ../applications/science/electronics/tkgate/2.x.nix { inherit (xlibs) libX11; }); tm = callPackage ../tools/system/tm { }; trang = callPackage ../tools/text/xml/trang { }; tre = callPackage ../development/libraries/tre { }; ts = callPackage ../tools/system/ts { }; transfig = callPackage ../tools/graphics/transfig { libpng = libpng12; }; truecrypt = callPackage ../applications/misc/truecrypt { wxGUI = config.truecrypt.wxGUI or true; }; ttmkfdir = callPackage ../tools/misc/ttmkfdir { }; unclutter = callPackage ../tools/misc/unclutter { }; unbound = callPackage ../tools/networking/unbound { }; units = callPackage ../tools/misc/units { }; unrar = callPackage ../tools/archivers/unrar { }; xarchive = callPackage ../tools/archivers/xarchive { }; xarchiver = callPackage ../tools/archivers/xarchiver { }; xcruiser = callPackage ../applications/misc/xcruiser { }; unarj = callPackage ../tools/archivers/unarj { }; unshield = callPackage ../tools/archivers/unshield { }; unzip = callPackage ../tools/archivers/unzip { }; unzipNLS = lowPrio (unzip.override { enableNLS = true; }); uptimed = callPackage ../tools/system/uptimed { }; varnish = callPackage ../servers/varnish { }; varnish2 = callPackage ../servers/varnish/2.1.nix { }; venus = callPackage ../tools/misc/venus { python = python27; }; vlan = callPackage ../tools/networking/vlan { }; wakelan = callPackage ../tools/networking/wakelan { }; wavemon = callPackage ../tools/networking/wavemon { }; w3cCSSValidator = callPackage ../tools/misc/w3c-css-validator { tomcat = tomcat6; }; wdfs = callPackage ../tools/filesystems/wdfs { }; wdiff = callPackage ../tools/text/wdiff { }; webalizer = callPackage ../tools/networking/webalizer { }; webdruid = builderDefsPackage ../tools/admin/webdruid { inherit zlib libpng freetype gd which libxml2 geoip; }; weighttp = callPackage ../tools/networking/weighttp { }; wget = callPackage ../tools/networking/wget { inherit (perlPackages) LWP; }; which = callPackage ../tools/system/which { }; wicd = callPackage ../tools/networking/wicd { }; wkhtmltopdf = callPackage ../tools/graphics/wkhtmltopdf { }; wv = callPackage ../tools/misc/wv { }; wv2 = callPackage ../tools/misc/wv2 { }; x86info = callPackage ../os-specific/linux/x86info { }; x11_ssh_askpass = callPackage ../tools/networking/x11-ssh-askpass { }; xbursttools = assert stdenv ? glibc; import ../tools/misc/xburst-tools { inherit stdenv fetchgit autoconf automake confuse pkgconfig libusb libusb1; # It needs a cross compiler for mipsel to build the firmware it will # load into the Ben Nanonote gccCross = let pkgsCross = (import ./all-packages.nix) { inherit system; inherit bootStdenv noSysDirs gccWithCC gccWithProfiling config; # Ben Nanonote system crossSystem = { config = "mipsel-unknown-linux"; bigEndian = true; arch = "mips"; float = "soft"; withTLS = true; libc = "uclibc"; platform = { name = "ben_nanonote"; kernelMajor = "2.6"; # It's not a bcm47xx processor, but for the headers this should work kernelHeadersBaseConfig = "bcm47xx_defconfig"; kernelArch = "mips"; }; gcc = { arch = "mips32"; }; }; }; in pkgsCross.gccCrossStageStatic; }; xclip = callPackage ../tools/misc/xclip { }; xtitle = callPackage ../tools/misc/xtitle { }; xdelta = callPackage ../tools/compression/xdelta { }; xdummy = callPackage ../tools/misc/xdummy { }; xfsprogs = callPackage ../tools/filesystems/xfsprogs { }; xmlroff = callPackage ../tools/typesetting/xmlroff { inherit (gnome) libgnomeprint; }; xmlstarlet = callPackage ../tools/text/xml/xmlstarlet { }; xmlto = callPackage ../tools/typesetting/xmlto { }; xmltv = callPackage ../tools/misc/xmltv { }; xmpppy = builderDefsPackage (import ../development/python-modules/xmpppy) { inherit python setuptools; }; xorriso = callPackage ../tools/cd-dvd/xorriso { }; xpf = callPackage ../tools/text/xml/xpf { libxml2 = libxml2Python; }; xsel = callPackage ../tools/misc/xsel { }; xtreemfs = callPackage ../tools/filesystems/xtreemfs {}; xvfb_run = callPackage ../tools/misc/xvfb-run { inherit (texFunctions) fontsConf; }; youtubeDL = callPackage ../tools/misc/youtube-dl { }; zbar = callPackage ../tools/graphics/zbar { pygtk = lib.overrideDerivation pygtk (x: { gtk = gtk2; }); }; zdelta = callPackage ../tools/compression/zdelta { }; zfstools = callPackage ../tools/filesystems/zfstools { zfs = linuxPackages.zfs; }; zile = callPackage ../applications/editors/zile { }; zip = callPackage ../tools/archivers/zip { }; zpaq = callPackage ../tools/archivers/zpaq { }; zpaqd = callPackage ../tools/archivers/zpaq/zpaqd.nix { }; zsync = callPackage ../tools/compression/zsync { }; ### SHELLS bash = lowPrio (callPackage ../shells/bash { texinfo = null; }); bashInteractive = appendToName "interactive" (callPackage ../shells/bash { interactive = true; readline = readline63; # Includes many vi mode fixes }); bashCompletion = callPackage ../shells/bash-completion { }; dash = callPackage ../shells/dash { }; fish = callPackage ../shells/fish { python = python27Full; }; tcsh = callPackage ../shells/tcsh { }; rush = callPackage ../shells/rush { }; zsh = callPackage ../shells/zsh { }; ### DEVELOPMENT / COMPILERS abc = abcPatchable []; abcPatchable = patches : import ../development/compilers/abc/default.nix { inherit stdenv fetchurl patches jre apacheAnt; javaCup = callPackage ../development/libraries/java/cup { }; }; aldor = callPackage ../development/compilers/aldor { }; aliceml = callPackage ../development/compilers/aliceml { }; aspectj = callPackage ../development/compilers/aspectj { }; ats = callPackage ../development/compilers/ats { }; ats2 = callPackage ../development/compilers/ats2 { }; avra = callPackage ../development/compilers/avra { }; bigloo = callPackage ../development/compilers/bigloo { }; chicken = callPackage ../development/compilers/chicken { }; ccl = builderDefsPackage ../development/compilers/ccl {}; clang = wrapClang llvmPackages.clang; clang_34 = wrapClang llvmPackages_34.clang; clang_33 = wrapClang (clangUnwrapped llvm_33 ../development/compilers/llvm/3.3/clang.nix); clangAnalyzer = callPackage ../development/tools/analysis/clang-analyzer { clang = clang_34; llvmPackages = llvmPackages_34; }; clangUnwrapped = llvm: pkg: callPackage pkg { stdenv = if stdenv.isDarwin then stdenvApple else stdenv; inherit llvm; }; clangSelf = clangWrapSelf llvmPackagesSelf.clang; clangWrapSelf = build: (import ../build-support/clang-wrapper) { clang = build; stdenv = clangStdenv; libc = glibc; binutils = binutils; shell = bash; inherit libcxx coreutils zlib; nativeTools = false; nativeLibc = false; }; #Use this instead of stdenv to build with clang clangStdenv = lowPrio (stdenvAdapters.overrideGCC stdenv clang); libcxxStdenv = stdenvAdapters.overrideGCC stdenv (clangWrapSelf llvmPackages.clang); clean = callPackage ../development/compilers/clean { }; closurecompiler = callPackage ../development/compilers/closure { }; cmucl_binary = callPackage ../development/compilers/cmucl/binary.nix { }; compcert = callPackage ../development/compilers/compcert {}; cryptol1 = lowPrio (callPackage ../development/compilers/cryptol/1.8.x.nix {}); cryptol2 = with haskellPackages_ghc763; callPackage ../development/compilers/cryptol/2.0.x.nix { Cabal = Cabal_1_18_1_3; cabalInstall = cabalInstall_1_18_0_3; process = process_1_2_0_0; }; cython = pythonPackages.cython; cython3 = python3Packages.cython; dylan = callPackage ../development/compilers/gwydion-dylan { dylan = callPackage ../development/compilers/gwydion-dylan/binary.nix { }; }; ecl = callPackage ../development/compilers/ecl { }; eql = callPackage ../development/compilers/eql {}; adobe_flex_sdk = callPackage ../development/compilers/adobe-flex-sdk { }; fpc = callPackage ../development/compilers/fpc { }; fpc_2_4_0 = callPackage ../development/compilers/fpc/2.4.0.nix { }; gambit = callPackage ../development/compilers/gambit { }; gcc = gcc48; gcc33 = wrapGCC (import ../development/compilers/gcc/3.3 { inherit fetchurl stdenv noSysDirs; }); gcc34 = wrapGCC (import ../development/compilers/gcc/3.4 { inherit fetchurl stdenv noSysDirs; }); gcc48_realCross = lib.addMetaAttrs { hydraPlatforms = []; } (callPackage ../development/compilers/gcc/4.8 { inherit noSysDirs; binutilsCross = binutilsCross; libcCross = libcCross; profiledCompiler = false; enableMultilib = false; crossStageStatic = false; cross = assert crossSystem != null; crossSystem; }); gcc_realCross = gcc48_realCross; gccCrossStageStatic = let libcCross1 = if stdenv.cross.libc == "msvcrt" then windows.mingw_w64_headers else if stdenv.cross.libc == "libSystem" then darwin.xcode else null; in wrapGCCCross { gcc = forceNativeDrv (lib.addMetaAttrs { hydraPlatforms = []; } ( gcc_realCross.override { crossStageStatic = true; langCC = false; libcCross = libcCross1; enableShared = false; })); libc = libcCross1; binutils = binutilsCross; cross = assert crossSystem != null; crossSystem; }; # Only needed for mingw builds gccCrossMingw2 = wrapGCCCross { gcc = gccCrossStageStatic.gcc; libc = windows.mingw_headers2; binutils = binutilsCross; cross = assert crossSystem != null; crossSystem; }; gccCrossStageFinal = wrapGCCCross { gcc = forceNativeDrv (gcc_realCross.override { libpthreadCross = # FIXME: Don't explicitly refer to `i586-pc-gnu'. if crossSystem != null && crossSystem.config == "i586-pc-gnu" then gnu.libpthreadCross else null; # XXX: We have troubles cross-compiling libstdc++ on MinGW (see # ), so don't even try. langCC = (crossSystem == null || crossSystem.config != "i686-pc-mingw32"); }); libc = libcCross; binutils = binutilsCross; cross = assert crossSystem != null; crossSystem; }; gcc44 = lowPrio (wrapGCC (makeOverridable (import ../development/compilers/gcc/4.4) { inherit fetchurl stdenv gmp mpfr /* ppl cloogppl */ gettext which noSysDirs; texinfo = texinfo4; profiledCompiler = true; })); gcc45 = lowPrio (wrapGCC (callPackage ../development/compilers/gcc/4.5 { inherit fetchurl stdenv gmp mpfr mpc libelf zlib perl gettext which noSysDirs; texinfo = texinfo4; ppl = null; cloogppl = null; # bootstrapping a profiled compiler does not work in the sheevaplug: # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43944 profiledCompiler = !stdenv.isArm; # When building `gcc.crossDrv' (a "Canadian cross", with host == target # and host != build), `cross' must be null but the cross-libc must still # be passed. cross = null; libcCross = if crossSystem != null then libcCross else null; libpthreadCross = if crossSystem != null && crossSystem.config == "i586-pc-gnu" then gnu.libpthreadCross else null; })); gcc46 = lowPrio (wrapGCC (callPackage ../development/compilers/gcc/4.6 { inherit noSysDirs; ppl = null; cloog = null; # bootstrapping a profiled compiler does not work in the sheevaplug: # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43944 profiledCompiler = false; # When building `gcc.crossDrv' (a "Canadian cross", with host == target # and host != build), `cross' must be null but the cross-libc must still # be passed. cross = null; libcCross = if crossSystem != null then libcCross else null; libpthreadCross = if crossSystem != null && crossSystem.config == "i586-pc-gnu" then gnu.libpthreadCross else null; texinfo = texinfo413; })); gcc48 = lowPrio (wrapGCC (callPackage ../development/compilers/gcc/4.8 { inherit noSysDirs; # PGO seems to speed up compilation by gcc by ~10%, see #445 discussion profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64)); # When building `gcc.crossDrv' (a "Canadian cross", with host == target # and host != build), `cross' must be null but the cross-libc must still # be passed. cross = null; libcCross = if crossSystem != null then libcCross else null; libpthreadCross = if crossSystem != null && crossSystem.config == "i586-pc-gnu" then gnu.libpthreadCross else null; })); gcc48_multi = if system == "x86_64-linux" then lowPrio ( wrapGCCWith (import ../build-support/gcc-wrapper) glibc_multi (gcc48.gcc.override { stdenv = overrideGCC stdenv (wrapGCCWith (import ../build-support/gcc-wrapper) glibc_multi gcc.gcc); profiledCompiler = false; enableMultilib = true; })) else throw "Multilib gcc not supported on ‘${system}’"; gcc48_debug = lowPrio (wrapGCC (callPackage ../development/compilers/gcc/4.8 { stripped = false; inherit noSysDirs; cross = null; libcCross = null; binutilsCross = null; })); gcc49 = lowPrio (wrapGCC (callPackage ../development/compilers/gcc/4.9 { inherit noSysDirs; # PGO seems to speed up compilation by gcc by ~10%, see #445 discussion profiledCompiler = with stdenv; (!isDarwin && (isi686 || isx86_64)); # When building `gcc.crossDrv' (a "Canadian cross", with host == target # and host != build), `cross' must be null but the cross-libc must still # be passed. cross = null; libcCross = if crossSystem != null then libcCross else null; libpthreadCross = if crossSystem != null && crossSystem.config == "i586-pc-gnu" then gnu.libpthreadCross else null; })); gccApple = assert stdenv.isDarwin; wrapGCC (makeOverridable (import ../development/compilers/gcc/4.2-apple64) { inherit fetchurl noSysDirs; profiledCompiler = true; # Since it fails to build with GCC 4.6, build it with the "native" # Apple-GCC. stdenv = allStdenvs.stdenvNative; }); gfortran = gfortran48; gfortran48 = wrapGCC (gcc48.gcc.override { name = "gfortran"; langFortran = true; langCC = false; langC = false; profiledCompiler = false; }); gcj = gcj48; gcj48 = wrapGCC (gcc48.gcc.override { name = "gcj"; langJava = true; langFortran = false; langCC = false; langC = false; profiledCompiler = false; inherit zip unzip zlib boehmgc gettext pkgconfig perl; inherit gtk; inherit (gnome) libart_lgpl; inherit (xlibs) libX11 libXt libSM libICE libXtst libXi libXrender libXrandr xproto renderproto xextproto inputproto randrproto; }); gnat = gnat45; gnat45 = wrapGCC (gcc45.gcc.override { name = "gnat"; langCC = false; langC = true; langAda = true; profiledCompiler = false; inherit gnatboot; # We can't use the ppl stuff, because we would have # libstdc++ problems. cloogppl = null; ppl = null; }); gnat46 = wrapGCC (gcc46.gcc.override { name = "gnat"; langCC = false; langC = true; langAda = true; profiledCompiler = false; gnatboot = gnat45; # We can't use the ppl stuff, because we would have # libstdc++ problems. ppl = null; cloog = null; }); gnatboot = wrapGCC (import ../development/compilers/gnatboot { inherit fetchurl stdenv; }); gccgo = gccgo48; gccgo48 = wrapGCC (gcc48.gcc.override { name = "gccgo"; langCC = true; #required for go. langC = true; langGo = true; }); ghdl = wrapGCC (import ../development/compilers/gcc/4.3 { inherit stdenv fetchurl gmp mpfr noSysDirs gnat; texinfo = texinfo4; name = "ghdl"; langVhdl = true; langCC = false; langC = false; profiledCompiler = false; enableMultilib = false; }); ghdl_mcode = callPackage ../development/compilers/ghdl { }; gcl = builderDefsPackage ../development/compilers/gcl { inherit mpfr m4 binutils fetchcvs emacs zlib which texinfo; gmp = gmp4; inherit (xlibs) libX11 xproto inputproto libXi libXext xextproto libXt libXaw libXmu; inherit stdenv; texLive = texLiveAggregationFun { paths = [ texLive texLiveExtra ]; }; }; jhc = callPackage ../development/compilers/jhc { inherit (haskellPackages_ghc763) ghc binary zlib utf8String readline fgl regexCompat HsSyck random; }; gcc-arm-embedded-4_7 = callPackage_i686 ../development/compilers/gcc-arm-embedded { version = "4.7-2013q3-20130916"; releaseType = "update"; sha256 = "1bd9bi9q80xn2rpy0rn1vvj70rh15kb7dmah0qs4q2rv78fqj40d"; }; gcc-arm-embedded-4_8 = callPackage_i686 ../development/compilers/gcc-arm-embedded { version = "4.8-2014q1-20140314"; releaseType = "update"; sha256 = "ce92859550819d4a3d1a6e2672ea64882b30afa2c08cf67fa8e1d93788c2c577"; }; gcc-arm-embedded = gcc-arm-embedded-4_8; # Haskell and GHC # Import Haskell infrastructure. haskell = let pkgs_ = pkgs // { gmp = gmp.override { withStatic = true; }; }; callPackage = newScope pkgs_; newScope = extra: lib.callPackageWith (pkgs_ // pkgs_.xorg // extra); in callPackage ./haskell-defaults.nix { pkgs = pkgs_; inherit callPackage newScope; }; # Available GHC versions. # For several compiler versions, we export a large set of Haskell-related # packages. # NOTE (recurseIntoAttrs): After discussion, we originally decided to # enable it for all GHC versions. However, this is getting too much, # particularly in connection with Hydra builds for all these packages. # So we enable it for selected versions only. We build all ghcs, though ghc = recurseIntoAttrs (lib.mapAttrs' (name: value: lib.nameValuePair (builtins.substring (builtins.stringLength "packages_") (builtins.stringLength name) name) value.ghc ) (lib.filterAttrs (name: value: builtins.substring 0 (builtins.stringLength "packages_") name == "packages_" ) haskell)); haskellPackages = haskellPackages_ghc783; haskellPlatform = haskellPlatformPackages."2013_2_0_0"; haskellPackages_ghc6104 = haskell.packages_ghc6104; haskellPackages_ghc6123 = haskell.packages_ghc6123; haskellPackages_ghc704 = haskell.packages_ghc704; haskellPackages_ghc722 = haskell.packages_ghc722; haskellPackages_ghc742 = haskell.packages_ghc742; haskellPackages_ghc763 = haskell.packages_ghc763; haskellPackages_ghc783_no_profiling = recurseIntoAttrs haskell.packages_ghc783.noProfiling; haskellPackages_ghc783_profiling = recurseIntoAttrs haskell.packages_ghc783.profiling; haskellPackages_ghc783 = recurseIntoAttrs haskell.packages_ghc783.highPrio; haskellPackages_ghcHEAD = haskell.packages_ghcHEAD; haskellPlatformPackages = recurseIntoAttrs (import ../development/libraries/haskell/haskell-platform { inherit pkgs; }); haxe = callPackage ../development/compilers/haxe { }; hhvm = callPackage ../development/compilers/hhvm { }; hiphopvm = hhvm; /* Compatibility alias */ falcon = builderDefsPackage (import ../development/interpreters/falcon) { inherit cmake; }; fsharp = callPackage ../development/compilers/fsharp {}; go_1_0 = callPackage ../development/compilers/go { }; go_1_1 = if stdenv.isDarwin then callPackage ../development/compilers/go/1.1-darwin.nix { } else callPackage ../development/compilers/go/1.1.nix { }; go_1_2 = callPackage ../development/compilers/go/1.2.nix { }; go_1_3 = callPackage ../development/compilers/go/1.3.nix { }; go = go_1_3; gox = callPackage ../development/compilers/go/gox.nix { }; gprolog = callPackage ../development/compilers/gprolog { }; gwt240 = callPackage ../development/compilers/gwt/2.4.0.nix { }; icedtea7_jdk = callPackage ../development/compilers/icedtea rec { jdk = openjdk; jdkPath = "${openjdk}/lib/openjdk"; } // { outputs = [ "out" ]; }; icedtea7_jre = (lib.setName "icedtea7-${lib.getVersion pkgs.icedtea7_jdk.jre}" (lib.addMetaAttrs { description = "Free Java runtime environment based on OpenJDK 7.0 and the IcedTea project"; } pkgs.icedtea7_jdk.jre)) // { outputs = [ "jre" ]; }; icedtea7_web = callPackage ../development/compilers/icedtea-web { jdk = "${icedtea7_jdk}/lib/icedtea"; }; ikarus = callPackage ../development/compilers/ikarus { }; hugs = callPackage ../development/compilers/hugs { }; path64 = callPackage ../development/compilers/path64 { }; openjdk = if stdenv.isDarwin then callPackage ../development/compilers/openjdk-darwin { } else let openjdkBootstrap = callPackage ../development/compilers/openjdk/bootstrap.nix { }; in (callPackage ../development/compilers/openjdk { jdk = openjdkBootstrap; }) // { outputs = [ "out" ]; }; # FIXME: Need a way to set per-output meta attributes. openjre = (lib.setName "openjre-${lib.getVersion pkgs.openjdk.jre}" (lib.addMetaAttrs { description = "The open-source Java Runtime Environment"; } pkgs.openjdk.jre)) // { outputs = [ "jre" ]; }; jdk = if stdenv.isDarwin || stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux" then pkgs.openjdk else pkgs.oraclejdk; jre = if stdenv.isDarwin || stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux" then pkgs.openjre else pkgs.oraclejre; oraclejdk = pkgs.jdkdistro true false; oraclejdk7 = pkgs.oraclejdk7distro true false; oraclejdk8 = pkgs.oraclejdk8distro true false; oraclejre = lowPrio (pkgs.jdkdistro false false); oraclejre7 = lowPrio (pkgs.oraclejdk7distro false false); oraclejre8 = lowPrio (pkgs.oraclejdk8distro false false); jrePlugin = lowPrio (pkgs.jdkdistro false true); supportsJDK = system == "i686-linux" || system == "x86_64-linux"; jdkdistro = installjdk: pluginSupport: assert supportsJDK; (if pluginSupport then appendToName "with-plugin" else x: x) (callPackage ../development/compilers/oraclejdk/jdk6-linux.nix { }); oraclejdk7distro = installjdk: pluginSupport: assert supportsJDK; (if pluginSupport then appendToName "with-plugin" else x: x) (callPackage ../development/compilers/oraclejdk/jdk7-linux.nix { inherit installjdk; }); oraclejdk8distro = installjdk: pluginSupport: assert supportsJDK; (if pluginSupport then appendToName "with-plugin" else x: x) (callPackage ../development/compilers/oraclejdk/jdk8-linux.nix { inherit installjdk; }); jikes = callPackage ../development/compilers/jikes { }; juliaGit = callPackage ../development/compilers/julia/git-20131013.nix { liblapack = liblapack.override {shared = true;}; llvm = llvm_33; }; julia021 = callPackage ../development/compilers/julia/0.2.1.nix { liblapack = liblapack.override {shared = true;}; llvm = llvm_33; }; julia030 = let liblapack = liblapack_3_5_0.override {shared = true;}; in callPackage ../development/compilers/julia/0.3.0.nix { inherit liblapack; suitesparse = suitesparse.override { inherit liblapack; }; openblas = openblas_0_2_10; llvm = llvm_34; }; julia = julia021; lazarus = builderDefsPackage (import ../development/compilers/fpc/lazarus.nix) { inherit makeWrapper gtk glib pango atk gdk_pixbuf; inherit (xlibs) libXi inputproto libX11 xproto libXext xextproto; fpc = fpc; }; lessc = callPackage ../development/compilers/lessc { }; llvm = llvmPackages.llvm; llvm_34 = llvmPackages_34.llvm; llvm_33 = llvm_v ../development/compilers/llvm/3.3/llvm.nix; llvm_v = path: callPackage path { stdenv = if stdenv.isDarwin then stdenvApple else stdenv; }; llvmPackages = if !stdenv.isDarwin then llvmPackages_34 else llvmPackages_34 // { # until someone solves build problems with _34 llvm = llvm_33; clang = clang_33; }; llvmPackages_34 = recurseIntoAttrs (import ../development/compilers/llvm/3.4 { inherit stdenv newScope fetchurl; isl = isl_0_12; }); llvmPackagesSelf = import ../development/compilers/llvm/3.4 { inherit newScope fetchurl; isl = isl_0_12; stdenv = libcxxStdenv; }; manticore = callPackage ../development/compilers/manticore { }; mentorToolchains = recurseIntoAttrs ( callPackage_i686 ../development/compilers/mentor {} ); mercury = callPackage ../development/compilers/mercury { }; mitscheme = callPackage ../development/compilers/mit-scheme { }; mlton = callPackage ../development/compilers/mlton { }; mono = callPackage ../development/compilers/mono { inherit (xlibs) libX11; }; monoDLLFixer = callPackage ../build-support/mono-dll-fixer { }; mozart = callPackage ../development/compilers/mozart { }; neko = callPackage ../development/compilers/neko { }; nasm = callPackage ../development/compilers/nasm { }; nvidia_cg_toolkit = callPackage ../development/compilers/nvidia-cg-toolkit { }; ocaml = ocamlPackages.ocaml; ocaml_3_08_0 = callPackage ../development/compilers/ocaml/3.08.0.nix { }; ocaml_3_10_0 = callPackage ../development/compilers/ocaml/3.10.0.nix { }; ocaml_3_11_2 = callPackage ../development/compilers/ocaml/3.11.2.nix { }; ocaml_3_12_1 = callPackage ../development/compilers/ocaml/3.12.1.nix { }; ocaml_4_00_1 = callPackage ../development/compilers/ocaml/4.00.1.nix { }; ocaml_4_01_0 = callPackage ../development/compilers/ocaml/4.01.0.nix { }; orc = callPackage ../development/compilers/orc { }; metaocaml_3_09 = callPackage ../development/compilers/ocaml/metaocaml-3.09.nix { }; ber_metaocaml_003 = callPackage ../development/compilers/ocaml/ber-metaocaml-003.nix { }; mkOcamlPackages = ocaml: self: let callPackage = newScope self; in rec { inherit ocaml; camlidl = callPackage ../development/tools/ocaml/camlidl { }; camlp5_5_strict = callPackage ../development/tools/ocaml/camlp5/5.15.nix { }; camlp5_5_transitional = callPackage ../development/tools/ocaml/camlp5/5.15.nix { transitional = true; }; camlp5_6_strict = callPackage ../development/tools/ocaml/camlp5 { }; camlp5_6_transitional = callPackage ../development/tools/ocaml/camlp5 { transitional = true; }; camlp5_strict = camlp5_6_strict; camlp5_transitional = camlp5_6_transitional; camlzip = callPackage ../development/ocaml-modules/camlzip { }; camomile_0_8_2 = callPackage ../development/ocaml-modules/camomile/0.8.2.nix { }; camomile = callPackage ../development/ocaml-modules/camomile { }; camlimages = callPackage ../development/ocaml-modules/camlimages { libpng = libpng12; giflib = giflib_4_1; }; biniou = callPackage ../development/ocaml-modules/biniou { }; ocaml_cairo = callPackage ../development/ocaml-modules/ocaml-cairo { }; cppo = callPackage ../development/tools/ocaml/cppo { }; cryptokit = callPackage ../development/ocaml-modules/cryptokit { }; csv = callPackage ../development/ocaml-modules/csv { }; deriving = callPackage ../development/tools/ocaml/deriving { }; easy-format = callPackage ../development/ocaml-modules/easy-format { }; findlib = callPackage ../development/tools/ocaml/findlib { }; javalib = callPackage ../development/ocaml-modules/javalib { extlib = ocaml_extlib_maximal; }; dypgen = callPackage ../development/ocaml-modules/dypgen { }; patoline = callPackage ../tools/typesetting/patoline { }; gmetadom = callPackage ../development/ocaml-modules/gmetadom { }; lablgl = callPackage ../development/ocaml-modules/lablgl { }; lablgtk = callPackage ../development/ocaml-modules/lablgtk { inherit (gnome) libgnomecanvas libglade gtksourceview; }; lablgtkmathview = callPackage ../development/ocaml-modules/lablgtkmathview { gtkmathview = callPackage ../development/libraries/gtkmathview { }; }; menhir = callPackage ../development/ocaml-modules/menhir { }; merlin = callPackage ../development/tools/ocaml/merlin { }; mldonkey = callPackage ../applications/networking/p2p/mldonkey { }; mlgmp = callPackage ../development/ocaml-modules/mlgmp { }; ocaml_batteries = callPackage ../development/ocaml-modules/batteries { }; ocaml_cryptgps = callPackage ../development/ocaml-modules/cryptgps { }; ocaml_data_notation = callPackage ../development/ocaml-modules/odn { }; ocaml_expat = callPackage ../development/ocaml-modules/expat { }; ocamlgraph = callPackage ../development/ocaml-modules/ocamlgraph { }; ocaml_http = callPackage ../development/ocaml-modules/http { }; ocamlify = callPackage ../development/tools/ocaml/ocamlify { }; ocaml_lwt = callPackage ../development/ocaml-modules/lwt { }; ocamlmod = callPackage ../development/tools/ocaml/ocamlmod { }; ocaml_mysql = callPackage ../development/ocaml-modules/mysql { }; ocamlnet = callPackage ../development/ocaml-modules/ocamlnet { }; ocaml_oasis = callPackage ../development/tools/ocaml/oasis { }; ocaml_pcre = callPackage ../development/ocaml-modules/pcre { inherit pcre; }; ocaml_react = callPackage ../development/ocaml-modules/react { }; ocamlsdl= callPackage ../development/ocaml-modules/ocamlsdl { }; ocaml_sqlite3 = callPackage ../development/ocaml-modules/sqlite3 { }; ocaml_ssl = callPackage ../development/ocaml-modules/ssl { }; ounit = callPackage ../development/ocaml-modules/ounit { }; ulex = callPackage ../development/ocaml-modules/ulex { }; ulex08 = callPackage ../development/ocaml-modules/ulex/0.8 { camlp5 = camlp5_transitional; }; ocaml_typeconv = callPackage ../development/ocaml-modules/typeconv { }; ocaml_typeconv_3_0_5 = callPackage ../development/ocaml-modules/typeconv/3.0.5.nix { }; ocaml_sexplib = callPackage ../development/ocaml-modules/sexplib { }; ocaml_extlib = callPackage ../development/ocaml-modules/extlib { }; ocaml_extlib_maximal = callPackage ../development/ocaml-modules/extlib { minimal = false; }; pycaml = callPackage ../development/ocaml-modules/pycaml { }; opam_1_0_0 = callPackage ../development/tools/ocaml/opam/1.0.0.nix { }; opam_1_1 = callPackage ../development/tools/ocaml/opam/1.1.nix { }; opam = opam_1_1; sawja = callPackage ../development/ocaml-modules/sawja { }; uucd = callPackage ../development/ocaml-modules/uucd { }; uunf = callPackage ../development/ocaml-modules/uunf { }; uutf = callPackage ../development/ocaml-modules/uutf { }; xmlm = callPackage ../development/ocaml-modules/xmlm { }; yojson = callPackage ../development/ocaml-modules/yojson { }; zarith = callPackage ../development/ocaml-modules/zarith { }; }; ocamlPackages = recurseIntoAttrs ocamlPackages_4_01_0; ocamlPackages_3_10_0 = mkOcamlPackages ocaml_3_10_0 pkgs.ocamlPackages_3_10_0; ocamlPackages_3_11_2 = mkOcamlPackages ocaml_3_11_2 pkgs.ocamlPackages_3_11_2; ocamlPackages_3_12_1 = mkOcamlPackages ocaml_3_12_1 pkgs.ocamlPackages_3_12_1; ocamlPackages_4_00_1 = mkOcamlPackages ocaml_4_00_1 pkgs.ocamlPackages_4_00_1; ocamlPackages_4_01_0 = mkOcamlPackages ocaml_4_01_0 pkgs.ocamlPackages_4_01_0; ocamlPackages_latest = ocamlPackages_4_01_0; ocaml_make = callPackage ../development/ocaml-modules/ocamlmake { }; opa = let callPackage = newScope pkgs.ocamlPackages_4_00_1; in callPackage ../development/compilers/opa { }; ocamlnat = let callPackage = newScope pkgs.ocamlPackages_3_12_1; in callPackage ../development/ocaml-modules/ocamlnat { }; qcmm = callPackage ../development/compilers/qcmm { lua = lua4; ocaml = ocaml_3_08_0; }; roadsend = callPackage ../development/compilers/roadsend { }; rustc = callPackage ../development/compilers/rustc/0.11.nix {}; rustcMaster = callPackage ../development/compilers/rustc/head.nix {}; rust = rustc; sbclBootstrap = callPackage ../development/compilers/sbcl/bootstrap.nix {}; sbcl = callPackage ../development/compilers/sbcl { clisp = clisp; }; scala_2_9 = callPackage ../development/compilers/scala/2.9.nix { }; scala_2_10 = callPackage ../development/compilers/scala/2.10.nix { }; scala_2_11 = callPackage ../development/compilers/scala { }; scala = scala_2_11; sdcc = callPackage ../development/compilers/sdcc { }; smlnjBootstrap = callPackage ../development/compilers/smlnj/bootstrap.nix { }; smlnj = callPackage_i686 ../development/compilers/smlnj { }; stalin = callPackage ../development/compilers/stalin { }; strategoPackages = recurseIntoAttrs strategoPackages018; strategoPackages016 = callPackage ../development/compilers/strategoxt/0.16.nix { stdenv = overrideInStdenv stdenv [gnumake380]; }; strategoPackages017 = callPackage ../development/compilers/strategoxt/0.17.nix { readline = readline5; }; strategoPackages018 = callPackage ../development/compilers/strategoxt/0.18.nix { readline = readline5; }; metaBuildEnv = callPackage ../development/compilers/meta-environment/meta-build-env { }; swiProlog = callPackage ../development/compilers/swi-prolog { }; tbb = callPackage ../development/libraries/tbb { }; tinycc = callPackage ../development/compilers/tinycc { }; urweb = callPackage ../development/compilers/urweb { }; vala = callPackage ../development/compilers/vala/default.nix { }; visualcpp = callPackage ../development/compilers/visual-c++ { }; vs90wrapper = callPackage ../development/compilers/vs90wrapper { }; webdsl = callPackage ../development/compilers/webdsl { }; win32hello = callPackage ../development/compilers/visual-c++/test { }; wrapGCCWith = gccWrapper: glibc: baseGCC: gccWrapper { nativeTools = stdenv ? gcc && stdenv.gcc.nativeTools; nativeLibc = stdenv ? gcc && stdenv.gcc.nativeLibc; nativePrefix = if stdenv ? gcc then stdenv.gcc.nativePrefix else ""; gcc = baseGCC; libc = glibc; shell = bash; inherit stdenv binutils coreutils zlib; }; wrapClangWith = clangWrapper: glibc: baseClang: clangWrapper { nativeTools = stdenv.gcc.nativeTools or false; nativeLibc = stdenv.gcc.nativeLibc or false; nativePrefix = stdenv.gcc.nativePrefix or ""; clang = baseClang; libc = glibc; shell = bash; binutils = stdenv.gcc.binutils; inherit stdenv coreutils zlib; }; wrapClang = wrapClangWith (makeOverridable (import ../build-support/clang-wrapper)) glibc; wrapGCC = wrapGCCWith (makeOverridable (import ../build-support/gcc-wrapper)) glibc; wrapGCCCross = {gcc, libc, binutils, cross, shell ? "", name ? "gcc-cross-wrapper"}: forceNativeDrv (import ../build-support/gcc-cross-wrapper { nativeTools = false; nativeLibc = false; noLibc = (libc == null); inherit stdenv gcc binutils libc shell name cross; }); # prolog yap = callPackage ../development/compilers/yap { }; yasm = callPackage ../development/compilers/yasm { }; ### DEVELOPMENT / INTERPRETERS acl2 = builderDefsPackage ../development/interpreters/acl2 { inherit sbcl; }; angelscript = callPackage ../development/interpreters/angelscript {}; clisp = callPackage ../development/interpreters/clisp { }; # compatibility issues in 2.47 - at list 2.44.1 is known good # for sbcl bootstrap clisp_2_44_1 = callPackage ../development/interpreters/clisp/2.44.1.nix { libsigsegv = libsigsegv_25; }; clojure = callPackage ../development/interpreters/clojure { }; clooj = callPackage ../development/interpreters/clojure/clooj.nix { }; erlangR14 = callPackage ../development/interpreters/erlang/R14.nix { }; erlangR15 = callPackage ../development/interpreters/erlang/R15.nix { }; erlangR16 = callPackage ../development/interpreters/erlang/R16.nix { }; erlangR17 = callPackage ../development/interpreters/erlang/R17.nix { }; erlang = erlangR17; rebar = callPackage ../development/tools/build-managers/rebar { }; elixir = callPackage ../development/interpreters/elixir { }; groovy = callPackage ../development/interpreters/groovy { }; guile_1_8 = callPackage ../development/interpreters/guile/1.8.nix { }; guile_2_0 = callPackage ../development/interpreters/guile { }; guile = guile_2_0; hadoop = callPackage ../applications/networking/cluster/hadoop { }; io = callPackage ../development/interpreters/io { }; j = callPackage ../development/interpreters/j {}; jmeter = callPackage ../applications/networking/jmeter {}; davmail = callPackage ../applications/networking/davmail {}; lxappearance = callPackage ../applications/misc/lxappearance {}; kona = callPackage ../development/interpreters/kona {}; love = callPackage ../development/interpreters/love {lua=lua5;}; love_luajit = callPackage ../development/interpreters/love {lua=luajit;}; love_0_9 = callPackage ../development/interpreters/love/0.9.nix { }; lua4 = callPackage ../development/interpreters/lua-4 { }; lua5_0 = callPackage ../development/interpreters/lua-5/5.0.3.nix { }; lua5_1 = callPackage ../development/interpreters/lua-5/5.1.nix { }; lua5_2 = callPackage ../development/interpreters/lua-5/5.2.nix { }; lua5_2_compat = callPackage ../development/interpreters/lua-5/5.2.nix { compat = true; }; lua5 = lua5_1; lua = lua5; lua5_sockets = callPackage ../development/interpreters/lua-5/sockets.nix {}; lua5_expat = callPackage ../development/interpreters/lua-5/expat.nix {}; lua5_filesystem = callPackage ../development/interpreters/lua-5/filesystem.nix {}; lua5_sec = callPackage ../development/interpreters/lua-5/sec.nix {}; luarocks = callPackage ../development/tools/misc/luarocks { lua = lua5; }; luajit = callPackage ../development/interpreters/luajit {}; lush2 = callPackage ../development/interpreters/lush {}; maude = callPackage ../development/interpreters/maude { bison = bison2; flex = flex_2_5_35; }; mesos = callPackage ../applications/networking/cluster/mesos { sasl = cyrus_sasl; automake = automake114x; inherit (pythonPackages) python boto setuptools distutils-cfg wrapPython; pythonProtobuf = pythonPackages.protobuf; }; octave = callPackage ../development/interpreters/octave { fltk = fltk13; qt = null; ghostscript = null; llvm = null; hdf5 = null; glpk = null; suitesparse = null; openjdk = null; gnuplot = null; readline = readline63; }; octaveFull = (lowPrio (callPackage ../development/interpreters/octave { fltk = fltk13; qt = qt4; })); # mercurial (hg) bleeding edge version octaveHG = callPackage ../development/interpreters/octave/hg.nix { }; ocropus = callPackage ../applications/misc/ocropus { }; perl514 = callPackage ../development/interpreters/perl/5.14 { }; perl516 = callPackage ../development/interpreters/perl/5.16 { fetchurl = fetchurlBoot; }; perl520 = callPackage ../development/interpreters/perl/5.20 { }; perl = if system != "i686-cygwin" then perl516 else sysPerl; php = php54; phpPackages = recurseIntoAttrs (import ./php-packages.nix { inherit php pkgs; }); php53 = callPackage ../development/interpreters/php/5.3.nix { }; php_fpm53 = callPackage ../development/interpreters/php/5.3.nix { config = config // { php = (config.php or {}) // { fpm = true; apxs2 = false; }; }; }; php54 = callPackage ../development/interpreters/php/5.4.nix { }; picolisp = callPackage ../development/interpreters/picolisp {}; pltScheme = racket; # just to be sure polyml = callPackage ../development/compilers/polyml { }; pure = callPackage ../development/interpreters/pure { llvm = llvm_33 ; }; python = python2; python2 = python27; python3 = python34; # pythonPackages further below, but assigned here because they need to be in sync pythonPackages = python2Packages; python2Packages = python27Packages; python3Packages = python34Packages; pythonFull = python2Full; python2Full = python27Full; python26 = callPackage ../development/interpreters/python/2.6 { db = db47; }; python27 = callPackage ../development/interpreters/python/2.7 { }; python32 = callPackage ../development/interpreters/python/3.2 { }; python33 = callPackage ../development/interpreters/python/3.3 { }; python34 = hiPrio (callPackage ../development/interpreters/python/3.4 { }); pypy = callPackage ../development/interpreters/pypy/2.3 { }; python26Full = callPackage ../development/interpreters/python/wrapper.nix { extraLibs = []; postBuild = ""; python = python26; inherit (python26Packages) recursivePthLoader; }; python27Full = callPackage ../development/interpreters/python/wrapper.nix { extraLibs = []; postBuild = ""; python = python27; inherit (python27Packages) recursivePthLoader; }; pythonDocs = recurseIntoAttrs (import ../development/interpreters/python/docs { inherit stdenv fetchurl lib; }); pythonLinkmeWrapper = callPackage ../development/interpreters/python/python-linkme-wrapper.nix { }; pypi2nix = python27Packages.pypi2nix; pyrex = pyrex095; pyrex095 = callPackage ../development/interpreters/pyrex/0.9.5.nix { }; pyrex096 = callPackage ../development/interpreters/pyrex/0.9.6.nix { }; qi = callPackage ../development/compilers/qi { }; racket = callPackage ../development/interpreters/racket { }; rakudo = callPackage ../development/interpreters/rakudo { }; rascal = callPackage ../development/interpreters/rascal { }; regina = callPackage ../development/interpreters/regina { }; renpy = callPackage ../development/interpreters/renpy { wrapPython = pythonPackages.wrapPython; }; ruby18 = callPackage ../development/interpreters/ruby/ruby-18.nix { }; ruby19 = callPackage ../development/interpreters/ruby/ruby-19.nix { }; ruby2 = lowPrio (callPackage ../development/interpreters/ruby/ruby-2.0.nix { }); ruby = ruby19; rubyLibs = recurseIntoAttrs (callPackage ../development/interpreters/ruby/libs.nix { }); rake = rubyLibs.rake; rubySqlite3 = callPackage ../development/ruby-modules/sqlite3 { }; rubygemsFun = ruby: builderDefsPackage (import ../development/interpreters/ruby/rubygems.nix) { inherit ruby makeWrapper; }; rubygems = hiPrio (rubygemsFun ruby); rq = callPackage ../applications/networking/cluster/rq { }; scsh = callPackage ../development/interpreters/scsh { }; scheme48 = callPackage ../development/interpreters/scheme48 { }; spark = callPackage ../applications/networking/cluster/spark { }; spidermonkey = callPackage ../development/interpreters/spidermonkey { }; spidermonkey_1_8_0rc1 = callPackage ../development/interpreters/spidermonkey/1.8.0-rc1.nix { }; spidermonkey_185 = callPackage ../development/interpreters/spidermonkey/185-1.0.0.nix { }; spidermonkey_17 = callPackage ../development/interpreters/spidermonkey/17.0.nix { }; spidermonkey_24 = callPackage ../development/interpreters/spidermonkey/24.2.nix { }; supercollider = callPackage ../development/interpreters/supercollider { qt = qt4; fftw = fftwSinglePrec; }; supercollider_scel = supercollider.override { useSCEL = true; }; sysPerl = callPackage ../development/interpreters/perl/sys-perl { }; tcl = callPackage ../development/interpreters/tcl { }; xulrunner = callPackage ../development/interpreters/xulrunner { inherit (gnome) libIDL; inherit (pythonPackages) pysqlite; }; xulrunner_30 = firefox30Pkgs.xulrunner; ### DEVELOPMENT / MISC amdadlsdk = callPackage ../development/misc/amdadl-sdk { }; amdappsdk26 = callPackage ../development/misc/amdapp-sdk { version = "2.6"; }; amdappsdk27 = callPackage ../development/misc/amdapp-sdk { version = "2.7"; }; amdappsdk28 = callPackage ../development/misc/amdapp-sdk { version = "2.8"; }; amdappsdk = amdappsdk28; amdappsdkFull = callPackage ../development/misc/amdapp-sdk { version = "2.8"; samples = true; }; avrgcclibc = callPackage ../development/misc/avr-gcc-with-avr-libc { gcc = gcc46; stdenv = overrideGCC stdenv gcc46; }; avr8burnomat = callPackage ../development/misc/avr8-burn-omat { }; sourceFromHead = import ../build-support/source-from-head-fun.nix { inherit config; }; ecj = callPackage ../development/eclipse/ecj { }; jdtsdk = callPackage ../development/eclipse/jdt-sdk { }; jruby165 = callPackage ../development/interpreters/jruby { }; guileCairo = callPackage ../development/guile-modules/guile-cairo { }; guileGnome = callPackage ../development/guile-modules/guile-gnome { gconf = gnome.GConf; inherit (gnome) gnome_vfs libglade libgnome libgnomecanvas libgnomeui; }; guile_lib = callPackage ../development/guile-modules/guile-lib { }; guile_ncurses = callPackage ../development/guile-modules/guile-ncurses { }; guile-xcb = callPackage ../development/guile-modules/guile-xcb { }; pharo-vm = callPackage_i686 ../development/pharo/vm { }; srecord = callPackage ../development/tools/misc/srecord { }; windowssdk = ( import ../development/misc/windows-sdk { inherit fetchurl stdenv cabextract; }); ### DEVELOPMENT / TOOLS ansible = callPackage ../tools/system/ansible { }; antlr = callPackage ../development/tools/parsing/antlr/2.7.7.nix { }; antlr3 = callPackage ../development/tools/parsing/antlr { }; ant = apacheAnt; apacheAnt = callPackage ../development/tools/build-managers/apache-ant { }; astyle = callPackage ../development/tools/misc/astyle { }; autobuild = callPackage ../development/tools/misc/autobuild { }; autoconf = callPackage ../development/tools/misc/autoconf { }; autoconf213 = callPackage ../development/tools/misc/autoconf/2.13.nix { }; autocutsel = callPackage ../tools/X11/autocutsel{ }; automake = automake112x; automake111x = callPackage ../development/tools/misc/automake/automake-1.11.x.nix { }; automake112x = callPackage ../development/tools/misc/automake/automake-1.12.x.nix { }; automake113x = callPackage ../development/tools/misc/automake/automake-1.13.x.nix { }; automake114x = callPackage ../development/tools/misc/automake/automake-1.14.x.nix { }; automoc4 = callPackage ../development/tools/misc/automoc4 { }; avrdude = callPackage ../development/tools/misc/avrdude { }; avarice = callPackage ../development/tools/misc/avarice { }; babeltrace = callPackage ../development/tools/misc/babeltrace { }; bam = callPackage ../development/tools/build-managers/bam {}; binutils = callPackage ../development/tools/misc/binutils { inherit noSysDirs; }; binutils_nogold = lowPrio (callPackage ../development/tools/misc/binutils { inherit noSysDirs; gold = false; }); binutilsCross = if crossSystem != null && crossSystem.libc == "libSystem" then darwin.cctools else lowPrio (forceNativeDrv (import ../development/tools/misc/binutils { inherit stdenv fetchurl zlib bison; noSysDirs = true; cross = assert crossSystem != null; crossSystem; })); bison2 = callPackage ../development/tools/parsing/bison/2.x.nix { }; bison3 = callPackage ../development/tools/parsing/bison/3.x.nix { }; bison = bison3; buildbot = callPackage ../development/tools/build-managers/buildbot { inherit (pythonPackages) twisted jinja2 sqlalchemy sqlalchemy_migrate; dateutil = pythonPackages.dateutil_1_5; }; buildbotSlave = callPackage ../development/tools/build-managers/buildbot-slave { inherit (pythonPackages) twisted; }; byacc = callPackage ../development/tools/parsing/byacc { }; casperjs = callPackage ../development/tools/casperjs { }; cbrowser = callPackage ../development/tools/misc/cbrowser { }; ccache = callPackage ../development/tools/misc/ccache { }; # Wrapper that works as gcc or g++ # It can be used by setting in nixpkgs config like this, for example: # replaceStdenv = { pkgs }: pkgs.ccacheStdenv; # But if you build in chroot, you should have that path in chroot # If instantiated directly, it will use the HOME/.ccache as cache directory. # You can use an override in packageOverrides to set extraConfig: # packageOverrides = pkgs: { # ccacheWrapper = pkgs.ccacheWrapper.override { # extraConfig = '' # CCACHE_COMPRESS=1 # CCACHE_DIR=/bin/.ccache # ''; # }; # ccacheWrapper = makeOverridable ({ extraConfig ? "" }: wrapGCC (ccache.links extraConfig)) {}; ccacheStdenv = lowPrio (overrideGCC stdenv ccacheWrapper); cccc = callPackage ../development/tools/analysis/cccc { }; cgdb = callPackage ../development/tools/misc/cgdb { }; chromedriver = callPackage ../development/tools/selenium/chromedriver { gconf = gnome.GConf; }; chrpath = callPackage ../development/tools/misc/chrpath { }; "cl-launch" = callPackage ../development/tools/misc/cl-launch {}; complexity = callPackage ../development/tools/misc/complexity { }; ctags = callPackage ../development/tools/misc/ctags { }; ctagsWrapped = import ../development/tools/misc/ctags/wrapped.nix { inherit pkgs ctags writeScriptBin; }; cmake = callPackage ../development/tools/build-managers/cmake { }; cmake264 = callPackage ../development/tools/build-managers/cmake/264.nix { }; cmakeCurses = cmake.override { useNcurses = true; }; cmakeWithGui = cmakeCurses.override { useQt4 = true; }; coccinelle = callPackage ../development/tools/misc/coccinelle { }; framac = callPackage ../development/tools/analysis/frama-c { }; cppi = callPackage ../development/tools/misc/cppi { }; cproto = callPackage ../development/tools/misc/cproto { }; cflow = callPackage ../development/tools/misc/cflow { }; cov-build = callPackage ../development/tools/analysis/cov-build {}; cppcheck = callPackage ../development/tools/analysis/cppcheck { }; cscope = callPackage ../development/tools/misc/cscope { }; csslint = callPackage ../development/web/csslint { }; libcxx = callPackage ../development/libraries/libc++ { stdenv = pkgs.clangStdenv; }; libcxxabi = callPackage ../development/libraries/libc++abi { stdenv = pkgs.clangStdenv; }; libsigrok = callPackage ../development/tools/libsigrok { }; libsigrokdecode = callPackage ../development/tools/libsigrokdecode { }; dejagnu = callPackage ../development/tools/misc/dejagnu { }; dfeet = callPackage ../development/tools/misc/d-feet { inherit (pythonPackages) pep8; }; dfu-programmer = callPackage ../development/tools/misc/dfu-programmer { }; ddd = callPackage ../development/tools/misc/ddd { }; distcc = callPackage ../development/tools/misc/distcc { }; # distccWrapper: wrapper that works as gcc or g++ # It can be used by setting in nixpkgs config like this, for example: # replaceStdenv = { pkgs }: pkgs.distccStdenv; # But if you build in chroot, a default 'nix' will create # a new net namespace, and won't have network access. # You can use an override in packageOverrides to set extraConfig: # packageOverrides = pkgs: { # distccWrapper = pkgs.distccWrapper.override { # extraConfig = '' # DISTCC_HOSTS="myhost1 myhost2" # ''; # }; # distccWrapper = makeOverridable ({ extraConfig ? "" }: wrapGCC (distcc.links extraConfig)) {}; distccStdenv = lowPrio (overrideGCC stdenv distccWrapper); distccMasquerade = callPackage ../development/tools/misc/distcc/masq.nix { gccRaw = gcc.gcc; binutils = binutils; }; docutils = builderDefsPackage (import ../development/tools/documentation/docutils) { inherit python pil makeWrapper; }; doxygen = callPackage ../development/tools/documentation/doxygen { qt4 = null; }; doxygen_gui = lowPrio (doxygen.override { inherit qt4; }); drush = callPackage ../development/tools/misc/drush { }; eggdbus = callPackage ../development/tools/misc/eggdbus { }; elfutils = callPackage ../development/tools/misc/elfutils { }; epm = callPackage ../development/tools/misc/epm { }; emma = callPackage ../development/tools/analysis/emma { }; findbugs = callPackage ../development/tools/analysis/findbugs { }; pmd = callPackage ../development/tools/analysis/pmd { }; jdepend = callPackage ../development/tools/analysis/jdepend { }; checkstyle = callPackage ../development/tools/analysis/checkstyle { }; flex_2_5_35 = callPackage ../development/tools/parsing/flex/2.5.35.nix { }; flex_2_5_39 = callPackage ../development/tools/parsing/flex/2.5.39.nix { }; flex = flex_2_5_39; m4 = gnum4; global = callPackage ../development/tools/misc/global { }; gnome_doc_utils = callPackage ../development/tools/documentation/gnome-doc-utils {}; gnum4 = callPackage ../development/tools/misc/gnum4 { }; gnumake380 = callPackage ../development/tools/build-managers/gnumake/3.80 { }; gnumake381 = callPackage ../development/tools/build-managers/gnumake/3.81 { }; gnumake382 = callPackage ../development/tools/build-managers/gnumake/3.82 { }; gnumake40 = callPackage ../development/tools/build-managers/gnumake/4.0 { }; gnumake = gnumake382; gob2 = callPackage ../development/tools/misc/gob2 { }; gradle = callPackage ../development/tools/build-managers/gradle { }; gperf = callPackage ../development/tools/misc/gperf { }; gtk_doc = callPackage ../development/tools/documentation/gtk-doc { }; gtkdialog = callPackage ../development/tools/misc/gtkdialog { }; guileLint = callPackage ../development/tools/guile/guile-lint { }; gwrap = callPackage ../development/tools/guile/g-wrap { }; help2man = callPackage ../development/tools/misc/help2man { inherit (perlPackages) LocaleGettext; }; hyenae = callPackage ../tools/networking/hyenae { }; ibus = callPackage ../development/libraries/ibus { }; iconnamingutils = callPackage ../development/tools/misc/icon-naming-utils { inherit (perlPackages) XMLSimple; }; indent = callPackage ../development/tools/misc/indent { }; ino = callPackage ../development/arduino/ino { }; inotifyTools = callPackage ../development/tools/misc/inotify-tools { }; intel-gpu-tools = callPackage ../development/tools/misc/intel-gpu-tools { inherit (xorg) libpciaccess dri2proto libX11 libXext libXv libXrandr; }; ired = callPackage ../development/tools/analysis/radare/ired.nix { }; itstool = callPackage ../development/tools/misc/itstool { }; jam = callPackage ../development/tools/build-managers/jam { }; jikespg = callPackage ../development/tools/parsing/jikespg { }; jenkins = callPackage ../development/tools/continuous-integration/jenkins { }; lcov = callPackage ../development/tools/analysis/lcov { }; leiningen = callPackage ../development/tools/build-managers/leiningen { }; libtool = libtool_2; libtool_1_5 = callPackage ../development/tools/misc/libtool { }; libtool_2 = callPackage ../development/tools/misc/libtool/libtool2.nix { }; lsof = callPackage ../development/tools/misc/lsof { }; ltrace = callPackage ../development/tools/misc/ltrace { }; lttng-tools = callPackage ../development/tools/misc/lttng-tools { }; lttng-ust = callPackage ../development/tools/misc/lttng-ust { }; lttv = callPackage ../development/tools/misc/lttv { }; mk = callPackage ../development/tools/build-managers/mk { }; neoload = callPackage ../development/tools/neoload { licenseAccepted = (config.neoload.accept_license or false); }; ninja = callPackage ../development/tools/build-managers/ninja { }; nixbang = callPackage ../development/tools/misc/nixbang { pythonPackages = python3Packages; }; node_webkit = callPackage ../development/tools/node-webkit { gconf = pkgs.gnome.GConf; }; noweb = callPackage ../development/tools/literate-programming/noweb { }; omake = callPackage ../development/tools/ocaml/omake { }; omake_rc1 = callPackage ../development/tools/ocaml/omake/0.9.8.6-rc1.nix { }; opengrok = callPackage ../development/tools/misc/opengrok { }; openocd = callPackage ../development/tools/misc/openocd { }; oprofile = callPackage ../development/tools/profiling/oprofile { }; patchelf = callPackage ../development/tools/misc/patchelf { }; peg = callPackage ../development/tools/parsing/peg { }; phantomjs = callPackage ../development/tools/phantomjs { stdenv = if stdenv.isDarwin then overrideGCC stdenv gccApple else stdenv; }; pmccabe = callPackage ../development/tools/misc/pmccabe { }; /* Make pkgconfig always return a nativeDrv, never a proper crossDrv, because most usage of pkgconfig as buildInput (inheritance of pre-cross nixpkgs) means using it using as nativeBuildInput cross_renaming: we should make all programs use pkgconfig as nativeBuildInput after the renaming. */ pkgconfig = forceNativeDrv (callPackage ../development/tools/misc/pkgconfig { }); pkgconfigUpstream = lowPrio (pkgconfig.override { vanilla = true; }); prelink = callPackage ../development/tools/misc/prelink { }; premake3 = callPackage ../development/tools/misc/premake/3.nix { }; premake4 = callPackage ../development/tools/misc/premake { }; premake = premake4; pstack = callPackage ../development/tools/misc/gdb/pstack.nix { }; radare = callPackage ../development/tools/analysis/radare { inherit (gnome) vte; lua = lua5; useX11 = config.radare.useX11 or false; pythonBindings = config.radare.pythonBindings or false; rubyBindings = config.radare.rubyBindings or false; luaBindings = config.radare.luaBindings or false; }; ragel = callPackage ../development/tools/parsing/ragel { }; re2c = callPackage ../development/tools/parsing/re2c { }; remake = callPackage ../development/tools/build-managers/remake { }; saleae-logic = callPackage ../development/tools/misc/saleae-logic { }; # couldn't find the source yet seleniumRCBin = callPackage ../development/tools/selenium/remote-control { jre = jdk; }; selenium-server-standalone = callPackage ../development/tools/selenium/server { }; scons = callPackage ../development/tools/build-managers/scons { }; simpleBuildTool = callPackage ../development/tools/build-managers/simple-build-tool { }; sigrok-cli = callPackage ../development/tools/sigrok-cli { }; slimerjs = callPackage ../development/tools/slimerjs {}; sloccount = callPackage ../development/tools/misc/sloccount { }; smatch = callPackage ../development/tools/analysis/smatch { buildllvmsparse = false; buildc2xml = false; }; smc = callPackage ../tools/misc/smc { }; sparse = callPackage ../development/tools/analysis/sparse { }; speedtest_cli = callPackage ../tools/networking/speedtest-cli { }; spin = callPackage ../development/tools/analysis/spin { }; splint = callPackage ../development/tools/analysis/splint { flex = flex_2_5_35; }; stm32flash = callPackage ../development/tools/misc/stm32flash { }; strace = callPackage ../development/tools/misc/strace { }; swig = callPackage ../development/tools/misc/swig { }; swig2 = callPackage ../development/tools/misc/swig/2.x.nix { }; swig3 = callPackage ../development/tools/misc/swig/3.x.nix { }; swigWithJava = swig; swfmill = callPackage ../tools/video/swfmill { }; swftools = callPackage ../tools/video/swftools { }; tcptrack = callPackage ../development/tools/misc/tcptrack { }; teensy-loader = callPackage ../development/tools/misc/teensy { }; texinfo413 = callPackage ../development/tools/misc/texinfo/4.13a.nix { }; texinfo5 = callPackage ../development/tools/misc/texinfo/5.2.nix { }; texinfo4 = texinfo413; texinfo = texinfo5; texinfoInteractive = appendToName "interactive" ( texinfo.override { interactive = true; } ); texi2html = callPackage ../development/tools/misc/texi2html { }; uhd = callPackage ../development/tools/misc/uhd { }; uisp = callPackage ../development/tools/misc/uisp { }; uncrustify = callPackage ../development/tools/misc/uncrustify { }; vagrant = callPackage ../development/tools/vagrant { ruby = ruby2; }; gdb = callPackage ../development/tools/misc/gdb { hurd = gnu.hurdCross; readline = readline63; inherit (gnu) mig; }; gdbCross = lowPrio (callPackage ../development/tools/misc/gdb { target = crossSystem; }); valgrind = callPackage ../development/tools/analysis/valgrind { stdenv = # On Darwin, Valgrind 3.7.0 expects Apple's GCC (for # `__private_extern'.) if stdenv.isDarwin then overrideGCC stdenv gccApple else stdenv; }; valkyrie = callPackage ../development/tools/analysis/valkyrie { }; xc3sprog = callPackage ../development/tools/misc/xc3sprog { }; xmlindent = callPackage ../development/web/xmlindent {}; xpwn = callPackage ../development/mobile/xpwn {}; xxdiff = callPackage ../development/tools/misc/xxdiff { bison = bison2; }; yacc = bison; yodl = callPackage ../development/tools/misc/yodl { }; ### DEVELOPMENT / LIBRARIES a52dec = callPackage ../development/libraries/a52dec { }; aacskeys = callPackage ../development/libraries/aacskeys { }; aalib = callPackage ../development/libraries/aalib { }; accountsservice = callPackage ../development/libraries/accountsservice { }; acl = callPackage ../development/libraries/acl { }; activemq = callPackage ../development/libraries/apache-activemq { }; adns = callPackage ../development/libraries/adns { }; afflib = callPackage ../development/libraries/afflib {}; agg = callPackage ../development/libraries/agg { }; allegro = callPackage ../development/libraries/allegro {}; allegro5 = callPackage ../development/libraries/allegro/5.nix {}; allegro5unstable = callPackage ../development/libraries/allegro/5-unstable.nix {}; amrnb = callPackage ../development/libraries/amrnb { }; amrwb = callPackage ../development/libraries/amrwb { }; apr = callPackage ../development/libraries/apr { }; aprutil = callPackage ../development/libraries/apr-util { bdbSupport = true; }; asio = callPackage ../development/libraries/asio { }; aspell = callPackage ../development/libraries/aspell { }; aspellDicts = recurseIntoAttrs (import ../development/libraries/aspell/dictionaries.nix { inherit fetchurl stdenv aspell which; }); aterm = aterm25; aterm25 = callPackage ../development/libraries/aterm/2.5.nix { }; aterm28 = lowPrio (callPackage ../development/libraries/aterm/2.8.nix { }); attica = callPackage ../development/libraries/attica { }; attr = callPackage ../development/libraries/attr { }; at_spi2_core = callPackage ../development/libraries/at-spi2-core { }; at_spi2_atk = callPackage ../development/libraries/at-spi2-atk { }; aqbanking = callPackage ../development/libraries/aqbanking { }; aubio = callPackage ../development/libraries/aubio { }; audiofile = callPackage ../development/libraries/audiofile { }; axis = callPackage ../development/libraries/axis { }; babl_0_0_22 = callPackage ../development/libraries/babl/0_0_22.nix { }; babl = callPackage ../development/libraries/babl { }; beecrypt = callPackage ../development/libraries/beecrypt { }; boehmgc = callPackage ../development/libraries/boehm-gc { }; boolstuff = callPackage ../development/libraries/boolstuff { }; boost144 = callPackage ../development/libraries/boost/1.44.nix { }; boost149 = callPackage ../development/libraries/boost/1.49.nix { }; boost155 = callPackage ../development/libraries/boost/1.55.nix { }; boost = boost155; boostHeaders = callPackage ../development/libraries/boost/header-only-wrapper.nix { }; botan = callPackage ../development/libraries/botan { }; botanUnstable = callPackage ../development/libraries/botan/unstable.nix { }; box2d = callPackage ../development/libraries/box2d { }; box2d_2_0_1 = callPackage ../development/libraries/box2d/2.0.1.nix { }; buddy = callPackage ../development/libraries/buddy { }; bwidget = callPackage ../development/libraries/bwidget { }; c-ares = callPackage ../development/libraries/c-ares { fetchurl = fetchurlBoot; }; caelum = callPackage ../development/libraries/caelum { }; capnproto = callPackage ../development/libraries/capnproto { }; scmccid = callPackage ../development/libraries/scmccid { }; ccrtp = callPackage ../development/libraries/ccrtp { }; ccrtp_1_8 = callPackage ../development/libraries/ccrtp/1.8.nix { }; celt = callPackage ../development/libraries/celt {}; celt_0_7 = callPackage ../development/libraries/celt/0.7.nix {}; celt_0_5_1 = callPackage ../development/libraries/celt/0.5.1.nix {}; cgal = callPackage ../development/libraries/CGAL {}; cgui = callPackage ../development/libraries/cgui {}; check = callPackage ../development/libraries/check { }; chipmunk = builderDefsPackage (import ../development/libraries/chipmunk) { inherit cmake freeglut mesa; inherit (xlibs) libX11 xproto inputproto libXi libXmu; }; chmlib = callPackage ../development/libraries/chmlib { }; chromaprint = callPackage ../development/libraries/chromaprint { }; cil = callPackage ../development/libraries/cil { }; cilaterm = callPackage ../development/libraries/cil-aterm { stdenv = overrideInStdenv stdenv [gnumake380]; }; clanlib = callPackage ../development/libraries/clanlib { }; classads = callPackage ../development/libraries/classads { }; classpath = callPackage ../development/libraries/java/classpath { javac = gcj; jvm = gcj; gconf = gnome.GConf; }; clearsilver = callPackage ../development/libraries/clearsilver { }; cln = callPackage ../development/libraries/cln { }; clppcre = builderDefsPackage (import ../development/libraries/cl-ppcre) { }; clucene_core_2 = callPackage ../development/libraries/clucene-core/2.x.nix { }; clucene_core_1 = callPackage ../development/libraries/clucene-core { }; clucene_core = clucene_core_1; clutter = callPackage ../development/libraries/clutter { }; clutter_1_18 = callPackage ../development/libraries/clutter/1.18.nix { cogl = cogl_1_18; }; clutter-gst = callPackage ../development/libraries/clutter-gst { }; clutter_gtk = callPackage ../development/libraries/clutter-gtk { }; clutter_gtk_0_10 = callPackage ../development/libraries/clutter-gtk/0.10.8.nix { }; cminpack = callPackage ../development/libraries/cminpack { }; cogl = callPackage ../development/libraries/cogl { }; cogl_1_18 = callPackage ../development/libraries/cogl/1.18.nix { }; coin3d = callPackage ../development/libraries/coin3d { }; commoncpp2 = callPackage ../development/libraries/commoncpp2 { }; confuse = callPackage ../development/libraries/confuse { }; coredumper = callPackage ../development/libraries/coredumper { }; ctl = callPackage ../development/libraries/ctl { }; cpp-netlib = callPackage ../development/libraries/cpp-netlib { }; cppunit = callPackage ../development/libraries/cppunit { }; cppnetlib = callPackage ../development/libraries/cppnetlib { boost = boostHeaders; }; cracklib = callPackage ../development/libraries/cracklib { }; cryptopp = callPackage ../development/libraries/crypto++ { }; cyrus_sasl = callPackage ../development/libraries/cyrus-sasl { }; # Make bdb5 the default as it is the last release under the custom # bsd-like license db = db5; db4 = db48; db44 = callPackage ../development/libraries/db/db-4.4.nix { }; db45 = callPackage ../development/libraries/db/db-4.5.nix { }; db47 = callPackage ../development/libraries/db/db-4.7.nix { }; db48 = callPackage ../development/libraries/db/db-4.8.nix { }; db5 = db53; db53 = callPackage ../development/libraries/db/db-5.3.nix { }; db6 = db60; db60 = callPackage ../development/libraries/db/db-6.0.nix { }; dbus = callPackage ../development/libraries/dbus { }; dbus_cplusplus = callPackage ../development/libraries/dbus-cplusplus { }; dbus_glib = callPackage ../development/libraries/dbus-glib { }; dbus_java = callPackage ../development/libraries/java/dbus-java { }; dbus_python = callPackage ../development/python-modules/dbus { }; # Should we deprecate these? Currently there are many references. dbus_tools = pkgs.dbus.tools; dbus_libs = pkgs.dbus.libs; dbus_daemon = pkgs.dbus.daemon; dhex = callPackage ../applications/editors/dhex { }; dclib = callPackage ../development/libraries/dclib { }; dillo = callPackage ../applications/networking/browsers/dillo { fltk = fltk13; }; directfb = callPackage ../development/libraries/directfb { }; dotconf = callPackage ../development/libraries/dotconf { }; dssi = callPackage ../development/libraries/dssi {}; dragonegg = llvmPackages.dragonegg; dxflib = callPackage ../development/libraries/dxflib {}; eigen = callPackage ../development/libraries/eigen {}; eigen2 = callPackage ../development/libraries/eigen/2.0.nix {}; enchant = callPackage ../development/libraries/enchant { }; enet = callPackage ../development/libraries/enet { }; enginepkcs11 = callPackage ../development/libraries/enginepkcs11 { }; epoxy = callPackage ../development/libraries/epoxy { inherit (xorg) utilmacros libX11; }; esdl = callPackage ../development/libraries/esdl { }; exiv2 = callPackage ../development/libraries/exiv2 { }; expat = callPackage ../development/libraries/expat { }; extremetuxracer = builderDefsPackage (import ../games/extremetuxracer) { inherit mesa tcl freeglut SDL SDL_mixer pkgconfig gettext intltool; inherit (xlibs) libX11 xproto libXi inputproto libXmu libXext xextproto libXt libSM libICE; libpng = libpng12; }; eventlog = callPackage ../development/libraries/eventlog { }; facile = callPackage ../development/libraries/facile { }; faac = callPackage ../development/libraries/faac { }; faad2 = callPackage ../development/libraries/faad2 { }; farsight2 = callPackage ../development/libraries/farsight2 { }; farstream = callPackage ../development/libraries/farstream { inherit (gst_all_1) gstreamer gst-plugins-base gst-python gst-plugins-good gst-plugins-bad gst-libav; }; fcgi = callPackage ../development/libraries/fcgi { }; ffmpeg_0_6 = callPackage ../development/libraries/ffmpeg/0.6.nix { vpxSupport = !stdenv.isMips; }; ffmpeg_0_6_90 = callPackage ../development/libraries/ffmpeg/0.6.90.nix { vpxSupport = !stdenv.isMips; }; ffmpeg_0_10 = callPackage ../development/libraries/ffmpeg/0.10.nix { vpxSupport = !stdenv.isMips; stdenv = if stdenv.isDarwin then overrideGCC stdenv gccApple else stdenv; }; ffmpeg_1 = callPackage ../development/libraries/ffmpeg/1.x.nix { vpxSupport = !stdenv.isMips; }; ffmpeg_2 = callPackage ../development/libraries/ffmpeg/2.x.nix { }; ffmpeg = ffmpeg_2; ffms = callPackage ../development/libraries/ffms { }; fftw = callPackage ../development/libraries/fftw { }; fftwSinglePrec = fftw.override { precision = "single"; }; fftwFloat = fftwSinglePrec; # the configure option is just an alias flann = callPackage ../development/libraries/flann { }; flite = callPackage ../development/libraries/flite { }; fltk13 = callPackage ../development/libraries/fltk/fltk13.nix { }; fltk20 = callPackage ../development/libraries/fltk { }; fmod = callPackage ../development/libraries/fmod { }; freeimage = callPackage ../development/libraries/freeimage { }; freetts = callPackage ../development/libraries/freetts { }; cfitsio = callPackage ../development/libraries/cfitsio { }; fontconfig = callPackage ../development/libraries/fontconfig { }; makeFontsConf = let fontconfig_ = fontconfig; in {fontconfig ? fontconfig_, fontDirectories}: import ../development/libraries/fontconfig/make-fonts-conf.nix { inherit runCommand libxslt fontconfig fontDirectories; }; freealut = callPackage ../development/libraries/freealut { }; freeglut = callPackage ../development/libraries/freeglut { }; freetype = callPackage ../development/libraries/freetype { }; frei0r = callPackage ../development/libraries/frei0r { }; fribidi = callPackage ../development/libraries/fribidi { }; funambol = callPackage ../development/libraries/funambol { }; fam = gamin; gamin = callPackage ../development/libraries/gamin { }; ganv = callPackage ../development/libraries/ganv { }; gav = callPackage ../games/gav { }; gsb = callPackage ../games/gsb { }; gdome2 = callPackage ../development/libraries/gdome2 { inherit (gnome) gtkdoc; }; gdbm = callPackage ../development/libraries/gdbm { }; gegl = callPackage ../development/libraries/gegl { # avocodec avformat librsvg }; gegl_0_0_22 = callPackage ../development/libraries/gegl/0_0_22.nix { # avocodec avformat librsvg libpng = libpng12; }; geoclue = callPackage ../development/libraries/geoclue {}; geoclue2 = callPackage ../development/libraries/geoclue/2.0.nix {}; geoip = callPackage ../development/libraries/geoip { }; geoipjava = callPackage ../development/libraries/java/geoipjava { }; geos = callPackage ../development/libraries/geos { }; gettext = gettext_0_18; gettext_0_17 = callPackage ../development/libraries/gettext/0.17.nix { }; gettext_0_18 = callPackage ../development/libraries/gettext { }; gd = callPackage ../development/libraries/gd { }; gdal = callPackage ../development/libraries/gdal { }; ggz_base_libs = callPackage ../development/libraries/ggz_base_libs {}; giblib = callPackage ../development/libraries/giblib { }; libgit2 = callPackage ../development/libraries/git2 { }; glew = callPackage ../development/libraries/glew { }; glfw = glfw3; glfw2 = callPackage ../development/libraries/glfw/2.x.nix { }; glfw3 = callPackage ../development/libraries/glfw/3.x.nix { }; glibc = callPackage ../development/libraries/glibc/2.19 { kernelHeaders = linuxHeaders; installLocales = config.glibc.locales or false; machHeaders = null; hurdHeaders = null; gccCross = null; }; glibc_memusage = callPackage ../development/libraries/glibc/2.19 { kernelHeaders = linuxHeaders; installLocales = false; withGd = true; }; glibcCross = forceNativeDrv (makeOverridable (import ../development/libraries/glibc/2.19) (let crossGNU = crossSystem != null && crossSystem.config == "i586-pc-gnu"; in { inherit stdenv fetchurl; gccCross = gccCrossStageStatic; kernelHeaders = if crossGNU then gnu.hurdHeaders else linuxHeadersCross; installLocales = config.glibc.locales or false; } // lib.optionalAttrs crossGNU { inherit (gnu) machHeaders hurdHeaders libpthreadHeaders mig; inherit fetchgit; })); # We can choose: libcCrossChooser = name : if name == "glibc" then glibcCross else if name == "uclibc" then uclibcCross else if name == "msvcrt" then windows.mingw_w64 else if name == "libSystem" then darwin.xcode else throw "Unknown libc"; libcCross = assert crossSystem != null; libcCrossChooser crossSystem.libc; eglibc = callPackage ../development/libraries/eglibc { kernelHeaders = linuxHeaders; installLocales = config.glibc.locales or false; }; glibcLocales = callPackage ../development/libraries/glibc/2.19/locales.nix { }; glibcInfo = callPackage ../development/libraries/glibc/2.19/info.nix { }; glibc_multi = runCommand "${glibc.name}-multi" { glibc64 = glibc; glibc32 = (import ./all-packages.nix {system = "i686-linux";}).glibc; } '' mkdir -p $out ln -s $glibc64/* $out/ rm $out/lib $out/lib64 mkdir -p $out/lib ln -s $glibc64/lib/* $out/lib ln -s $glibc32/lib $out/lib/32 ln -s lib $out/lib64 # fixing ldd RLTDLIST rm $out/bin cp -rs $glibc64/bin $out chmod u+w $out/bin rm $out/bin/ldd sed -e "s|^RTLDLIST=.*$|RTLDLIST=\"$out/lib/ld-2.19.so $out/lib/32/ld-linux.so.2\"|g" \ $glibc64/bin/ldd > $out/bin/ldd chmod 555 $out/bin/ldd rm $out/include cp -rs $glibc32/include $out chmod -R u+w $out/include cp -rsf $glibc64/include $out '' # */ ; glm = callPackage ../development/libraries/glm { }; glog = callPackage ../development/libraries/glog { }; gloox = callPackage ../development/libraries/gloox { }; glpk = callPackage ../development/libraries/glpk { }; glsurf = callPackage ../applications/science/math/glsurf { inherit (ocamlPackages) lablgl findlib camlimages ocaml_mysql mlgmp; libpng = libpng12; giflib = giflib_4_1; }; gmime = callPackage ../development/libraries/gmime { }; gmm = callPackage ../development/libraries/gmm { }; gmp = gmp5; gmp5 = gmp51; gmpxx = appendToName "with-cxx" (gmp.override { cxx = true; }); # The GHC bootstrap binaries link against libgmp.so.3, which is in GMP 4.x. gmp4 = callPackage ../development/libraries/gmp/4.3.2.nix { }; gmp51 = callPackage ../development/libraries/gmp/5.1.x.nix { }; #GMP ex-satellite, so better keep it near gmp mpfr = callPackage ../development/libraries/mpfr/default.nix { }; gobjectIntrospection = callPackage ../development/libraries/gobject-introspection { }; goocanvas = callPackage ../development/libraries/goocanvas { }; google-gflags = callPackage ../development/libraries/google-gflags { }; gperftools = callPackage ../development/libraries/gperftools { }; gst_all_1 = recurseIntoAttrs(callPackage ../development/libraries/gstreamer { callPackage = pkgs.newScope (pkgs // { libav = pkgs.libav_10; }); }); gst_all = { inherit (pkgs) gstreamer gnonlin gst_python qt_gstreamer; gstPluginsBase = pkgs.gst_plugins_base; gstPluginsBad = pkgs.gst_plugins_bad; gstPluginsGood = pkgs.gst_plugins_good; gstPluginsUgly = pkgs.gst_plugins_ugly; gstFfmpeg = pkgs.gst_ffmpeg; }; gstreamer = callPackage ../development/libraries/gstreamer/legacy/gstreamer { bison = bison2; }; gst_plugins_base = callPackage ../development/libraries/gstreamer/legacy/gst-plugins-base {}; gst_plugins_good = callPackage ../development/libraries/gstreamer/legacy/gst-plugins-good {}; gst_plugins_bad = callPackage ../development/libraries/gstreamer/legacy/gst-plugins-bad {}; gst_plugins_ugly = callPackage ../development/libraries/gstreamer/legacy/gst-plugins-ugly {}; gst_ffmpeg = callPackage ../development/libraries/gstreamer/legacy/gst-ffmpeg { ffmpeg = ffmpeg_0_10; }; gst_python = callPackage ../development/libraries/gstreamer/legacy/gst-python {}; gstreamermm = callPackage ../development/libraries/gstreamer/legacy/gstreamermm { }; gnonlin = callPackage ../development/libraries/gstreamer/legacy/gnonlin {}; gusb = callPackage ../development/libraries/gusb { inherit (gnome) gtkdoc; }; qt_gstreamer = callPackage ../development/libraries/gstreamer/legacy/qt-gstreamer {}; gnet = callPackage ../development/libraries/gnet { }; gnu-efi = callPackage ../development/libraries/gnu-efi { }; gnutls = gnutls32; gnutls31 = callPackage ../development/libraries/gnutls/3.1.nix { guileBindings = config.gnutls.guile or false; }; gnutls32 = callPackage ../development/libraries/gnutls/3.2.nix { guileBindings = config.gnutls.guile or false; }; gnutls_with_guile = lowPrio (gnutls.override { guileBindings = true; }); gpac = callPackage ../applications/video/gpac { }; gpgme = callPackage ../development/libraries/gpgme { gnupg1 = gnupg1orig; }; grantlee = callPackage ../development/libraries/grantlee { }; gsasl = callPackage ../development/libraries/gsasl { }; gsl = callPackage ../development/libraries/gsl { }; gsm = callPackage ../development/libraries/gsm {}; gsoap = callPackage ../development/libraries/gsoap { }; gss = callPackage ../development/libraries/gss { }; gtkimageview = callPackage ../development/libraries/gtkimageview { }; gtkmathview = callPackage ../development/libraries/gtkmathview { }; gtkLibs = { inherit (pkgs) glib glibmm atk atkmm cairo pango pangomm gdk_pixbuf gtk gtkmm; }; glib = callPackage ../development/libraries/glib { }; glib-tested = glib.override { doCheck = true; }; # checked version separate to break cycles glibmm = callPackage ../development/libraries/glibmm { }; glib_networking = callPackage ../development/libraries/glib-networking {}; atk = callPackage ../development/libraries/atk { }; atkmm = callPackage ../development/libraries/atkmm { }; pixman = callPackage ../development/libraries/pixman { }; cairo = callPackage ../development/libraries/cairo { glSupport = config.cairo.gl or (stdenv.isLinux && !stdenv.isArm && !stdenv.isMips); }; cairomm = callPackage ../development/libraries/cairomm { }; pango = callPackage ../development/libraries/pango { }; pangomm = callPackage ../development/libraries/pangomm { }; pangox_compat = callPackage ../development/libraries/pangox-compat { }; gdk_pixbuf = callPackage ../development/libraries/gdk-pixbuf { # workaround signal 10 in gdk_pixbuf tests stdenv = if stdenv.isDarwin then clangStdenv else stdenv; }; gtk2 = callPackage ../development/libraries/gtk+/2.x.nix { cupsSupport = config.gtk2.cups or stdenv.isLinux; }; gtk3 = callPackage ../development/libraries/gtk+/3.x.nix { }; gtk = pkgs.gtk2; gtkmm = callPackage ../development/libraries/gtkmm/2.x.nix { }; gtkmm3 = callPackage ../development/libraries/gtkmm/3.x.nix { }; gtkmozembedsharp = callPackage ../development/libraries/gtkmozembed-sharp { gtksharp = gtksharp2; }; gtksharp1 = callPackage ../development/libraries/gtk-sharp-1 { inherit (gnome) libglade libgtkhtml gtkhtml libgnomecanvas libgnomeui libgnomeprint libgnomeprintui GConf; }; gtksharp2 = callPackage ../development/libraries/gtk-sharp-2 { inherit (gnome) libglade libgtkhtml gtkhtml libgnomecanvas libgnomeui libgnomeprint libgnomeprintui GConf gnomepanel; }; gtksourceviewsharp = callPackage ../development/libraries/gtksourceview-sharp { inherit (gnome) gtksourceview; gtksharp = gtksharp2; }; gtkspell = callPackage ../development/libraries/gtkspell { }; gtkspell3 = callPackage ../development/libraries/gtkspell/3.nix { }; gts = callPackage ../development/libraries/gts { }; gvfs = callPackage ../development/libraries/gvfs { gconf = gnome.GConf; }; gwenhywfar = callPackage ../development/libraries/gwenhywfar { }; hamlib = callPackage ../development/libraries/hamlib { }; # TODO : Add MIT Kerberos and let admin choose. kerberos = heimdal; heimdal = callPackage ../development/libraries/kerberos/heimdal.nix { }; harfbuzz = callPackage ../development/libraries/harfbuzz { }; hawknl = callPackage ../development/libraries/hawknl { }; herqq = callPackage ../development/libraries/herqq { }; hspell = callPackage ../development/libraries/hspell { }; hspellDicts = callPackage ../development/libraries/hspell/dicts.nix { }; hsqldb = callPackage ../development/libraries/java/hsqldb { }; http-parser = callPackage ../development/libraries/http-parser { inherit (pythonPackages) gyp; }; hunspell = callPackage ../development/libraries/hunspell { }; hwloc = callPackage ../development/libraries/hwloc { inherit (xlibs) libX11; }; hydraAntLogger = callPackage ../development/libraries/java/hydra-ant-logger { }; icu = callPackage ../development/libraries/icu { }; id3lib = callPackage ../development/libraries/id3lib { }; iksemel = callPackage ../development/libraries/iksemel { }; ilbc = callPackage ../development/libraries/ilbc { }; ilixi = callPackage ../development/libraries/ilixi { }; ilmbase = callPackage ../development/libraries/ilmbase { }; imlib = callPackage ../development/libraries/imlib { libpng = libpng12; }; imlib2 = callPackage ../development/libraries/imlib2 { }; incrtcl = callPackage ../development/libraries/incrtcl { }; indilib = callPackage ../development/libraries/indilib { }; iniparser = callPackage ../development/libraries/iniparser { }; intltool = callPackage ../development/tools/misc/intltool { }; irrlicht3843 = callPackage ../development/libraries/irrlicht { }; isocodes = callPackage ../development/libraries/iso-codes { }; itk = callPackage ../development/libraries/itk { }; jamp = builderDefsPackage ../games/jamp { inherit mesa SDL SDL_image SDL_mixer; }; jasper = callPackage ../development/libraries/jasper { }; jama = callPackage ../development/libraries/jama { }; jansson = callPackage ../development/libraries/jansson { }; jbig2dec = callPackage ../development/libraries/jbig2dec { }; jetty_gwt = callPackage ../development/libraries/java/jetty-gwt { }; jetty_util = callPackage ../development/libraries/java/jetty-util { }; json_glib = callPackage ../development/libraries/json-glib { }; json-c-0-11 = callPackage ../development/libraries/json-c/0.11.nix { }; # vulnerable json_c = callPackage ../development/libraries/json-c { }; jsoncpp = callPackage ../development/libraries/jsoncpp { }; libjson = callPackage ../development/libraries/libjson { }; judy = callPackage ../development/libraries/judy { }; keybinder = callPackage ../development/libraries/keybinder { automake = automake111x; lua = lua5_1; }; keybinder3 = callPackage ../development/libraries/keybinder3 { automake = automake111x; lua = lua5_1; }; krb5 = callPackage ../development/libraries/kerberos/krb5.nix { }; lcms = lcms1; lcms1 = callPackage ../development/libraries/lcms { }; lcms2 = callPackage ../development/libraries/lcms2 { }; lensfun = callPackage ../development/libraries/lensfun { }; lesstif = callPackage ../development/libraries/lesstif { }; lesstif93 = callPackage ../development/libraries/lesstif-0.93 { }; leveldb = callPackage ../development/libraries/leveldb { }; levmar = callPackage ../development/libraries/levmar { }; leptonica = callPackage ../development/libraries/leptonica { libpng = libpng12; }; lgi = callPackage ../development/libraries/lgi { lua = lua5_1; }; lib3ds = callPackage ../development/libraries/lib3ds { }; libaacs = callPackage ../development/libraries/libaacs { }; libaal = callPackage ../development/libraries/libaal { }; libao = callPackage ../development/libraries/libao { usePulseAudio = config.pulseaudio or true; }; libarchive = callPackage ../development/libraries/libarchive { }; libass = callPackage ../development/libraries/libass { }; libassuan1 = callPackage ../development/libraries/libassuan1 { }; libassuan = callPackage ../development/libraries/libassuan { }; libassuan2_1 = callPackage ../development/libraries/libassuan/git.nix { }; libatomic_ops = callPackage ../development/libraries/libatomic_ops {}; libav = libav_10; libav_all = callPackage ../development/libraries/libav { }; inherit (libav_all) libav_0_8 libav_9 libav_10; libavc1394 = callPackage ../development/libraries/libavc1394 { }; libbluedevil = callPackage ../development/libraries/libbluedevil { }; libbluray = callPackage ../development/libraries/libbluray { }; libbs2b = callPackage ../development/libraries/audio/libbs2b { }; libcaca = callPackage ../development/libraries/libcaca { }; libcanberra = callPackage ../development/libraries/libcanberra { }; libcanberra_gtk3 = libcanberra.override { gtk = gtk3; }; libcanberra_kde = if (config.kde_runtime.libcanberraWithoutGTK or true) then libcanberra.override { gtk = null; } else libcanberra; libcello = callPackage ../development/libraries/libcello {}; libcdaudio = callPackage ../development/libraries/libcdaudio { }; libcddb = callPackage ../development/libraries/libcddb { }; libcdio = callPackage ../development/libraries/libcdio { }; libcdio082 = callPackage ../development/libraries/libcdio/0.82.nix { }; libcdr = callPackage ../development/libraries/libcdr { lcms = lcms2; }; libchamplain = callPackage ../development/libraries/libchamplain { inherit (gnome) libsoup; }; libchamplain_0_6 = callPackage ../development/libraries/libchamplain/0.6.nix {}; libchop = callPackage ../development/libraries/libchop { }; libcm = callPackage ../development/libraries/libcm { }; inherit (gnome3) libcroco; libcangjie = callPackage ../development/libraries/libcangjie { }; libcredis = callPackage ../development/libraries/libcredis { }; libctemplate = callPackage ../development/libraries/libctemplate { }; libcue = callPackage ../development/libraries/libcue { }; libdaemon = callPackage ../development/libraries/libdaemon { }; libdbi = callPackage ../development/libraries/libdbi { }; libdbiDriversBase = callPackage ../development/libraries/libdbi-drivers { mysql = null; sqlite = null; }; libdbiDrivers = libdbiDriversBase.override { inherit sqlite mysql; }; libdbusmenu_qt = callPackage ../development/libraries/libdbusmenu-qt { }; libdc1394 = callPackage ../development/libraries/libdc1394 { }; libdc1394avt = callPackage ../development/libraries/libdc1394avt { }; libdevil = callPackage ../development/libraries/libdevil { }; libdiscid = callPackage ../development/libraries/libdiscid { }; libdivsufsort = callPackage ../development/libraries/libdivsufsort { }; libdmtx = callPackage ../development/libraries/libdmtx { }; libdnet = callPackage ../development/libraries/libdnet { }; libdrm = callPackage ../development/libraries/libdrm { inherit fetchurl stdenv pkgconfig; inherit (xorg) libpthreadstubs; }; libdv = callPackage ../development/libraries/libdv { }; libdvbpsi = callPackage ../development/libraries/libdvbpsi { }; libdwg = callPackage ../development/libraries/libdwg { }; libdvdcss = callPackage ../development/libraries/libdvdcss { }; libdvdnav = callPackage ../development/libraries/libdvdnav { }; libdvdread = callPackage ../development/libraries/libdvdread { }; libdwarf = callPackage ../development/libraries/libdwarf { }; libeatmydata = callPackage ../development/libraries/libeatmydata { }; libebml = callPackage ../development/libraries/libebml { }; libedit = callPackage ../development/libraries/libedit { }; libelf = callPackage ../development/libraries/libelf { }; libfm = callPackage ../development/libraries/libfm { }; libgadu = callPackage ../development/libraries/libgadu { }; libgdata = gnome3.libgdata; libgig = callPackage ../development/libraries/libgig { }; libgnome_keyring = callPackage ../development/libraries/libgnome-keyring { }; libgnome_keyring3 = gnome3.libgnome_keyring; libgnurl = callPackage ../development/libraries/libgnurl { }; libseccomp = callPackage ../development/libraries/libseccomp { }; libsecret = callPackage ../development/libraries/libsecret { }; libserialport = callPackage ../development/libraries/libserialport { }; libgtop = callPackage ../development/libraries/libgtop {}; liblo = callPackage ../development/libraries/liblo { }; liblrdf = librdf; liblscp = callPackage ../development/libraries/liblscp { }; libe-book = callPackage ../development/libraries/libe-book {}; libe-book_00 = callPackage ../development/libraries/libe-book/0.0.nix {}; libev = builderDefsPackage ../development/libraries/libev { }; libevent14 = callPackage ../development/libraries/libevent/1.4.nix { }; libevent = callPackage ../development/libraries/libevent { }; libewf = callPackage ../development/libraries/libewf { }; libexif = callPackage ../development/libraries/libexif { }; libexosip = callPackage ../development/libraries/exosip {}; libexosip_3 = callPackage ../development/libraries/exosip/3.x.nix { libosip = libosip_3; }; libextractor = callPackage ../development/libraries/libextractor { libmpeg2 = mpeg2dec; }; libexttextcat = callPackage ../development/libraries/libexttextcat {}; libf2c = callPackage ../development/libraries/libf2c {}; libfixposix = callPackage ../development/libraries/libfixposix {}; libffcall = builderDefsPackage (import ../development/libraries/libffcall) { inherit fetchcvs; }; libffi = callPackage ../development/libraries/libffi { }; libftdi = callPackage ../development/libraries/libftdi { }; libftdi1 = callPackage ../development/libraries/libftdi/1.x.nix { }; libgcrypt = callPackage ../development/libraries/libgcrypt { }; libgcrypt_1_6 = lowPrio (callPackage ../development/libraries/libgcrypt/1.6.nix { }); libgdiplus = callPackage ../development/libraries/libgdiplus { }; libgksu = callPackage ../development/libraries/libgksu { }; libgpgerror = callPackage ../development/libraries/libgpg-error { }; libgphoto2 = callPackage ../development/libraries/libgphoto2 { }; libgphoto2_4 = callPackage ../development/libraries/libgphoto2/2.4.nix { }; libgpod = callPackage ../development/libraries/libgpod { inherit (pkgs.pythonPackages) mutagen; }; libharu = callPackage ../development/libraries/libharu { }; libical = callPackage ../development/libraries/libical { }; libicns = callPackage ../development/libraries/libicns { }; libimobiledevice = callPackage ../development/libraries/libimobiledevice { }; libiodbc = callPackage ../development/libraries/libiodbc { useGTK = config.libiodbc.gtk or false; }; libivykis = callPackage ../development/libraries/libivykis { }; liblastfmSF = callPackage ../development/libraries/liblastfmSF { }; liblastfm = callPackage ../development/libraries/liblastfm { }; liblqr1 = callPackage ../development/libraries/liblqr-1 { }; liblockfile = callPackage ../development/libraries/liblockfile { }; liblogging = callPackage ../development/libraries/liblogging { }; libmcrypt = callPackage ../development/libraries/libmcrypt {}; libmhash = callPackage ../development/libraries/libmhash {}; libmodbus = callPackage ../development/libraries/libmodbus {}; libmtp = callPackage ../development/libraries/libmtp { }; libmsgpack = callPackage ../development/libraries/libmsgpack { }; libnatspec = callPackage ../development/libraries/libnatspec { }; libnfc = callPackage ../development/libraries/libnfc { }; libnfsidmap = callPackage ../development/libraries/libnfsidmap { }; libnice = callPackage ../development/libraries/libnice { }; liboping = callPackage ../development/libraries/liboping { }; libplist = callPackage ../development/libraries/libplist { }; libQGLViewer = callPackage ../development/libraries/libqglviewer { }; libre = callPackage ../development/libraries/libre {}; librem = callPackage ../development/libraries/librem {}; libresample = callPackage ../development/libraries/libresample {}; librevenge = callPackage ../development/libraries/librevenge {}; librevisa = callPackage ../development/libraries/librevisa { }; libsamplerate = callPackage ../development/libraries/libsamplerate { }; libspectre = callPackage ../development/libraries/libspectre { }; libgsf = callPackage ../development/libraries/libgsf { }; libiconv = callPackage ../development/libraries/libiconv { }; libiconvOrEmpty = if libiconvOrNull == null then [] else [libiconv]; libiconvOrNull = if gcc.libc or null != null || stdenv.isGlibc then null else libiconv; # The logic behind this attribute is broken: libiconvOrNull==null does # NOT imply libiconv=glibc! On Darwin, for example, we have a native # libiconv library which is not glibc. libiconvOrLibc = if libiconvOrNull == null then gcc.libc else libiconv; # On non-GNU systems we need GNU Gettext for libintl. libintlOrEmpty = stdenv.lib.optional (!stdenv.isLinux) gettext; libid3tag = callPackage ../development/libraries/libid3tag { }; libidn = callPackage ../development/libraries/libidn { }; libiec61883 = callPackage ../development/libraries/libiec61883 { }; libinfinity = callPackage ../development/libraries/libinfinity { inherit (gnome) gtkdoc; }; libiptcdata = callPackage ../development/libraries/libiptcdata { }; libjpeg_original = callPackage ../development/libraries/libjpeg { }; libjpeg_turbo = callPackage ../development/libraries/libjpeg-turbo { }; libjpeg = if (stdenv.isLinux) then libjpeg_turbo else libjpeg_original; # some problems, both on FreeBSD and Darwin libjpeg62 = callPackage ../development/libraries/libjpeg/62.nix { libtool = libtool_1_5; }; libjson_rpc_cpp = callPackage ../development/libraries/libjson-rpc-cpp { }; libkate = callPackage ../development/libraries/libkate { }; libksba = callPackage ../development/libraries/libksba { }; libmad = callPackage ../development/libraries/libmad { }; libmatchbox = callPackage ../development/libraries/libmatchbox { }; libmatthew_java = callPackage ../development/libraries/java/libmatthew-java { }; libmatroska = callPackage ../development/libraries/libmatroska { }; libmcs = callPackage ../development/libraries/libmcs { }; libmemcached = callPackage ../development/libraries/libmemcached { }; libmicrohttpd = callPackage ../development/libraries/libmicrohttpd { }; libmikmod = callPackage ../development/libraries/libmikmod { # resolve the "stray '@' in program" errors stdenv = if stdenv.isDarwin then overrideGCC stdenv gccApple else stdenv; }; libmilter = callPackage ../development/libraries/libmilter { }; libmkv = callPackage ../development/libraries/libmkv { }; libmms = callPackage ../development/libraries/libmms { }; libmowgli = callPackage ../development/libraries/libmowgli { }; libmng = callPackage ../development/libraries/libmng { }; libmnl = callPackage ../development/libraries/libmnl { }; libmodplug = callPackage ../development/libraries/libmodplug {}; libmpcdec = callPackage ../development/libraries/libmpcdec { }; libmp3splt = callPackage ../development/libraries/libmp3splt { }; libmrss = callPackage ../development/libraries/libmrss { }; libmsn = callPackage ../development/libraries/libmsn { }; libmspack = callPackage ../development/libraries/libmspack { }; libmusclecard = callPackage ../development/libraries/libmusclecard { }; libmusicbrainz2 = callPackage ../development/libraries/libmusicbrainz/2.x.nix { }; libmusicbrainz3 = callPackage ../development/libraries/libmusicbrainz { }; libmusicbrainz5 = callPackage ../development/libraries/libmusicbrainz/5.x.nix { }; libmusicbrainz = libmusicbrainz3; libmwaw = callPackage ../development/libraries/libmwaw { }; libmwaw_02 = callPackage ../development/libraries/libmwaw/0.2.nix { }; libmx = callPackage ../development/libraries/libmx { }; libnet = callPackage ../development/libraries/libnet { }; libnetfilter_conntrack = callPackage ../development/libraries/libnetfilter_conntrack { }; libnetfilter_queue = callPackage ../development/libraries/libnetfilter_queue { }; libnfnetlink = callPackage ../development/libraries/libnfnetlink { }; libnftnl = callPackage ../development/libraries/libnftnl { }; libnih = callPackage ../development/libraries/libnih { }; libnova = callPackage ../development/libraries/libnova { }; libnxml = callPackage ../development/libraries/libnxml { }; libodfgen = callPackage ../development/libraries/libodfgen { }; libofa = callPackage ../development/libraries/libofa { }; libofx = callPackage ../development/libraries/libofx { }; libogg = callPackage ../development/libraries/libogg { }; liboggz = callPackage ../development/libraries/liboggz { }; liboil = callPackage ../development/libraries/liboil { }; liboop = callPackage ../development/libraries/liboop { }; libopus = callPackage ../development/libraries/libopus { }; libosinfo = callPackage ../development/libraries/libosinfo {}; libosip = callPackage ../development/libraries/osip {}; libosip_3 = callPackage ../development/libraries/osip/3.nix {}; libotr = callPackage ../development/libraries/libotr { libgcrypt = libgcrypt_1_6; }; libotr_3_2 = callPackage ../development/libraries/libotr/3.2.nix { }; libp11 = callPackage ../development/libraries/libp11 { }; libpar2 = callPackage ../development/libraries/libpar2 { }; libpcap = callPackage ../development/libraries/libpcap { }; libpipeline = callPackage ../development/libraries/libpipeline { }; libpng = callPackage ../development/libraries/libpng { }; libpng_apng = libpng.override { apngSupport = true; }; libpng12 = callPackage ../development/libraries/libpng/12.nix { }; libpng15 = callPackage ../development/libraries/libpng/15.nix { }; libpaper = callPackage ../development/libraries/libpaper { }; libproxy = callPackage ../development/libraries/libproxy { stdenv = if stdenv.isDarwin then overrideGCC stdenv gcc else stdenv; }; libpseudo = callPackage ../development/libraries/libpseudo { }; libpwquality = callPackage ../development/libraries/libpwquality { }; libqalculate = callPackage ../development/libraries/libqalculate { }; librsvg = callPackage ../development/libraries/librsvg { gtk2 = null; gtk3 = null; # neither gtk version by default }; librsync = callPackage ../development/libraries/librsync { }; libsearpc = callPackage ../development/libraries/libsearpc { }; libsigcxx = callPackage ../development/libraries/libsigcxx { }; libsigcxx12 = callPackage ../development/libraries/libsigcxx/1.2.nix { }; libsigsegv = callPackage ../development/libraries/libsigsegv { }; # To bootstrap SBCL, I need CLisp 2.44.1; it needs libsigsegv 2.5 libsigsegv_25 = callPackage ../development/libraries/libsigsegv/2.5.nix { }; libsndfile = callPackage ../development/libraries/libsndfile { }; libsodium = callPackage ../development/libraries/libsodium { }; libsoup = callPackage ../development/libraries/libsoup { }; libssh = callPackage ../development/libraries/libssh { }; libssh2 = callPackage ../development/libraries/libssh2 { }; libstartup_notification = callPackage ../development/libraries/startup-notification { }; libspatialindex = callPackage ../development/libraries/libspatialindex { }; libspatialite = callPackage ../development/libraries/libspatialite { }; libtar = callPackage ../development/libraries/libtar { }; libtasn1 = callPackage ../development/libraries/libtasn1 { }; libtheora = callPackage ../development/libraries/libtheora { }; libtiff = callPackage ../development/libraries/libtiff { }; libtiger = callPackage ../development/libraries/libtiger { }; libtommath = callPackage ../development/libraries/libtommath { }; libtorrentRasterbar = callPackage ../development/libraries/libtorrent-rasterbar { # fix "unrecognized option -arch" error stdenv = if stdenv.isDarwin then clangStdenv else stdenv; }; libtoxcore = callPackage ../development/libraries/libtoxcore { }; libtsm = callPackage ../development/libraries/libtsm { }; libtunepimp = callPackage ../development/libraries/libtunepimp { }; libtxc_dxtn = callPackage ../development/libraries/libtxc_dxtn { }; libtxc_dxtn_s2tc = callPackage ../development/libraries/libtxc_dxtn_s2tc { }; libgeotiff = callPackage ../development/libraries/libgeotiff { }; libunistring = callPackage ../development/libraries/libunistring { }; libupnp = callPackage ../development/libraries/pupnp { }; giflib = callPackage ../development/libraries/giflib { }; giflib_4_1 = callPackage ../development/libraries/giflib/4.1.nix { }; libungif = callPackage ../development/libraries/giflib/libungif.nix { }; libunibreak = callPackage ../development/libraries/libunibreak { }; libunique = callPackage ../development/libraries/libunique/default.nix { }; liburcu = callPackage ../development/libraries/liburcu { }; libusb = callPackage ../development/libraries/libusb {}; libusb1 = callPackage ../development/libraries/libusb1 { stdenv = if stdenv.isDarwin then clangStdenv else stdenv; }; libunwind = callPackage ../development/libraries/libunwind { }; libuvVersions = callPackage ../development/libraries/libuv { }; libv4l = lowPrio (v4l_utils.override { withQt4 = false; }); libva = callPackage ../development/libraries/libva { }; libvdpau = callPackage ../development/libraries/libvdpau { }; libvirt = callPackage ../development/libraries/libvirt { }; libvirt-glib = callPackage ../development/libraries/libvirt-glib { }; libvisio = callPackage ../development/libraries/libvisio { }; libvisual = callPackage ../development/libraries/libvisual { }; libvncserver = callPackage ../development/libraries/libvncserver {}; libviper = callPackage ../development/libraries/libviper { }; libvpx = callPackage ../development/libraries/libvpx { }; libvterm = callPackage ../development/libraries/libvterm { }; libvorbis = callPackage ../development/libraries/libvorbis { }; libwebp = callPackage ../development/libraries/libwebp { }; libwmf = callPackage ../development/libraries/libwmf { }; libwnck = libwnck2; libwnck2 = callPackage ../development/libraries/libwnck { }; libwnck3 = callPackage ../development/libraries/libwnck/3.x.nix { }; libwpd = callPackage ../development/libraries/libwpd { }; libwpd_08 = callPackage ../development/libraries/libwpd/0.8.nix { }; libwpg = callPackage ../development/libraries/libwpg { }; libx86 = builderDefsPackage ../development/libraries/libx86 {}; libxdg_basedir = callPackage ../development/libraries/libxdg-basedir { }; libxkbcommon = callPackage ../development/libraries/libxkbcommon { }; libxklavier = callPackage ../development/libraries/libxklavier { }; libxmi = callPackage ../development/libraries/libxmi { }; libxml2 = callPackage ../development/libraries/libxml2 { pythonSupport = false; }; libxml2Python = lowPrio (libxml2.override { pythonSupport = true; }); libxmlxx = callPackage ../development/libraries/libxmlxx { }; libxmp = callPackage ../development/libraries/libxmp { }; libxslt = callPackage ../development/libraries/libxslt { }; libixp_for_wmii = lowPrio (import ../development/libraries/libixp_for_wmii { inherit fetchurl stdenv; }); libyaml = callPackage ../development/libraries/libyaml { }; libyamlcpp = callPackage ../development/libraries/libyaml-cpp { }; libyamlcpp03 = callPackage ../development/libraries/libyaml-cpp/0.3.x.nix { }; libyubikey = callPackage ../development/libraries/libyubikey {}; libzip = callPackage ../development/libraries/libzip { }; libzdb = callPackage ../development/libraries/libzdb { }; libzrtpcpp = callPackage ../development/libraries/libzrtpcpp { }; libzrtpcpp_1_6 = callPackage ../development/libraries/libzrtpcpp/1.6.nix { ccrtp = ccrtp_1_8; }; libwacom = callPackage ../development/libraries/libwacom { }; lightning = callPackage ../development/libraries/lightning { }; lirc = callPackage ../development/libraries/lirc { }; liquidwar = builderDefsPackage ../games/liquidwar { inherit (xlibs) xproto libX11 libXrender; inherit gmp mesa libjpeg expat gettext perl SDL SDL_image SDL_mixer SDL_ttf curl sqlite libogg libvorbis libcaca csound cunit ; guile = guile_1_8; libpng = libpng15; # 0.0.13 needs libpng 1.2--1.5 }; log4cpp = callPackage ../development/libraries/log4cpp { }; log4cxx = callPackage ../development/libraries/log4cxx { }; log4cplus = callPackage ../development/libraries/log4cplus { }; loudmouth = callPackage ../development/libraries/loudmouth { }; lzo = callPackage ../development/libraries/lzo { }; mdds_0_7_1 = callPackage ../development/libraries/mdds/0.7.1.nix { }; mdds = callPackage ../development/libraries/mdds { }; # failed to build mediastreamer = callPackage ../development/libraries/mediastreamer { }; menu-cache = callPackage ../development/libraries/menu-cache { }; mesaSupported = lib.elem system lib.platforms.mesaPlatforms; mesaDarwinOr = alternative: if stdenv.isDarwin then callPackage ../development/libraries/mesa-darwin { } else alternative; mesa_noglu = mesaDarwinOr (callPackage ../development/libraries/mesa { # makes it slower, but during runtime we link against just mesa_drivers # through /run/opengl-driver*, which is overriden according to config.grsecurity grsecEnabled = true; }); mesa_glu = mesaDarwinOr (callPackage ../development/libraries/mesa-glu { }); mesa_drivers = mesaDarwinOr ( let mo = mesa_noglu.override { grsecEnabled = config.grsecurity or false; }; in mo.drivers ); mesa = mesaDarwinOr (buildEnv { name = "mesa-${mesa_noglu.version}"; paths = [ mesa_noglu mesa_glu ]; }); metaEnvironment = recurseIntoAttrs (let callPackage = newScope pkgs.metaEnvironment; in rec { sdfLibrary = callPackage ../development/libraries/sdf-library { aterm = aterm28; }; toolbuslib = callPackage ../development/libraries/toolbuslib { aterm = aterm28; inherit (windows) w32api; }; cLibrary = callPackage ../development/libraries/c-library { aterm = aterm28; }; errorSupport = callPackage ../development/libraries/error-support { aterm = aterm28; }; ptSupport = callPackage ../development/libraries/pt-support { aterm = aterm28; }; ptableSupport = callPackage ../development/libraries/ptable-support { aterm = aterm28; }; configSupport = callPackage ../development/libraries/config-support { aterm = aterm28; }; asfSupport = callPackage ../development/libraries/asf-support { aterm = aterm28; }; tideSupport = callPackage ../development/libraries/tide-support { aterm = aterm28; }; rstoreSupport = callPackage ../development/libraries/rstore-support { aterm = aterm28; }; sdfSupport = callPackage ../development/libraries/sdf-support { aterm = aterm28; }; sglr = callPackage ../development/libraries/sglr { aterm = aterm28; }; ascSupport = callPackage ../development/libraries/asc-support { aterm = aterm28; }; pgen = callPackage ../development/libraries/pgen { aterm = aterm28; }; }); ming = callPackage ../development/libraries/ming { }; minizip = callPackage ../development/libraries/minizip { }; minmay = callPackage ../development/libraries/minmay { }; miro = callPackage ../applications/video/miro { inherit (pythonPackages) pywebkitgtk pysqlite pycurl mutagen; }; mkvtoolnix = callPackage ../applications/video/mkvtoolnix { }; mlt-qt4 = callPackage ../development/libraries/mlt { qt = qt4; SDL = SDL_pulseaudio; }; mlt-qt5 = callPackage ../development/libraries/mlt { qt = qt5; SDL = SDL_pulseaudio; }; movit = callPackage ../development/libraries/movit { }; mps = callPackage ../development/libraries/mps { }; libmpeg2 = callPackage ../development/libraries/libmpeg2 { }; mpeg2dec = libmpeg2; msilbc = callPackage ../development/libraries/msilbc { }; mp4v2 = callPackage ../development/libraries/mp4v2 { }; mpc = callPackage ../development/libraries/mpc { }; mpich2 = callPackage ../development/libraries/mpich2 { }; mtdev = callPackage ../development/libraries/mtdev { }; mtpfs = callPackage ../tools/filesystems/mtpfs { }; mu = callPackage ../tools/networking/mu { texinfo = texinfo4; }; muparser = callPackage ../development/libraries/muparser { }; mygpoclient = callPackage ../development/python-modules/mygpoclient { }; mygui = callPackage ../development/libraries/mygui {}; myguiSvn = callPackage ../development/libraries/mygui/svn.nix {}; mysocketw = callPackage ../development/libraries/mysocketw { }; mythes = callPackage ../development/libraries/mythes { }; nanomsg = callPackage ../development/libraries/nanomsg { }; ncurses = callPackage ../development/libraries/ncurses { unicode = system != "i686-cygwin"; }; neon = callPackage ../development/libraries/neon { compressionSupport = true; sslSupport = true; }; nethack = builderDefsPackage (import ../games/nethack) { inherit ncurses flex bison; }; nettle = callPackage ../development/libraries/nettle { }; newt = callPackage ../development/libraries/newt { }; nix-plugins = callPackage ../development/libraries/nix-plugins { nix = pkgs.nixUnstable; }; nspr = callPackage ../development/libraries/nspr { }; nss = lowPrio (callPackage ../development/libraries/nss { }); nssTools = callPackage ../development/libraries/nss { includeTools = true; }; ntrack = callPackage ../development/libraries/ntrack { }; nvidia-texture-tools = callPackage ../development/libraries/nvidia-texture-tools { }; ode = builderDefsPackage (import ../development/libraries/ode) { }; ogre = callPackage ../development/libraries/ogre {}; ogrepaged = callPackage ../development/libraries/ogrepaged { }; oniguruma = callPackage ../development/libraries/oniguruma { }; openal = callPackage ../development/libraries/openal { }; # added because I hope that it has been easier to compile on x86 (for blender) openalSoft = callPackage ../development/libraries/openal-soft { }; openbabel = callPackage ../development/libraries/openbabel { }; opencascade = callPackage ../development/libraries/opencascade { }; opencascade_6_5 = callPackage ../development/libraries/opencascade/6.5.nix { automake = automake111x; ftgl = ftgl212; }; opencascade_oce = callPackage ../development/libraries/opencascade/oce.nix { }; opencsg = callPackage ../development/libraries/opencsg { }; openct = callPackage ../development/libraries/openct { }; opencv = callPackage ../development/libraries/opencv { }; opencv_2_1 = callPackage ../development/libraries/opencv/2.1.nix { libpng = libpng12; }; # this ctl version is needed by openexr_viewers openexr_ctl = callPackage ../development/libraries/openexr_ctl { }; openexr = callPackage ../development/libraries/openexr { }; openldap = callPackage ../development/libraries/openldap { }; openlierox = callPackage ../games/openlierox { }; libopensc_dnie = callPackage ../development/libraries/libopensc-dnie { }; opencolorio = callPackage ../development/libraries/opencolorio { }; ois = callPackage ../development/libraries/ois {}; opal = callPackage ../development/libraries/opal {}; openjpeg = callPackage ../development/libraries/openjpeg { lcms = lcms2; }; openscenegraph = callPackage ../development/libraries/openscenegraph { giflib = giflib_4_1; ffmpeg = ffmpeg_0_10; }; openspades = callPackage ../games/openspades {}; libressl = callPackage ../development/libraries/libressl { }; boringssl = callPackage ../development/libraries/boringssl { }; openssl = callPackage ../development/libraries/openssl { fetchurl = fetchurlBoot; cryptodevHeaders = linuxPackages.cryptodev.override { fetchurl = fetchurlBoot; onlyHeaders = true; }; }; ortp = callPackage ../development/libraries/ortp { srtp = srtp_linphone; }; p11_kit = callPackage ../development/libraries/p11-kit { }; paperkey = callPackage ../tools/security/paperkey { }; pangoxsl = callPackage ../development/libraries/pangoxsl { }; pcl = callPackage ../development/libraries/pcl { vtk = vtkWithQt4; }; pcre = callPackage ../development/libraries/pcre { unicodeSupport = config.pcre.unicode or true; }; pdf2xml = callPackage ../development/libraries/pdf2xml {} ; phonon = callPackage ../development/libraries/phonon { }; phonon_backend_gstreamer = callPackage ../development/libraries/phonon-backend-gstreamer { }; phonon_backend_vlc = callPackage ../development/libraries/phonon-backend-vlc { }; physfs = callPackage ../development/libraries/physfs { }; pkcs11helper = callPackage ../development/libraries/pkcs11helper { }; plib = callPackage ../development/libraries/plib { }; pocketsphinx = callPackage ../development/libraries/pocketsphinx { }; podofo = callPackage ../development/libraries/podofo { }; polkit = callPackage ../development/libraries/polkit { spidermonkey = spidermonkey_185; }; polkit_qt_1 = callPackage ../development/libraries/polkit-qt-1 { }; policykit = callPackage ../development/libraries/policykit { }; poppler = callPackage ../development/libraries/poppler { lcms = lcms2; }; popplerQt4 = poppler.poppler_qt4; popt = callPackage ../development/libraries/popt { }; portaudio = callPackage ../development/libraries/portaudio { # resolves a variety of compile-time errors stdenv = if stdenv.isDarwin then clangStdenv else stdenv; }; portaudioSVN = callPackage ../development/libraries/portaudio/svn-head.nix { }; portmidi = callPackage ../development/libraries/portmidi {}; prison = callPackage ../development/libraries/prison { }; proj = callPackage ../development/libraries/proj { }; postgis = callPackage ../development/libraries/postgis { }; protobuf = callPackage ../development/libraries/protobuf { }; protobufc = callPackage ../development/libraries/protobufc { }; pth = callPackage ../development/libraries/pth { }; ptlib = callPackage ../development/libraries/ptlib {}; re2 = callPackage ../development/libraries/re2 { }; qca2 = callPackage ../development/libraries/qca2 {}; qca2_ossl = callPackage ../development/libraries/qca2/ossl.nix {}; qimageblitz = callPackage ../development/libraries/qimageblitz {}; qjson = callPackage ../development/libraries/qjson { }; qoauth = callPackage ../development/libraries/qoauth { }; qt3 = callPackage ../development/libraries/qt-3 { openglSupport = mesaSupported; libpng = libpng12; }; qt4 = pkgs.kde4.qt4; qt48 = callPackage ../development/libraries/qt-4.x/4.8 { # GNOME dependencies are not used unless gtkStyle == true mesa = mesa_noglu; inherit (pkgs.gnome) libgnomeui GConf gnome_vfs; cups = if stdenv.isLinux then cups else null; # resolve unrecognised flag '-fconstant-cfstrings' errors stdenv = if stdenv.isDarwin then clangStdenv else stdenv; }; qt48Full = qt48.override { docs = true; demos = true; examples = true; developerBuild = true; }; qt4SDK = qtcreator.override { sdkBuild = true; qtLib = qt48Full; }; qt53Full = qt53.override { buildDocs = true; buildExamples = true; buildTests = true; developerBuild = true; }; qt53 = callPackage ../development/libraries/qt-5/qt-5.3.nix { mesa = mesa_noglu; cups = if stdenv.isLinux then cups else null; # GNOME dependencies are not used unless gtkStyle == true inherit (gnome) libgnomeui GConf gnome_vfs; bison = bison2; # error: too few arguments to function 'int yylex(... }; qt5 = callPackage ../development/libraries/qt-5 { mesa = mesa_noglu; cups = if stdenv.isLinux then cups else null; # GNOME dependencies are not used unless gtkStyle == true inherit (gnome) libgnomeui GConf gnome_vfs; bison = bison2; # error: too few arguments to function 'int yylex(... }; qt5Full = qt5.override { buildDocs = true; buildExamples = true; buildTests = true; developerBuild = true; }; qt5SDK = qtcreator.override { sdkBuild = true; qtLib = qt5Full; }; qtcreator = callPackage ../development/qtcreator { qtLib = qt48.override { developerBuild = true; }; }; qtscriptgenerator = callPackage ../development/libraries/qtscriptgenerator { }; quesoglc = callPackage ../development/libraries/quesoglc { }; qwt = callPackage ../development/libraries/qwt {}; qwt6 = callPackage ../development/libraries/qwt/6.nix { }; rabbitmq-c = callPackage ../development/libraries/rabbitmq-c {}; rabbitmq-java-client = callPackage ../development/libraries/rabbitmq-java-client {}; raul = callPackage ../development/libraries/audio/raul { }; readline = readline6; # 6.2 works, 6.3 breaks python, parted readline4 = callPackage ../development/libraries/readline/readline4.nix { }; readline5 = callPackage ../development/libraries/readline/readline5.nix { }; readline6 = callPackage ../development/libraries/readline/readline6.nix { }; readline63 = callPackage ../development/libraries/readline/readline6.3.nix { }; librdf_raptor = callPackage ../development/libraries/librdf/raptor.nix { }; librdf_raptor2 = callPackage ../development/libraries/librdf/raptor2.nix { }; librdf_rasqal = callPackage ../development/libraries/librdf/rasqal.nix { }; librdf_redland = callPackage ../development/libraries/librdf/redland.nix { }; librdf = callPackage ../development/libraries/librdf { }; lilv = callPackage ../development/libraries/audio/lilv { }; lv2 = callPackage ../development/libraries/audio/lv2 { }; lvtk = callPackage ../development/libraries/audio/lvtk { }; qrupdate = callPackage ../development/libraries/qrupdate { }; redland = pkgs.librdf_redland; rhino = callPackage ../development/libraries/java/rhino { javac = gcj; jvm = gcj; }; rlog = callPackage ../development/libraries/rlog { }; rubberband = callPackage ../development/libraries/rubberband { fftw = fftwSinglePrec; inherit (vamp) vampSDK; }; sbc = callPackage ../development/libraries/sbc { }; schroedinger = callPackage ../development/libraries/schroedinger { }; SDL = callPackage ../development/libraries/SDL { openglSupport = mesaSupported; alsaSupport = (!stdenv.isDarwin); x11Support = true; pulseaudioSupport = stdenv.isDarwin; # better go through ALSA # resolve the unrecognized -fpascal-strings option error stdenv = if stdenv.isDarwin then clangStdenv else stdenv; }; # Fixes major problems with choppy sound in MLT / Kdenlive / Shotcut SDL_pulseaudio = SDL.override { pulseaudioSupport = true; }; SDL_gfx = callPackage ../development/libraries/SDL_gfx { }; SDL_image = callPackage ../development/libraries/SDL_image { # provide an Objective-C compiler stdenv = if stdenv.isDarwin then clangStdenv else stdenv; }; SDL_mixer = callPackage ../development/libraries/SDL_mixer { }; SDL_net = callPackage ../development/libraries/SDL_net { }; SDL_sound = callPackage ../development/libraries/SDL_sound { }; SDL_ttf = callPackage ../development/libraries/SDL_ttf { }; SDL2 = callPackage ../development/libraries/SDL2 { openglSupport = mesaSupported; alsaSupport = true; x11Support = true; pulseaudioSupport = false; # better go through ALSA }; SDL2_image = callPackage ../development/libraries/SDL2_image { }; SDL2_mixer = callPackage ../development/libraries/SDL2_mixer { }; SDL2_net = callPackage ../development/libraries/SDL2_net { }; SDL2_gfx = callPackage ../development/libraries/SDL2_gfx { }; serd = callPackage ../development/libraries/serd {}; serf = callPackage ../development/libraries/serf {}; silgraphite = callPackage ../development/libraries/silgraphite {}; graphite2 = callPackage ../development/libraries/silgraphite/graphite2.nix {}; simgear = callPackage ../development/libraries/simgear { }; sfml_git = callPackage ../development/libraries/sfml { }; skalibs = callPackage ../development/libraries/skalibs { }; slang = callPackage ../development/libraries/slang { }; slibGuile = callPackage ../development/libraries/slib { scheme = guile_1_8; texinfo = texinfo4; # otherwise erros: must be after `@defun' to use `@defunx' }; smpeg = callPackage ../development/libraries/smpeg { }; snack = callPackage ../development/libraries/snack { # optional }; snappy = callPackage ../development/libraries/snappy { }; sodium = callPackage ../development/libraries/sodium {}; sofia_sip = callPackage ../development/libraries/sofia-sip { }; soprano = callPackage ../development/libraries/soprano { }; soqt = callPackage ../development/libraries/soqt { }; sord = callPackage ../development/libraries/sord {}; spandsp = callPackage ../development/libraries/spandsp {}; speechd = callPackage ../development/libraries/speechd { }; speech_tools = callPackage ../development/libraries/speech-tools {}; speex = callPackage ../development/libraries/speex { }; sphinxbase = callPackage ../development/libraries/sphinxbase { }; spice = callPackage ../development/libraries/spice { celt = celt_0_5_1; inherit (xlibs) libXrandr libXfixes libXext libXrender libXinerama; inherit (pythonPackages) pyparsing; }; spice_gtk = callPackage ../development/libraries/spice-gtk { }; spice_protocol = callPackage ../development/libraries/spice-protocol { }; sratom = callPackage ../development/libraries/audio/sratom { }; srtp = callPackage ../development/libraries/srtp {}; srtp_linphone = callPackage ../development/libraries/srtp/linphone.nix { }; sqlite = lowPrio (callPackage ../development/libraries/sqlite { readline = null; ncurses = null; }); sqliteInteractive = appendToName "interactive" (sqlite.override { inherit readline ncurses; }); sqlcipher = lowPrio (callPackage ../development/libraries/sqlcipher { readline = null; ncurses = null; }); stfl = callPackage ../development/libraries/stfl { stdenv = if stdenv.isDarwin then overrideGCC stdenv gccApple else stdenv; }; stlink = callPackage ../development/tools/misc/stlink { }; steghide = callPackage ../tools/security/steghide {}; stepmania = callPackage ../games/stepmania {}; stlport = callPackage ../development/libraries/stlport { }; strigi = callPackage ../development/libraries/strigi { clucene_core = clucene_core_2; }; subtitleeditor = callPackage ../applications/video/subtitleeditor { }; suil = callPackage ../development/libraries/audio/suil { }; suitesparse = callPackage ../development/libraries/suitesparse { }; sutils = callPackage ../tools/misc/sutils { }; sword = callPackage ../development/libraries/sword { }; szip = callPackage ../development/libraries/szip { }; t1lib = callPackage ../development/libraries/t1lib { }; taglib = callPackage ../development/libraries/taglib { }; taglib_extras = callPackage ../development/libraries/taglib-extras { }; talloc = callPackage ../development/libraries/talloc { }; tclap = callPackage ../development/libraries/tclap {}; tclgpg = callPackage ../development/libraries/tclgpg { }; tcllib = callPackage ../development/libraries/tcllib { }; tcltls = callPackage ../development/libraries/tcltls { }; tdb = callPackage ../development/libraries/tdb { }; tecla = callPackage ../development/libraries/tecla { }; telepathy_glib = callPackage ../development/libraries/telepathy/glib { }; telepathy_farstream = callPackage ../development/libraries/telepathy/farstream {}; telepathy_qt = callPackage ../development/libraries/telepathy/qt { }; thrift = callPackage ../development/libraries/thrift { }; tinyxml = tinyxml2; tinyxml2 = callPackage ../development/libraries/tinyxml/2.6.2.nix { }; tk = callPackage ../development/libraries/tk { }; tnt = callPackage ../development/libraries/tnt { }; tokyocabinet = callPackage ../development/libraries/tokyo-cabinet { }; tokyotyrant = callPackage ../development/libraries/tokyo-tyrant { }; tremor = callPackage ../development/libraries/tremor { }; unicap = callPackage ../development/libraries/unicap {}; tsocks = callPackage ../development/libraries/tsocks { }; unixODBC = callPackage ../development/libraries/unixODBC { }; unixODBCDrivers = recurseIntoAttrs (import ../development/libraries/unixODBCDrivers { inherit fetchurl stdenv unixODBC glibc libtool openssl zlib; inherit postgresql mysql sqlite; }); urt = callPackage ../development/libraries/urt { }; ustr = callPackage ../development/libraries/ustr { }; usbredir = callPackage ../development/libraries/usbredir { libusb = libusb1; }; ucommon = callPackage ../development/libraries/ucommon { }; v8 = callPackage ../development/libraries/v8 { inherit (pythonPackages) gyp; }; vaapiIntel = callPackage ../development/libraries/vaapi-intel { }; vaapiVdpau = callPackage ../development/libraries/vaapi-vdpau { }; vamp = callPackage ../development/libraries/audio/vamp { }; vcdimager = callPackage ../development/libraries/vcdimager { }; vigra = callPackage ../development/libraries/vigra { inherit (pkgs.pythonPackages) numpy; }; vlock = callPackage ../misc/screensavers/vlock { }; vmime = callPackage ../development/libraries/vmime { }; vrpn = callPackage ../development/libraries/vrpn { }; vtk = callPackage ../development/libraries/vtk { }; vtkWithQt4 = vtk.override { qtLib = qt4; }; vxl = callPackage ../development/libraries/vxl { libpng = libpng12; }; wayland = callPackage ../development/libraries/wayland { }; webkit = webkitgtk; webkitgtk = callPackage ../development/libraries/webkitgtk { harfbuzz = harfbuzz.override { withIcu = true; }; gst-plugins-base = gst_all_1.gst-plugins-base; }; webkitgtk2 = webkitgtk.override { withGtk2 = true; enableIntrospection = false; }; wildmidi = callPackage ../development/libraries/wildmidi { }; wvstreams = callPackage ../development/libraries/wvstreams { }; wxGTK = wxGTK28; wxGTK28 = callPackage ../development/libraries/wxGTK-2.8 { inherit (gnome) GConf; withMesa = lib.elem system lib.platforms.mesaPlatforms; }; wxGTK29 = callPackage ../development/libraries/wxGTK-2.9/default.nix { inherit (gnome) GConf; withMesa = lib.elem system lib.platforms.mesaPlatforms; # use for Objective-C++ compiler stdenv = if stdenv.isDarwin then clangStdenv else stdenv; }; wxGTK30 = callPackage ../development/libraries/wxGTK-3.0/default.nix { inherit (gnome) GConf; withMesa = lib.elem system lib.platforms.mesaPlatforms; # use for Objective-C++ compiler stdenv = if stdenv.isDarwin then clangStdenv else stdenv; }; wtk = callPackage ../development/libraries/wtk { }; x264 = callPackage ../development/libraries/x264 { }; xapian = callPackage ../development/libraries/xapian { }; xapianBindings = callPackage ../development/libraries/xapian/bindings { # TODO perl php Java, tcl, C#, python }; xapian10 = callPackage ../development/libraries/xapian/1.0.x.nix { }; xapianBindings10 = callPackage ../development/libraries/xapian/bindings/1.0.x.nix { # TODO perl php Java, tcl, C#, python }; Xaw3d = callPackage ../development/libraries/Xaw3d { }; xbase = callPackage ../development/libraries/xbase { }; xcb-util-cursor = callPackage ../development/libraries/xcb-util-cursor { }; xdo = callPackage ../tools/misc/xdo { }; xineLib = callPackage ../development/libraries/xine-lib { ffmpeg = ffmpeg_1; }; xautolock = callPackage ../misc/screensavers/xautolock { }; xercesc = callPackage ../development/libraries/xercesc {}; xlibsWrapper = callPackage ../development/libraries/xlibs-wrapper { packages = [ freetype fontconfig xlibs.xproto xlibs.libX11 xlibs.libXt xlibs.libXft xlibs.libXext xlibs.libSM xlibs.libICE xlibs.xextproto ]; }; xmlrpc_c = callPackage ../development/libraries/xmlrpc-c { }; xmlsec = callPackage ../development/libraries/xmlsec { }; xvidcore = callPackage ../development/libraries/xvidcore { }; xylib = callPackage ../development/libraries/xylib { }; yajl = callPackage ../development/libraries/yajl { }; zangband = builderDefsPackage (import ../games/zangband) { inherit ncurses flex bison autoconf automake m4 coreutils; }; zeitgeist = callPackage ../development/libraries/zeitgeist { }; zlib = callPackage ../development/libraries/zlib { fetchurl = fetchurlBoot; }; zlibStatic = lowPrio (appendToName "static" (callPackage ../development/libraries/zlib { static = true; })); zeromq2 = callPackage ../development/libraries/zeromq/2.x.nix {}; zeromq3 = callPackage ../development/libraries/zeromq/3.x.nix {}; zeromq4 = callPackage ../development/libraries/zeromq/4.x.nix {}; zziplib = callPackage ../development/libraries/zziplib { }; ### DEVELOPMENT / LIBRARIES / JAVA atermjava = callPackage ../development/libraries/java/aterm { stdenv = overrideInStdenv stdenv [gnumake380]; }; commonsFileUpload = callPackage ../development/libraries/java/jakarta-commons/file-upload { }; fastjar = callPackage ../development/tools/java/fastjar { }; httpunit = callPackage ../development/libraries/java/httpunit { }; gwtdragdrop = callPackage ../development/libraries/java/gwt-dragdrop { }; gwtwidgets = callPackage ../development/libraries/java/gwt-widgets { }; jakartabcel = callPackage ../development/libraries/java/jakarta-bcel { regexp = jakartaregexp; }; jakartaregexp = callPackage ../development/libraries/java/jakarta-regexp { }; javaCup = callPackage ../development/libraries/java/cup { }; javasvn = callPackage ../development/libraries/java/javasvn { }; jclasslib = callPackage ../development/tools/java/jclasslib { }; jdom = callPackage ../development/libraries/java/jdom { }; jflex = callPackage ../development/libraries/java/jflex { }; jjtraveler = callPackage ../development/libraries/java/jjtraveler { stdenv = overrideInStdenv stdenv [gnumake380]; }; junit = callPackage ../development/libraries/java/junit { antBuild = releaseTools.antBuild; }; junixsocket = callPackage ../development/libraries/java/junixsocket { }; jzmq = callPackage ../development/libraries/java/jzmq { }; lucene = callPackage ../development/libraries/java/lucene { }; mockobjects = callPackage ../development/libraries/java/mockobjects { }; saxon = callPackage ../development/libraries/java/saxon { }; saxonb = callPackage ../development/libraries/java/saxon/default8.nix { }; sharedobjects = callPackage ../development/libraries/java/shared-objects { stdenv = overrideInStdenv stdenv [gnumake380]; }; smack = callPackage ../development/libraries/java/smack { }; swt = callPackage ../development/libraries/java/swt { inherit (gnome) libsoup; }; ### DEVELOPMENT / LIBRARIES / JAVASCRIPT jquery_ui = callPackage ../development/libraries/javascript/jquery-ui { }; yuicompressor = callPackage ../development/tools/yuicompressor { }; ### DEVELOPMENT / LISP MODULES asdf = callPackage ../development/lisp-modules/asdf { texLive = null; }; clwrapperFunction = callPackage ../development/lisp-modules/clwrapper; wrapLisp = lisp: clwrapperFunction { inherit lisp; }; lispPackagesFor = clwrapper: callPackage ../development/lisp-modules/lisp-packages.nix { inherit clwrapper; }; lispPackagesClisp = lispPackagesFor (wrapLisp clisp); lispPackagesSBCL = lispPackagesFor (wrapLisp sbcl); lispPackages = recurseIntoAttrs lispPackagesSBCL; ### DEVELOPMENT / PERL MODULES buildPerlPackage = import ../development/perl-modules/generic perl; perlPackages = recurseIntoAttrs (import ./perl-packages.nix { inherit pkgs; overrides = (config.perlPackageOverrides or (p: {})) pkgs; }); perl514Packages = import ./perl-packages.nix { pkgs = pkgs // { perl = perl514; buildPerlPackage = import ../development/perl-modules/generic perl514; }; overrides = (config.perl514PackageOverrides or (p: {})) pkgs; }; perlXMLParser = perlPackages.XMLParser; ack = perlPackages.ack; perlArchiveCpio = perlPackages.ArchiveCpio; perlcritic = perlPackages.PerlCritic; planetary_annihilation = callPackage ../games/planetaryannihilation { }; ### DEVELOPMENT / PYTHON MODULES # python function with default python interpreter buildPythonPackage = pythonPackages.buildPythonPackage; # `nix-env -i python-nose` installs for 2.7, the default python. # Therefore we do not recurse into attributes here, in contrast to # python27Packages. `nix-env -iA python26Packages.nose` works # regardless. python26Packages = import ./python-packages.nix { inherit pkgs; python = python26; }; python27Packages = lib.hiPrioSet (recurseIntoAttrs (import ./python-packages.nix { inherit pkgs; python = python27; })); python32Packages = import ./python-packages.nix { inherit pkgs; python = python32; }; python33Packages = recurseIntoAttrs (import ./python-packages.nix { inherit pkgs; python = python33; }); python34Packages = recurseIntoAttrs (import ./python-packages.nix { inherit pkgs; python = python34; }); pypyPackages = recurseIntoAttrs (import ./python-packages.nix { inherit pkgs; python = pypy; }); foursuite = callPackage ../development/python-modules/4suite { }; bsddb3 = callPackage ../development/python-modules/bsddb3 { }; ecdsa = callPackage ../development/python-modules/ecdsa { }; numeric = callPackage ../development/python-modules/numeric { }; pil = pythonPackages.pil; psyco = callPackage ../development/python-modules/psyco { }; pycairo = pythonPackages.pycairo; pycapnp = pythonPackages.pycapnp; pycrypto = pythonPackages.pycrypto; pycups = callPackage ../development/python-modules/pycups { }; pyexiv2 = callPackage ../development/python-modules/pyexiv2 { }; pygame = callPackage ../development/python-modules/pygame { }; pygobject = pythonPackages.pygobject; pygobject3 = pythonPackages.pygobject3; pygtk = pythonPackages.pygtk; pyGtkGlade = pythonPackages.pyGtkGlade; pylint = callPackage ../development/python-modules/pylint { }; pyopenssl = builderDefsPackage (import ../development/python-modules/pyopenssl) { inherit python openssl; }; rhpl = callPackage ../development/python-modules/rhpl { }; sip = callPackage ../development/python-modules/sip { }; pyqt4 = callPackage ../development/python-modules/pyqt/4.x.nix { stdenv = if stdenv.isDarwin then clangStdenv else stdenv; }; pysideApiextractor = callPackage ../development/python-modules/pyside/apiextractor.nix { }; pysideGeneratorrunner = callPackage ../development/python-modules/pyside/generatorrunner.nix { }; pyside = callPackage ../development/python-modules/pyside { }; pysideTools = callPackage ../development/python-modules/pyside/tools.nix { }; pysideShiboken = callPackage ../development/python-modules/pyside/shiboken.nix { }; pyx = callPackage ../development/python-modules/pyx { }; pyxml = callPackage ../development/python-modules/pyxml { }; rbtools = callPackage ../development/python-modules/rbtools { }; setuptools = pythonPackages.setuptools; slowaes = callPackage ../development/python-modules/slowaes { }; wxPython = pythonPackages.wxPython; wxPython28 = pythonPackages.wxPython28; twisted = pythonPackages.twisted; ZopeInterface = pythonPackages.zope_interface; ### DEVELOPMENT / R MODULES R = callPackage ../applications/science/math/R { inherit (xlibs) libX11 libXt; texLive = texLiveAggregationFun { paths = [ texLive texLiveExtra ]; }; withRecommendedPackages = false; }; rWrapper = callPackage ../development/r-modules/wrapper.nix { # Those packages are usually installed as part of the R build. recommendedPackages = with rPackages; [ MASS lattice Matrix nlme survival boot cluster codetools foreign KernSmooth rpart class nnet spatial mgcv ]; # Override this attribute to register additional libraries. packages = []; }; rPackages = import ../development/r-modules/cran-packages.nix { inherit pkgs; overrides = (config.rPackageOverrides or (p: {})) pkgs; }; ### SERVERS rdf4store = callPackage ../servers/http/4store { }; apacheHttpd = pkgs.apacheHttpd_2_2; apacheHttpd_2_2 = callPackage ../servers/http/apache-httpd/2.2.nix { sslSupport = true; }; apacheHttpd_2_4 = lowPrio (callPackage ../servers/http/apache-httpd/2.4.nix { sslSupport = true; }); apcupsd = callPackage ../servers/apcupsd { }; sabnzbd = callPackage ../servers/sabnzbd { }; bind = callPackage ../servers/dns/bind { }; bird = callPackage ../servers/bird { }; couchdb = callPackage ../servers/http/couchdb { spidermonkey = spidermonkey_185; python = python27; sphinx = python27Packages.sphinx; erlang = erlangR16; }; dico = callPackage ../servers/dico { }; dict = callPackage ../servers/dict { libmaa = callPackage ../servers/dict/libmaa.nix {}; }; dictdDBs = recurseIntoAttrs (import ../servers/dict/dictd-db.nix { inherit builderDefs; }); dictDBCollector = import ../servers/dict/dictd-db-collector.nix { inherit stdenv lib dict; }; dictdWiktionary = callPackage ../servers/dict/dictd-wiktionary.nix {}; dictdWordnet = callPackage ../servers/dict/dictd-wordnet.nix {}; diod = callPackage ../servers/diod { }; dovecot = dovecot21; dovecot21 = callPackage ../servers/mail/dovecot { }; dovecot22 = callPackage ../servers/mail/dovecot/2.2.x.nix { }; dovecot_pigeonhole = callPackage ../servers/mail/dovecot-pigeonhole { }; etcd = callPackage ../servers/etcd { }; ejabberd = callPackage ../servers/xmpp/ejabberd { erlang = erlangR16; }; elasticmq = callPackage ../servers/elasticmq { }; etcdctl = callPackage ../development/tools/etcdctl { }; fcgiwrap = callPackage ../servers/fcgiwrap { }; felix = callPackage ../servers/felix { }; felix_remoteshell = callPackage ../servers/felix/remoteshell.nix { }; fingerd_bsd = callPackage ../servers/fingerd/bsd-fingerd { }; firebird = callPackage ../servers/firebird { icu = null; }; firebirdSuper = callPackage ../servers/firebird { superServer = true; }; fleet = callPackage ../servers/fleet { }; freepops = callPackage ../servers/mail/freepops { }; freeswitch = callPackage ../servers/sip/freeswitch { }; ghostOne = callPackage ../servers/games/ghost-one { boost = boost144.override { taggedLayout = true; }; }; ircdHybrid = callPackage ../servers/irc/ircd-hybrid { }; jboss = callPackage ../servers/http/jboss { }; jboss_mysql_jdbc = callPackage ../servers/http/jboss/jdbc/mysql { }; jetty = callPackage ../servers/http/jetty { }; jetty61 = callPackage ../servers/http/jetty/6.1 { }; joseki = callPackage ../servers/http/joseki {}; leafnode = callPackage ../servers/news/leafnode { }; lighttpd = callPackage ../servers/http/lighttpd { }; mailman = callPackage ../servers/mail/mailman { }; mediatomb = callPackage ../servers/mediatomb { }; memcached = callPackage ../servers/memcached {}; mod_dnssd = callPackage ../servers/http/apache-modules/mod_dnssd/default.nix { }; mod_evasive = callPackage ../servers/http/apache-modules/mod_evasive { }; mod_python = callPackage ../servers/http/apache-modules/mod_python { }; mod_fastcgi = callPackage ../servers/http/apache-modules/mod_fastcgi { }; mod_wsgi = callPackage ../servers/http/apache-modules/mod_wsgi { }; mpd = callPackage ../servers/mpd { aacSupport = config.mpd.aacSupport or true; ffmpegSupport = config.mpd.ffmpegSupport or true; }; mpd_clientlib = callPackage ../servers/mpd/clientlib.nix { }; miniHttpd = callPackage ../servers/http/mini-httpd {}; mlmmj = callPackage ../servers/mail/mlmmj { }; myserver = callPackage ../servers/http/myserver { }; nginx = callPackage ../servers/http/nginx { rtmp = true; fullWebDAV = true; syslog = true; moreheaders = true; }; ngircd = callPackage ../servers/irc/ngircd { }; nix-binary-cache = callPackage ../servers/http/nix-binary-cache {}; nsd = callPackage ../servers/dns/nsd { }; nsq = callPackage ../servers/nsq { }; openresty = callPackage ../servers/http/openresty { }; opensmtpd = callPackage ../servers/mail/opensmtpd { }; petidomo = callPackage ../servers/mail/petidomo { }; popa3d = callPackage ../servers/mail/popa3d { }; postfix = callPackage ../servers/mail/postfix { }; postfix211 = callPackage ../servers/mail/postfix/2.11.nix { }; pulseaudio = callPackage ../servers/pulseaudio { gconf = gnome.GConf; # The following are disabled in the default build, because if this # functionality is desired, they are only needed in the PulseAudio # server. bluez = null; avahi = null; }; pulseaudioFull = pulseaudio.override { bluez = bluez5; avahi = avahi; jackaudioSupport = true; x11Support = true; }; tomcat_connectors = callPackage ../servers/http/apache-modules/tomcat-connectors { }; pies = callPackage ../servers/pies { }; portmap = callPackage ../servers/portmap { }; rpcbind = callPackage ../servers/rpcbind { }; #monetdb = callPackage ../servers/sql/monetdb { }; mariadb = callPackage ../servers/sql/mariadb {}; mongodb = callPackage ../servers/nosql/mongodb { }; riak = callPackage ../servers/nosql/riak/1.3.1.nix { }; influxdb = callPackage ../servers/nosql/influxdb { }; mysql51 = import ../servers/sql/mysql/5.1.x.nix { inherit fetchurl ncurses zlib perl openssl stdenv; ps = procps; /* !!! Linux only */ }; mysql55 = callPackage ../servers/sql/mysql/5.5.x.nix { }; mysql = mysql51; mysql_jdbc = callPackage ../servers/sql/mysql/jdbc { }; nagios = callPackage ../servers/monitoring/nagios { }; munin = callPackage ../servers/monitoring/munin { }; nagiosPluginsOfficial = callPackage ../servers/monitoring/nagios/plugins/official-2.x.nix { }; neo4j = callPackage ../servers/nosql/neo4j { }; net_snmp = callPackage ../servers/monitoring/net-snmp { }; riemann = callPackage ../servers/monitoring/riemann { }; oidentd = callPackage ../servers/identd/oidentd { }; openfire = callPackage ../servers/xmpp/openfire { }; oracleXE = callPackage ../servers/sql/oracle-xe { }; OVMF = callPackage ../applications/virtualization/OVMF { }; postgresql = postgresql92; postgresql84 = callPackage ../servers/sql/postgresql/8.4.x.nix { }; postgresql90 = callPackage ../servers/sql/postgresql/9.0.x.nix { }; postgresql91 = callPackage ../servers/sql/postgresql/9.1.x.nix { }; postgresql92 = callPackage ../servers/sql/postgresql/9.2.x.nix { }; postgresql93 = callPackage ../servers/sql/postgresql/9.3.x.nix { }; postgresql_jdbc = callPackage ../servers/sql/postgresql/jdbc { }; psqlodbc = callPackage ../servers/sql/postgresql/psqlodbc { }; pyIRCt = builderDefsPackage (import ../servers/xmpp/pyIRCt) { inherit xmpppy pythonIRClib python makeWrapper; }; pyMAILt = builderDefsPackage (import ../servers/xmpp/pyMAILt) { inherit xmpppy python makeWrapper fetchcvs; }; qpid-cpp = callPackage ../servers/amqp/qpid-cpp { }; rabbitmq_server = callPackage ../servers/amqp/rabbitmq-server { }; radius = callPackage ../servers/radius { }; redis = callPackage ../servers/nosql/redis { }; redstore = callPackage ../servers/http/redstore { }; restund = callPackage ../servers/restund {}; rethinkdb = callPackage ../servers/nosql/rethinkdb { }; rippled = callPackage ../servers/rippled { }; s6 = callPackage ../servers/s6 { }; spamassassin = callPackage ../servers/mail/spamassassin { inherit (perlPackages) HTMLParser NetDNS NetAddrIP DBFile HTTPDate MailDKIM LWP IOSocketSSL; }; samba = callPackage ../servers/samba { }; # A lightweight Samba, useful for non-Linux-based OSes. samba_light = lowPrio (callPackage ../servers/samba { pam = null; fam = null; cups = null; acl = null; openldap = null; # libunwind 1.0.1 is not ported to GNU/Hurd. libunwind = null; }); serfdom = callPackage ../servers/serfdom { }; seyren = callPackage ../servers/monitoring/seyren { }; shishi = callPackage ../servers/shishi { }; sipwitch = callPackage ../servers/sip/sipwitch { }; spawn_fcgi = callPackage ../servers/http/spawn-fcgi { }; squids = recurseIntoAttrs( import ../servers/squid/squids.nix { inherit fetchurl stdenv perl lib composableDerivation openldap pam db cyrus_sasl kerberos libcap expat libxml2 libtool openssl; }); squid = squids.squid31; # has ipv6 support thttpd = callPackage ../servers/http/thttpd { }; storm = callPackage ../servers/computing/storm { }; tomcat5 = callPackage ../servers/http/tomcat/5.0.nix { }; tomcat6 = callPackage ../servers/http/tomcat/6.0.nix { }; tomcat_mysql_jdbc = callPackage ../servers/http/tomcat/jdbc/mysql { }; axis2 = callPackage ../servers/http/tomcat/axis2 { }; unifi = callPackage ../servers/unifi { }; virtuoso6 = callPackage ../servers/sql/virtuoso/6.x.nix { }; virtuoso7 = callPackage ../servers/sql/virtuoso/7.x.nix { }; virtuoso = virtuoso6; vsftpd = callPackage ../servers/ftp/vsftpd { }; winstone = callPackage ../servers/http/winstone { }; xinetd = callPackage ../servers/xinetd { }; xquartz = callPackage ../servers/x11/xquartz { }; quartz-wm = callPackage ../servers/x11/quartz-wm { stdenv = clangStdenv; }; xorg = recurseIntoAttrs (import ../servers/x11/xorg/default.nix { inherit clangStdenv fetchurl fetchgit fetchpatch stdenv pkgconfig intltool freetype fontconfig libxslt expat libpng zlib perl mesa_drivers spice_protocol dbus libuuid openssl gperf m4 autoconf automake libtool xmlto asciidoc flex bison python mtdev pixman; mesa = mesa_noglu; udev = if stdenv.isLinux then udev else null; libdrm = if stdenv.isLinux then libdrm else null; } // { xf86videointel-testing = callPackage ../servers/x11/xorg/xf86-video-intel-testing.nix { }; }); xorgReplacements = callPackage ../servers/x11/xorg/replacements.nix { }; xorgVideoUnichrome = callPackage ../servers/x11/xorg/unichrome/default.nix { }; yaws = callPackage ../servers/http/yaws { }; zabbix = recurseIntoAttrs (import ../servers/monitoring/zabbix { inherit fetchurl stdenv pkgconfig postgresql curl openssl zlib; }); zabbix20 = callPackage ../servers/monitoring/zabbix/2.0.nix { }; zabbix22 = callPackage ../servers/monitoring/zabbix/2.2.nix { }; ### OS-SPECIFIC afuse = callPackage ../os-specific/linux/afuse { }; amdUcode = callPackage ../os-specific/linux/microcode/amd.nix { }; autofs5 = callPackage ../os-specific/linux/autofs/autofs-v5.nix { }; _915resolution = callPackage ../os-specific/linux/915resolution { }; nfsUtils = callPackage ../os-specific/linux/nfs-utils { }; acpi = callPackage ../os-specific/linux/acpi { }; acpid = callPackage ../os-specific/linux/acpid { }; acpitool = callPackage ../os-specific/linux/acpitool { }; alienfx = callPackage ../os-specific/linux/alienfx { }; alsaLib = callPackage ../os-specific/linux/alsa-lib { }; alsaPlugins = callPackage ../os-specific/linux/alsa-plugins { jack2 = null; }; alsaPluginWrapper = callPackage ../os-specific/linux/alsa-plugins/wrapper.nix { }; alsaUtils = callPackage ../os-specific/linux/alsa-utils { }; alsaOss = callPackage ../os-specific/linux/alsa-oss { }; microcode2ucode = callPackage ../os-specific/linux/microcode/converter.nix { }; microcodeIntel = callPackage ../os-specific/linux/microcode/intel.nix { }; apparmor = callPackage ../os-specific/linux/apparmor { inherit (perlPackages) LocaleGettext TermReadKey RpcXML; bison = bison2; }; atop = callPackage ../os-specific/linux/atop { }; audit = callPackage ../os-specific/linux/audit { }; b43Firmware_5_1_138 = callPackage ../os-specific/linux/firmware/b43-firmware/5.1.138.nix { }; b43FirmwareCutter = callPackage ../os-specific/linux/firmware/b43-firmware-cutter { }; batctl = callPackage ../os-specific/linux/batman-adv/batctl.nix { }; bluez4 = callPackage ../os-specific/linux/bluez { pygobject = pygobject3; }; bluez5 = lowPrio (callPackage ../os-specific/linux/bluez/bluez5.nix { }); bluez = bluez4; inherit (pythonPackages) bedup; beret = callPackage ../games/beret { }; bridge_utils = callPackage ../os-specific/linux/bridge-utils { }; busybox = callPackage ../os-specific/linux/busybox { }; checkpolicy = callPackage ../os-specific/linux/checkpolicy { }; checksec = callPackage ../os-specific/linux/checksec { }; cifs_utils = callPackage ../os-specific/linux/cifs-utils { }; conky = callPackage ../os-specific/linux/conky { mpdSupport = config.conky.mpdSupport or true; x11Support = config.conky.x11Support or false; xdamage = config.conky.xdamage or false; wireless = config.conky.wireless or false; luaSupport = config.conky.luaSupport or false; rss = config.conky.rss or false; weatherMetar = config.conky.weatherMetar or false; weatherXoap = config.conky.weatherXoap or false; }; cpufrequtils = callPackage ../os-specific/linux/cpufrequtils { }; cryopid = callPackage ../os-specific/linux/cryopid { }; criu = callPackage ../os-specific/linux/criu { }; cryptsetup = callPackage ../os-specific/linux/cryptsetup { }; cramfsswap = callPackage ../os-specific/linux/cramfsswap { }; darwin = rec { cctools = forceNativeDrv (callPackage ../os-specific/darwin/cctools-port { cross = assert crossSystem != null; crossSystem; inherit maloader; xctoolchain = xcode.toolchain; }); maloader = callPackage ../os-specific/darwin/maloader { inherit opencflite; }; opencflite = callPackage ../os-specific/darwin/opencflite {}; xcode = callPackage ../os-specific/darwin/xcode {}; }; devicemapper = lvm2; disk_indicator = callPackage ../os-specific/linux/disk-indicator { }; dmidecode = callPackage ../os-specific/linux/dmidecode { }; dmtcp = callPackage ../os-specific/linux/dmtcp { }; dietlibc = callPackage ../os-specific/linux/dietlibc { }; directvnc = builderDefsPackage ../os-specific/linux/directvnc { inherit libjpeg pkgconfig zlib directfb; inherit (xlibs) xproto; }; dmraid = callPackage ../os-specific/linux/dmraid { }; drbd = callPackage ../os-specific/linux/drbd { }; dstat = callPackage ../os-specific/linux/dstat { # pythonFull includes the "curses" standard library module, for pretty # dstat color output python = pythonFull; }; libossp_uuid = callPackage ../development/libraries/libossp-uuid { }; libuuid = if crossSystem != null && crossSystem.config == "i586-pc-gnu" then (utillinux // { crossDrv = lib.overrideDerivation utillinux.crossDrv (args: { # `libblkid' fails to build on GNU/Hurd. configureFlags = args.configureFlags + " --disable-libblkid --disable-mount --disable-libmount" + " --disable-fsck --enable-static --disable-partx"; doCheck = false; CPPFLAGS = # ugly hack for ugly software! lib.concatStringsSep " " (map (v: "-D${v}=4096") [ "PATH_MAX" "MAXPATHLEN" "MAXHOSTNAMELEN" ]); }); }) else if stdenv.isLinux then utillinux else null; e3cfsprogs = callPackage ../os-specific/linux/e3cfsprogs { }; ebtables = callPackage ../os-specific/linux/ebtables { }; eject = utillinux; ffado = callPackage ../os-specific/linux/ffado { }; fbterm = callPackage ../os-specific/linux/fbterm { }; firejail = callPackage ../os-specific/linux/firejail {}; fuse = callPackage ../os-specific/linux/fuse { }; fxload = callPackage ../os-specific/linux/fxload { }; gfxtablet = callPackage ../os-specific/linux/gfxtablet {}; gpm = callPackage ../servers/gpm { }; gradm = callPackage ../os-specific/linux/gradm { flex = flex_2_5_35; }; hdparm = callPackage ../os-specific/linux/hdparm { }; hibernate = callPackage ../os-specific/linux/hibernate { }; hostapd = callPackage ../os-specific/linux/hostapd { }; htop = if stdenv.isLinux then callPackage ../os-specific/linux/htop { } else if stdenv.isDarwin then callPackage ../os-specific/darwin/htop { } else null; # GNU/Hurd core packages. gnu = recurseIntoAttrs (callPackage ../os-specific/gnu { inherit platform crossSystem; }); hwdata = callPackage ../os-specific/linux/hwdata { }; i7z = callPackage ../os-specific/linux/i7z { }; ifplugd = callPackage ../os-specific/linux/ifplugd { }; iomelt = callPackage ../os-specific/linux/iomelt { }; iotop = callPackage ../os-specific/linux/iotop { }; iproute = callPackage ../os-specific/linux/iproute { }; iputils = callPackage ../os-specific/linux/iputils { sp = spCompat; inherit (perlPackages) SGMLSpm; }; iptables = callPackage ../os-specific/linux/iptables { }; iw = callPackage ../os-specific/linux/iw { }; jujuutils = callPackage ../os-specific/linux/jujuutils { }; kbd = callPackage ../os-specific/linux/kbd { }; kmscon = callPackage ../os-specific/linux/kmscon { }; latencytop = callPackage ../os-specific/linux/latencytop { }; ldm = callPackage ../os-specific/linux/ldm { }; libaio = callPackage ../os-specific/linux/libaio { }; libatasmart = callPackage ../os-specific/linux/libatasmart { }; libcgroup = callPackage ../os-specific/linux/libcgroup { }; libnl = callPackage ../os-specific/linux/libnl { }; libnl_3_2_19 = callPackage ../os-specific/linux/libnl/3.2.19.nix { }; linuxConsoleTools = callPackage ../os-specific/linux/consoletools { }; # -- Linux kernel expressions ------------------------------------------------ linuxHeaders = linuxHeaders_3_7; linuxHeaders24Cross = forceNativeDrv (import ../os-specific/linux/kernel-headers/2.4.nix { inherit stdenv fetchurl perl; cross = assert crossSystem != null; crossSystem; }); linuxHeaders26Cross = forceNativeDrv (import ../os-specific/linux/kernel-headers/2.6.32.nix { inherit stdenv fetchurl perl; cross = assert crossSystem != null; crossSystem; }); linuxHeaders_3_7 = callPackage ../os-specific/linux/kernel-headers/3.7.nix { }; linuxHeaders_3_14 = callPackage ../os-specific/linux/kernel-headers/3.14.nix { }; # We can choose: linuxHeadersCrossChooser = ver : if ver == "2.4" then linuxHeaders24Cross else if ver == "2.6" then linuxHeaders26Cross else throw "Unknown linux kernel version"; linuxHeadersCross = assert crossSystem != null; linuxHeadersCrossChooser crossSystem.platform.kernelMajor; kernelPatches = callPackage ../os-specific/linux/kernel/patches.nix { }; linux_3_2 = makeOverridable (import ../os-specific/linux/kernel/linux-3.2.nix) { inherit fetchurl stdenv perl buildLinux; kernelPatches = []; }; linux_3_2_xen = lowPrio (linux_3_2.override { extraConfig = '' XEN_DOM0 y ''; }); linux_3_4 = makeOverridable (import ../os-specific/linux/kernel/linux-3.4.nix) { inherit fetchurl stdenv perl buildLinux; kernelPatches = lib.optionals ((platform.kernelArch or null) == "mips") [ kernelPatches.mips_fpureg_emu kernelPatches.mips_fpu_sigill ]; }; linux_3_6_rpi = makeOverridable (import ../os-specific/linux/kernel/linux-rpi-3.6.nix) { inherit fetchurl stdenv perl buildLinux; }; linux_3_10 = makeOverridable (import ../os-specific/linux/kernel/linux-3.10.nix) { inherit fetchurl stdenv perl buildLinux; kernelPatches = lib.optionals ((platform.kernelArch or null) == "mips") [ kernelPatches.mips_fpureg_emu kernelPatches.mips_fpu_sigill kernelPatches.mips_ext3_n32 ]; }; linux_3_12 = makeOverridable (import ../os-specific/linux/kernel/linux-3.12.nix) { inherit fetchurl stdenv perl buildLinux; kernelPatches = lib.optionals ((platform.kernelArch or null) == "mips") [ kernelPatches.mips_fpureg_emu kernelPatches.mips_fpu_sigill kernelPatches.mips_ext3_n32 ]; }; linux_3_14 = makeOverridable (import ../os-specific/linux/kernel/linux-3.14.nix) { inherit fetchurl stdenv perl buildLinux; kernelPatches = lib.optionals ((platform.kernelArch or null) == "mips") [ kernelPatches.mips_fpureg_emu kernelPatches.mips_fpu_sigill kernelPatches.mips_ext3_n32 ]; }; linux_3_15 = makeOverridable (import ../os-specific/linux/kernel/linux-3.15.nix) { inherit fetchurl stdenv perl buildLinux; kernelPatches = lib.optionals ((platform.kernelArch or null) == "mips") [ kernelPatches.mips_fpureg_emu kernelPatches.mips_fpu_sigill kernelPatches.mips_ext3_n32 ]; }; linux_3_16 = makeOverridable (import ../os-specific/linux/kernel/linux-3.16.nix) { inherit fetchurl stdenv perl buildLinux; kernelPatches = lib.optionals ((platform.kernelArch or null) == "mips") [ kernelPatches.mips_fpureg_emu kernelPatches.mips_fpu_sigill kernelPatches.mips_ext3_n32 ]; }; linux_testing = makeOverridable (import ../os-specific/linux/kernel/linux-testing.nix) { inherit fetchurl stdenv perl buildLinux; kernelPatches = lib.optionals ((platform.kernelArch or null) == "mips") [ kernelPatches.mips_fpureg_emu kernelPatches.mips_fpu_sigill kernelPatches.mips_ext3_n32 ]; }; /* grsec configuration We build several flavors of 'default' grsec kernels. These are built by default with Hydra. If the user selects a matching 'default' flavor, then the pre-canned package set can be chosen. Typically, users will make very basic choices like 'security' + 'server' or 'performance' + 'desktop' with virtualisation support. These will then be picked. Note: Xen guest kernels are included for e.g. NixOps deployments to EC2, where Xen is the Hypervisor. */ grFlavors = import ../build-support/grsecurity/flavors.nix; mkGrsecurity = opts: (import ../build-support/grsecurity { grsecOptions = opts; inherit pkgs lib; }); grKernel = opts: (mkGrsecurity opts).grsecKernel; grPackage = opts: recurseIntoAttrs (mkGrsecurity opts).grsecPackage; # Stable kernels linux_grsec_stable_desktop = grKernel grFlavors.linux_grsec_stable_desktop; linux_grsec_stable_server = grKernel grFlavors.linux_grsec_stable_server; linux_grsec_stable_server_xen = grKernel grFlavors.linux_grsec_stable_server_xen; # Testing kernels linux_grsec_testing_desktop = grKernel grFlavors.linux_grsec_testing_desktop; linux_grsec_testing_server = grKernel grFlavors.linux_grsec_testing_server; linux_grsec_testing_server_xen = grKernel grFlavors.linux_grsec_testing_server_xen; /* Linux kernel modules are inherently tied to a specific kernel. So rather than provide specific instances of those packages for a specific kernel, we have a function that builds those packages for a specific kernel. This function can then be called for whatever kernel you're using. */ linuxPackagesFor = kernel: self: let callPackage = newScope self; in { inherit kernel; acpi_call = callPackage ../os-specific/linux/acpi-call {}; batman_adv = callPackage ../os-specific/linux/batman-adv {}; bbswitch = callPackage ../os-specific/linux/bbswitch {}; ati_drivers_x11 = callPackage ../os-specific/linux/ati-drivers { }; blcr = callPackage ../os-specific/linux/blcr { }; cryptodev = callPackage ../os-specific/linux/cryptodev { }; cpupower = callPackage ../os-specific/linux/cpupower { }; e1000e = callPackage ../os-specific/linux/e1000e {}; v4l2loopback = callPackage ../os-specific/linux/v4l2loopback { }; frandom = callPackage ../os-specific/linux/frandom { }; ktap = callPackage ../os-specific/linux/ktap { }; lttng-modules = callPackage ../os-specific/linux/lttng-modules { }; broadcom_sta = callPackage ../os-specific/linux/broadcom-sta/default.nix { }; nvidiabl = callPackage ../os-specific/linux/nvidiabl { }; nvidia_x11 = callPackage ../os-specific/linux/nvidia-x11 { }; nvidia_x11_legacy173 = callPackage ../os-specific/linux/nvidia-x11/legacy173.nix { }; nvidia_x11_legacy304 = callPackage ../os-specific/linux/nvidia-x11/legacy304.nix { }; openafsClient = callPackage ../servers/openafs-client { }; openiscsi = callPackage ../os-specific/linux/open-iscsi { }; wis_go7007 = callPackage ../os-specific/linux/wis-go7007 { }; kernelHeaders = callPackage ../os-specific/linux/kernel-headers { }; klibc = callPackage ../os-specific/linux/klibc { }; klibcShrunk = lowPrio (callPackage ../os-specific/linux/klibc/shrunk.nix { }); /* compiles but has to be integrated into the kernel somehow Let's have it uncommented and finish it.. */ ndiswrapper = callPackage ../os-specific/linux/ndiswrapper { }; netatop = callPackage ../os-specific/linux/netatop { }; perf = callPackage ../os-specific/linux/kernel/perf.nix { }; psmouse_alps = callPackage ../os-specific/linux/psmouse-alps { }; spl = callPackage ../os-specific/linux/spl { }; spl_git = callPackage ../os-specific/linux/spl/git.nix { }; sysdig = callPackage ../os-specific/linux/sysdig {}; tp_smapi = callPackage ../os-specific/linux/tp_smapi { }; v86d = callPackage ../os-specific/linux/v86d { }; virtualbox = callPackage ../applications/virtualization/virtualbox { stdenv = stdenv_32bit; inherit (gnome) libIDL; enableExtensionPack = config.virtualbox.enableExtensionPack or false; }; virtualboxGuestAdditions = callPackage ../applications/virtualization/virtualbox/guest-additions { }; zfs = callPackage ../os-specific/linux/zfs { }; zfs_git = callPackage ../os-specific/linux/zfs/git.nix { }; }; # The current default kernel / kernel modules. linux = linuxPackages.kernel; linuxPackages = linuxPackages_3_12; # Update this when adding the newest kernel major version! linux_latest = pkgs.linux_3_16; linuxPackages_latest = pkgs.linuxPackages_3_16; # Build the kernel modules for the some of the kernels. linuxPackages_3_2 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_2 linuxPackages_3_2); linuxPackages_3_2_xen = linuxPackagesFor pkgs.linux_3_2_xen linuxPackages_3_2_xen; linuxPackages_3_4 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_4 linuxPackages_3_4); linuxPackages_3_6_rpi = linuxPackagesFor pkgs.linux_3_6_rpi linuxPackages_3_6_rpi; linuxPackages_3_10 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_10 linuxPackages_3_10); linuxPackages_3_10_tuxonice = linuxPackagesFor pkgs.linux_3_10_tuxonice linuxPackages_3_10_tuxonice; linuxPackages_3_12 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_12 linuxPackages_3_12); linuxPackages_3_14 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_14 linuxPackages_3_14); linuxPackages_3_15 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_15 linuxPackages_3_15); linuxPackages_3_16 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_16 linuxPackages_3_16); linuxPackages_testing = recurseIntoAttrs (linuxPackagesFor pkgs.linux_testing linuxPackages_testing); # grsecurity flavors # Stable kernels linuxPackages_grsec_stable_desktop = grPackage grFlavors.linux_grsec_stable_desktop; linuxPackages_grsec_stable_server = grPackage grFlavors.linux_grsec_stable_server; linuxPackages_grsec_stable_server_xen = grPackage grFlavors.linux_grsec_stable_server_xen; # Testing kernels linuxPackages_grsec_testing_desktop = grPackage grFlavors.linux_grsec_testing_desktop; linuxPackages_grsec_testing_server = grPackage grFlavors.linux_grsec_testing_server; linuxPackages_grsec_testing_server_xen = grPackage grFlavors.linux_grsec_testing_server_xen; # A function to build a manually-configured kernel linuxManualConfig = pkgs.buildLinux; buildLinux = import ../os-specific/linux/kernel/manual-config.nix { inherit (pkgs) stdenv runCommand nettools bc perl kmod writeTextFile ubootChooser; }; keyutils = callPackage ../os-specific/linux/keyutils { }; libselinux = callPackage ../os-specific/linux/libselinux { }; libsemanage = callPackage ../os-specific/linux/libsemanage { }; libraw = callPackage ../development/libraries/libraw { }; libraw1394 = callPackage ../development/libraries/libraw1394 { }; libsexy = callPackage ../development/libraries/libsexy { }; libsepol = callPackage ../os-specific/linux/libsepol { }; libsmbios = callPackage ../os-specific/linux/libsmbios { }; lm_sensors = callPackage ../os-specific/linux/lm-sensors { }; lockdep = callPackage ../os-specific/linux/lockdep { }; lsiutil = callPackage ../os-specific/linux/lsiutil { }; kmod = callPackage ../os-specific/linux/kmod { }; kmod-blacklist-ubuntu = callPackage ../os-specific/linux/kmod-blacklist-ubuntu { }; kvm = qemu_kvm; libcap = callPackage ../os-specific/linux/libcap { }; libcap_progs = callPackage ../os-specific/linux/libcap/progs.nix { }; libcap_pam = callPackage ../os-specific/linux/libcap/pam.nix { }; libcap_manpages = callPackage ../os-specific/linux/libcap/man.nix { }; libcap_ng = callPackage ../os-specific/linux/libcap-ng { }; libnscd = callPackage ../os-specific/linux/libnscd { }; libnotify = callPackage ../development/libraries/libnotify { }; libvolume_id = callPackage ../os-specific/linux/libvolume_id { }; lsscsi = callPackage ../os-specific/linux/lsscsi { }; lvm2 = callPackage ../os-specific/linux/lvm2 { }; mdadm = callPackage ../os-specific/linux/mdadm { }; mingetty = callPackage ../os-specific/linux/mingetty { }; module_init_tools = callPackage ../os-specific/linux/module-init-tools { }; aggregateModules = modules: callPackage ../os-specific/linux/kmod/aggregator.nix { inherit modules; }; multipath_tools = callPackage ../os-specific/linux/multipath-tools { }; musl = callPackage ../os-specific/linux/musl { }; nettools = callPackage ../os-specific/linux/net-tools { }; neverball = callPackage ../games/neverball { libpng = libpng15; }; nftables = callPackage ../os-specific/linux/nftables { }; numactl = callPackage ../os-specific/linux/numactl { }; gocode = callPackage ../development/tools/gocode { }; gogoclient = callPackage ../os-specific/linux/gogoclient { }; nss_ldap = callPackage ../os-specific/linux/nss_ldap { }; pam = callPackage ../os-specific/linux/pam { }; # pam_bioapi ( see http://www.thinkwiki.org/wiki/How_to_enable_the_fingerprint_reader ) pam_ccreds = callPackage ../os-specific/linux/pam_ccreds { }; pam_console = callPackage ../os-specific/linux/pam_console { libtool = libtool_1_5; }; pam_devperm = callPackage ../os-specific/linux/pam_devperm { }; pam_krb5 = callPackage ../os-specific/linux/pam_krb5 { }; pam_ldap = callPackage ../os-specific/linux/pam_ldap { }; pam_login = callPackage ../os-specific/linux/pam_login { }; pam_ssh_agent_auth = callPackage ../os-specific/linux/pam_ssh_agent_auth { }; pam_usb = callPackage ../os-specific/linux/pam_usb { }; paxctl = callPackage ../os-specific/linux/paxctl { }; pax-utils = callPackage ../os-specific/linux/pax-utils { }; pcmciaUtils = callPackage ../os-specific/linux/pcmciautils { firmware = config.pcmciaUtils.firmware or []; config = config.pcmciaUtils.config or null; }; plymouth = callPackage ../os-specific/linux/plymouth { automake = automake113x; }; pmount = callPackage ../os-specific/linux/pmount { }; pmutils = callPackage ../os-specific/linux/pm-utils { }; pmtools = callPackage ../os-specific/linux/pmtools { }; policycoreutils = callPackage ../os-specific/linux/policycoreutils { }; powertop = callPackage ../os-specific/linux/powertop { }; prayer = callPackage ../servers/prayer { }; procps = procps-ng; procps-old = lowPrio (callPackage ../os-specific/linux/procps { }); procps-ng = callPackage ../os-specific/linux/procps-ng { }; watch = callPackage ../os-specific/linux/procps/watch.nix { }; qemu_kvm = lowPrio (qemu.override { x86Only = true; }); firmwareLinuxNonfree = callPackage ../os-specific/linux/firmware/firmware-linux-nonfree { }; radeontools = callPackage ../os-specific/linux/radeontools { }; raspberrypifw = callPackage ../os-specific/linux/firmware/raspberrypi {}; regionset = callPackage ../os-specific/linux/regionset { }; rfkill = callPackage ../os-specific/linux/rfkill { }; rfkill_udev = callPackage ../os-specific/linux/rfkill/udev.nix { }; rtkit = callPackage ../os-specific/linux/rtkit { }; sdparm = callPackage ../os-specific/linux/sdparm { }; sepolgen = callPackage ../os-specific/linux/sepolgen { }; setools = callPackage ../os-specific/linux/setools { }; shadow = callPackage ../os-specific/linux/shadow { }; statifier = builderDefsPackage (import ../os-specific/linux/statifier) { }; sysdig = callPackage ../os-specific/linux/sysdig { kernel = null; }; # pkgs.sysdig is a client, for a driver look at linuxPackagesFor sysfsutils = callPackage ../os-specific/linux/sysfsutils { }; sysprof = callPackage ../development/tools/profiling/sysprof { inherit (gnome) libglade; }; # Provided with sysfsutils. libsysfs = sysfsutils; systool = sysfsutils; sysklogd = callPackage ../os-specific/linux/sysklogd { }; syslinux = callPackage ../os-specific/linux/syslinux { }; sysstat = callPackage ../os-specific/linux/sysstat { }; systemd = callPackage ../os-specific/linux/systemd { linuxHeaders = linuxHeaders_3_14; }; systemtap = callPackage ../development/tools/profiling/systemtap { inherit (gnome) libglademm; }; # In nixos, you can set systemd.package = pkgs.systemd_with_lvm2 to get # LVM2 working in systemd. systemd_with_lvm2 = pkgs.lib.overrideDerivation pkgs.systemd (p: { name = p.name + "-with-lvm2"; postInstall = p.postInstall + '' cp "${pkgs.lvm2}/lib/systemd/system-generators/"* $out/lib/systemd/system-generators ''; }); sysvinit = callPackage ../os-specific/linux/sysvinit { }; sysvtools = callPackage ../os-specific/linux/sysvinit { withoutInitTools = true; }; # FIXME: `tcp-wrapper' is actually not OS-specific. tcp_wrappers = callPackage ../os-specific/linux/tcp-wrappers { }; trackballs = callPackage ../games/trackballs { debug = false; guile = guile_1_8; }; tunctl = callPackage ../os-specific/linux/tunctl { }; ubootChooser = name : if name == "upstream" then ubootUpstream else if name == "sheevaplug" then ubootSheevaplug else if name == "guruplug" then ubootGuruplug else if name == "nanonote" then ubootNanonote else throw "Unknown uboot"; ubootUpstream = callPackage ../misc/uboot { }; ubootSheevaplug = callPackage ../misc/uboot/sheevaplug.nix { }; ubootNanonote = callPackage ../misc/uboot/nanonote.nix { }; ubootGuruplug = callPackage ../misc/uboot/guruplug.nix { }; uclibc = callPackage ../os-specific/linux/uclibc { }; uclibcCross = lowPrio (callPackage ../os-specific/linux/uclibc { inherit fetchurl stdenv libiconv; linuxHeaders = linuxHeadersCross; gccCross = gccCrossStageStatic; cross = assert crossSystem != null; crossSystem; }); udev145 = callPackage ../os-specific/linux/udev/145.nix { }; udev = pkgs.systemd; udisks1 = callPackage ../os-specific/linux/udisks/1-default.nix { }; udisks2 = callPackage ../os-specific/linux/udisks/2-default.nix { }; udisks = udisks1; udisks_glue = callPackage ../os-specific/linux/udisks-glue { }; untie = callPackage ../os-specific/linux/untie { }; upower = callPackage ../os-specific/linux/upower { }; upower_99 = callPackage ../os-specific/linux/upower/0.99.nix { }; upstart = callPackage ../os-specific/linux/upstart { }; usbutils = callPackage ../os-specific/linux/usbutils { }; usermount = callPackage ../os-specific/linux/usermount { }; utillinux = lowPrio (callPackage ../os-specific/linux/util-linux { ncurses = null; perl = null; }); utillinuxCurses = utillinux.override { inherit ncurses perl; }; v4l_utils = callPackage ../os-specific/linux/v4l-utils { withQt4 = true; }; windows = rec { cygwinSetup = callPackage ../os-specific/windows/cygwin-setup { }; jom = callPackage ../os-specific/windows/jom { }; w32api = callPackage ../os-specific/windows/w32api { gccCross = gccCrossStageStatic; binutilsCross = binutilsCross; }; w32api_headers = w32api.override { onlyHeaders = true; }; mingw_runtime = callPackage ../os-specific/windows/mingwrt { gccCross = gccCrossMingw2; binutilsCross = binutilsCross; }; mingw_runtime_headers = mingw_runtime.override { onlyHeaders = true; }; mingw_headers1 = buildEnv { name = "mingw-headers-1"; paths = [ w32api_headers mingw_runtime_headers ]; }; mingw_headers2 = buildEnv { name = "mingw-headers-2"; paths = [ w32api mingw_runtime_headers ]; }; mingw_headers3 = buildEnv { name = "mingw-headers-3"; paths = [ w32api mingw_runtime ]; }; mingw_w64 = callPackage ../os-specific/windows/mingw-w64 { gccCross = gccCrossStageStatic; binutilsCross = binutilsCross; }; mingw_w64_headers = callPackage ../os-specific/windows/mingw-w64 { onlyHeaders = true; }; mingw_w64_pthreads = callPackage ../os-specific/windows/mingw-w64 { onlyPthreads = true; }; pthreads = callPackage ../os-specific/windows/pthread-w32 { mingw_headers = mingw_headers3; }; wxMSW = callPackage ../os-specific/windows/wxMSW-2.8 { }; }; wesnoth = callPackage ../games/wesnoth { lua = lua5; }; wirelesstools = callPackage ../os-specific/linux/wireless-tools { }; wpa_supplicant = callPackage ../os-specific/linux/wpa_supplicant { }; wpa_supplicant_gui = callPackage ../os-specific/linux/wpa_supplicant/gui.nix { }; xf86_input_mtrack = callPackage ../os-specific/linux/xf86-input-mtrack { inherit (xorg) utilmacros xproto inputproto xorgserver; }; xf86_input_multitouch = callPackage ../os-specific/linux/xf86-input-multitouch { }; xf86_input_wacom = callPackage ../os-specific/linux/xf86-input-wacom { }; xf86_video_nested = callPackage ../os-specific/linux/xf86-video-nested { inherit (xorg) fontsproto renderproto utilmacros xorgserver; }; xf86_video_nouveau = xorg.xf86videonouveau; xmoto = builderDefsPackage (import ../games/xmoto) { inherit chipmunk sqlite curl zlib bzip2 libjpeg libpng freeglut mesa SDL SDL_mixer SDL_image SDL_net SDL_ttf lua5 ode libxdg_basedir libxml2; }; xorg_sys_opengl = callPackage ../os-specific/linux/opengl/xorg-sys { }; zd1211fw = callPackage ../os-specific/linux/firmware/zd1211 { }; ### DATA andagii = callPackage ../data/fonts/andagii {}; anonymousPro = callPackage ../data/fonts/anonymous-pro {}; arkpandora_ttf = builderDefsPackage (import ../data/fonts/arkpandora) { }; aurulent-sans = callPackage ../data/fonts/aurulent-sans { }; bakoma_ttf = callPackage ../data/fonts/bakoma-ttf { }; cacert = callPackage ../data/misc/cacert { }; cantarell_fonts = callPackage ../data/fonts/cantarell-fonts { }; corefonts = callPackage ../data/fonts/corefonts { }; wrapFonts = paths : ((import ../data/fonts/fontWrap) { inherit fetchurl stdenv builderDefs paths; inherit (xorg) mkfontdir mkfontscale; }); clearlyU = callPackage ../data/fonts/clearlyU { }; cm_unicode = callPackage ../data/fonts/cm-unicode {}; dejavu_fonts = callPackage ../data/fonts/dejavu-fonts { inherit (perlPackages) FontTTF; }; docbook5 = callPackage ../data/sgml+xml/schemas/docbook-5.0 { }; docbook_sgml_dtd_31 = callPackage ../data/sgml+xml/schemas/sgml-dtd/docbook/3.1.nix { }; docbook_sgml_dtd_41 = callPackage ../data/sgml+xml/schemas/sgml-dtd/docbook/4.1.nix { }; docbook_xml_dtd_412 = callPackage ../data/sgml+xml/schemas/xml-dtd/docbook/4.1.2.nix { }; docbook_xml_dtd_42 = callPackage ../data/sgml+xml/schemas/xml-dtd/docbook/4.2.nix { }; docbook_xml_dtd_43 = callPackage ../data/sgml+xml/schemas/xml-dtd/docbook/4.3.nix { }; docbook_xml_dtd_45 = callPackage ../data/sgml+xml/schemas/xml-dtd/docbook/4.5.nix { }; docbook_xml_ebnf_dtd = callPackage ../data/sgml+xml/schemas/xml-dtd/docbook-ebnf { }; docbook_xml_xslt = docbook_xsl; docbook_xsl = callPackage ../data/sgml+xml/stylesheets/xslt/docbook-xsl { }; docbook5_xsl = docbook_xsl_ns; docbook_xsl_ns = callPackage ../data/sgml+xml/stylesheets/xslt/docbook-xsl-ns { }; dosemu_fonts = callPackage ../data/fonts/dosemu-fonts { }; eb-garamond = callPackage ../data/fonts/eb-garamond { }; fira = callPackage ../data/fonts/fira { }; freefont_ttf = callPackage ../data/fonts/freefont-ttf { }; freepats = callPackage ../data/misc/freepats { }; gentium = callPackage ../data/fonts/gentium {}; gnome_user_docs = callPackage ../data/documentation/gnome-user-docs { }; inherit (gnome3) gsettings_desktop_schemas; hicolor_icon_theme = callPackage ../data/icons/hicolor-icon-theme { }; inconsolata = callPackage ../data/fonts/inconsolata {}; ipafont = callPackage ../data/fonts/ipafont {}; junicode = callPackage ../data/fonts/junicode { }; kochi-substitute = callPackage ../data/fonts/kochi-substitute {}; kochi-substitute-naga10 = callPackage ../data/fonts/kochi-substitute-naga10 {}; liberation_ttf = callPackage ../data/fonts/redhat-liberation-fonts { }; libertine = builderDefsPackage (import ../data/fonts/libertine) { inherit fetchurl fontforge lib; }; lmmath = callPackage ../data/fonts/lmodern/lmmath.nix {}; lmodern = callPackage ../data/fonts/lmodern { }; lohit-fonts = callPackage ../data/fonts/lohit-fonts { }; manpages = callPackage ../data/documentation/man-pages { }; miscfiles = callPackage ../data/misc/miscfiles { }; mobile_broadband_provider_info = callPackage ../data/misc/mobile-broadband-provider-info { }; mph_2b_damase = callPackage ../data/fonts/mph-2b-damase { }; nafees = callPackage ../data/fonts/nafees { }; oldstandard = callPackage ../data/fonts/oldstandard { }; opensans-ttf = callPackage ../data/fonts/opensans-ttf { }; poly = callPackage ../data/fonts/poly { }; posix_man_pages = callPackage ../data/documentation/man-pages-posix { }; pthreadmanpages = callPackage ../data/documentation/pthread-man-pages { }; shared_mime_info = callPackage ../data/misc/shared-mime-info { }; shared_desktop_ontologies = callPackage ../data/misc/shared-desktop-ontologies { }; stdmanpages = callPackage ../data/documentation/std-man-pages { }; symbola = callPackage ../data/fonts/symbola { }; iana_etc = callPackage ../data/misc/iana-etc { }; poppler_data = callPackage ../data/misc/poppler-data { }; r3rs = callPackage ../data/documentation/rnrs/r3rs.nix { }; r4rs = callPackage ../data/documentation/rnrs/r4rs.nix { }; r5rs = callPackage ../data/documentation/rnrs/r5rs.nix { }; source-code-pro = callPackage ../data/fonts/source-code-pro {}; source-sans-pro = callPackage ../data/fonts/source-sans-pro { }; source-serif-pro = callPackage ../data/fonts/source-serif-pro { }; source-han-sans-japanese = callPackage ../data/fonts/source-han-sans/japanese.nix {}; source-han-sans-korean = callPackage ../data/fonts/source-han-sans/korean.nix {}; source-han-sans-simplified-chinese = callPackage ../data/fonts/source-han-sans/simplified-chinese.nix {}; source-han-sans-traditional-chinese = callPackage ../data/fonts/source-han-sans/traditional-chinese.nix {}; tango-icon-theme = callPackage ../data/icons/tango-icon-theme { }; themes = name: import (../data/misc/themes + ("/" + name + ".nix")) { inherit fetchurl; }; theano = callPackage ../data/fonts/theano { }; tempora_lgc = callPackage ../data/fonts/tempora-lgc { }; terminus_font = callPackage ../data/fonts/terminus-font { }; tipa = callPackage ../data/fonts/tipa { }; ttf_bitstream_vera = callPackage ../data/fonts/ttf-bitstream-vera { }; tzdata = callPackage ../data/misc/tzdata { }; ubuntu_font_family = callPackage ../data/fonts/ubuntu-font-family { }; ucsFonts = callPackage ../data/fonts/ucs-fonts { }; unifont = callPackage ../data/fonts/unifont { }; vistafonts = callPackage ../data/fonts/vista-fonts { }; wqy_microhei = callPackage ../data/fonts/wqy-microhei { }; wqy_zenhei = callPackage ../data/fonts/wqy-zenhei { }; xhtml1 = callPackage ../data/sgml+xml/schemas/xml-dtd/xhtml1 { }; xkeyboard_config = xorg.xkeyboardconfig; ### APPLICATIONS a2jmidid = callPackage ../applications/audio/a2jmidid { }; aangifte2006 = callPackage_i686 ../applications/taxes/aangifte-2006 { }; aangifte2007 = callPackage_i686 ../applications/taxes/aangifte-2007 { }; aangifte2008 = callPackage_i686 ../applications/taxes/aangifte-2008 { }; aangifte2009 = callPackage_i686 ../applications/taxes/aangifte-2009 { }; aangifte2010 = callPackage_i686 ../applications/taxes/aangifte-2010 { }; aangifte2011 = callPackage_i686 ../applications/taxes/aangifte-2011 { }; aangifte2012 = callPackage_i686 ../applications/taxes/aangifte-2012 { }; aangifte2013 = callPackage_i686 ../applications/taxes/aangifte-2013 { }; abcde = callPackage ../applications/audio/abcde { inherit (perlPackages) DigestSHA MusicBrainz MusicBrainzDiscID; libcdio = libcdio082; }; abiword = callPackage ../applications/office/abiword { inherit (gnome) libglade libgnomecanvas; }; abook = callPackage ../applications/misc/abook { }; adobe-reader = callPackage_i686 ../applications/misc/adobe-reader { }; aewan = callPackage ../applications/editors/aewan { }; alchemy = callPackage ../applications/graphics/alchemy { }; ams-lv2 = callPackage ../applications/audio/ams-lv2 { }; amsn = callPackage ../applications/networking/instant-messengers/amsn { }; antiword = callPackage ../applications/office/antiword {}; ardour = ardour3; ardour3 = lowPrio (callPackage ../applications/audio/ardour { inherit (gnome) libgnomecanvas libgnomecanvasmm; }); arora = callPackage ../applications/networking/browsers/arora { }; atom = callPackage ../applications/editors/atom { gconf = gnome.GConf; }; aseprite = callPackage ../applications/editors/aseprite { giflib = giflib_4_1; }; audacious = callPackage ../applications/audio/audacious { }; audacity = callPackage ../applications/audio/audacity { ffmpeg = ffmpeg_0_10; }; milkytracker = callPackage ../applications/audio/milkytracker { }; aumix = callPackage ../applications/audio/aumix { gtkGUI = false; }; autopanosiftc = callPackage ../applications/graphics/autopanosiftc { }; avidemux = callPackage ../applications/video/avidemux { }; avogadro = callPackage ../applications/science/chemistry/avogadro { eigen = eigen2; }; avrdudess = callPackage ../applications/misc/avrdudess { }; avxsynth = callPackage ../applications/video/avxsynth { }; awesome-3-4 = callPackage ../applications/window-managers/awesome/3.4.nix { lua = lua5; cairo = cairo.override { xcbSupport = true; }; }; awesome-3-5 = callPackage ../applications/window-managers/awesome { lua = lua5_1; cairo = cairo.override { xcbSupport = true; }; }; awesome = awesome-3-5; inherit (gnome3) baobab; bar = callPackage ../applications/window-managers/bar { }; baresip = callPackage ../applications/networking/instant-messengers/baresip { ffmpeg = ffmpeg_1; }; batik = callPackage ../applications/graphics/batik { }; bazaar = callPackage ../applications/version-management/bazaar { }; bazaarTools = builderDefsPackage (import ../applications/version-management/bazaar/tools.nix) { inherit bazaar; }; beast = callPackage ../applications/audio/beast { inherit (gnome) libgnomecanvas libart_lgpl; guile = guile_1_8; }; bibletime = callPackage ../applications/misc/bibletime { }; bitcoin = callPackage ../applications/misc/bitcoin { }; bitlbee = callPackage ../applications/networking/instant-messengers/bitlbee { gnutls = gnutls; libotr = libotr_3_2; }; blender = callPackage ../applications/misc/blender { python = python34; }; bristol = callPackage ../applications/audio/bristol { }; bspwm = callPackage ../applications/window-managers/bspwm { }; bvi = callPackage ../applications/editors/bvi { }; calf = callPackage ../applications/audio/calf { inherit (gnome) libglade; }; calibre = callPackage ../applications/misc/calibre { inherit (pythonPackages) pyqt5 sip_4_16; }; camlistore = callPackage ../applications/misc/camlistore { }; carrier = builderDefsPackage (import ../applications/networking/instant-messengers/carrier/2.5.0.nix) { inherit fetchurl stdenv pkgconfig perl perlXMLParser libxml2 openssl nss gtkspell aspell gettext ncurses avahi dbus dbus_glib python libtool automake autoconf gstreamer; inherit gtk glib; inherit (gnome) startupnotification GConf ; inherit (xlibs) libXScrnSaver scrnsaverproto libX11 xproto kbproto; }; funpidgin = carrier; cc1394 = callPackage ../applications/video/cc1394 { }; cddiscid = callPackage ../applications/audio/cd-discid { }; cdparanoia = cdparanoiaIII; cdparanoiaIII = callPackage ../applications/audio/cdparanoia { }; cdrtools = callPackage ../applications/misc/cdrtools { }; centerim = callPackage ../applications/networking/instant-messengers/centerim { }; cgit = callPackage ../applications/version-management/git-and-tools/cgit { }; cgminer = callPackage ../applications/misc/cgminer { amdappsdk = amdappsdk28; }; chatzilla = callPackage ../applications/networking/irc/chatzilla { }; chromium = lowPrio (callPackage ../applications/networking/browsers/chromium { channel = "stable"; pulseSupport = config.pulseaudio or true; enablePepperFlash = config.chromium.enablePepperFlash or false; enablePepperPDF = config.chromium.enablePepperPDF or false; }); chromiumBeta = lowPrio (chromium.override { channel = "beta"; }); chromiumBetaWrapper = lowPrio (wrapChromium chromiumBeta); chromiumDev = lowPrio (chromium.override { channel = "dev"; }); chromiumDevWrapper = lowPrio (wrapChromium chromiumDev); chromiumWrapper = wrapChromium chromium; cinelerra = callPackage ../applications/video/cinelerra { }; clipit = callPackage ../applications/misc/clipit { }; cmus = callPackage ../applications/audio/cmus { }; compiz = callPackage ../applications/window-managers/compiz { inherit (gnome) GConf ORBit2 metacity; boost = boost149; # https://bugs.launchpad.net/compiz/+bug/1131864 }; coriander = callPackage ../applications/video/coriander { inherit (gnome) libgnomeui GConf; }; csound = callPackage ../applications/audio/csound { }; cinepaint = callPackage ../applications/graphics/cinepaint { fltk = fltk13; libpng = libpng12; }; codeblocks = callPackage ../applications/editors/codeblocks { }; codeblocksFull = callPackage ../applications/editors/codeblocks { contribPlugins = true; }; codeville = builderDefsPackage (import ../applications/version-management/codeville/0.8.0.nix) { inherit makeWrapper; python = pythonFull; }; comical = callPackage ../applications/graphics/comical { }; conkeror = callPackage ../applications/networking/browsers/conkeror { }; conkerorWrapper = wrapFirefox { browser = conkeror; browserName = "conkeror"; desktopName = "Conkeror"; }; cuneiform = builderDefsPackage (import ../tools/graphics/cuneiform) { inherit cmake patchelf; imagemagick = imagemagick; }; cvs = callPackage ../applications/version-management/cvs { }; cvsps = callPackage ../applications/version-management/cvsps { }; cvs2svn = callPackage ../applications/version-management/cvs2svn { }; d4x = callPackage ../applications/misc/d4x { }; darcs = with haskellPackages_ghc783; callPackage ../applications/version-management/darcs { cabal = cabal.override { extension = self : super : { isLibrary = false; configureFlags = "-f-library " + super.configureFlags or ""; }; }; }; darktable = callPackage ../applications/graphics/darktable { inherit (gnome) GConf libglade; }; dd-agent = callPackage ../tools/networking/dd-agent { inherit (pythonPackages) tornado; }; dia = callPackage ../applications/graphics/dia { inherit (pkgs.gnome) libart_lgpl libgnomeui; }; diffuse = callPackage ../applications/version-management/diffuse { }; distrho = callPackage ../applications/audio/distrho {}; djvulibre = callPackage ../applications/misc/djvulibre { }; djvu2pdf = callPackage ../tools/typesetting/djvu2pdf { }; djview = callPackage ../applications/graphics/djview { }; djview4 = pkgs.djview; dmenu = callPackage ../applications/misc/dmenu { enableXft = config.dmenu.enableXft or false; }; dmtx = builderDefsPackage (import ../tools/graphics/dmtx) { inherit libpng libtiff libjpeg imagemagick librsvg pkgconfig bzip2 zlib libtool freetype fontconfig ghostscript jasper xz; inherit (xlibs) libX11; }; docker = callPackage ../applications/virtualization/docker { }; doodle = callPackage ../applications/search/doodle { }; dunst = callPackage ../applications/misc/dunst { }; dvb_apps = callPackage ../applications/video/dvb-apps { }; dvdauthor = callPackage ../applications/video/dvdauthor { }; dwb = callPackage ../applications/networking/browsers/dwb { dconf = gnome3.dconf; }; dwbWrapper = wrapFirefox { browser = dwb; browserName = "dwb"; desktopName = "dwb"; }; dwm = callPackage ../applications/window-managers/dwm { patches = config.dwm.patches or []; }; dzen2 = callPackage ../applications/window-managers/dzen2 { }; eaglemode = callPackage ../applications/misc/eaglemode { }; eclipses = recurseIntoAttrs (callPackage ../applications/editors/eclipse { }); ed = callPackage ../applications/editors/ed { }; ekho = callPackage ../applications/audio/ekho { }; electrum = callPackage ../applications/misc/electrum { }; elinks = callPackage ../applications/networking/browsers/elinks { }; elvis = callPackage ../applications/editors/elvis { }; emacs = emacs24; emacs24 = callPackage ../applications/editors/emacs-24 { # use override to enable additional features libXaw = xlibs.libXaw; Xaw3d = null; gconf = null; librsvg = null; alsaLib = null; imagemagick = null; }; emacs24-nox = lowPrio (appendToName "nox" (emacs24.override { withX = false; })); emacs24Macport = lowPrio (callPackage ../applications/editors/emacs-24/macport.nix { stdenv = pkgs.clangStdenv; }); emacsPackages = emacs: self: let callPackage = newScope self; in rec { inherit emacs; autoComplete = callPackage ../applications/editors/emacs-modes/auto-complete { }; bbdb = callPackage ../applications/editors/emacs-modes/bbdb { }; bbdb3 = callPackage ../applications/editors/emacs-modes/bbdb/3.nix {}; cedet = callPackage ../applications/editors/emacs-modes/cedet { }; calfw = callPackage ../applications/editors/emacs-modes/calfw { }; coffee = callPackage ../applications/editors/emacs-modes/coffee { }; colorTheme = callPackage ../applications/editors/emacs-modes/color-theme { }; colorThemeSolarized = callPackage ../applications/editors/emacs-modes/color-theme-solarized { }; cryptol = callPackage ../applications/editors/emacs-modes/cryptol { }; cua = callPackage ../applications/editors/emacs-modes/cua { }; darcsum = callPackage ../applications/editors/emacs-modes/darcsum { }; # ecb = callPackage ../applications/editors/emacs-modes/ecb { }; jabber = callPackage ../applications/editors/emacs-modes/jabber { }; emacsClangCompleteAsync = callPackage ../applications/editors/emacs-modes/emacs-clang-complete-async { }; emacsSessionManagement = callPackage ../applications/editors/emacs-modes/session-management-for-emacs { }; emacsw3m = callPackage ../applications/editors/emacs-modes/emacs-w3m { }; emms = callPackage ../applications/editors/emacs-modes/emms { }; ess = callPackage ../applications/editors/emacs-modes/ess { }; flymakeCursor = callPackage ../applications/editors/emacs-modes/flymake-cursor { }; gh = callPackage ../applications/editors/emacs-modes/gh { }; graphvizDot = callPackage ../applications/editors/emacs-modes/graphviz-dot { }; gist = callPackage ../applications/editors/emacs-modes/gist { }; idris = callPackage ../applications/editors/emacs-modes/idris { }; jade = callPackage ../applications/editors/emacs-modes/jade { }; jdee = callPackage ../applications/editors/emacs-modes/jdee { # Requires Emacs 23, for `avl-tree'. }; js2 = callPackage ../applications/editors/emacs-modes/js2 { }; stratego = callPackage ../applications/editors/emacs-modes/stratego { }; haskellMode = callPackage ../applications/editors/emacs-modes/haskell { }; ocamlMode = callPackage ../applications/editors/emacs-modes/ocaml { }; structuredHaskellMode = callPackage ../applications/editors/emacs-modes/structured-haskell-mode { inherit (haskellPackages) cabal haskellSrcExts; }; tuaregMode = callPackage ../applications/editors/emacs-modes/tuareg { }; hol_light_mode = callPackage ../applications/editors/emacs-modes/hol_light { }; htmlize = callPackage ../applications/editors/emacs-modes/htmlize { }; logito = callPackage ../applications/editors/emacs-modes/logito { }; loremIpsum = callPackage ../applications/editors/emacs-modes/lorem-ipsum { }; magit = callPackage ../applications/editors/emacs-modes/magit { }; maudeMode = callPackage ../applications/editors/emacs-modes/maude { }; metaweblog = callPackage ../applications/editors/emacs-modes/metaweblog { }; notmuch = lowPrio (callPackage ../applications/networking/mailreaders/notmuch { }); offlineimap = callPackage ../applications/editors/emacs-modes/offlineimap {}; # This is usually a newer version of Org-Mode than that found in GNU Emacs, so # we want it to have higher precedence. org = hiPrio (callPackage ../applications/editors/emacs-modes/org { }); org2blog = callPackage ../applications/editors/emacs-modes/org2blog { }; pcache = callPackage ../applications/editors/emacs-modes/pcache { }; phpMode = callPackage ../applications/editors/emacs-modes/php { }; prologMode = callPackage ../applications/editors/emacs-modes/prolog { }; proofgeneral_4_2 = callPackage ../applications/editors/emacs-modes/proofgeneral/4.2.nix { texinfo = texinfo4 ; texLive = pkgs.texLiveAggregationFun { paths = [ pkgs.texLive pkgs.texLiveCMSuper ]; }; }; proofgeneral_4_3_pre = callPackage ../applications/editors/emacs-modes/proofgeneral/4.3pre.nix { texinfo = texinfo4 ; texLive = pkgs.texLiveAggregationFun { paths = [ pkgs.texLive pkgs.texLiveCMSuper ]; }; }; proofgeneral = self.proofgeneral_4_2; quack = callPackage ../applications/editors/emacs-modes/quack { }; rectMark = callPackage ../applications/editors/emacs-modes/rect-mark { }; remember = callPackage ../applications/editors/emacs-modes/remember { }; rudel = callPackage ../applications/editors/emacs-modes/rudel { }; sbtMode = callPackage ../applications/editors/emacs-modes/sbt-mode { }; scalaMode1 = callPackage ../applications/editors/emacs-modes/scala-mode/v1.nix { }; scalaMode2 = callPackage ../applications/editors/emacs-modes/scala-mode/v2.nix { }; sunriseCommander = callPackage ../applications/editors/emacs-modes/sunrise-commander { }; writeGood = callPackage ../applications/editors/emacs-modes/writegood { }; xmlRpc = callPackage ../applications/editors/emacs-modes/xml-rpc { }; }; emacs24Packages = recurseIntoAttrs (emacsPackages emacs24 pkgs.emacs24Packages); inherit (gnome3) empathy; epdfview = callPackage ../applications/misc/epdfview { }; inherit (gnome3) epiphany; espeak = callPackage ../applications/audio/espeak { }; espeakedit = callPackage ../applications/audio/espeak/edit.nix { }; esniper = callPackage ../applications/networking/esniper { }; etherape = callPackage ../applications/networking/sniffers/etherape { inherit (gnome) gnomedocutils libgnome libglade libgnomeui scrollkeeper; }; evopedia = callPackage ../applications/misc/evopedia { }; keepassx = callPackage ../applications/misc/keepassx { }; keepassx2 = callPackage ../applications/misc/keepassx/2.0.nix { }; inherit (gnome3) evince; evolution_data_server = gnome3.evolution_data_server; keepass = callPackage ../applications/misc/keepass { }; exrdisplay = callPackage ../applications/graphics/exrdisplay { fltk = fltk20; }; fbpanel = callPackage ../applications/window-managers/fbpanel { }; fbreader = callPackage ../applications/misc/fbreader { }; fetchmail = import ../applications/misc/fetchmail { inherit stdenv fetchurl openssl; }; fldigi = callPackage ../applications/audio/fldigi { }; fluidsynth = callPackage ../applications/audio/fluidsynth { }; fossil = callPackage ../applications/version-management/fossil { }; fribid = callPackage ../applications/networking/browsers/mozilla-plugins/fribid { }; fvwm = callPackage ../applications/window-managers/fvwm { }; geany = callPackage ../applications/editors/geany { }; gksu = callPackage ../applications/misc/gksu { }; gnuradio = callPackage ../applications/misc/gnuradio { inherit (pythonPackages) lxml numpy scipy matplotlib pyopengl; fftw = fftwFloat; }; gnuradio-osmosdr = callPackage ../applications/misc/gnuradio-osmosdr { }; goldendict = callPackage ../applications/misc/goldendict { }; google-musicmanager = callPackage ../applications/audio/google-musicmanager { }; gpicview = callPackage ../applications/graphics/gpicview { }; gqrx = callPackage ../applications/misc/gqrx { }; grass = import ../applications/misc/grass { inherit (xlibs) libXmu libXext libXp libX11 libXt libSM libICE libXpm libXaw libXrender; inherit config composableDerivation stdenv fetchurl lib flex bison cairo fontconfig gdal zlib ncurses gdbm proj pkgconfig swig blas liblapack libjpeg libpng mysql unixODBC mesa postgresql python readline sqlite tcl tk libtiff freetype makeWrapper wxGTK; fftw = fftwSinglePrec; ffmpeg = ffmpeg_0_10; motif = lesstif; opendwg = libdwg; wxPython = wxPython28; }; grip = callPackage ../applications/misc/grip { inherit (gnome) libgnome libgnomeui vte; }; gtimelog = pythonPackages.gtimelog; inherit (gnome3) gucharmap; guitarix = callPackage ../applications/audio/guitarix { fftw = fftwSinglePrec; }; photivo = callPackage ../applications/graphics/photivo { }; wavesurfer = callPackage ../applications/misc/audio/wavesurfer { }; wireshark = callPackage ../applications/networking/sniffers/wireshark { }; wvdial = callPackage ../os-specific/linux/wvdial { }; fbida = callPackage ../applications/graphics/fbida { }; fdupes = callPackage ../tools/misc/fdupes { }; feh = callPackage ../applications/graphics/feh { }; filezilla = callPackage ../applications/networking/ftp/filezilla { }; firefox13Pkgs = callPackage ../applications/networking/browsers/firefox/13.0.nix { inherit (gnome) libIDL; }; firefox13Wrapper = wrapFirefox { browser = firefox13Pkgs.firefox; }; firefox30Pkgs = callPackage ../applications/networking/browsers/firefox/30.nix { inherit (gnome) libIDL; inherit (pythonPackages) pysqlite; libpng = libpng_apng; }; firefox = callPackage ../applications/networking/browsers/firefox { inherit (gnome) libIDL; inherit (pythonPackages) pysqlite; }; firefoxWrapper = wrapFirefox { browser = pkgs.firefox; }; firefox-bin = callPackage ../applications/networking/browsers/firefox-bin { gconf = pkgs.gnome.GConf; inherit (pkgs.gnome) libgnome libgnomeui; inherit (pkgs.xlibs) libX11 libXScrnSaver libXext libXinerama libXrender libXt; }; flac = callPackage ../applications/audio/flac { }; flashplayer = callPackage ../applications/networking/browsers/mozilla-plugins/flashplayer-11 { debug = config.flashplayer.debug or false; }; fluxbox = callPackage ../applications/window-managers/fluxbox { }; freecad = callPackage ../applications/graphics/freecad { opencascade = opencascade_6_5; inherit (pythonPackages) matplotlib pycollada; }; freemind = callPackage ../applications/misc/freemind { jdk = jdk; jre = jdk; }; freenet = callPackage ../applications/networking/p2p/freenet { }; freepv = callPackage ../applications/graphics/freepv { }; xfontsel = callPackage ../applications/misc/xfontsel { }; xlsfonts = callPackage ../applications/misc/xlsfonts { }; freerdp = callPackage ../applications/networking/remote/freerdp { ffmpeg = ffmpeg_1; }; freerdpUnstable = callPackage ../applications/networking/remote/freerdp/unstable.nix { }; freicoin = callPackage ../applications/misc/freicoin { }; fspot = callPackage ../applications/graphics/f-spot { inherit (gnome) libgnome libgnomeui; gtksharp = gtksharp1; }; fuze = callPackage ../applications/networking/instant-messengers/fuze {}; gcolor2 = callPackage ../applications/graphics/gcolor2 { }; get_iplayer = callPackage ../applications/misc/get_iplayer {}; gimp_2_8 = callPackage ../applications/graphics/gimp/2.8.nix { inherit (gnome) libart_lgpl; webkit = null; lcms = lcms2; wrapPython = pythonPackages.wrapPython; }; gimp = gimp_2_8; gimpPlugins = recurseIntoAttrs (import ../applications/graphics/gimp/plugins { inherit pkgs gimp; }); gitAndTools = recurseIntoAttrs (import ../applications/version-management/git-and-tools { inherit pkgs; }); git = gitAndTools.git; gitFull = gitAndTools.gitFull; gitSVN = gitAndTools.gitSVN; gitRepo = callPackage ../applications/version-management/git-repo { python = python27; }; gitolite = callPackage ../applications/version-management/gitolite { }; inherit (gnome3) gitg; giv = callPackage ../applications/graphics/giv { pcre = pcre.override { unicodeSupport = true; }; }; gmrun = callPackage ../applications/misc/gmrun {}; gnucash = callPackage ../applications/office/gnucash { inherit (gnome2) libgnomeui libgtkhtml gtkhtml libbonoboui libgnomeprint libglade libart_lgpl; gconf = gnome2.GConf; guile = guile_1_8; slibGuile = slibGuile.override { scheme = guile_1_8; }; goffice = goffice_0_8; }; goffice_0_8 = callPackage ../desktops/gnome-3/3.10/misc/goffice/0.8.nix { inherit (gnome2) libglade libgnomeui; gconf = gnome2.GConf; libart = gnome2.libart_lgpl; }; # latest version: gnome3.goffice ideas = recurseIntoAttrs ( (callPackage ../applications/editors/idea { }) // (callPackage ../applications/editors/idea/pycharm.nix { })); libquvi = callPackage ../applications/video/quvi/library.nix { }; mi2ly = callPackage ../applications/audio/mi2ly {}; praat = callPackage ../applications/audio/praat { }; quvi = callPackage ../applications/video/quvi/tool.nix { }; quvi_scripts = callPackage ../applications/video/quvi/scripts.nix { }; qjackctl = callPackage ../applications/audio/qjackctl { }; gkrellm = callPackage ../applications/misc/gkrellm { }; gmu = callPackage ../applications/audio/gmu { }; gnash = callPackage ../applications/video/gnash { inherit (gnome) gtkglext; }; gnome_mplayer = callPackage ../applications/video/gnome-mplayer { inherit (gnome) GConf; }; gnumeric = callPackage ../applications/office/gnumeric { inherit (gnome3) goffice gnome_icon_theme; }; gnunet = callPackage ../applications/networking/p2p/gnunet { libgcrypt = libgcrypt_1_6; }; gnunet_svn = lowPrio (callPackage ../applications/networking/p2p/gnunet/svn.nix { libgcrypt = libgcrypt_1_6; }); gocr = callPackage ../applications/graphics/gocr { }; gobby5 = callPackage ../applications/editors/gobby { inherit (gnome) gtksourceview; }; gphoto2 = callPackage ../applications/misc/gphoto2 { }; gphoto2fs = builderDefsPackage ../applications/misc/gphoto2/gphotofs.nix { inherit libgphoto2 fuse pkgconfig glib libtool; }; graphicsmagick = callPackage ../applications/graphics/graphicsmagick { }; graphicsmagick_q16 = callPackage ../applications/graphics/graphicsmagick { quantumdepth = 16; }; graphicsmagick137 = callPackage ../applications/graphics/graphicsmagick/1.3.7.nix { libpng = libpng12; }; gtkpod = callPackage ../applications/audio/gtkpod { inherit (gnome) libglade; }; jbidwatcher = callPackage ../applications/misc/jbidwatcher { java = if stdenv.isLinux then jre else jdk; }; qrdecode = builderDefsPackage (import ../tools/graphics/qrdecode) { libpng = libpng12; opencv = opencv_2_1; }; qrencode = callPackage ../tools/graphics/qrencode { }; gecko_mediaplayer = callPackage ../applications/networking/browsers/mozilla-plugins/gecko-mediaplayer { inherit (gnome) GConf; browser = firefox; }; geeqie = callPackage ../applications/graphics/geeqie { }; gigedit = callPackage ../applications/audio/gigedit { }; gqview = callPackage ../applications/graphics/gqview { }; gmpc = callPackage ../applications/audio/gmpc { }; gmtk = callPackage ../applications/networking/browsers/mozilla-plugins/gmtk { inherit (gnome) GConf; }; googleearth = callPackage_i686 ../applications/misc/googleearth { }; google_talk_plugin = callPackage ../applications/networking/browsers/mozilla-plugins/google-talk-plugin { libpng = libpng12; }; gosmore = builderDefsPackage ../applications/misc/gosmore { inherit fetchsvn curl pkgconfig libxml2 gtk; }; gpsbabel = callPackage ../applications/misc/gpsbabel { }; gpscorrelate = callPackage ../applications/misc/gpscorrelate { }; gpsd = callPackage ../servers/gpsd { }; guitone = callPackage ../applications/version-management/guitone { }; gv = callPackage ../applications/misc/gv { }; guvcview = callPackage ../os-specific/linux/guvcview { }; hello = callPackage ../applications/misc/hello/ex-2 { }; herbstluftwm = callPackage ../applications/window-managers/herbstluftwm { }; hexchat = callPackage ../applications/networking/irc/hexchat { }; hexedit = callPackage ../applications/editors/hexedit { }; hipchat = callPackage ../applications/networking/instant-messengers/hipchat { }; homebank = callPackage ../applications/office/homebank { }; htmldoc = callPackage ../applications/misc/htmldoc { fltk = fltk13; }; hugin = callPackage ../applications/graphics/hugin { }; hydrogen = callPackage ../applications/audio/hydrogen { }; i3 = callPackage ../applications/window-managers/i3 { }; i3lock = callPackage ../applications/window-managers/i3/lock.nix { inherit (xorg) libxkbfile; cairo = cairo.override { xcbSupport = true; }; }; i3minator = callPackage ../tools/misc/i3minator { }; i3status = callPackage ../applications/window-managers/i3/status.nix { }; i810switch = callPackage ../os-specific/linux/i810switch { }; icewm = callPackage ../applications/window-managers/icewm { }; id3v2 = callPackage ../applications/audio/id3v2 { }; ifenslave = callPackage ../os-specific/linux/ifenslave { }; ii = callPackage ../applications/networking/irc/ii { }; ike = callPackage ../applications/ike { }; ikiwiki = callPackage ../applications/misc/ikiwiki { inherit (perlPackages) TextMarkdown URI HTMLParser HTMLScrubber HTMLTemplate TimeDate CGISession DBFile CGIFormBuilder LocaleGettext RpcXML XMLSimple PerlMagick YAML YAMLLibYAML HTMLTree Filechdir AuthenPassphrase NetOpenIDConsumer LWPxParanoidAgent CryptSSLeay; }; imagemagick = callPackage ../applications/graphics/ImageMagick { tetex = null; librsvg = null; }; imagemagickBig = lowPrio (callPackage ../applications/graphics/ImageMagick { }); # Impressive, formerly known as "KeyJNote". impressive = callPackage ../applications/office/impressive { # XXX These are the PyOpenGL dependencies, which we need here. inherit (pythonPackages) pyopengl; }; inferno = callPackage_i686 ../applications/inferno { }; inkscape = callPackage ../applications/graphics/inkscape { inherit (pythonPackages) lxml; lcms = lcms2; }; ion3 = callPackage ../applications/window-managers/ion-3 { lua = lua5; }; ipe = callPackage ../applications/graphics/ipe { }; iptraf = callPackage ../applications/networking/iptraf { }; irssi = callPackage ../applications/networking/irc/irssi { # compile with gccApple on darwin to support the -no-cpp-precompile flag stdenv = if stdenv.isDarwin then stdenvAdapters.overrideGCC stdenv gccApple else stdenv; }; irssi_fish = callPackage ../applications/networking/irc/irssi/fish { }; irssi_otr = callPackage ../applications/networking/irc/irssi/otr { }; bip = callPackage ../applications/networking/irc/bip { }; jack_capture = callPackage ../applications/audio/jack-capture { }; jack_oscrolloscope = callPackage ../applications/audio/jack-oscrolloscope { }; jack_rack = callPackage ../applications/audio/jack-rack { }; jackmeter = callPackage ../applications/audio/jackmeter { }; jalv = callPackage ../applications/audio/jalv { }; jedit = callPackage ../applications/editors/jedit { }; jigdo = callPackage ../applications/misc/jigdo { }; jitsi = callPackage ../applications/networking/instant-messengers/jitsi { }; joe = callPackage ../applications/editors/joe { }; jbrout = callPackage ../applications/graphics/jbrout { inherit (pythonPackages) lxml; }; jwm = callPackage ../applications/window-managers/jwm { }; k3d = callPackage ../applications/graphics/k3d { inherit (pkgs.gnome2) gtkglext; }; keepnote = callPackage ../applications/office/keepnote { pygtk = pyGtkGlade; }; kermit = callPackage ../tools/misc/kermit { }; keymon = callPackage ../applications/video/key-mon { }; kino = callPackage ../applications/video/kino { inherit (gnome) libglade; }; lame = callPackage ../applications/audio/lame { }; larswm = callPackage ../applications/window-managers/larswm { }; lash = callPackage ../applications/audio/lash { }; ladspaH = callPackage ../applications/audio/ladspa-plugins/ladspah.nix { }; ladspaPlugins = callPackage ../applications/audio/ladspa-plugins { fftw = fftwSinglePrec; }; caps = callPackage ../applications/audio/caps { }; lastwatch = callPackage ../applications/audio/lastwatch { }; lastfmsubmitd = callPackage ../applications/audio/lastfmsubmitd { }; lbdb = callPackage ../tools/misc/lbdb { }; lci = callPackage ../applications/science/logic/lci {}; ldcpp = callPackage ../applications/networking/p2p/ldcpp { inherit (gnome) libglade; }; librecad = callPackage ../applications/misc/librecad { }; librecad2 = callPackage ../applications/misc/librecad/2.0.nix { }; libreoffice = callPackage ../applications/office/libreoffice { inherit (perlPackages) ArchiveZip CompressZlib; inherit (gnome) GConf ORBit2 gnome_vfs; zip = zip.override { enableNLS = false; }; boost = boost155; jdk = openjdk; fontsConf = makeFontsConf { fontDirectories = [ freefont_ttf xorg.fontmiscmisc xorg.fontbhttf ]; }; clucene_core = clucene_core_2; lcms = lcms2; harfbuzz = harfbuzz.override { withIcu = true; withGraphite2 = true; }; }; liferea = callPackage ../applications/networking/newsreaders/liferea { }; lingot = callPackage ../applications/audio/lingot { inherit (gnome) libglade; }; links = callPackage ../applications/networking/browsers/links { }; ledger = callPackage ../applications/office/ledger/2.6.3.nix { }; ledger3 = callPackage ../applications/office/ledger/3.0.nix { }; lighttable = callPackage ../applications/editors/lighttable {}; links2 = callPackage ../applications/networking/browsers/links2 { }; linphone = callPackage ../applications/networking/instant-messengers/linphone rec { inherit (gnome) libglade; libexosip = libexosip_3; libosip = libosip_3; }; linuxsampler = callPackage ../applications/audio/linuxsampler { bison = bison2; }; llpp = callPackage ../applications/misc/llpp { inherit (ocamlPackages) lablgl; }; lmms = callPackage ../applications/audio/lmms { }; lrzsz = callPackage ../tools/misc/lrzsz { }; luminanceHDR = callPackage ../applications/graphics/luminance-hdr { }; lxdvdrip = callPackage ../applications/video/lxdvdrip { }; handbrake = callPackage ../applications/video/handbrake { }; lynx = callPackage ../applications/networking/browsers/lynx { }; lyx = callPackage ../applications/misc/lyx { }; makeself = callPackage ../applications/misc/makeself { }; matchbox = callPackage ../applications/window-managers/matchbox { }; mcpp = callPackage ../development/compilers/mcpp { }; mda_lv2 = callPackage ../applications/audio/mda-lv2 { }; meld = callPackage ../applications/version-management/meld { inherit (gnome) scrollkeeper; pygtk = pyGtkGlade; }; mcomix = callPackage ../applications/graphics/mcomix { }; mercurial = callPackage ../applications/version-management/mercurial { inherit (pythonPackages) curses docutils; guiSupport = false; # use mercurialFull to get hgk GUI }; mercurialFull = appendToName "full" (pkgs.mercurial.override { guiSupport = true; }); merkaartor = callPackage ../applications/misc/merkaartor { }; meshlab = callPackage ../applications/graphics/meshlab { }; mhwaveedit = callPackage ../applications/audio/mhwaveedit {}; mid2key = callPackage ../applications/audio/mid2key { }; midori = callPackage ../applications/networking/browsers/midori { }; midoriWrapper = wrapFirefox { browser = midori; browserName = "midori"; desktopName = "Midori"; icon = "${midori}/share/icons/hicolor/22x22/apps/midori.png"; }; mikmod = callPackage ../applications/audio/mikmod { }; minicom = callPackage ../tools/misc/minicom { }; minimodem = callPackage ../applications/audio/minimodem { }; minidjvu = callPackage ../applications/graphics/minidjvu { }; mirage = callPackage ../applications/graphics/mirage {}; mixxx = callPackage ../applications/audio/mixxx { inherit (vamp) vampSDK; }; mmex = callPackage ../applications/office/mmex { }; moc = callPackage ../applications/audio/moc { }; monkeysAudio = callPackage ../applications/audio/monkeys-audio { }; monodevelop = callPackage ../applications/editors/monodevelop { inherit (gnome) gnome_vfs libbonobo libglade libgnome GConf; mozilla = firefox; gtksharp = gtksharp2; }; monodoc = callPackage ../applications/editors/monodoc { gtksharp = gtksharp1; }; monotone = callPackage ../applications/version-management/monotone { lua = lua5; boost = boost149; }; monotoneViz = builderDefsPackage (import ../applications/version-management/monotone-viz/mtn-head.nix) { inherit ocaml graphviz pkgconfig autoconf automake libtool glib gtk; inherit (ocamlPackages) lablgtk; inherit (gnome) libgnomecanvas; }; mopidy = callPackage ../applications/audio/mopidy { }; mopidy-spotify = callPackage ../applications/audio/mopidy-spotify { }; mopidy-moped = callPackage ../applications/audio/mopidy-moped { }; mozilla = callPackage ../applications/networking/browsers/mozilla { inherit (gnome) libIDL; }; mozplugger = builderDefsPackage (import ../applications/networking/browsers/mozilla-plugins/mozplugger) { inherit firefox; inherit (xlibs) libX11 xproto; }; easytag = callPackage ../applications/audio/easytag { }; mp3info = callPackage ../applications/audio/mp3info { }; mp3splt = callPackage ../applications/audio/mp3splt { }; mpc123 = callPackage ../applications/audio/mpc123 { }; mpg123 = callPackage ../applications/audio/mpg123 { }; mpg321 = callPackage ../applications/audio/mpg321 { }; mpc_cli = callPackage ../applications/audio/mpc { }; ncmpc = callPackage ../applications/audio/ncmpc { }; ncmpcpp = callPackage ../applications/audio/ncmpcpp { }; normalize = callPackage ../applications/audio/normalize { }; mplayer = callPackage ../applications/video/mplayer { pulseSupport = config.pulseaudio or false; vdpauSupport = config.mplayer.vdpauSupport or false; }; mplayer2 = callPackage ../applications/video/mplayer2 { ffmpeg = libav_9; # see https://trac.macports.org/ticket/44386 }; MPlayerPlugin = browser: import ../applications/networking/browsers/mozilla-plugins/mplayerplug-in { inherit browser; inherit fetchurl stdenv pkgconfig gettext; inherit (xlibs) libXpm; # !!! should depend on MPlayer }; mpv = callPackage ../applications/video/mpv { lua = lua5_1; bs2bSupport = true; quviSupport = true; cacaSupport = true; }; mrxvt = callPackage ../applications/misc/mrxvt { }; multisync = callPackage ../applications/misc/multisync { inherit (gnome) ORBit2 libbonobo libgnomeui GConf; }; mumble = callPackage ../applications/networking/mumble { avahi = avahi.override { withLibdnssdCompat = true; }; jackSupport = config.mumble.jackSupport or false; speechdSupport = config.mumble.speechdSupport or false; }; murmur = callPackage ../applications/networking/mumble/murmur.nix { avahi = avahi.override { withLibdnssdCompat = true; }; iceSupport = config.murmur.iceSupport or true; }; mutt = callPackage ../applications/networking/mailreaders/mutt { }; pcmanfm = callPackage ../applications/misc/pcmanfm { }; ruby_gpgme = callPackage ../development/libraries/ruby_gpgme { ruby = ruby19; hoe = rubyLibs.hoe; }; ruby_ncursesw_sup = callPackage ../development/libraries/ruby_ncursesw_sup { }; shotcut = callPackage ../applications/video/shotcut { mlt = mlt-qt5; }; smplayer = callPackage ../applications/video/smplayer { }; sup = with rubyLibs; callPackage ../applications/networking/mailreaders/sup { ruby = ruby19.override { cursesSupport = true; }; inherit gettext highline iconv locale lockfile text trollop xapian_ruby which; rmail_sup = ""; # missing unicode = ""; # See https://github.com/NixOS/nixpkgs/issues/1804 and # https://github.com/NixOS/nixpkgs/issues/2146 bundler = pkgs.lib.overrideDerivation pkgs.rubyLibs.bundler ( oldAttrs: { dontPatchShebangs = 1; } ); chronic = chronic; gpgme = ruby_gpgme; mime_types = mime_types; ncursesw_sup = ruby_ncursesw_sup; rake = rake; }; synfigstudio = callPackage ../applications/graphics/synfigstudio { fontsConf = makeFontsConf { fontDirectories = [ freefont_ttf ]; }; }; sxhkd = callPackage ../applications/window-managers/sxhkd { }; msmtp = callPackage ../applications/networking/msmtp { }; imapfilter = callPackage ../applications/networking/mailreaders/imapfilter.nix { lua = lua5; }; mupdf = callPackage ../applications/misc/mupdf { }; mypaint = callPackage ../applications/graphics/mypaint { }; mythtv = callPackage ../applications/video/mythtv { }; tvtime = callPackage ../applications/video/tvtime { kernel = linux; }; nano = callPackage ../applications/editors/nano { }; navipowm = callPackage ../applications/misc/navipowm { }; navit = callPackage ../applications/misc/navit { }; netbeans = callPackage ../applications/editors/netbeans { }; ncdu = callPackage ../tools/misc/ncdu { }; ncdc = callPackage ../applications/networking/p2p/ncdc { }; nedit = callPackage ../applications/editors/nedit { motif = lesstif; }; netsurfBrowser = netsurf.browser; netsurf = recurseIntoAttrs (import ../applications/networking/browsers/netsurf { inherit pkgs; }); notmuch = callPackage ../applications/networking/mailreaders/notmuch { # use emacsPackages.notmuch if you want emacs support emacs = null; }; nova = callPackage ../applications/virtualization/nova { }; novaclient = callPackage ../applications/virtualization/nova/client.nix { }; nspluginwrapper = callPackage ../applications/networking/browsers/mozilla-plugins/nspluginwrapper {}; nvi = callPackage ../applications/editors/nvi { }; nvpy = callPackage ../applications/editors/nvpy { }; obconf = callPackage ../tools/X11/obconf { inherit (gnome) libglade; }; ocrad = callPackage ../applications/graphics/ocrad { }; offrss = callPackage ../applications/networking/offrss { }; ogmtools = callPackage ../applications/video/ogmtools { }; omxplayer = callPackage ../applications/video/omxplayer { }; oneteam = callPackage ../applications/networking/instant-messengers/oneteam {}; openbox = callPackage ../applications/window-managers/openbox { }; openimageio = callPackage ../applications/graphics/openimageio { }; openjump = callPackage ../applications/misc/openjump { }; openscad = callPackage ../applications/graphics/openscad {}; opera = callPackage ../applications/networking/browsers/opera { inherit (pkgs.kde4) kdelibs; }; opusfile = callPackage ../applications/audio/opusfile { }; opusTools = callPackage ../applications/audio/opus-tools { }; pamixer = callPackage ../applications/audio/pamixer { }; pan = callPackage ../applications/networking/newsreaders/pan { spellChecking = false; }; panotools = callPackage ../applications/graphics/panotools { }; pavucontrol = callPackage ../applications/audio/pavucontrol { }; paraview = callPackage ../applications/graphics/paraview { }; pencil = callPackage ../applications/graphics/pencil { }; petrifoo = callPackage ../applications/audio/petrifoo { inherit (gnome) libgnomecanvas; }; pdftk = callPackage ../tools/typesetting/pdftk { }; pdfgrep = callPackage ../tools/typesetting/pdfgrep { }; pianobar = callPackage ../applications/audio/pianobar { }; pianobooster = callPackage ../applications/audio/pianobooster { }; picard = callPackage ../applications/audio/picard { }; picocom = callPackage ../tools/misc/picocom { }; pidgin = callPackage ../applications/networking/instant-messengers/pidgin { openssl = if config.pidgin.openssl or true then openssl else null; gnutls = if config.pidgin.gnutls or false then gnutls else null; libgcrypt = if config.pidgin.gnutls or false then libgcrypt else null; startupnotification = libstartup_notification; }; pidginlatex = callPackage ../applications/networking/instant-messengers/pidgin-plugins/pidgin-latex { imagemagick = imagemagickBig; }; pidginlatexSF = builderDefsPackage (import ../applications/networking/instant-messengers/pidgin-plugins/pidgin-latex/pidgin-latex-sf.nix) { inherit pkgconfig pidgin texLive imagemagick which glib gtk; }; pidginmsnpecan = callPackage ../applications/networking/instant-messengers/pidgin-plugins/msn-pecan { }; pidginotr = callPackage ../applications/networking/instant-messengers/pidgin-plugins/otr { }; pidginsipe = callPackage ../applications/networking/instant-messengers/pidgin-plugins/sipe { }; toxprpl = callPackage ../applications/networking/instant-messengers/pidgin-plugins/tox-prpl { }; pinfo = callPackage ../applications/misc/pinfo { }; pinta = callPackage ../applications/graphics/pinta { gtksharp = gtksharp2; }; pommed = callPackage ../os-specific/linux/pommed { inherit (xorg) libXpm; }; potrace = callPackage ../applications/graphics/potrace {}; posterazor = callPackage ../applications/misc/posterazor { }; pqiv = callPackage ../applications/graphics/pqiv { }; qiv = callPackage ../applications/graphics/qiv { }; # perhaps there are better apps for this task? It's how I had configured my preivous system. # And I don't want to rewrite all rules procmail = callPackage ../applications/misc/procmail { }; pstree = callPackage ../applications/misc/pstree { }; pulseview = callPackage ../applications/science/electronics/pulseview { }; puredata = callPackage ../applications/audio/puredata { }; pythonmagick = callPackage ../applications/graphics/PythonMagick { }; qbittorrent = callPackage ../applications/networking/p2p/qbittorrent { }; eiskaltdcpp = callPackage ../applications/networking/p2p/eiskaltdcpp { }; qemu = callPackage ../applications/virtualization/qemu { }; qmmp = callPackage ../applications/audio/qmmp { }; qsampler = callPackage ../applications/audio/qsampler { }; qsynth = callPackage ../applications/audio/qsynth { }; qtpfsgui = callPackage ../applications/graphics/qtpfsgui { }; qtractor = callPackage ../applications/audio/qtractor { }; quodlibet = callPackage ../applications/audio/quodlibet { inherit (pythonPackages) mutagen; }; quodlibet-with-gst-plugins = callPackage ../applications/audio/quodlibet { inherit (pythonPackages) mutagen; withGstPlugins = true; gst_plugins_bad = null; }; rakarrack = callPackage ../applications/audio/rakarrack { inherit (xorg) libXpm libXft; fltk = fltk13; }; rapcad = callPackage ../applications/graphics/rapcad {}; rapidsvn = callPackage ../applications/version-management/rapidsvn { }; ratpoison = callPackage ../applications/window-managers/ratpoison { }; rawtherapee = callPackage ../applications/graphics/rawtherapee { fftw = fftwSinglePrec; }; rcs = callPackage ../applications/version-management/rcs { }; rdesktop = callPackage ../applications/networking/remote/rdesktop { }; recode = callPackage ../tools/text/recode { }; retroshare = callPackage ../applications/networking/p2p/retroshare { qt = qt4; }; retroshare06 = lowPrio (callPackage ../applications/networking/p2p/retroshare/0.6.nix { qt = qt4; }); rsync = callPackage ../applications/networking/sync/rsync { enableACLs = !(stdenv.isDarwin || stdenv.isSunOS || stdenv.isFreeBSD); enableCopyDevicesPatch = (config.rsync.enableCopyDevicesPatch or false); }; rtl-sdr = callPackage ../applications/misc/rtl-sdr { }; rubyripper = callPackage ../applications/audio/rubyripper {}; rxvt = callPackage ../applications/misc/rxvt { }; # = urxvt rxvt_unicode = callPackage ../applications/misc/rxvt_unicode { perlSupport = true; gdkPixbufSupport = true; unicode3Support = true; }; sakura = callPackage ../applications/misc/sakura { inherit (gnome) vte; }; sbagen = callPackage ../applications/misc/sbagen { }; scite = callPackage ../applications/editors/scite { }; scribus = callPackage ../applications/office/scribus { inherit (gnome) libart_lgpl; }; seafile-client = callPackage ../applications/networking/seafile-client { }; seeks = callPackage ../tools/networking/p2p/seeks { opencv = opencv_2_1; }; seg3d = callPackage ../applications/graphics/seg3d { wxGTK = wxGTK28.override { unicode = false; }; }; seq24 = callPackage ../applications/audio/seq24 { }; setbfree = callPackage ../applications/audio/setbfree { }; sflphone = callPackage ../applications/networking/instant-messengers/sflphone { gtk = gtk3; }; siproxd = callPackage ../applications/networking/siproxd { }; skype = callPackage_i686 ../applications/networking/instant-messengers/skype { }; skype4pidgin = callPackage ../applications/networking/instant-messengers/pidgin-plugins/skype4pidgin { }; skype_call_recorder = callPackage ../applications/networking/instant-messengers/skype-call-recorder { }; slrn = callPackage ../applications/networking/newsreaders/slrn { }; spideroak = callPackage ../applications/networking/spideroak { }; ssvnc = callPackage ../applications/networking/remote/ssvnc { }; st = callPackage ../applications/misc/st { conf = config.st.conf or null; }; linuxstopmotion = callPackage ../applications/video/linuxstopmotion { }; sweethome3d = recurseIntoAttrs ( (callPackage ../applications/misc/sweethome3d { }) // (callPackage ../applications/misc/sweethome3d/editors.nix { sweethome3dApp = sweethome3d.application; }) ); sxiv = callPackage ../applications/graphics/sxiv { }; bittorrentSync = callPackage ../applications/networking/bittorrentsync { }; dropbox = callPackage ../applications/networking/dropbox { }; dropbox-cli = callPackage ../applications/networking/dropbox-cli { }; lightdm = callPackage ../applications/display-managers/lightdm { }; lightdm_gtk_greeter = callPackage ../applications/display-managers/lightdm-gtk-greeter { }; # slic3r 0.9.10b says: "Running Slic3r under Perl >= 5.16 is not supported nor recommended" slic3r = callPackage ../applications/misc/slic3r { perlPackages = perl514Packages; perl = perl514; }; curaengine = callPackage ../applications/misc/curaengine { }; cura = callPackage ../applications/misc/cura { }; printrun = callPackage ../applications/misc/printrun { }; slim = callPackage ../applications/display-managers/slim { libpng = libpng12; }; smartdeblur = callPackage ../applications/graphics/smartdeblur { }; snd = callPackage ../applications/audio/snd { }; shntool = callPackage ../applications/audio/shntool { }; sonic_visualiser = callPackage ../applications/audio/sonic-visualiser { inherit (pkgs.vamp) vampSDK; inherit (pkgs.xlibs) libX11; fftw = pkgs.fftwSinglePrec; }; sox = callPackage ../applications/misc/audio/sox { }; soxr = callPackage ../applications/misc/audio/soxr { }; spotify = callPackage ../applications/audio/spotify { inherit (gnome) GConf; libpng = libpng12; }; libspotify = callPackage ../development/libraries/libspotify { apiKey = config.libspotify.apiKey or null; }; stalonetray = callPackage ../applications/window-managers/stalonetray {}; stp = callPackage ../applications/science/logic/stp {}; stumpwm = lispPackages.stumpwm; sublime = callPackage ../applications/editors/sublime { }; sublime3 = lowPrio (callPackage ../applications/editors/sublime3 { }); subversion = callPackage ../applications/version-management/subversion/default.nix { bdbSupport = true; httpServer = false; httpSupport = true; pythonBindings = false; perlBindings = false; javahlBindings = false; saslSupport = false; httpd = apacheHttpd; sasl = cyrus_sasl; }; subversionClient = appendToName "client" (subversion.override { bdbSupport = false; perlBindings = true; pythonBindings = true; }); surf = callPackage ../applications/misc/surf { webkit = webkitgtk2; }; svk = perlPackages.SVK; swh_lv2 = callPackage ../applications/audio/swh-lv2 { }; sylpheed = callPackage ../applications/networking/mailreaders/sylpheed { sslSupport = true; gpgSupport = true; }; symlinks = callPackage ../tools/system/symlinks { }; syncthing = callPackage ../applications/networking/syncthing { }; # linux only by now synergy = callPackage ../applications/misc/synergy { }; tabbed = callPackage ../applications/window-managers/tabbed { }; tahoelafs = callPackage ../tools/networking/p2p/tahoe-lafs { inherit (pythonPackages) twisted foolscap simplejson nevow zfec pycryptopp sqlite3 darcsver setuptoolsTrial setuptoolsDarcs numpy pyasn1 mock; }; tailor = builderDefsPackage (import ../applications/version-management/tailor) { inherit makeWrapper python; }; tangogps = callPackage ../applications/misc/tangogps { gconf = gnome.GConf; }; teamspeak_client = callPackage ../applications/networking/instant-messengers/teamspeak/client.nix { }; teamspeak_server = callPackage ../applications/networking/instant-messengers/teamspeak/server.nix { }; taskjuggler = callPackage ../applications/misc/taskjuggler { }; taskwarrior = callPackage ../applications/misc/taskwarrior { }; taskserver = callPackage ../servers/misc/taskserver { }; telegram-cli = callPackage ../applications/networking/instant-messengers/telegram-cli/default.nix { }; telepathy_gabble = callPackage ../applications/networking/instant-messengers/telepathy/gabble { }; telepathy_haze = callPackage ../applications/networking/instant-messengers/telepathy/haze {}; telepathy_logger = callPackage ../applications/networking/instant-messengers/telepathy/logger {}; telepathy_mission_control = callPackage ../applications/networking/instant-messengers/telepathy/mission-control { }; telepathy_rakia = callPackage ../applications/networking/instant-messengers/telepathy/rakia { }; telepathy_salut = callPackage ../applications/networking/instant-messengers/telepathy/salut {}; terminator = callPackage ../applications/misc/terminator { vte = gnome.vte.override { pythonSupport = true; }; inherit (pythonPackages) notify; }; tesseract = callPackage ../applications/graphics/tesseract { }; thinkingRock = callPackage ../applications/misc/thinking-rock { }; thunderbird = callPackage ../applications/networking/mailreaders/thunderbird { inherit (gnome) libIDL; inherit (pythonPackages) pysqlite; libpng = libpng_apng; }; thunderbird-bin = callPackage ../applications/networking/mailreaders/thunderbird-bin { gconf = pkgs.gnome.GConf; inherit (pkgs.gnome) libgnome libgnomeui; inherit (pkgs.xlibs) libX11 libXScrnSaver libXext libXinerama libXrender libXt; }; tig = gitAndTools.tig; timidity = callPackage ../tools/misc/timidity { }; tint2 = callPackage ../applications/misc/tint2 { }; tkcvs = callPackage ../applications/version-management/tkcvs { }; tla = callPackage ../applications/version-management/arch { }; todo-txt-cli = callPackage ../applications/office/todo.txt-cli { }; torchat = callPackage ../applications/networking/instant-messengers/torchat { wrapPython = pythonPackages.wrapPython; }; toxic = callPackage ../applications/networking/instant-messengers/toxic { }; transcode = callPackage ../applications/audio/transcode { }; transmission = callPackage ../applications/networking/p2p/transmission { }; transmission_gtk = transmission.override { enableGTK3 = true; }; transmission_remote_gtk = callPackage ../applications/networking/p2p/transmission-remote-gtk {}; trayer = callPackage ../applications/window-managers/trayer { }; tree = callPackage ../tools/system/tree {}; tribler = callPackage ../applications/networking/p2p/tribler { }; twister = callPackage ../applications/networking/p2p/twister { }; twmn = callPackage ../applications/misc/twmn { }; twinkle = callPackage ../applications/networking/instant-messengers/twinkle { }; umurmur = callPackage ../applications/networking/umurmur { }; unison = callPackage ../applications/networking/sync/unison { inherit (ocamlPackages) lablgtk; enableX11 = config.unison.enableX11 or true; }; uucp = callPackage ../tools/misc/uucp { }; uvccapture = callPackage ../applications/video/uvccapture { }; uwimap = callPackage ../tools/networking/uwimap { }; uzbl = callPackage ../applications/networking/browsers/uzbl { webkit = webkitgtk2; }; uTox = callPackage ../applications/networking/instant-messengers/utox { }; vanitygen = callPackage ../applications/misc/vanitygen { }; vbindiff = callPackage ../applications/editors/vbindiff { }; vcprompt = callPackage ../applications/version-management/vcprompt { }; vdpauinfo = callPackage ../tools/X11/vdpauinfo { }; veracity = callPackage ../applications/version-management/veracity {}; viewMtn = builderDefsPackage (import ../applications/version-management/viewmtn/0.10.nix) { inherit monotone cheetahTemplate highlight ctags makeWrapper graphviz which python; flup = pythonPackages.flup; }; vim = callPackage ../applications/editors/vim { }; macvim = callPackage ../applications/editors/vim/macvim.nix { }; vimHugeX = vim_configurable; vim_configurable = callPackage ../applications/editors/vim/configurable.nix { inherit (pkgs) fetchurl fetchhg stdenv ncurses pkgconfig gettext composableDerivation lib config glib gtk python perl tcl ruby; inherit (pkgs.xlibs) libX11 libXext libSM libXpm libXt libXaw libXau libXmu libICE; features = "huge"; # one of tiny, small, normal, big or huge lua = pkgs.lua5; gui = config.vim.gui or "auto"; # optional features by flags flags = [ "python" "X11" ]; # only flag "X11" by now # so that we can use gccApple if we're building on darwin inherit stdenvAdapters gccApple; }; vimNox = lowPrio (vim_configurable.override { source = "vim-nox"; }); qvim = lowPrio (callPackage ../applications/editors/vim/qvim.nix { inherit (pkgs) fetchgit stdenv ncurses pkgconfig gettext composableDerivation lib config python perl tcl ruby qt4; inherit (pkgs.xlibs) libX11 libXext libSM libXpm libXt libXaw libXau libXmu libICE; inherit (pkgs) stdenvAdapters gccApple; features = "huge"; # one of tiny, small, normal, big or huge lua = pkgs.lua5; flags = [ "python" "X11" ]; # only flag "X11" by now }); vimpc = callPackage ../applications/audio/vimpc { }; virtviewer = callPackage ../applications/virtualization/virt-viewer { gtkvnc = gtkvnc.override { enableGTK3 = true; }; spice_gtk = spice_gtk.override { enableGTK3 = true; }; }; virtmanager = callPackage ../applications/virtualization/virt-manager { inherit (gnome) gnome_python; vte = gnome3.vte; dconf = gnome3.dconf; gtkvnc = gtkvnc.override { enableGTK3 = true; }; spice_gtk = spice_gtk.override { enableGTK3 = true; }; }; virtinst = callPackage ../applications/virtualization/virtinst {}; virtualgl = callPackage ../tools/X11/virtualgl { }; bumblebee = callPackage ../tools/X11/bumblebee { }; vkeybd = callPackage ../applications/audio/vkeybd { inherit (xlibs) libX11; }; vlc = callPackage ../applications/video/vlc { }; vmpk = callPackage ../applications/audio/vmpk { }; vnstat = callPackage ../applications/networking/vnstat { }; vorbisTools = callPackage ../applications/audio/vorbis-tools { }; vue = callPackage ../applications/misc/vue { jre = icedtea7_jre; }; vwm = callPackage ../applications/window-managers/vwm { }; vym = callPackage ../applications/misc/vym { }; w3m = callPackage ../applications/networking/browsers/w3m { graphicsSupport = false; }; weechat = callPackage ../applications/networking/irc/weechat { }; weechatDevel = lowPrio (callPackage ../applications/networking/irc/weechat/devel.nix { }); weston = callPackage ../applications/window-managers/weston { }; windowmaker = callPackage ../applications/window-managers/windowmaker { }; winswitch = callPackage ../tools/X11/winswitch { }; wings = callPackage ../applications/graphics/wings { erlang = erlangR14; esdl = esdl.override { erlang = erlangR14; }; }; wmname = callPackage ../applications/misc/wmname { }; wmctrl = callPackage ../tools/X11/wmctrl { }; # I'm keen on wmiimenu only >wmii-3.5 no longer has it... wmiimenu = import ../applications/window-managers/wmii31 { libixp = libixp_for_wmii; inherit fetchurl /* fetchhg */ stdenv gawk; inherit (xlibs) libX11; }; wmiiSnap = import ../applications/window-managers/wmii { libixp = libixp_for_wmii; inherit fetchurl /* fetchhg */ stdenv gawk; inherit (xlibs) libX11 xextproto libXt libXext; includeUnpack = config.stdenv.includeUnpack or false; }; wordnet = callPackage ../applications/misc/wordnet { }; wrapChromium = browser: wrapFirefox { inherit browser; browserName = browser.packageName; desktopName = "Chromium"; icon = "${browser}/share/icons/hicolor/48x48/apps/${browser.packageName}.png"; }; wrapFirefox = { browser, browserName ? "firefox", desktopName ? "Firefox", nameSuffix ? "" , icon ? "${browser}/lib/${browser.name}/browser/icons/mozicon128.png" }: let cfg = stdenv.lib.attrByPath [ browserName ] {} config; enableAdobeFlash = cfg.enableAdobeFlash or false; enableGnash = cfg.enableGnash or false; in import ../applications/networking/browsers/firefox/wrapper.nix { inherit stdenv lib makeWrapper makeDesktopItem browser browserName desktopName nameSuffix icon; plugins = assert !(enableGnash && enableAdobeFlash); ([ ] ++ lib.optional enableGnash gnash ++ lib.optional enableAdobeFlash flashplayer ++ lib.optional (cfg.enableDjvu or false) (djview4) ++ lib.optional (cfg.enableMPlayer or false) (MPlayerPlugin browser) ++ lib.optional (cfg.enableGeckoMediaPlayer or false) gecko_mediaplayer ++ lib.optional (supportsJDK && cfg.jre or false && jrePlugin ? mozillaPlugin) jrePlugin ++ lib.optional (cfg.enableGoogleTalkPlugin or false) google_talk_plugin ++ lib.optional (cfg.enableFriBIDPlugin or false) fribid ++ lib.optional (cfg.enableGnomeExtensions or false) gnome3.gnome_shell ); libs = [ gstreamer gst_plugins_base ] ++ lib.optionals (cfg.enableQuakeLive or false) (with xlibs; [ stdenv.gcc libX11 libXxf86dga libXxf86vm libXext libXt alsaLib zlib ]); gtk_modules = [ libcanberra ]; }; x11vnc = callPackage ../tools/X11/x11vnc { }; x2vnc = callPackage ../tools/X11/x2vnc { }; xaos = builderDefsPackage (import ../applications/graphics/xaos) { inherit (xlibs) libXt libX11 libXext xextproto xproto; inherit gsl aalib zlib intltool gettext perl; libpng = libpng12; }; xara = callPackage ../applications/graphics/xara { }; xawtv = callPackage ../applications/video/xawtv { }; xbindkeys = callPackage ../tools/X11/xbindkeys { }; xbmc = callPackage ../applications/video/xbmc { ffmpeg = ffmpeg_1; }; xca = callPackage ../applications/misc/xca { }; xcalib = callPackage ../tools/X11/xcalib { }; xcape = callPackage ../tools/X11/xcape { }; xchainkeys = callPackage ../tools/X11/xchainkeys { }; xchat = callPackage ../applications/networking/irc/xchat { }; xchm = callPackage ../applications/misc/xchm { }; xcompmgr = callPackage ../applications/window-managers/xcompmgr { }; compton = callPackage ../applications/window-managers/compton { }; xdaliclock = callPackage ../tools/misc/xdaliclock {}; xdg-user-dirs = callPackage ../tools/X11/xdg-user-dirs { }; xdg_utils = callPackage ../tools/X11/xdg-utils { }; xdotool = callPackage ../tools/X11/xdotool { }; xen = callPackage ../applications/virtualization/xen { stdenv = overrideGCC stdenv gcc45; }; xfe = callPackage ../applications/misc/xfe { fox = fox_1_6; }; xfig = callPackage ../applications/graphics/xfig { }; xineUI = callPackage ../applications/video/xine-ui { }; xneur_0_13 = callPackage ../applications/misc/xneur { }; xneur_0_8 = callPackage ../applications/misc/xneur/0.8.nix { }; xneur = xneur_0_13; gxneur = callPackage ../applications/misc/gxneur { inherit (gnome) libglade GConf; }; xournal = callPackage ../applications/graphics/xournal { inherit (gnome) libgnomeprint libgnomeprintui libgnomecanvas; }; xpdf = callPackage ../applications/misc/xpdf { motif = lesstif; base14Fonts = "${ghostscript}/share/ghostscript/fonts"; }; xkb_switch = callPackage ../tools/X11/xkb-switch { }; libxpdf = callPackage ../applications/misc/xpdf/libxpdf.nix { }; xpra = callPackage ../tools/X11/xpra { }; xrestop = callPackage ../tools/X11/xrestop { }; xscreensaver = callPackage ../misc/screensavers/xscreensaver { inherit (gnome) libglade; }; xsynth_dssi = callPackage ../applications/audio/xsynth-dssi { }; xterm = callPackage ../applications/misc/xterm { }; finalterm = callPackage ../applications/misc/finalterm { }; xtrace = callPackage ../tools/X11/xtrace { }; xlaunch = callPackage ../tools/X11/xlaunch { }; xmacro = callPackage ../tools/X11/xmacro { }; xmove = callPackage ../applications/misc/xmove { }; xmp = callPackage ../applications/audio/xmp { }; xnee = callPackage ../tools/X11/xnee { # Work around "missing separator" error. stdenv = overrideInStdenv stdenv [ gnumake381 ]; }; xvidcap = callPackage ../applications/video/xvidcap { inherit (gnome) scrollkeeper libglade; }; yate = callPackage ../applications/misc/yate { }; inherit (gnome3) yelp; qgis = callPackage ../applications/misc/qgis {}; qtbitcointrader = callPackage ../applications/misc/qtbitcointrader { }; ykpers = callPackage ../applications/misc/ykpers {}; yoshimi = callPackage ../applications/audio/yoshimi { fltk = fltk13; }; zathuraCollection = recurseIntoAttrs (let callPackage = newScope pkgs.zathuraCollection; in import ../applications/misc/zathura { inherit callPackage pkgs fetchurl; useMupdf = config.zathura.useMupdf or false; }); zathura = zathuraCollection.zathuraWrapper; zed = callPackage ../applications/editors/zed { }; zeroc_ice = callPackage ../development/libraries/zeroc-ice { }; girara = callPackage ../applications/misc/girara { gtk = gtk3; }; zgrviewer = callPackage ../applications/graphics/zgrviewer {}; zotero = callPackage ../applications/office/zotero { xulrunner = xulrunner_30; }; zynaddsubfx = callPackage ../applications/audio/zynaddsubfx { }; ### GAMES alienarena = callPackage ../games/alienarena { }; andyetitmoves = if stdenv.isLinux then callPackage ../games/andyetitmoves {} else null; anki = callPackage ../games/anki { }; asc = callPackage ../games/asc { lua = lua5; libsigcxx = libsigcxx12; }; astromenace = callPackage ../games/astromenace { }; atanks = callPackage ../games/atanks {}; ballAndPaddle = callPackage ../games/ball-and-paddle { guile = guile_1_8; }; bitsnbots = callPackage ../games/bitsnbots { lua = lua5; }; blackshades = callPackage ../games/blackshades { }; blackshadeselite = callPackage ../games/blackshadeselite { }; blobby = callPackage ../games/blobby { }; bsdgames = callPackage ../games/bsdgames { }; btanks = callPackage ../games/btanks { }; bzflag = callPackage ../games/bzflag { }; castle_combat = callPackage ../games/castle-combat { }; chessdb = callPackage ../games/chessdb { }; construoBase = lowPrio (callPackage ../games/construo { mesa = null; freeglut = null; }); construo = construoBase.override { inherit mesa freeglut; }; crack_attack = callPackage ../games/crack-attack { }; crafty = callPackage ../games/crafty { }; craftyFull = appendToName "full" (crafty.override { fullVariant = true; }); crrcsim = callPackage ../games/crrcsim {}; dhewm3 = callPackage ../games/dhewm3 {}; drumkv1 = callPackage ../applications/audio/drumkv1 { }; dwarf_fortress = callPackage_i686 ../games/dwarf-fortress { SDL_image = pkgsi686Linux.SDL_image.override { libpng = pkgsi686Linux.libpng12; }; }; dwarf_fortress_2014 = callPackage_i686 ../games/dwarf-fortress/df2014.nix { SDL_image = pkgsi686Linux.SDL_image.override { libpng = pkgsi686Linux.libpng12; }; }; dwarf_fortress_modable = appendToName "moddable" (dwarf_fortress.override { copyDataDirectory = true; }); dwarf_fortress_2014_modable = appendToName "moddable" (dwarf_fortress_2014.override { copyDataDirectory = true; }); dwarf-therapist = callPackage ../games/dwarf-therapist { }; d1x_rebirth = callPackage ../games/d1x-rebirth { }; d2x_rebirth = callPackage ../games/d2x-rebirth { }; eboard = callPackage ../games/eboard { }; eduke32 = callPackage ../games/eduke32 { }; egoboo = callPackage ../games/egoboo { }; exult = callPackage ../games/exult { }; flightgear = callPackage ../games/flightgear { }; freeciv = callPackage ../games/freeciv { }; freeciv_gtk = callPackage ../games/freeciv { gtkClient = true; sdlClient = false; }; freedink = callPackage ../games/freedink { }; fsg = callPackage ../games/fsg { wxGTK = wxGTK28.override { unicode = false; }; }; gemrb = callPackage ../games/gemrb { }; gl117 = callPackage ../games/gl-117 {}; glestae = callPackage ../games/glestae {}; globulation2 = callPackage ../games/globulation {}; gltron = callPackage ../games/gltron { }; gnuchess = callPackage ../games/gnuchess { }; gnugo = callPackage ../games/gnugo { }; gparted = callPackage ../tools/misc/gparted { }; gsmartcontrol = callPackage ../tools/misc/gsmartcontrol { inherit (gnome) libglademm; }; gtypist = callPackage ../games/gtypist { }; hexen = callPackage ../games/hexen { }; icbm3d = callPackage ../games/icbm3d { }; ingen = callPackage ../applications/audio/ingen { }; instead = callPackage ../games/instead { lua = lua5; }; kobodeluxe = callPackage ../games/kobodeluxe { }; lincity = builderDefsPackage (import ../games/lincity) { inherit (xlibs) libX11 libXext xextproto libICE libSM xproto; inherit libpng zlib; }; lincity_ng = callPackage ../games/lincity/ng.nix {}; mars = callPackage ../games/mars { }; micropolis = callPackage ../games/micropolis { }; mnemosyne = callPackage ../games/mnemosyne { inherit (pythonPackages) matplotlib cherrypy sqlite3; }; naev = callPackage ../games/naev { }; nexuiz = callPackage ../games/nexuiz { }; njam = callPackage ../games/njam { }; oilrush = callPackage ../games/oilrush { }; openra = callPackage ../games/openra { }; openttd = callPackage ../games/openttd { zlib = zlibStatic; }; opentyrian = callPackage ../games/opentyrian { }; openxcom = callPackage ../games/openxcom { }; pingus = callPackage ../games/pingus {}; pioneers = callPackage ../games/pioneers { }; pong3d = callPackage ../games/pong3d { }; prboom = callPackage ../games/prboom { }; quake3demo = callPackage ../games/quake3/wrapper { name = "quake3-demo-${quake3game.name}"; description = "Demo of Quake 3 Arena, a classic first-person shooter"; game = quake3game; paks = [quake3demodata]; }; quake3demodata = callPackage ../games/quake3/demo { }; quake3game = callPackage ../games/quake3/game { }; quantumminigolf = callPackage ../games/quantumminigolf {}; racer = callPackage ../games/racer { }; residualvm = callPackage ../games/residualvm { openglSupport = mesaSupported; }; rigsofrods = callPackage ../games/rigsofrods { mygui = myguiSvn; }; rili = callPackage ../games/rili { }; rogue = callPackage ../games/rogue { }; samplv1 = callPackage ../applications/audio/samplv1 { }; sauerbraten = callPackage ../games/sauerbraten {}; scid = callPackage ../games/scid { }; scummvm = callPackage ../games/scummvm { }; scorched3d = callPackage ../games/scorched3d { }; sdlmame = callPackage ../games/sdlmame { }; sgtpuzzles = builderDefsPackage (import ../games/sgt-puzzles) { inherit pkgconfig fetchsvn perl gtk; inherit (xlibs) libX11; }; simutrans = callPackage ../games/simutrans { }; soi = callPackage ../games/soi {}; # You still can override by passing more arguments. spaceOrbit = callPackage ../games/orbit { }; spring = callPackage ../games/spring { }; springLobby = callPackage ../games/spring/springlobby.nix { }; stardust = callPackage ../games/stardust {}; steam = callPackage_i686 ../games/steam {}; steamChrootEnv = callPackage_i686 ../games/steam/chrootenv.nix { zenity = gnome2.zenity; }; stuntrally = callPackage ../games/stuntrally { }; superTux = callPackage ../games/super-tux { }; superTuxKart = callPackage ../games/super-tux-kart { }; synthv1 = callPackage ../applications/audio/synthv1 { }; tbe = callPackage ../games/the-butterfly-effect {}; teetertorture = callPackage ../games/teetertorture { }; teeworlds = callPackage ../games/teeworlds { }; tennix = callPackage ../games/tennix { }; tibia = callPackage ../games/tibia { }; tintin = callPackage ../games/tintin { }; tpm = callPackage ../games/thePenguinMachine { }; tremulous = callPackage ../games/tremulous { }; speed_dreams = callPackage ../games/speed-dreams { # Torcs wants to make shared libraries linked with plib libraries (it provides static). # i686 is the only platform I know than can do that linking without plib built with -fPIC plib = plib.override { enablePIC = !stdenv.isi686; }; libpng = libpng12; }; torcs = callPackage ../games/torcs { # Torcs wants to make shared libraries linked with plib libraries (it provides static). # i686 is the only platform I know than can do that linking without plib built with -fPIC plib = plib.override { enablePIC = !stdenv.isi686; }; }; trigger = callPackage ../games/trigger { }; typespeed = callPackage ../games/typespeed { }; ufoai = callPackage ../games/ufoai { }; ultimatestunts = callPackage ../games/ultimatestunts { }; ultrastardx = callPackage ../games/ultrastardx { ffmpeg = ffmpeg_0_6; lua = lua5; }; unvanquished = callPackage ../games/unvanquished { }; uqm = callPackage ../games/uqm { }; urbanterror = callPackage ../games/urbanterror { }; ut2004demo = callPackage ../games/ut2004demo { }; vdrift = callPackage ../games/vdrift { }; vectoroids = callPackage ../games/vectoroids { }; vessel = callPackage_i686 ../games/vessel { }; warmux = callPackage ../games/warmux { }; warsow = callPackage ../games/warsow { libjpeg = libjpeg62; }; warzone2100 = callPackage ../games/warzone2100 { }; widelands = callPackage ../games/widelands { lua = lua5_1; }; worldofgoo_demo = callPackage ../games/worldofgoo { demo = true; }; worldofgoo = callPackage ../games/worldofgoo { }; xboard = callPackage ../games/xboard { }; xconq = callPackage ../games/xconq {}; # TODO: the corresponding nix file is missing # xracer = callPackage ../games/xracer { }; xonotic = callPackage ../games/xonotic { }; xskat = callPackage ../games/xskat { }; xsokoban = builderDefsPackage (import ../games/xsokoban) { inherit (xlibs) libX11 xproto libXpm libXt; }; zdoom = callPackage ../games/zdoom { }; zod = callPackage ../games/zod { }; zoom = callPackage ../games/zoom { }; keen4 = callPackage ../games/keen4 { }; zeroad = callPackage ../games/0ad { }; ### DESKTOP ENVIRONMENTS cinnamon = recurseIntoAttrs rec { callPackage = newScope pkgs.cinnamon; inherit (gnome3) gnome_common libgnomekbd gnome-menus zenity; muffin = callPackage ../desktops/cinnamon/muffin.nix { } ; cinnamon-control-center = callPackage ../desktops/cinnamon/cinnamon-control-center.nix{ }; cinnamon-settings-daemon = callPackage ../desktops/cinnamon/cinnamon-settings-daemon.nix{ }; cinnamon-session = callPackage ../desktops/cinnamon/cinnamon-session.nix{ } ; cinnamon-desktop = callPackage ../desktops/cinnamon/cinnamon-desktop.nix { }; cinnamon-translations = callPackage ../desktops/cinnamon/cinnamon-translations.nix { }; cjs = callPackage ../desktops/cinnamon/cjs.nix { }; }; enlightenment = callPackage ../desktops/enlightenment { }; e17 = recurseIntoAttrs ( let callPackage = newScope pkgs.e17; in import ../desktops/e17 { inherit callPackage pkgs; } ); e18 = recurseIntoAttrs ( let callPackage = newScope pkgs.e18; in import ../desktops/e18 { inherit callPackage pkgs; } ); gnome2 = callPackage ../desktops/gnome-2 { callPackage = pkgs.newScope pkgs.gnome2; self = pkgs.gnome2; } // pkgs.gtkLibs // { # Backwards compatibility; inherit (pkgs) libsoup libwnck gtk_doc gnome_doc_utils; }; gnome3 = recurseIntoAttrs (callPackage ../desktops/gnome-3/3.10 { callPackage = pkgs.newScope pkgs.gnome3; self = pkgs.gnome3; }); gnome3_12 = recurseIntoAttrs (callPackage ../desktops/gnome-3/3.12 { callPackage = pkgs.newScope pkgs.gnome3_12; }); gnome = recurseIntoAttrs gnome2; hsetroot = callPackage ../tools/X11/hsetroot { }; kakasi = callPackage ../tools/text/kakasi { }; kde4 = recurseIntoAttrs pkgs.kde412; kde4_next = recurseIntoAttrs( lib.lowPrioSet pkgs.kde412 ); kde412 = kdePackagesFor (pkgs.kde412 // { eigen = eigen2; libusb = libusb1; libcanberra = libcanberra_kde; }) ../desktops/kde-4.12; kdePackagesFor = self: dir: let callPackageOrig = callPackage; in let callPackage = newScope self; kde4 = callPackageOrig dir { inherit callPackage callPackageOrig; }; in kde4 // { inherit kde4; wrapper = callPackage ../build-support/kdewrapper {}; recurseForRelease = true; akunambol = callPackage ../applications/networking/sync/akunambol { }; amarok = callPackage ../applications/audio/amarok { }; bangarang = callPackage ../applications/video/bangarang { }; basket = callPackage ../applications/office/basket { }; bluedevil = callPackage ../tools/bluetooth/bluedevil { }; calligra = callPackage ../applications/office/calligra { }; colord-kde = callPackage ../tools/misc/colord-kde { }; digikam = if builtins.compareVersions "4.9" kde4.release == 1 then callPackage ../applications/graphics/digikam/2.nix { } else callPackage ../applications/graphics/digikam { }; eventlist = callPackage ../applications/office/eventlist {}; k3b = callPackage ../applications/misc/k3b { }; kadu = callPackage ../applications/networking/instant-messengers/kadu { }; kbibtex = callPackage ../applications/office/kbibtex { }; kde_gtk_config = callPackage ../tools/misc/kde-gtk-config { }; kde_wacomtablet = callPackage ../applications/misc/kde-wacomtablet { }; kdeconnect = callPackage ../applications/misc/kdeconnect { }; kdenlive = callPackage ../applications/video/kdenlive { mlt = mlt-qt4; }; kdesvn = callPackage ../applications/version-management/kdesvn { }; kdevelop = callPackage ../applications/editors/kdevelop { }; kdevplatform = callPackage ../development/libraries/kdevplatform { }; kdiff3 = callPackage ../tools/text/kdiff3 { }; kile = callPackage ../applications/editors/kile { }; kmplayer = callPackage ../applications/video/kmplayer { }; kmymoney = callPackage ../applications/office/kmymoney { }; kipi_plugins = callPackage ../applications/graphics/kipi-plugins { }; konversation = callPackage ../applications/networking/irc/konversation { }; kvirc = callPackage ../applications/networking/irc/kvirc { }; krename = callPackage ../applications/misc/krename { }; krusader = callPackage ../applications/misc/krusader { }; ksshaskpass = callPackage ../tools/security/ksshaskpass {}; ktorrent = callPackage ../applications/networking/p2p/ktorrent { }; kuickshow = callPackage ../applications/graphics/kuickshow { }; libalkimia = callPackage ../development/libraries/libalkimia { }; libktorrent = callPackage ../development/libraries/libktorrent { }; libkvkontakte = callPackage ../development/libraries/libkvkontakte { }; liblikeback = callPackage ../development/libraries/liblikeback { }; libmm-qt = callPackage ../development/libraries/libmm-qt { }; libnm-qt = callPackage ../development/libraries/libnm-qt { }; networkmanagement = callPackage ../tools/networking/networkmanagement { }; partitionManager = callPackage ../tools/misc/partition-manager { }; plasma-nm = callPackage ../tools/networking/plasma-nm { }; polkit_kde_agent = callPackage ../tools/security/polkit-kde-agent { }; psi = callPackage ../applications/networking/instant-messengers/psi { }; qtcurve = callPackage ../misc/themes/qtcurve { }; quassel = callPackage ../applications/networking/irc/quassel { dconf = gnome3.dconf; }; quasselWithoutKDE = (self.quassel.override { withKDE = false; tag = "-without-kde"; }); quasselDaemon = (self.quassel.override { monolithic = false; daemon = true; tag = "-daemon"; }); quasselClient = (self.quassel.override { monolithic = false; client = true; tag = "-client"; }); quasselClientWithoutKDE = (self.quasselClient.override { withKDE = false; tag = "-client-without-kde"; }); rekonq = callPackage ../applications/networking/browsers/rekonq { }; kwebkitpart = callPackage ../applications/networking/browsers/kwebkitpart { }; rsibreak = callPackage ../applications/misc/rsibreak { }; semnotes = callPackage ../applications/misc/semnotes { }; skrooge = callPackage ../applications/office/skrooge { }; telepathy = callPackage ../applications/networking/instant-messengers/telepathy/kde {}; yakuake = callPackage ../applications/misc/yakuake { }; zanshin = callPackage ../applications/office/zanshin { }; kwooty = callPackage ../applications/networking/newsreaders/kwooty { }; }; redshift = callPackage ../applications/misc/redshift { inherit (xorg) libX11 libXrandr libxcb randrproto libXxf86vm xf86vidmodeproto; inherit (gnome) GConf; inherit (pythonPackages) pyxdg; geoclue = geoclue2; }; oxygen_gtk = callPackage ../misc/themes/gtk2/oxygen-gtk { }; gtk_engines = callPackage ../misc/themes/gtk2/gtk-engines { }; gtk-engine-murrine = callPackage ../misc/themes/gtk2/gtk-engine-murrine { }; gnome_themes_standard = gnome3.gnome_themes_standard; mate-icon-theme = callPackage ../misc/themes/mate-icon-theme { }; mate-themes = callPackage ../misc/themes/mate-themes { }; xfce = xfce4_10; xfce4_10 = recurseIntoAttrs (import ../desktops/xfce { inherit pkgs newScope; }); ### SCIENCE ### SCIENCE/GEOMETRY drgeo = builderDefsPackage (import ../applications/science/geometry/drgeo) { inherit (gnome) libglade; inherit libxml2 perl intltool libtool pkgconfig gtk; guile = guile_1_8; }; tetgen = callPackage ../applications/science/geometry/tetgen { }; ### SCIENCE/BIOLOGY alliance = callPackage ../applications/science/electronics/alliance { motif = lesstif; }; arb = callPackage ../applications/science/biology/arb { lesstif = lesstif93; }; archimedes = callPackage ../applications/science/electronics/archimedes { }; biolib = callPackage ../development/libraries/science/biology/biolib { }; emboss = callPackage ../applications/science/biology/emboss { }; mrbayes = callPackage ../applications/science/biology/mrbayes { }; ncbiCTools = builderDefsPackage ../development/libraries/ncbi { inherit tcsh mesa lesstif; inherit (xlibs) libX11 libXaw xproto libXt libSM libICE libXmu libXext; }; ncbi_tools = callPackage ../applications/science/biology/ncbi-tools { }; paml = callPackage ../applications/science/biology/paml { }; pal2nal = callPackage ../applications/science/biology/pal2nal { }; plink = callPackage ../applications/science/biology/plink/default.nix { }; ### SCIENCE/MATH arpack = callPackage ../development/libraries/science/math/arpack { }; atlas = callPackage ../development/libraries/science/math/atlas { # The build process measures CPU capabilities and optimizes the # library to perform best on that particular machine. That is a # great feature, but it's of limited use with pre-built binaries # coming from a central build farm. tolerateCpuTimingInaccuracy = true; }; blas = callPackage ../development/libraries/science/math/blas { }; content = builderDefsPackage ../applications/science/math/content { inherit mesa lesstif; inherit (xlibs) libX11 libXaw xproto libXt libSM libICE libXmu libXext libXcursor; }; jags = callPackage ../applications/science/math/jags { }; liblapack = callPackage ../development/libraries/science/math/liblapack { }; liblapack_3_5_0 = callPackage ../development/libraries/science/math/liblapack/3.5.0.nix { }; liblbfgs = callPackage ../development/libraries/science/math/liblbfgs { }; openblas = callPackage ../development/libraries/science/math/openblas { }; openblas_0_2_10 = callPackage ../development/libraries/science/math/openblas/0.2.10.nix { liblapack = liblapack_3_5_0; }; mathematica = callPackage ../applications/science/math/mathematica { }; sage = callPackage ../applications/science/math/sage { }; ### SCIENCE/MOLECULAR-DYNAMICS gromacs = callPackage ../applications/science/molecular-dynamics/gromacs { singlePrec = true; fftw = fftwSinglePrec; cmake = cmakeCurses; }; gromacsDouble = lowPrio (callPackage ../applications/science/molecular-dynamics/gromacs { singlePrec = false; fftw = fftw; cmake = cmakeCurses; }); ### SCIENCE/LOGIC abc-verifier = callPackage ../applications/science/logic/abc {}; alt-ergo = callPackage ../applications/science/logic/alt-ergo {}; coq = callPackage ../applications/science/logic/coq { inherit (ocamlPackages) findlib lablgtk; camlp5 = ocamlPackages.camlp5_transitional; }; coq_HEAD = callPackage ../applications/science/logic/coq/HEAD.nix { inherit (ocamlPackages) findlib lablgtk; camlp5 = ocamlPackages.camlp5_transitional; }; coq_8_3 = callPackage ../applications/science/logic/coq/8.3.nix { inherit (ocamlPackages) findlib lablgtk; camlp5 = ocamlPackages.camlp5_transitional; }; cvc3 = callPackage ../applications/science/logic/cvc3 {}; ekrhyper = callPackage ../applications/science/logic/ekrhyper {}; eprover = callPackage ../applications/science/logic/eprover { texLive = texLiveAggregationFun { paths = [ texLive texLiveExtra ]; }; }; ginac = callPackage ../applications/science/math/ginac { }; hol = callPackage ../applications/science/logic/hol { }; hol_light = callPackage ../applications/science/logic/hol_light { inherit (ocamlPackages) findlib; camlp5 = ocamlPackages.camlp5_strict; }; isabelle = import ../applications/science/logic/isabelle { inherit (pkgs) stdenv fetchurl nettools perl polyml; inherit (pkgs.emacs24Packages) proofgeneral; }; iprover = callPackage ../applications/science/logic/iprover {}; leo2 = callPackage ../applications/science/logic/leo2 {}; logisim = callPackage ../applications/science/logic/logisim {}; ltl2ba = callPackage ../applications/science/logic/ltl2ba {}; matita = callPackage ../applications/science/logic/matita { ocaml = ocaml_3_11_2; inherit (ocamlPackages_3_11_2) findlib lablgtk ocaml_expat gmetadom ocaml_http lablgtkmathview ocaml_mysql ocaml_sqlite3 ocamlnet camlzip ocaml_pcre; ulex08 = ocamlPackages_3_11_2.ulex08.override { camlp5 = ocamlPackages_3_11_2.camlp5_5_transitional; }; }; matita_130312 = lowPrio (callPackage ../applications/science/logic/matita/130312.nix { inherit (ocamlPackages) findlib lablgtk ocaml_expat gmetadom ocaml_http ocaml_mysql ocamlnet ulex08 camlzip ocaml_pcre; }); minisat = callPackage ../applications/science/logic/minisat {}; opensmt = callPackage ../applications/science/logic/opensmt { }; otter = callPackage ../applications/science/logic/otter {}; picosat = callPackage ../applications/science/logic/picosat {}; prooftree = callPackage ../applications/science/logic/prooftree { inherit (ocamlPackages) findlib lablgtk; camlp5 = ocamlPackages.camlp5_transitional; }; prover9 = callPackage ../applications/science/logic/prover9 { }; satallax = callPackage ../applications/science/logic/satallax {}; spass = callPackage ../applications/science/logic/spass {}; ssreflect = callPackage ../applications/science/logic/ssreflect { camlp5 = ocamlPackages.camlp5_transitional; }; tptp = callPackage ../applications/science/logic/tptp {}; twelf = callPackage ../applications/science/logic/twelf { smlnj = if stdenv.isDarwin then smlnjBootstrap else smlnj; }; verifast = callPackage ../applications/science/logic/verifast {}; why3 = callPackage ../applications/science/logic/why3 {}; yices = callPackage ../applications/science/logic/yices {}; z3 = callPackage ../applications/science/logic/z3 {}; boolector = boolector15; boolector15 = callPackage ../applications/science/logic/boolector {}; boolector16 = lowPrio (callPackage ../applications/science/logic/boolector { useV16 = true; }); ### SCIENCE / ELECTRONICS eagle = callPackage_i686 ../applications/science/electronics/eagle { }; caneda = callPackage ../applications/science/electronics/caneda { }; gtkwave = callPackage ../applications/science/electronics/gtkwave { }; kicad = callPackage ../applications/science/electronics/kicad { wxGTK = wxGTK29; }; ngspice = callPackage ../applications/science/electronics/ngspice { }; qucs = callPackage ../applications/science/electronics/qucs { }; xoscope = callPackage ../applications/science/electronics/xoscope { }; ### SCIENCE / MATH ecm = callPackage ../applications/science/math/ecm { }; eukleides = callPackage ../applications/science/math/eukleides { texinfo = texinfo4; }; fricas = callPackage ../applications/science/math/fricas { }; gap = callPackage ../applications/science/math/gap { }; maxima = callPackage ../applications/science/math/maxima { }; wxmaxima = callPackage ../applications/science/math/wxmaxima { }; pari = callPackage ../applications/science/math/pari {}; pspp = callPackage ../applications/science/math/pssp { inherit (gnome) libglade gtksourceview; }; singular = callPackage ../applications/science/math/singular {}; scilab = callPackage ../applications/science/math/scilab { withXaw3d = false; withTk = true; withGtk = false; withOCaml = true; withX = true; }; msieve = callPackage ../applications/science/math/msieve { }; weka = callPackage ../applications/science/math/weka { }; yad = callPackage ../tools/misc/yad { }; yacas = callPackage ../applications/science/math/yacas { }; speedcrunch = callPackage ../applications/science/math/speedcrunch { qt = qt4; cmake = cmakeCurses; }; ### SCIENCE / MISC boinc = callPackage ../applications/science/misc/boinc { }; celestia = callPackage ../applications/science/astronomy/celestia { lua = lua5_1; inherit (xlibs) libXmu; inherit (pkgs.gnome) gtkglext; }; fityk = callPackage ../applications/science/misc/fityk { }; gravit = callPackage ../applications/science/astronomy/gravit { }; golly = callPackage ../applications/science/misc/golly { }; megam = callPackage ../applications/science/misc/megam { }; root = callPackage ../applications/science/misc/root { }; simgrid = callPackage ../applications/science/misc/simgrid { }; spyder = callPackage ../applications/science/spyder { inherit (pythonPackages) pyflakes rope sphinx numpy scipy matplotlib; # recommended inherit (pythonPackages) ipython pep8; # optional inherit pylint; }; stellarium = callPackage ../applications/science/astronomy/stellarium { }; tulip = callPackage ../applications/science/misc/tulip { }; vite = callPackage ../applications/science/misc/vite { }; xplanet = callPackage ../applications/science/astronomy/xplanet { }; ### MISC atari800 = callPackage ../misc/emulators/atari800 { }; ataripp = callPackage ../misc/emulators/atari++ { }; auctex = callPackage ../tools/typesetting/tex/auctex { }; beep = callPackage ../misc/beep { }; cups = callPackage ../misc/cups { libusb = libusb1; }; cups_pdf_filter = callPackage ../misc/cups/pdf-filter.nix { }; gutenprint = callPackage ../misc/drivers/gutenprint { }; gutenprintBin = callPackage ../misc/drivers/gutenprint/bin.nix { }; cupsBjnp = callPackage ../misc/cups/drivers/cups-bjnp { }; darcnes = callPackage ../misc/emulators/darcnes { }; dbacl = callPackage ../tools/misc/dbacl { }; dblatex = callPackage ../tools/typesetting/tex/dblatex { enableAllFeatures = false; }; dblatexFull = appendToName "full" (dblatex.override { enableAllFeatures = true; }); dosbox = callPackage ../misc/emulators/dosbox { }; dpkg = callPackage ../tools/package-management/dpkg { }; ekiga = newScope pkgs.gnome ../applications/networking/instant-messengers/ekiga { }; emulationstation = callPackage ../misc/emulators/emulationstation { }; electricsheep = callPackage ../misc/screensavers/electricsheep { }; fakenes = callPackage ../misc/emulators/fakenes { }; fceux = callPackage ../misc/emulators/fceux { }; foldingathome = callPackage ../misc/foldingathome { }; foo2zjs = callPackage ../misc/drivers/foo2zjs {}; foomatic_filters = callPackage ../misc/drivers/foomatic-filters {}; freestyle = callPackage ../misc/freestyle { }; gajim = callPackage ../applications/networking/instant-messengers/gajim { }; gammu = callPackage ../applications/misc/gammu { }; gensgs = callPackage_i686 ../misc/emulators/gens-gs { }; ghostscript = callPackage ../misc/ghostscript { x11Support = false; cupsSupport = config.ghostscript.cups or (!stdenv.isDarwin); gnuFork = config.ghostscript.gnu or false; }; ghostscriptX = appendToName "with-X" (ghostscript.override { x11Support = true; }); guix = callPackage ../tools/package-management/guix { }; gxemul = callPackage ../misc/gxemul { }; hatari = callPackage ../misc/emulators/hatari { }; hplip = callPackage ../misc/drivers/hplip { }; hplipWithPlugin = hplip.override { withPlugin = true; }; # using the new configuration style proposal which is unstable jack1 = callPackage ../misc/jackaudio/jack1.nix { }; jack2 = callPackage ../misc/jackaudio { }; keynav = callPackage ../tools/X11/keynav { }; lazylist = callPackage ../tools/typesetting/tex/lazylist { }; lilypond = callPackage ../misc/lilypond { guile = guile_1_8; }; martyr = callPackage ../development/libraries/martyr { }; maven = maven3; maven3 = callPackage ../misc/maven { jdk = openjdk; }; mess = callPackage ../misc/emulators/mess { inherit (pkgs.gnome) GConf; }; mupen64plus = callPackage ../misc/emulators/mupen64plus { }; mupen64plus1_5 = callPackage ../misc/emulators/mupen64plus/1.5.nix { }; nix = nixStable; nixStable = callPackage ../tools/package-management/nix { storeDir = config.nix.storeDir or "/nix/store"; stateDir = config.nix.stateDir or "/nix/var"; }; nixUnstable = callPackage ../tools/package-management/nix/unstable.nix { storeDir = config.nix.storeDir or "/nix/store"; stateDir = config.nix.stateDir or "/nix/var"; }; nixops = callPackage ../tools/package-management/nixops { }; nix-prefetch-scripts = callPackage ../tools/package-management/nix-prefetch-scripts { }; nix-repl = callPackage ../tools/package-management/nix-repl { }; nut = callPackage ../applications/misc/nut { }; solfege = callPackage ../misc/solfege { pysqlite = pkgs.pythonPackages.sqlite3; }; disnix = callPackage ../tools/package-management/disnix { }; dysnomia = callPackage ../tools/package-management/disnix/dysnomia { enableApacheWebApplication = config.disnix.enableApacheWebApplication or false; enableAxis2WebService = config.disnix.enableAxis2WebService or false; enableEjabberdDump = config.disnix.enableEjabberdDump or false; enableMySQLDatabase = config.disnix.enableMySQLDatabase or false; enablePostgreSQLDatabase = config.disnix.enablePostgreSQLDatabase or false; enableSubversionRepository = config.disnix.enableSubversionRepository or false; enableTomcatWebApplication = config.disnix.enableTomcatWebApplication or false; }; disnixos = callPackage ../tools/package-management/disnix/disnixos { }; DisnixWebService = callPackage ../tools/package-management/disnix/DisnixWebService { }; latex2html = callPackage ../tools/typesetting/tex/latex2html/default.nix { tex = tetex; }; lkproof = callPackage ../tools/typesetting/tex/lkproof { }; mysqlWorkbench = newScope gnome ../applications/misc/mysql-workbench { lua = lua5; inherit (pythonPackages) pexpect paramiko; }; robomongo = callPackage ../applications/misc/robomongo { }; opkg = callPackage ../tools/package-management/opkg { }; pgadmin = callPackage ../applications/misc/pgadmin { }; pgf = pgf2; # Keep the old PGF since some documents don't render properly with # the new one. pgf1 = callPackage ../tools/typesetting/tex/pgf/1.x.nix { }; pgf2 = callPackage ../tools/typesetting/tex/pgf/2.x.nix { }; pgfplots = callPackage ../tools/typesetting/tex/pgfplots { }; pjsip = callPackage ../applications/networking/pjsip { }; polytable = callPackage ../tools/typesetting/tex/polytable { }; PPSSPP = callPackage ../misc/emulators/ppsspp { }; uae = callPackage ../misc/emulators/uae { }; putty = callPackage ../applications/networking/remote/putty { }; retroarch = callPackage ../misc/emulators/retroarch { }; rssglx = callPackage ../misc/screensavers/rss-glx { }; xlockmore = callPackage ../misc/screensavers/xlockmore { }; samsungUnifiedLinuxDriver = import ../misc/cups/drivers/samsung { inherit fetchurl stdenv; inherit cups ghostscript glibc patchelf; gcc = import ../development/compilers/gcc/4.4 { inherit stdenv fetchurl gmp mpfr noSysDirs gettext which; texinfo = texinfo4; profiledCompiler = true; }; }; saneBackends = callPackage ../applications/graphics/sane/backends.nix { gt68xxFirmware = config.sane.gt68xxFirmware or null; snapscanFirmware = config.sane.snapscanFirmware or null; hotplugSupport = config.sane.hotplugSupport or true; libusb = libusb1; }; saneBackendsGit = callPackage ../applications/graphics/sane/backends-git.nix { gt68xxFirmware = config.sane.gt68xxFirmware or null; snapscanFirmware = config.sane.snapscanFirmware or null; hotplugSupport = config.sane.hotplugSupport or true; }; mkSaneConfig = callPackage ../applications/graphics/sane/config.nix { }; saneFrontends = callPackage ../applications/graphics/sane/frontends.nix { }; seafile-shared = callPackage ../misc/seafile-shared { }; slock = callPackage ../misc/screensavers/slock { }; sourceAndTags = import ../misc/source-and-tags { inherit pkgs stdenv unzip lib ctags; hasktags = haskellPackages.hasktags; }; splix = callPackage ../misc/cups/drivers/splix { }; streamripper = callPackage ../applications/audio/streamripper { }; sqsh = callPackage ../development/tools/sqsh { }; tetex = callPackage ../tools/typesetting/tex/tetex { libpng = libpng12; }; tex4ht = callPackage ../tools/typesetting/tex/tex4ht { }; texFunctions = import ../tools/typesetting/tex/nix pkgs; texLive = builderDefsPackage (import ../tools/typesetting/tex/texlive) { inherit builderDefs zlib bzip2 ncurses libpng ed lesstif ruby potrace gd t1lib freetype icu perl expat curl xz pkgconfig zziplib texinfo libjpeg bison python fontconfig flex poppler libpaper graphite2 makeWrapper; inherit (xlibs) libXaw libX11 xproto libXt libXpm libXmu libXext xextproto libSM libICE; ghostscript = ghostscriptX; harfbuzz = harfbuzz.override { withIcu = true; withGraphite2 = true; }; }; texLiveFull = lib.setName "texlive-full" (texLiveAggregationFun { paths = [ texLive texLiveExtra lmodern texLiveCMSuper texLiveLatexXColor texLivePGF texLiveBeamer texLiveModerncv tipa tex4ht texinfo texLiveModerntimeline ]; }); /* Look in configurations/misc/raskin.nix for usage example (around revisions where TeXLive was added) (texLiveAggregationFun { paths = [texLive texLiveExtra texLiveCMSuper texLiveBeamer ]; }) You need to use texLiveAggregationFun to regenerate, say, ls-R (TeX-related file list) Just installing a few packages doesn't work. */ texLiveAggregationFun = params: builderDefsPackage (import ../tools/typesetting/tex/texlive/aggregate.nix) ({inherit poppler perl makeWrapper;} // params); texDisser = callPackage ../tools/typesetting/tex/disser {}; texLiveContext = builderDefsPackage (import ../tools/typesetting/tex/texlive/context.nix) { inherit texLive; }; texLiveExtra = builderDefsPackage (import ../tools/typesetting/tex/texlive/extra.nix) { inherit texLive xz; }; texLiveCMSuper = builderDefsPackage (import ../tools/typesetting/tex/texlive/cm-super.nix) { inherit texLive; }; texLiveLatexXColor = builderDefsPackage (import ../tools/typesetting/tex/texlive/xcolor.nix) { inherit texLive; }; texLivePGF = builderDefsPackage (import ../tools/typesetting/tex/texlive/pgf.nix) { inherit texLiveLatexXColor texLive; }; texLiveBeamer = builderDefsPackage (import ../tools/typesetting/tex/texlive/beamer.nix) { inherit texLiveLatexXColor texLivePGF texLive; }; texLiveModerncv = builderDefsPackage (import ../tools/typesetting/tex/texlive/moderncv.nix) { inherit texLive unzip; }; texLiveModerntimeline = builderDefsPackage (import ../tools/typesetting/tex/texlive/moderntimeline.nix) { inherit texLive unzip; }; thermald = callPackage ../tools/system/thermald { }; thinkfan = callPackage ../tools/system/thinkfan { }; vice = callPackage ../misc/emulators/vice { libX11 = xlibs.libX11; giflib = giflib_4_1; }; viewnior = callPackage ../applications/graphics/viewnior { }; vimPlugins = recurseIntoAttrs (callPackage ../misc/vim-plugins { }); vimprobable2 = callPackage ../applications/networking/browsers/vimprobable2 { webkit = webkitgtk2; }; vimprobable2Wrapper = wrapFirefox { browser = vimprobable2; browserName = "vimprobable2"; desktopName = "Vimprobable2"; }; vimb = callPackage ../applications/networking/browsers/vimb { webkit = webkitgtk2; }; vimbWrapper = wrapFirefox { browser = vimb; browserName = "vimb"; desktopName = "Vimb"; }; VisualBoyAdvance = callPackage ../misc/emulators/VisualBoyAdvance { }; # Wine cannot be built in 64-bit; use a 32-bit build instead. wineStable = callPackage_i686 ../misc/emulators/wine/stable.nix { bison = bison2; }; wineUnstable = lowPrio (callPackage_i686 ../misc/emulators/wine/unstable.nix { bison = bison2; }); wine = wineStable; winetricks = callPackage ../misc/emulators/wine/winetricks.nix { inherit (gnome2) zenity; }; wxmupen64plus = callPackage ../misc/emulators/wxmupen64plus { }; x2x = callPackage ../tools/X11/x2x { }; xboxdrv = callPackage ../misc/drivers/xboxdrv { }; xinput_calibrator = callPackage ../tools/X11/xinput_calibrator { inherit (xlibs) libXi inputproto; }; xosd = callPackage ../misc/xosd { }; xsane = callPackage ../applications/graphics/sane/xsane.nix { libpng = libpng12; saneBackends = saneBackends; }; yafc = callPackage ../applications/networking/yafc { }; yandex-disk = callPackage ../tools/filesystems/yandex-disk { }; myEnvFun = import ../misc/my-env { inherit substituteAll pkgs; inherit (stdenv) mkDerivation; }; # patoline requires a rather large ocaml compilation environment. # this is why it is build as an environment and not just a normal package. # remark : the emacs mode is also installed, but you have to adjust your load-path. PatolineEnv = pack: myEnvFun { name = "patoline"; buildInputs = [ stdenv ncurses mesa freeglut libzip gcc pack.ocaml pack.findlib pack.camomile pack.dypgen pack.ocaml_sqlite3 pack.camlzip pack.lablgtk pack.camlimages pack.ocaml_cairo pack.lablgl pack.ocamlnet pack.cryptokit pack.ocaml_pcre pack.patoline ]; # this is to circumvent the bug with libgcc_s.so.1 which is # not found when using thread extraCmds = '' LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:${gcc.gcc}/lib export LD_LIBRARY_PATH ''; }; patoline = PatolineEnv ocamlPackages_4_00_1; znc = callPackage ../applications/networking/znc { }; zncModules = recurseIntoAttrs ( callPackage ../applications/networking/znc/modules.nix { } ); zsnes = callPackage_i686 ../misc/emulators/zsnes { }; snes9x-gtk = callPackage ../misc/emulators/snes9x-gtk { }; misc = import ../misc/misc.nix { inherit pkgs stdenv; }; bullet = callPackage ../development/libraries/bullet {}; dart = callPackage ../development/interpreters/dart { }; httrack = callPackage ../tools/backup/httrack { }; mg = callPackage ../applications/editors/mg { }; # Attributes for backward compatibility. adobeReader = adobe-reader; asciidocFull = asciidoc-full; # added 2014-06-22 lttngTools = lttng-tools; # added 2014-07-31 lttngUst = lttng-ust; # added 2014-07-31 }; in self; in pkgs ================================================ FILE: data/simple-pretty.nix ================================================ { a = 3; b = 4; c = { inherit ({ a = 3; }) a; e = 4; f = 5; }; d = if true then { a = 1; b = 2; c = 3; } else if false then null else { inherit ({ a = 3; b = 4; cdefgads = 5; }) cdefgads; }; f = x: x; list = [ 1 2 (f 3) ((x: x) 3) [ 4 5 ] ]; } ================================================ FILE: data/simple.nix ================================================ { a = 3; b = 4; c = { inherit ({a = 3; }) a; e = 4; f = 5; }; d = if true then { a = 1; b = 2; c = 3; } else if false then null else { inherit ({a = 3; b = 4; cdefgads = 5; }) cdefgads; }; f = x: x; list = [ 1 2 (f 3) ((x: x) 3) [ 4 5 ] ]; } ================================================ FILE: default.nix ================================================ { # For current default and explicitly supported GHCs https://search.nixos.org/packages?query=ghc&from=0&size=500&channel=unstable, Nixpkgs implicitly supports older minor versions also, until the configuration departs from compatibility with them. # Compiler in a form ghc8101 <- GHC 8.10.1, just remove spaces and dots compiler ? "ghc947" # Deafult.nix is a unit package abstraciton that allows to abstract over packages even in monorepos: # Example: pass --arg cabalName --arg packageRoot "./subprojectDir", or map default.nix over a list of tiples for subprojects. # cabalName is package resulting name: by default and on error resolves in haskellPackages.developPackage to project root directory name by default, but outside the haskellPackages.developPackage as you see below packageRoot can be different , cabalName ? "hnix" , packageRoot ? pkgs.nix-gitignore.gitignoreSource [ ] ./. # This settings expose most of the Nixpkgs Haskell.lib API: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/lib.nix # Some of these options implicitly enable other options they require, and some counterpoint options clash, obviously # Don't fail at configure time if there are multiple versions of the same package in the (recursive) dependencies of the package being built. Will delay failures, if any, to compile time. , allowInconsistentDependencies ? false # Escape the version bounds from the cabal file. You may want to avoid this function. , doJailbreak ? false # Nix dependency checking, compilation and execution of test suites listed in the package description file. # TODO(srk): 2023-11-21 # needs moving of the hnix-store-remote test harness to hnix-store-tests , doCheck ? false # Just produce a SDist src tarball , sdistTarball ? false # The strict packaging process as used on Hackage. Tests consistency of the Cabal file. , buildFromSdist ? true # Allow a shell environment to be requested , returnShellEnv ? false # Turn all warn into err with {-Wall,-Werror} , failOnAllWarnings ? false # `failOnAllWarnings` + `buildFromSdist` , buildStrictly ? false # 2020-06-02: NOTE: enableDeadCodeElimination = true: On GHC =< 8.8.3 macOS build falls due to https://gitlab.haskell.org/ghc/ghc/issues/17283 , enableDeadCodeElimination ? false # Disabled GHC code optimizations make build/tolling/dev loops faster. # Works also for Haskel IDE Engine and GHCID. # Enable optimizations for production use, and to pass benchmarks. , disableOptimization ? true # Use faster `gold` ELF linker from GNU binutils instead of older&slower but more versatile GNU linker. Is not available by default since macOS does not have it. , linkWithGold ? false # Provide an inventory of performance events and timings for the execution. Provides informaiton in an absolute sense. Nothing is timestamped. , enableLibraryProfiling ? false , enableExecutableProfiling ? false # Include tracing information & abilities. Tracing records the chronology, often with timestamps and is extensive in time , doTracing ? false # Include DWARF debugging information & abilities , enableDWARFDebugging ? true # Strip results from all debugging symbols , doStrip ? false # Nixpkgs expects shared libraries , enableSharedLibraries ? true # Ability to make static libraries , enableStaticLibraries ? false # Make hybrid executable that is also a shared library , enableSharedExecutables ? false # link executables statically against haskell libs to reduce closure size , justStaticExecutables ? false , enableSeparateBinOutput ? false # checkUnusedPackages: is `failOnAllWarnings` + `cabal sdist` + post-build dep check. # Currently uses `packunused` or GHC 8.8 internals, later switches into GHC internal feature. # Adds a post-build check to verify that dependencies declared in the cabal file are actually used. , checkUnusedPackages ? false # Generation and installation of haddock API documentation , doHaddock ? false # Generate hyperlinked source code for documentation using HsColour, and have Haddock documentation link to it. , doHyperlinkSource ? false # Generation and installation of a coverage report. See https://wiki.haskell.org/Haskell_program_coverage , doCoverage ? false # doBenchmark: Dependency checking + compilation and execution for benchmarks listed in the package description file. , doBenchmark ? false # For binaries named in `executableNamesToShellComplete` list, generate and bundle-into package an automatically loaded shell complettions , generateOptparseApplicativeCompletions ? false , executableNamesToShellComplete ? [ "hnix" ] # Include Hoogle executable and DB into derivation , withHoogle ? false # Nix by default updates and uses locally configured nixpkgs-unstable channel # Nixpkgs revision options: # `rev` vals in order of freshness -> cache & stability: # { master # , # , haskell-updates # Haskell development branch in Nixpkgs, can be inconsistent. Weekly merged into the upstream # , nixpkgs-unstable # Default branch on Nix installation, default for non NixOS # , nixos-unstable # nixpkgs-unstable that passes a bunch of base tests # , nixos-20.03 # Last stable release, gets almost no updates to recipes, gets only required backports # ... # } , rev ? "c757e9bd77b16ca2e03c89bf8bc9ecb28e0c06ad" , pkgs ? if builtins.compareVersions builtins.nixVersion "2.0" > 0 then if ((rev == "") || (rev == "default") || (rev == "local")) then import {} # Do not guard with hash, so the project is able to use current channels (rolling `rev`) of Nixpkgs else import (builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz") {} // { # Try to build dependencies even if they are marked broken. # config.allowBroken = true; } else abort "Requires Nix >= 2.0" , mkDerivation ? null , inNixShell ? false }: let hlib = pkgs.haskell.lib; lib = pkgs.lib; getDefaultGHC = "ghc${ ( # Remove '.' from the string 8.8.4 -> 884 lib.stringAsChars (c: if c == "." then "" else c) # Get default GHC version, (lib.getVersion pkgs.haskellPackages.ghc) ) }"; compilerPackage = if ((compiler == "") || (compiler == "default")) then getDefaultGHC else compiler; haskellPackages = pkgs.haskell.packages.${compilerPackage}; # Application of functions from this list to the package in code here happens # in the reverse order (from the tail). Some options depend on & override others, # so if enabling options caused Nix error or not expected result - change the order, # and please do not change this order without proper testing. listSwitchFunc = [ { switch = sdistTarball; function = hlib.sdistTarball; } { switch = buildFromSdist; function = hlib.buildFromSdist; } { switch = buildStrictly; function = hlib.buildStrictly; } { switch = disableOptimization; function = hlib.disableOptimization; } { switch = doJailbreak; function = hlib.doJailBreak; } { switch = doStrip; function = hlib.doStrip; } { switch = enableDWARFDebugging; function = hlib.enableDWARFDebugging; } { switch = linkWithGold; function = hlib.linkWithGold; } { switch = failOnAllWarnings; function = hlib.failOnAllWarnings; } { switch = justStaticExecutables; function = hlib.justStaticExecutables; } { switch = checkUnusedPackages; function = hlib.checkUnusedPackages {}; } { switch = generateOptparseApplicativeCompletions; function = hlib.generateOptparseApplicativeCompletions executableNamesToShellComplete; } { switch = doHyperlinkSource; function = hlib.doHyperlinkSource; } ]; # Function that applies enabled option to the package, used in the fold. onSwitchApplyFunc = set: object: if set.switch then set.function object else object; # General description of package package = haskellPackages.developPackage { name = cabalName; # Do not include into closure the files listed in .gitignore root = packageRoot; overrides = self: super: { hnix-store-core = super.hnix-store-core_0_6_1_0; hnix-store-remote = super.hnix-store-remote_0_6_0_0; hnix-store-nar = super.hnix-store-nar or self.hnix-store-nar; }; modifier = drv: hlib.overrideCabal drv (attrs: { buildTools = (attrs.buildTools or []) ++ [ haskellPackages.cabal-install ]; testHaskellDepends = attrs.testHaskellDepends ++ [ pkgs.nix haskellPackages.criterion ]; # Declare that the header set arguments as according Haskell.lib switches inherit allowInconsistentDependencies; inherit doCheck; inherit enableDeadCodeElimination; inherit enableLibraryProfiling; inherit enableExecutableProfiling; inherit enableSharedLibraries; inherit enableStaticLibraries; inherit enableSharedExecutables; inherit enableSeparateBinOutput; inherit doBenchmark; inherit doCoverage; inherit doHaddock; configureFlags = lib.optional doTracing "--flags=tracing"; passthru = { nixpkgs = pkgs; }; }); inherit returnShellEnv withHoogle; }; # One part of Haskell.lib options are argument switches, those are in `inherit`ed list. # Other part - are function wrappers over pkg. Fold allows to compose those. # composePackage = foldr (if switch then function) (package) ([{switch,function}]) == (functionN .. (function1 package)) composedPackage = lib.foldr (onSwitchApplyFunc) package listSwitchFunc; in # when returnShellEnv is enable, package is an shell env, we do not apply switch function. if returnShellEnv then package else composedPackage ================================================ FILE: doc/grammar.y ================================================ %glr-parser %pure-parser %locations %error-verbose %defines /* %no-lines */ %parse-param { void * scanner } %parse-param { nix::ParseData * data } %lex-param { void * scanner } %lex-param { nix::ParseData * data } %expect 1 %expect-rr 1 %code requires { #ifndef BISON_HEADER #define BISON_HEADER #include "util.hh" #include "nixexpr.hh" #include "eval.hh" namespace nix { struct ParseData { EvalState & state; SymbolTable & symbols; Expr * result; Path basePath; Symbol path; string error; Symbol sLetBody; ParseData(EvalState & state) : state(state) , symbols(state.symbols) , sLetBody(symbols.create("")) { }; }; } #define YY_DECL int yylex \ (YYSTYPE * yylval_param, YYLTYPE * yylloc_param, yyscan_t yyscanner, nix::ParseData * data) #endif } %{ #include "parser-tab.hh" #include "lexer-tab.hh" #include #include #include YY_DECL; using namespace nix; namespace nix { static void dupAttr(const AttrPath & attrPath, const Pos & pos, const Pos & prevPos) { throw ParseError(format("attribute `%1%' at %2% already defined at %3%") % showAttrPath(attrPath) % pos % prevPos); } static void dupAttr(Symbol attr, const Pos & pos, const Pos & prevPos) { throw ParseError(format("attribute `%1%' at %2% already defined at %3%") % attr % pos % prevPos); } static void addAttr(ExprAttrs * attrs, AttrPath & attrPath, Expr * e, const Pos & pos) { AttrPath::iterator i; // All attrpaths have at least one attr assert(!attrPath.empty()); for (i = attrPath.begin(); i + 1 < attrPath.end(); i++) { if (i->symbol.set()) { ExprAttrs::AttrDefs::iterator j = attrs->attrs.find(i->symbol); if (j != attrs->attrs.end()) { if (!j->second.inherited) { ExprAttrs * attrs2 = dynamic_cast(j->second.e); if (!attrs2) dupAttr(attrPath, pos, j->second.pos); attrs = attrs2; } else dupAttr(attrPath, pos, j->second.pos); } else { ExprAttrs * nested = new ExprAttrs; attrs->attrs[i->symbol] = ExprAttrs::AttrDef(nested, pos); attrs = nested; } } else { ExprAttrs *nested = new ExprAttrs; attrs->dynamicAttrs.push_back(ExprAttrs::DynamicAttrDef(i->expr, nested, pos)); attrs = nested; } } if (i->symbol.set()) { ExprAttrs::AttrDefs::iterator j = attrs->attrs.find(i->symbol); if (j != attrs->attrs.end()) { dupAttr(attrPath, pos, j->second.pos); } else { attrs->attrs[i->symbol] = ExprAttrs::AttrDef(e, pos); e->setName(i->symbol); } } else { attrs->dynamicAttrs.push_back(ExprAttrs::DynamicAttrDef(i->expr, e, pos)); } } static void addFormal(const Pos & pos, Formals * formals, const Formal & formal) { if (formals->argNames.find(formal.name) != formals->argNames.end()) throw ParseError(format("duplicate formal function argument `%1%' at %2%") % formal.name % pos); formals->formals.push_front(formal); formals->argNames.insert(formal.name); } static Expr * stripIndentation(const Pos & pos, SymbolTable & symbols, vector & es) { if (es.empty()) return new ExprString(symbols.create("")); /* Figure out the minimum indentation. Note that by design whitespace-only final lines are not taken into account. (So the " " in "\n ''" is ignored, but the " " in "\n foo''" is.) */ bool atStartOfLine = true; /* = seen only whitespace in the current line */ unsigned int minIndent = 1000000; unsigned int curIndent = 0; foreach (vector::iterator, i, es) { ExprIndStr * e = dynamic_cast(*i); if (!e) { /* Anti-quotations end the current start-of-line whitespace. */ if (atStartOfLine) { atStartOfLine = false; if (curIndent < minIndent) minIndent = curIndent; } continue; } for (unsigned int j = 0; j < e->s.size(); ++j) { if (atStartOfLine) { if (e->s[j] == ' ') curIndent++; else if (e->s[j] == '\n') { /* Empty line, doesn't influence minimum indentation. */ curIndent = 0; } else { atStartOfLine = false; if (curIndent < minIndent) minIndent = curIndent; } } else if (e->s[j] == '\n') { atStartOfLine = true; curIndent = 0; } } } /* Strip spaces from each line. */ vector * es2 = new vector; atStartOfLine = true; unsigned int curDropped = 0; unsigned int n = es.size(); for (vector::iterator i = es.begin(); i != es.end(); ++i, --n) { ExprIndStr * e = dynamic_cast(*i); if (!e) { atStartOfLine = false; curDropped = 0; es2->push_back(*i); continue; } string s2; for (unsigned int j = 0; j < e->s.size(); ++j) { if (atStartOfLine) { if (e->s[j] == ' ') { if (curDropped++ >= minIndent) s2 += e->s[j]; } else if (e->s[j] == '\n') { curDropped = 0; s2 += e->s[j]; } else { atStartOfLine = false; curDropped = 0; s2 += e->s[j]; } } else { s2 += e->s[j]; if (e->s[j] == '\n') atStartOfLine = true; } } /* Remove the last line if it is empty and consists only of spaces. */ if (n == 1) { string::size_type p = s2.find_last_of('\n'); if (p != string::npos && s2.find_first_not_of(' ', p + 1) == string::npos) s2 = string(s2, 0, p + 1); } es2->push_back(new ExprString(symbols.create(s2))); } /* If this is a single string, then don't do a concatenation. */ return es2->size() == 1 && dynamic_cast((*es2)[0]) ? (*es2)[0] : new ExprConcatStrings(pos, true, es2); } void backToString(yyscan_t scanner); void backToIndString(yyscan_t scanner); static inline Pos makeCurPos(const YYLTYPE & loc, ParseData * data) { return Pos(data->path, loc.first_line, loc.first_column); } #define CUR_POS makeCurPos(*yylocp, data) } void yyerror(YYLTYPE * loc, yyscan_t scanner, ParseData * data, const char * error) { data->error = (format("%1%, at %2%") % error % makeCurPos(*loc, data)).str(); } %} %union { // !!! We're probably leaking stuff here. nix::Expr * e; nix::ExprList * list; nix::ExprAttrs * attrs; nix::Formals * formals; nix::Formal * formal; nix::NixInt n; const char * id; // !!! -> Symbol char * path; char * uri; std::vector * attrNames; std::vector * string_parts; } %type start expr expr_function expr_if expr_op %type expr_app expr_select expr_simple %type expr_list %type binds %type formals %type formal %type attrs attrpath %type string_parts_interpolated ind_string_parts %type string_parts string_attr %type attr %token ID ATTRPATH %token STR IND_STR %token INT %token PATH SPATH %token URI %token IF THEN ELSE ASSERT WITH LET IN REC INHERIT EQ NEQ AND OR IMPL OR_KW %token DOLLAR_CURLY /* == ${ */ %token IND_STRING_OPEN IND_STRING_CLOSE %token ELLIPSIS %nonassoc IMPL %left OR %left AND %nonassoc EQ NEQ %left '<' '>' LEQ GEQ %right UPDATE %left NOT %left '+' '-' %left '*' '/' %right CONCAT %nonassoc '?' %nonassoc '~' %nonassoc NEGATE %% start: expr { data->result = $1; }; expr: expr_function; expr_function : ID ':' expr_function { $$ = new ExprLambda(CUR_POS, data->symbols.create($1), false, 0, $3); } | '{' formals '}' ':' expr_function { $$ = new ExprLambda(CUR_POS, data->symbols.create(""), true, $2, $5); } | '{' formals '}' '@' ID ':' expr_function { $$ = new ExprLambda(CUR_POS, data->symbols.create($5), true, $2, $7); } | ID '@' '{' formals '}' ':' expr_function { $$ = new ExprLambda(CUR_POS, data->symbols.create($1), true, $4, $7); } | ASSERT expr ';' expr_function { $$ = new ExprAssert(CUR_POS, $2, $4); } | WITH expr ';' expr_function { $$ = new ExprWith(CUR_POS, $2, $4); } | LET binds IN expr_function { if (!$2->dynamicAttrs.empty()) throw ParseError(format("dynamic attributes not allowed in let at %1%") % CUR_POS); $$ = new ExprLet($2, $4); } | expr_if ; expr_if : IF expr THEN expr ELSE expr { $$ = new ExprIf($2, $4, $6); } | expr_op ; expr_op : '!' expr_op %prec NOT { $$ = new ExprOpNot($2); } | '-' expr_op %prec NEGATE { $$ = new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.create("__sub")), new ExprInt(0)), $2); } | expr_op EQ expr_op { $$ = new ExprOpEq($1, $3); } | expr_op NEQ expr_op { $$ = new ExprOpNEq($1, $3); } | expr_op '<' expr_op { $$ = new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.create("__lessThan")), $1), $3); } | expr_op LEQ expr_op { $$ = new ExprOpNot(new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.create("__lessThan")), $3), $1)); } | expr_op '>' expr_op { $$ = new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.create("__lessThan")), $3), $1); } | expr_op GEQ expr_op { $$ = new ExprOpNot(new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.create("__lessThan")), $1), $3)); } | expr_op AND expr_op { $$ = new ExprOpAnd(CUR_POS, $1, $3); } | expr_op OR expr_op { $$ = new ExprOpOr(CUR_POS, $1, $3); } | expr_op IMPL expr_op { $$ = new ExprOpImpl(CUR_POS, $1, $3); } | expr_op UPDATE expr_op { $$ = new ExprOpUpdate(CUR_POS, $1, $3); } | expr_op '?' attrpath { $$ = new ExprOpHasAttr($1, *$3); } | expr_op '+' expr_op { vector * l = new vector; l->push_back($1); l->push_back($3); $$ = new ExprConcatStrings(CUR_POS, false, l); } | expr_op '-' expr_op { $$ = new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.create("__sub")), $1), $3); } | expr_op '*' expr_op { $$ = new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.create("__mul")), $1), $3); } | expr_op '/' expr_op { $$ = new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.create("__div")), $1), $3); } | expr_op CONCAT expr_op { $$ = new ExprOpConcatLists(CUR_POS, $1, $3); } | expr_app ; expr_app : expr_app expr_select { $$ = new ExprApp(CUR_POS, $1, $2); } | expr_select { $$ = $1; } ; expr_select : expr_simple '.' attrpath { $$ = new ExprSelect(CUR_POS, $1, *$3, 0); } | expr_simple '.' attrpath OR_KW expr_select { $$ = new ExprSelect(CUR_POS, $1, *$3, $5); } | /* Backwards compatibility: because Nixpkgs has a rarely used function named ‘or’, allow stuff like ‘map or [...]’. */ expr_simple OR_KW { $$ = new ExprApp(CUR_POS, $1, new ExprVar(CUR_POS, data->symbols.create("or"))); } | expr_simple { $$ = $1; } ; expr_simple : ID { if (strcmp($1, "__curPos") == 0) $$ = new ExprPos(CUR_POS); else $$ = new ExprVar(CUR_POS, data->symbols.create($1)); } | INT { $$ = new ExprInt($1); } | '"' string_parts '"' { $$ = $2; } | IND_STRING_OPEN ind_string_parts IND_STRING_CLOSE { $$ = stripIndentation(CUR_POS, data->symbols, *$2); } | PATH { $$ = new ExprPath(absPath($1, data->basePath)); } | SPATH { string path($1 + 1, strlen($1) - 2); $$ = new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.create("__findFile")), new ExprVar(data->symbols.create("nixPath"))), new ExprString(data->symbols.create(path))); } | URI { $$ = new ExprString(data->symbols.create($1)); } | '(' expr ')' { $$ = $2; } /* Let expressions `let {..., body = ...}' are just desugared into `(rec {..., body = ...}).body'. */ | LET '{' binds '}' { $3->recursive = true; $$ = new ExprSelect(noPos, $3, data->symbols.create("body")); } | REC '{' binds '}' { $3->recursive = true; $$ = $3; } | '{' binds '}' { $$ = $2; } | '[' expr_list ']' { $$ = $2; } ; string_parts : STR | string_parts_interpolated { $$ = new ExprConcatStrings(CUR_POS, true, $1); } | { $$ = new ExprString(data->symbols.create("")); } ; string_parts_interpolated : string_parts_interpolated STR { $$ = $1; $1->push_back($2); } | string_parts_interpolated DOLLAR_CURLY expr '}' { backToString(scanner); $$ = $1; $1->push_back($3); } | STR DOLLAR_CURLY expr '}' { backToString(scanner); $$ = new vector; $$->push_back($1); $$->push_back($3); } | DOLLAR_CURLY expr '}' { backToString(scanner); $$ = new vector; $$->push_back($2); } ; ind_string_parts : ind_string_parts IND_STR { $$ = $1; $1->push_back($2); } | ind_string_parts DOLLAR_CURLY expr '}' { backToIndString(scanner); $$ = $1; $1->push_back($3); } | { $$ = new vector; } ; binds : binds attrpath '=' expr ';' { $$ = $1; addAttr($$, *$2, $4, makeCurPos(@2, data)); } | binds INHERIT attrs ';' { $$ = $1; foreach (AttrPath::iterator, i, *$3) { if ($$->attrs.find(i->symbol) != $$->attrs.end()) dupAttr(i->symbol, makeCurPos(@3, data), $$->attrs[i->symbol].pos); Pos pos = makeCurPos(@3, data); $$->attrs[i->symbol] = ExprAttrs::AttrDef(new ExprVar(CUR_POS, i->symbol), pos, true); } } | binds INHERIT '(' expr ')' attrs ';' { $$ = $1; /* !!! Should ensure sharing of the expression in $4. */ foreach (AttrPath::iterator, i, *$6) { if ($$->attrs.find(i->symbol) != $$->attrs.end()) dupAttr(i->symbol, makeCurPos(@6, data), $$->attrs[i->symbol].pos); $$->attrs[i->symbol] = ExprAttrs::AttrDef(new ExprSelect(CUR_POS, $4, i->symbol), makeCurPos(@6, data)); } } | { $$ = new ExprAttrs; } ; attrs : attrs attr { $$ = $1; $1->push_back(AttrName(data->symbols.create($2))); } | attrs string_attr { $$ = $1; ExprString *str = dynamic_cast($2); if (str) { $$->push_back(AttrName(str->s)); delete str; } else throw ParseError(format("dynamic attributes not allowed in inherit at %1%") % makeCurPos(@2, data)); } | { $$ = new AttrPath; } ; attrpath : attrpath '.' attr { $$ = $1; $1->push_back(AttrName(data->symbols.create($3))); } | attrpath '.' string_attr { $$ = $1; ExprString *str = dynamic_cast($3); if (str) { $$->push_back(AttrName(str->s)); delete str; } else $$->push_back(AttrName(static_cast($3))); } | attr { $$ = new vector; $$->push_back(AttrName(data->symbols.create($1))); } | string_attr { $$ = new vector; ExprString *str = dynamic_cast($1); if (str) { $$->push_back(AttrName(str->s)); delete str; } else $$->push_back(AttrName(static_cast($1))); } ; attr : ID { $$ = $1; } | OR_KW { $$ = "or"; } ; string_attr : '"' string_parts '"' { $$ = $2; } | DOLLAR_CURLY expr '}' { $$ = new ExprConcatStrings(CUR_POS, true, new vector(1, $2)); } ; expr_list : expr_list expr_select { $$ = $1; $1->elems.push_back($2); /* !!! dangerous */ } | { $$ = new ExprList; } ; formals : formal ',' formals { $$ = $3; addFormal(CUR_POS, $$, *$1); } | formal { $$ = new Formals; addFormal(CUR_POS, $$, *$1); $$->ellipsis = false; } | { $$ = new Formals; $$->ellipsis = false; } | ELLIPSIS { $$ = new Formals; $$->ellipsis = true; } ; formal : ID { $$ = new Formal(data->symbols.create($1), 0); } | ID '?' expr { $$ = new Formal(data->symbols.create($1), $3); } ; %% #include #include #include #include #include namespace nix { Expr * EvalState::parse(const char * text, const Path & path, const Path & basePath, StaticEnv & staticEnv) { yyscan_t scanner; ParseData data(*this); data.basePath = basePath; data.path = data.symbols.create(path); yylex_init(&scanner); yy_scan_string(text, scanner); int res = yyparse(scanner, &data); yylex_destroy(scanner); if (res) throw ParseError(data.error); data.result->bindVars(staticEnv); return data.result; } Path resolveExprPath(Path path) { assert(path[0] == '/'); /* If `path' is a symlink, follow it. This is so that relative path references work. */ struct stat st; while (true) { if (lstat(path.c_str(), &st)) throw SysError(format("getting status of `%1%'") % path); if (!S_ISLNK(st.st_mode)) break; path = absPath(readLink(path), dirOf(path)); } /* If `path' refers to a directory, append `/default.nix'. */ if (S_ISDIR(st.st_mode)) path = canonPath(path + "/default.nix"); return path; } Expr * EvalState::parseExprFromFile(const Path & path) { return parseExprFromFile(path, staticBaseEnv); } Expr * EvalState::parseExprFromFile(const Path & path, StaticEnv & staticEnv) { return parse(readFile(path).c_str(), path, dirOf(path), staticEnv); } Expr * EvalState::parseExprFromString(const string & s, const Path & basePath, StaticEnv & staticEnv) { return parse(s.c_str(), "(string)", basePath, staticEnv); } Expr * EvalState::parseExprFromString(const string & s, const Path & basePath) { return parseExprFromString(s, basePath, staticBaseEnv); } void EvalState::addToSearchPath(const string & s, bool warn) { size_t pos = s.find('='); string prefix; Path path; if (pos == string::npos) { path = s; } else { prefix = string(s, 0, pos); path = string(s, pos + 1); } path = absPath(path); if (pathExists(path)) { debug(format("adding path `%1%' to the search path") % path); searchPath.push_back(std::pair(prefix, path)); } else if (warn) printMsg(lvlError, format("warning: Nix search path entry `%1%' does not exist, ignoring") % path); } Path EvalState::findFile(const string & path) { return findFile(searchPath, path); } Path EvalState::findFile(SearchPath & searchPath, const string & path) { foreach (SearchPath::iterator, i, searchPath) { Path res; if (i->first.empty()) res = i->second + "/" + path; else { if (path.compare(0, i->first.size(), i->first) != 0 || (path.size() > i->first.size() && path[i->first.size()] != '/')) continue; res = i->second + (path.size() == i->first.size() ? "" : "/" + string(path, i->first.size())); } if (pathExists(res)) return canonPath(res); } throw ThrownError(format("file `%1%' was not found in the Nix search path (add it using $NIX_PATH or -I)") % path); } } ================================================ FILE: doc/lexer.l ================================================ %option reentrant bison-bridge bison-locations %option noyywrap %option never-interactive %x STRING %x IND_STRING %{ #include "nixexpr.hh" #include "parser-tab.hh" using namespace nix; namespace nix { static void initLoc(YYLTYPE * loc) { loc->first_line = loc->last_line = 1; loc->first_column = loc->last_column = 1; } static void adjustLoc(YYLTYPE * loc, const char * s, size_t len) { loc->first_line = loc->last_line; loc->first_column = loc->last_column; while (len--) { switch (*s++) { case '\r': if (*s == '\n') /* cr/lf */ s++; /* fall through */ case '\n': ++loc->last_line; loc->last_column = 1; break; default: ++loc->last_column; } } } static Expr * unescapeStr(SymbolTable & symbols, const char * s) { string t; char c; while ((c = *s++)) { if (c == '\\') { assert(*s); c = *s++; if (c == 'n') t += '\n'; else if (c == 'r') t += '\r'; else if (c == 't') t += '\t'; else t += c; } else if (c == '\r') { /* Normalise CR and CR/LF into LF. */ t += '\n'; if (*s == '\n') s++; /* cr/lf */ } else t += c; } return new ExprString(symbols.create(t)); } } #define YY_USER_INIT initLoc(yylloc) #define YY_USER_ACTION adjustLoc(yylloc, yytext, yyleng); %} ID [a-zA-Z\_][a-zA-Z0-9\_\'\-]* INT [0-9]+ PATH [a-zA-Z0-9\.\_\-\+]*(\/[a-zA-Z0-9\.\_\-\+]+)+ SPATH \<[a-zA-Z0-9\.\_\-\+]+(\/[a-zA-Z0-9\.\_\-\+]+)*\> URI [a-zA-Z][a-zA-Z0-9\+\-\.]*\:[a-zA-Z0-9\%\/\?\:\@\&\=\+\$\,\-\_\.\!\~\*\']+ %% if { return IF; } then { return THEN; } else { return ELSE; } assert { return ASSERT; } with { return WITH; } let { return LET; } in { return IN; } rec { return REC; } inherit { return INHERIT; } or { return OR_KW; } \.\.\. { return ELLIPSIS; } \=\= { return EQ; } \!\= { return NEQ; } \<\= { return LEQ; } \>\= { return GEQ; } \&\& { return AND; } \|\| { return OR; } \-\> { return IMPL; } \/\/ { return UPDATE; } \+\+ { return CONCAT; } {ID} { yylval->id = strdup(yytext); return ID; } {INT} { errno = 0; yylval->n = strtol(yytext, 0, 10); if (errno != 0) throw ParseError(format("invalid integer `%1%'") % yytext); return INT; } \$\{ { return DOLLAR_CURLY; } \" { BEGIN(STRING); return '"'; } ([^\$\"\\]|\$[^\{\"]|\\.)+ { /* !!! Not quite right: we want a follow restriction on "$", it shouldn't be followed by a "{". Right now "$\"" will be consumed as part of a string, rather than a "$" followed by the string terminator. Disallow "$\"" for now. */ yylval->e = unescapeStr(data->symbols, yytext); return STR; } \$\{ { BEGIN(INITIAL); return DOLLAR_CURLY; } \" { BEGIN(INITIAL); return '"'; } . return yytext[0]; /* just in case: shouldn't be reached */ \'\'(\ *\n)? { BEGIN(IND_STRING); return IND_STRING_OPEN; } ([^\$\']|\$[^\{\']|\'[^\'\$])+ { yylval->e = new ExprIndStr(yytext); return IND_STR; } \'\'\$ { yylval->e = new ExprIndStr("$"); return IND_STR; } \'\'\' { yylval->e = new ExprIndStr("''"); return IND_STR; } \'\'\\. { yylval->e = unescapeStr(data->symbols, yytext + 2); return IND_STR; } \$\{ { BEGIN(INITIAL); return DOLLAR_CURLY; } \'\' { BEGIN(INITIAL); return IND_STRING_CLOSE; } \' { yylval->e = new ExprIndStr("'"); return IND_STR; } . return yytext[0]; /* just in case: shouldn't be reached */ {PATH} { yylval->path = strdup(yytext); return PATH; } {SPATH} { yylval->path = strdup(yytext); return SPATH; } {URI} { yylval->uri = strdup(yytext); return URI; } [ \t\r\n]+ /* eat up whitespace */ \#[^\r\n]* /* single-line comments */ \/\*([^*]|\*[^\/])*\*\/ /* long comments */ . return yytext[0]; %% namespace nix { /* Horrible, disgusting hack: allow the parser to set the scanner start condition back to STRING. Necessary in interpolations like "foo${expr}bar"; after the close brace we have to go back to the STRING state. */ void backToString(yyscan_t scanner) { struct yyguts_t * yyg = (struct yyguts_t *) scanner; BEGIN(STRING); } void backToIndString(yyscan_t scanner) { struct yyguts_t * yyg = (struct yyguts_t *) scanner; BEGIN(IND_STRING); } } ================================================ FILE: flake.nix ================================================ { description = "A Haskell re-implementation of the Nix expression language"; inputs = { nixpkgs.follows = "haskellNix/nixpkgs-unstable"; nix.url = "github:NixOS/nix"; haskellNix.url = "github:input-output-hk/haskell.nix"; flake-utils.url = "github:numtide/flake-utils"; }; outputs = { self, nixpkgs, nix, flake-utils, haskellNix }: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system overlays; inherit (haskellNix) config; }; flake = pkgs.hnix.flake { }; overlays = [ haskellNix.overlay (final: prev: { hnix = final.haskell-nix.project' { src = ./.; supportHpack = true; compiler-nix-name = "ghc910"; # packageRoot = pkgs.runCommand "hnix-src" {} '' # cp -r ${./.} $out # chmod -R +w $out # cp -r ${nix} $out/data/nix # ''; shell = { tools = { cabal = {}; hlint = {}; haskell-language-server = {}; }; buildInputs = with pkgs; [ haskellPackages.fourmolu pkg-config shellcheck shfmt lefthook ]; withHoogle = false; }; modules = [{ packages.hnix.doCheck = false; # enableLibraryProfiling = true; # enableProfiling = true; }]; }; }) ]; in flake // { packages.default = flake.packages."hnix:exe:hnix"; checks = (flake.checks or {}) // { formatting = pkgs.runCommand "check-formatting" { nativeBuildInputs = [ pkgs.haskellPackages.fourmolu pkgs.findutils ]; } '' cd ${./.} find src main tests benchmarks -name '*.hs' \ -exec fourmolu --mode check {} + touch $out ''; hlint = pkgs.runCommand "check-hlint" { nativeBuildInputs = [ pkgs.hlint ]; } '' cd ${./.} hlint src/ main/ tests/ benchmarks/ touch $out ''; shellcheck = pkgs.runCommand "check-shellcheck" { nativeBuildInputs = [ pkgs.shellcheck ]; } '' cd ${./.} shellcheck build.sh touch $out ''; shell-formatting = pkgs.runCommand "check-shell-formatting" { nativeBuildInputs = [ pkgs.shfmt ]; } '' cd ${./.} shfmt -d build.sh touch $out ''; }; }); } ================================================ FILE: hnix.cabal ================================================ cabal-version: 2.2 name: hnix version: 0.17.0 synopsis: Haskell implementation of the Nix language description: Haskell implementation of the Nix language. category: System, Data, Nix homepage: https://github.com/haskell-nix/hnix#readme bug-reports: https://github.com/haskell-nix/hnix/issues author: John Wiegley maintainer: johnw@newartisans.com license: BSD-3-Clause license-file: License build-type: Simple data-dir: data/ extra-source-files: ChangeLog.md ReadMe.md License data/nix/tests/lang/binary-data data/nix/tests/lang/data data/nix/tests/lang/dir1/a.nix data/nix/tests/lang/dir2/a.nix data/nix/tests/lang/dir2/b.nix data/nix/tests/lang/dir3/a.nix data/nix/tests/lang/dir3/b.nix data/nix/tests/lang/dir3/c.nix data/nix/tests/lang/dir4/a.nix data/nix/tests/lang/dir4/c.nix data/nix/tests/lang/eval-fail-abort.nix data/nix/tests/lang/eval-fail-assert.nix data/nix/tests/lang/eval-fail-bad-antiquote-1.nix data/nix/tests/lang/eval-fail-bad-antiquote-2.nix data/nix/tests/lang/eval-fail-bad-antiquote-3.nix data/nix/tests/lang/eval-fail-blackhole.nix data/nix/tests/lang/eval-fail-deepseq.nix data/nix/tests/lang/eval-fail-hashfile-missing.nix data/nix/tests/lang/eval-fail-missing-arg.nix data/nix/tests/lang/eval-fail-path-slash.nix data/nix/tests/lang/eval-fail-remove.nix data/nix/tests/lang/eval-fail-scope-5.nix data/nix/tests/lang/eval-fail-seq.nix data/nix/tests/lang/eval-fail-substring.nix data/nix/tests/lang/eval-fail-to-path.nix data/nix/tests/lang/eval-fail-undeclared-arg.nix data/nix/tests/lang/eval-okay-any-all.exp data/nix/tests/lang/eval-okay-any-all.nix data/nix/tests/lang/eval-okay-arithmetic.exp data/nix/tests/lang/eval-okay-arithmetic.nix data/nix/tests/lang/eval-okay-attrnames.exp data/nix/tests/lang/eval-okay-attrnames.nix data/nix/tests/lang/eval-okay-attrs2.exp data/nix/tests/lang/eval-okay-attrs2.nix data/nix/tests/lang/eval-okay-attrs3.exp data/nix/tests/lang/eval-okay-attrs3.nix data/nix/tests/lang/eval-okay-attrs4.exp data/nix/tests/lang/eval-okay-attrs4.nix data/nix/tests/lang/eval-okay-attrs5.exp data/nix/tests/lang/eval-okay-attrs5.nix data/nix/tests/lang/eval-okay-attrs.exp data/nix/tests/lang/eval-okay-attrs.nix data/nix/tests/lang/eval-okay-autoargs.exp data/nix/tests/lang/eval-okay-autoargs.flags data/nix/tests/lang/eval-okay-autoargs.nix data/nix/tests/lang/eval-okay-backslash-newline-1.exp data/nix/tests/lang/eval-okay-backslash-newline-1.nix data/nix/tests/lang/eval-okay-backslash-newline-2.exp data/nix/tests/lang/eval-okay-backslash-newline-2.nix data/nix/tests/lang/eval-okay-builtins-add.exp data/nix/tests/lang/eval-okay-builtins-add.nix data/nix/tests/lang/eval-okay-builtins.exp data/nix/tests/lang/eval-okay-builtins.nix data/nix/tests/lang/eval-okay-callable-attrs.exp data/nix/tests/lang/eval-okay-callable-attrs.nix data/nix/tests/lang/eval-okay-catattrs.exp data/nix/tests/lang/eval-okay-catattrs.nix data/nix/tests/lang/eval-okay-closure.exp.xml data/nix/tests/lang/eval-okay-closure.nix data/nix/tests/lang/eval-okay-comments.exp data/nix/tests/lang/eval-okay-comments.nix data/nix/tests/lang/eval-okay-concat.exp data/nix/tests/lang/eval-okay-concatmap.exp data/nix/tests/lang/eval-okay-concatmap.nix data/nix/tests/lang/eval-okay-concat.nix data/nix/tests/lang/eval-okay-concatstringssep.exp data/nix/tests/lang/eval-okay-concatstringssep.nix data/nix/tests/lang/eval-okay-context.exp data/nix/tests/lang/eval-okay-context-introspection.exp data/nix/tests/lang/eval-okay-context-introspection.nix data/nix/tests/lang/eval-okay-context.nix data/nix/tests/lang/eval-okay-curpos.exp data/nix/tests/lang/eval-okay-curpos.nix data/nix/tests/lang/eval-okay-deepseq.exp data/nix/tests/lang/eval-okay-deepseq.nix data/nix/tests/lang/eval-okay-delayed-with.exp data/nix/tests/lang/eval-okay-delayed-with-inherit.exp data/nix/tests/lang/eval-okay-delayed-with-inherit.nix data/nix/tests/lang/eval-okay-delayed-with.nix data/nix/tests/lang/eval-okay-dynamic-attrs-2.exp data/nix/tests/lang/eval-okay-dynamic-attrs-2.nix data/nix/tests/lang/eval-okay-dynamic-attrs-bare.exp data/nix/tests/lang/eval-okay-dynamic-attrs-bare.nix data/nix/tests/lang/eval-okay-dynamic-attrs.exp data/nix/tests/lang/eval-okay-dynamic-attrs.nix data/nix/tests/lang/eval-okay-elem.exp data/nix/tests/lang/eval-okay-elem.nix data/nix/tests/lang/eval-okay-empty-args.exp data/nix/tests/lang/eval-okay-empty-args.nix data/nix/tests/lang/eval-okay-eq-derivations.exp data/nix/tests/lang/eval-okay-eq-derivations.nix data/nix/tests/lang/eval-okay-eq.exp.disabled data/nix/tests/lang/eval-okay-eq.nix data/nix/tests/lang/eval-okay-filter.exp data/nix/tests/lang/eval-okay-filter.nix data/nix/tests/lang/eval-okay-flatten.exp data/nix/tests/lang/eval-okay-flatten.nix data/nix/tests/lang/eval-okay-float.exp data/nix/tests/lang/eval-okay-float.nix data/nix/tests/lang/eval-okay-fromjson.exp data/nix/tests/lang/eval-okay-fromjson.nix data/nix/tests/lang/eval-okay-fromTOML.exp data/nix/tests/lang/eval-okay-fromTOML.nix data/nix/tests/lang/eval-okay-functionargs.exp.xml data/nix/tests/lang/eval-okay-functionargs.nix data/nix/tests/lang/eval-okay-getattrpos.exp data/nix/tests/lang/eval-okay-getattrpos.nix data/nix/tests/lang/eval-okay-getattrpos-undefined.exp data/nix/tests/lang/eval-okay-getattrpos-undefined.nix data/nix/tests/lang/eval-okay-getenv.exp data/nix/tests/lang/eval-okay-getenv.nix data/nix/tests/lang/eval-okay-hash.exp data/nix/tests/lang/eval-okay-hashfile.exp data/nix/tests/lang/eval-okay-hashfile.nix data/nix/tests/lang/eval-okay-hashstring.exp data/nix/tests/lang/eval-okay-hashstring.nix data/nix/tests/lang/eval-okay-if.exp data/nix/tests/lang/eval-okay-if.nix data/nix/tests/lang/eval-okay-import.exp data/nix/tests/lang/eval-okay-import.nix data/nix/tests/lang/eval-okay-ind-string.exp data/nix/tests/lang/eval-okay-ind-string.nix data/nix/tests/lang/eval-okay-let.exp data/nix/tests/lang/eval-okay-let.nix data/nix/tests/lang/eval-okay-list.exp data/nix/tests/lang/eval-okay-list.nix data/nix/tests/lang/eval-okay-listtoattrs.exp data/nix/tests/lang/eval-okay-listtoattrs.nix data/nix/tests/lang/eval-okay-logic.exp data/nix/tests/lang/eval-okay-logic.nix data/nix/tests/lang/eval-okay-mapattrs.exp data/nix/tests/lang/eval-okay-mapattrs.nix data/nix/tests/lang/eval-okay-map.exp data/nix/tests/lang/eval-okay-map.nix data/nix/tests/lang/eval-okay-nested-with.exp data/nix/tests/lang/eval-okay-nested-with.nix data/nix/tests/lang/eval-okay-new-let.exp data/nix/tests/lang/eval-okay-new-let.nix data/nix/tests/lang/eval-okay-null-dynamic-attrs.exp data/nix/tests/lang/eval-okay-null-dynamic-attrs.nix data/nix/tests/lang/eval-okay-overrides.exp data/nix/tests/lang/eval-okay-overrides.nix data/nix/tests/lang/eval-okay-partition.exp data/nix/tests/lang/eval-okay-partition.nix data/nix/tests/lang/eval-okay-pathexists.exp data/nix/tests/lang/eval-okay-pathexists.nix data/nix/tests/lang/eval-okay-path.nix data/nix/tests/lang/eval-okay-patterns.exp data/nix/tests/lang/eval-okay-patterns.nix data/nix/tests/lang/eval-okay-readDir.exp data/nix/tests/lang/eval-okay-readDir.nix data/nix/tests/lang/eval-okay-readfile.exp data/nix/tests/lang/eval-okay-readfile.nix data/nix/tests/lang/eval-okay-redefine-builtin.exp data/nix/tests/lang/eval-okay-redefine-builtin.nix data/nix/tests/lang/eval-okay-regex-match.exp data/nix/tests/lang/eval-okay-regex-match.nix data/nix/tests/lang/eval-okay-regex-split.exp data/nix/tests/lang/eval-okay-regex-split.nix data/nix/tests/lang/eval-okay-remove.exp data/nix/tests/lang/eval-okay-remove.nix data/nix/tests/lang/eval-okay-replacestrings.exp data/nix/tests/lang/eval-okay-replacestrings.nix data/nix/tests/lang/eval-okay-scope-1.exp data/nix/tests/lang/eval-okay-scope-1.nix data/nix/tests/lang/eval-okay-scope-2.exp data/nix/tests/lang/eval-okay-scope-2.nix data/nix/tests/lang/eval-okay-scope-3.exp data/nix/tests/lang/eval-okay-scope-3.nix data/nix/tests/lang/eval-okay-scope-4.exp data/nix/tests/lang/eval-okay-scope-4.nix data/nix/tests/lang/eval-okay-scope-6.exp data/nix/tests/lang/eval-okay-scope-6.nix data/nix/tests/lang/eval-okay-scope-7.exp data/nix/tests/lang/eval-okay-scope-7.nix data/nix/tests/lang/eval-okay-search-path.exp data/nix/tests/lang/eval-okay-search-path.flags data/nix/tests/lang/eval-okay-search-path.nix data/nix/tests/lang/eval-okay-seq.exp data/nix/tests/lang/eval-okay-seq.nix data/nix/tests/lang/eval-okay-sort.exp data/nix/tests/lang/eval-okay-sort.nix data/nix/tests/lang/eval-okay-splitversion.exp data/nix/tests/lang/eval-okay-splitversion.nix data/nix/tests/lang/eval-okay-string.exp data/nix/tests/lang/eval-okay-string.nix data/nix/tests/lang/eval-okay-strings-as-attrs-names.exp data/nix/tests/lang/eval-okay-strings-as-attrs-names.nix data/nix/tests/lang/eval-okay-substring.exp data/nix/tests/lang/eval-okay-substring.nix data/nix/tests/lang/eval-okay-tail-call-1.exp-disabled data/nix/tests/lang/eval-okay-tail-call-1.nix data/nix/tests/lang/eval-okay-tojson.exp data/nix/tests/lang/eval-okay-tojson.nix data/nix/tests/lang/eval-okay-toxml2.exp data/nix/tests/lang/eval-okay-toxml2.nix data/nix/tests/lang/eval-okay-toxml.exp data/nix/tests/lang/eval-okay-toxml.nix data/nix/tests/lang/eval-okay-tryeval.exp data/nix/tests/lang/eval-okay-tryeval.nix data/nix/tests/lang/eval-okay-types.exp data/nix/tests/lang/eval-okay-types.nix data/nix/tests/lang/eval-okay-versions.exp data/nix/tests/lang/eval-okay-versions.nix data/nix/tests/lang/eval-okay-with.exp data/nix/tests/lang/eval-okay-with.nix data/nix/tests/lang/eval-okay-xml.exp.xml data/nix/tests/lang/eval-okay-xml.nix data/nix/tests/lang/imported2.nix data/nix/tests/lang/imported.nix data/nix/tests/lang/lib.nix data/nix/tests/lang/parse-fail-dup-attrs-1.nix data/nix/tests/lang/parse-fail-dup-attrs-2.nix data/nix/tests/lang/parse-fail-dup-attrs-3.nix data/nix/tests/lang/parse-fail-dup-attrs-4.nix data/nix/tests/lang/parse-fail-dup-attrs-7.nix data/nix/tests/lang/parse-fail-dup-formals.nix data/nix/tests/lang/parse-fail-mixed-nested-attrs1.nix data/nix/tests/lang/parse-fail-mixed-nested-attrs2.nix data/nix/tests/lang/parse-fail-patterns-1.nix data/nix/tests/lang/parse-fail-regression-20060610.nix data/nix/tests/lang/parse-fail-uft8.nix data/nix/tests/lang/parse-fail-undef-var-2.nix data/nix/tests/lang/parse-fail-undef-var.nix data/nix/tests/lang/parse-okay-1.nix data/nix/tests/lang/parse-okay-crlf.nix data/nix/tests/lang/parse-okay-dup-attrs-5.nix data/nix/tests/lang/parse-okay-dup-attrs-6.nix data/nix/tests/lang/parse-okay-mixed-nested-attrs-1.nix data/nix/tests/lang/parse-okay-mixed-nested-attrs-2.nix data/nix/tests/lang/parse-okay-mixed-nested-attrs-3.nix data/nix/tests/lang/parse-okay-regression-20041027.nix data/nix/tests/lang/parse-okay-regression-751.nix data/nix/tests/lang/parse-okay-subversion.nix data/nix/tests/lang/parse-okay-url.nix data/nix/tests/lang/readDir/bar data/nix/tests/lang/readDir/foo/git-hates-directories data/nixpkgs-all-packages.nix data/let-comments.nix data/let-comments-multiline.nix data/simple-pretty.nix data/simple.nix data/nixpkgs-all-packages-pretty.nix data/let.nix tests/eval-compare/builtins.appendContext.nix tests/eval-compare/builtins.eq-bottom-00.nix tests/eval-compare/builtins.fetchurl-01.nix tests/eval-compare/builtins.fromJSON-01.nix tests/eval-compare/builtins.getContext.nix tests/eval-compare/builtins.lessThan-01.nix tests/eval-compare/builtins.mapAttrs-01.nix tests/eval-compare/builtins.pathExists.nix tests/eval-compare/builtins.replaceStrings-01.nix tests/eval-compare/builtins.split-01.nix tests/eval-compare/builtins.split-02.nix tests/eval-compare/builtins.split-03.nix tests/eval-compare/builtins.split-04.nix tests/eval-compare/builtins.string.store.nix tests/eval-compare/builtins.toJSON.nix tests/eval-compare/current-system.nix tests/eval-compare/ellipsis.nix tests/eval-compare/ind-string-01.nix tests/eval-compare/ind-string-02.nix tests/eval-compare/ind-string-03.nix tests/eval-compare/ind-string-04.nix tests/eval-compare/ind-string-05.nix tests/eval-compare/ind-string-06.nix tests/eval-compare/ind-string-07.nix tests/eval-compare/ind-string-08.nix tests/eval-compare/ind-string-09.nix tests/eval-compare/ind-string-10.nix tests/eval-compare/ind-string-11.nix tests/eval-compare/ind-string-12.nix tests/eval-compare/ind-string-13.nix tests/eval-compare/ind-string-14.nix tests/eval-compare/ind-string-15.nix tests/eval-compare/ind-string-16.nix tests/eval-compare/ind-string-17.nix tests/eval-compare/paths-01.nix tests/eval-compare/placeholder.nix tests/files/attrs.nix tests/files/callLibs.nix tests/files/eighty.nix tests/files/file.nix tests/files/file2.nix tests/files/findFile.nix tests/files/force.nix tests/files/goodbye.nix tests/files/hello.nix tests/files/hello2.nix tests/files/if-then.nix tests/files/lint.nix tests/files/loop.nix tests/files/test.nix tests/files/with.nix source-repository head type: git location: https://github.com/haskell-nix/hnix flag optimize description: Enable all optimization flags manual: True default: True flag profiling description: Enable profiling manual: True default: False common shared default-language: Haskell2010 default-extensions: NoImplicitPrelude , OverloadedStrings , DeriveGeneric , DeriveDataTypeable , DeriveFunctor , DeriveFoldable , DeriveTraversable , DeriveLift , FlexibleContexts , FlexibleInstances , ScopedTypeVariables , StandaloneDeriving , TypeApplications , TypeSynonymInstances , InstanceSigs , MultiParamTypeClasses , TupleSections , LambdaCase , BangPatterns , ViewPatterns build-depends: base >= 4.12 && < 5 , data-default-class >= 0.1.2 && < 0.3 , data-fix >= 0.3.0 && < 0.4 , exceptions >= 0.10.0 && < 0.11 , filepath >= 1.4.2 && < 1.6 , optparse-applicative >= 0.14.3 && < 0.19 , relude >= 1.0.0 && < 1.3 , serialise >= 0.2.1 && < 0.3 , template-haskell >= 2.13 && < 2.23 , time >= 1.8.0 && < 1.9 || >= 1.9.3 && < 1.13 ghc-options: -Wall -Wno-incomplete-uni-patterns -fprint-potential-instances if flag(optimize) default-extensions: ApplicativeDo ghc-options: -O2 -fexpose-all-unfoldings -fspecialise-aggressively -- if !flag(profiling) -- build-depends: -- ghc-datasize library import: shared exposed-modules: Nix Nix.Prelude Nix.Utils Nix.Atoms Nix.Builtins Nix.Cache Nix.Cited Nix.Cited.Basic Nix.Context Nix.Convert Nix.Effects Nix.Effects.Basic Nix.Effects.Derivation Nix.Eval Nix.Exec Nix.Expr Nix.Expr.Shorthands Nix.Expr.Strings Nix.Expr.Types Nix.Expr.Types.Annotated Nix.Frames Nix.Fresh Nix.Fresh.Basic Nix.Json Nix.Lint Nix.Normal Nix.Options Nix.Options.Parser Nix.Parser Nix.Pretty Nix.Reduce Nix.Render Nix.Render.Frame Nix.Scope Nix.Standard Nix.String Nix.String.Coerce Nix.TH Nix.Thunk Nix.Thunk.Basic Nix.Type.Assumption Nix.Type.Env Nix.Type.Infer Nix.Type.Type Nix.Utils.Fix1 Nix.Value Nix.Value.Equal Nix.Value.Monad Nix.Var Nix.XML other-modules: Paths_hnix Nix.Unused autogen-modules: Paths_hnix hs-source-dirs: src build-depends: aeson >= 1.4.2 && < 1.6 || >= 2.0 && < 2.3 , array >= 0.4 && < 0.7 , base16-bytestring >= 0.1.1 && < 1.1 , binary >= 0.8.5 && < 0.9 , bytestring >= 0.10.8 && < 0.13 , crypton , cryptonite , memory , comonad >= 5.0.4 && < 5.2 , containers >= 0.5.11.0 && < 0.8 , deepseq >= 1.4.3 && <1.6 , dependent-sum >= 0.7 && < 0.8 , deriving-compat >= 0.3 && < 0.7 , directory >= 1.3.1 && < 1.5 , extra >= 1.7 && < 1.9 , free >= 5.1 && < 5.3 , gitrev >= 1.1.0 && < 1.4 , hashable >= 1.2.5 && < 1.5 , hashing >= 0.1.0 && < 0.2 , hnix-store-core >= 0.6.0 && < 0.9 , hnix-store-nar >= 0.1.0 && < 0.2 , hnix-store-remote >= 0.6.0 && < 0.9 , http-client >= 0.5.14 && < 0.6 || >= 0.6.4 && < 0.8 , http-client-tls >= 0.3.5 && < 0.4 , http-types >= 0.12.2 && < 0.14 , lens-family >= 1.2.2 && < 2.2 , lens-family-core >= 1.2.2 && < 2.2 , lens-family-th >= 0.5.0 && < 0.6 , logict >= 0.6.0 && < 0.7 || >= 0.7.0.2 && < 0.9 , megaparsec >= 7.0 && < 9.6 , monad-control >= 1.0.2 && < 1.1 , monadlist >= 0.0.2 && < 0.1 , mtl >= 2.2.2 && < 2.4 , neat-interpolation >= 0.4 && < 0.7 , parser-combinators >= 1.0.1 && < 1.4 , pretty-show >= 1.9.5 && < 1.11 , prettyprinter >= 1.7.0 && < 1.8 , process >= 1.6.3 && < 1.7 , ref-tf >= 0.5 && < 0.6 , regex-tdfa >= 1.2.3 && < 1.4 , scientific >= 0.3.6 && < 0.5 , semialign >= 1.2 && < 1.4 , some >= 1.0.1 && < 1.1 , split >= 0.2.3 && < 0.3 , syb >= 0.7 && < 0.8 -- provides: -- * compat instances for old versions of TH for old GHCs -- * orphan instances for TH missing instances -- aka Lift Text, Bytestring, Vector, Containers, -- we use Lift Text particulrarly for GHC 8.6 , th-lift-instances >= 0.1 && < 0.2 , text >= 1.2.3 && < 2.2 , these >= 1.0.1 && < 1.3 , transformers >= 0.5.5 && < 0.7 , transformers-base >= 0.4.5 && < 0.5 , unix-compat >= 0.4.3 && < 0.8 , unordered-containers >= 0.2.14 && < 0.3 , vector >= 0.12.0 && < 0.14 , xml >= 1.3.14 && < 1.4 executable hnix import: shared hs-source-dirs: main main-is: Main.hs other-modules: Repl Paths_hnix autogen-modules: Paths_hnix build-depends: hnix , aeson , comonad , containers , deepseq , free , haskeline >= 0.8.0.0 && < 0.9 , pretty-show , prettyprinter , ref-tf , repline >= 0.4.0.0 && < 0.5 if impl(ghc < 8.10) -- GHC < 8.10 comes with haskeline < 0.8, which we don't support. -- To simplify CI, we just disable the component. buildable: False test-suite hnix-tests import: shared type: exitcode-stdio-1.0 main-is: Main.hs other-modules: EvalTests NixLanguageTests ParserTests PrettyParseTests PrettyTests ReduceExprTests TestCommon hs-source-dirs: tests build-depends: hnix , Diff , Glob , containers , directory , hedgehog , megaparsec , neat-interpolation , pretty-show , prettyprinter , process , split , tasty , tasty-hedgehog , tasty-hunit , tasty-th , unix-compat benchmark hnix-benchmarks import: shared type: exitcode-stdio-1.0 main-is: Main.hs other-modules: ParserBench hs-source-dirs: benchmarks build-depends: hnix , criterion ================================================ FILE: hydra.json ================================================ { "enabled": 1, "hidden": true, "description": "Jobsets", "nixexprinput": "src", "nixexprpath": "jobsets.nix", "checkinterval": 300, "schedulingshares": 100, "enableemail": false, "emailoverride": "", "keepnr": 10, "inputs": { "src": { "type": "git", "value": "https://github.com/haskell-nix/hnix.git master 1", "emailresponsible": false }, "nixpkgs": { "type": "git", "value": "https://github.com/NixOS/nixpkgs-channels nixos-unstable", "emailresponsible": false }, "prs": { "type": "githubpulls", "value": "haskell-nix hnix", "emailresponsible": false } } } ================================================ FILE: jobsets.nix ================================================ { prs }: let self = import ./. {}; pkgs = self.nixpkgs; mkFetchGithub = value: { inherit value; type = "git"; emailresponsible = false; }; in with pkgs.lib; let defaults = jobs: { inherit (jobs) description; enabled = 1; hidden = false; keepnr = 10; schedulingshares = 100; checkinterval = 120; enableemail = false; emailoverride = ""; nixexprinput = "hnix"; nixexprpath = "release.nix"; inputs = jobs.inputs // { nixpkgs = { type = "git"; value = "https://github.com/NixOS/nixpkgs-channels nixos-unstable"; emailresponsible = false; }; }; }; branchJobset = branch: defaults { description = "hnix-${branch}"; inputs = { hnix = { value = "https://github.com/haskell-nix/hnix ${branch}"; type = "git"; emailresponsible = false; }; }; }; makePr = num: info: { name = "hnix-pr-${num}"; value = defaults { description = "#${num}: ${info.title}"; inputs = { hnix = { #NOTE: This should really use "pull/${num}/merge"; however, GitHub's #status checks only operate on PR heads. This creates a race #condition, which can currently only be solved by requiring PRs to be #up to date before they're merged. See #https://github.com/isaacs/github/issues/1002 value = "https://github.com/haskell-nix/hnix pull/${num}/head 1"; type = "git"; emailresponsible = false; }; }; }; }; processedPrs = mapAttrs' makePr (builtins.fromJSON (builtins.readFile prs)); jobsetsAttrs = processedPrs // genAttrs ["master" "pending"] branchJobset; in { jobsets = pkgs.writeText "spec.json" (builtins.toJSON jobsetsAttrs); } ================================================ FILE: lefthook.yml ================================================ pre-commit: parallel: true commands: fourmolu: glob: "*.hs" run: "command -v fourmolu > /dev/null && fourmolu --mode check {staged_files} || echo 'fourmolu not found (run: nix develop)'" hlint: glob: "*.hs" run: "command -v hlint > /dev/null && hlint {staged_files} || echo 'hlint not found (run: nix develop)'" shellcheck: glob: "*.sh" run: "command -v shellcheck > /dev/null && shellcheck {staged_files} || echo 'shellcheck not found (run: nix develop)'" shfmt: glob: "*.sh" run: "command -v shfmt > /dev/null && shfmt -d {staged_files} || echo 'shfmt not found (run: nix develop)'" pre-push: parallel: true commands: cabal-build-and-test: glob: "*.{hs,cabal}" run: "cabal v2-build --ghc-options=-Werror 2>&1 && cabal v2-test 2>&1" nix-check: glob: "*.{hs,nix,cabal}" run: "nix flake check --no-warn-dirty --allow-import-from-derivation 2>&1" ================================================ FILE: main/Main.hs ================================================ {-# LANGUAGE MultiWayIf #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TypeFamilies #-} module Main (main) where import Control.Comonad (extract) import qualified Control.Exception as Exception import Control.Monad.Catch import Control.Monad.Free import Control.Monad.Ref (MonadRef (readRef)) import qualified Data.HashMap.Lazy as M import qualified Data.Map as Map import qualified Data.Text.IO as Text import Data.Time import GHC.Err (errorWithoutStackTrace) import Nix hiding (force) import Nix.Convert import Nix.Eval import Nix.Json import Nix.Options.Parser import Nix.Prelude import Nix.Standard import Nix.Thunk.Basic import Nix.Type.Env (Env (..)) import qualified Nix.Type.Infer as HM import Nix.Type.Type (Scheme) import Nix.Value.Monad import Options.Applicative hiding (ParserResult (..)) import Prettyprinter hiding (list) import Prettyprinter.Render.Text (renderIO) import Relude as Prelude (force) import qualified Repl import System.IO (hPutStrLn) import Text.Show.Pretty (ppShow) main :: IO () main = do currentTime <- getCurrentTime opts <- execParser $ nixOptionsInfo currentTime main' opts main' :: Options -> IO () main' opts@Options{..} = runWithBasicEffectsIO opts execContentsFilesOrRepl where -- 2021-07-15: NOTE: This logic should be weaved stronger through CLI options logic (OptParse-Applicative code) -- As this logic is not stated in the CLI documentation, for example. So user has no knowledge of these. execContentsFilesOrRepl :: StdIO execContentsFilesOrRepl = fromMaybe loadFromCliFilePathList $ loadBinaryCacheFile <|> loadLiteralExpression <|> loadExpressionFromFile where -- \| The base case: read expressions from the last CLI directive (@[FILE]@) listed on the command line. loadFromCliFilePathList :: StdIO loadFromCliFilePathList = case getFilePaths of [] -> runRepl ["-"] -> readExpressionFromStdin _paths -> processSeveralFiles (coerce _paths) where -- \| Fall back to running the REPL runRepl = withEmptyNixContext Repl.main readExpressionFromStdin = processExpr =<< liftIO Text.getContents processSeveralFiles :: [Path] -> StdIO processSeveralFiles = traverse_ processFile where processFile path = handleResult (pure path) =<< parseNixFileLoc path -- \| The `--read` option: load expression from a serialized file. loadBinaryCacheFile :: Maybe StdIO loadBinaryCacheFile = ( \(binaryCacheFile :: Path) -> do let file = replaceExtension binaryCacheFile "nixc" processCLIOptions (pure file) =<< liftIO (readCache binaryCacheFile) ) <$> getReadFrom -- \| The `--expr` option: read expression from the argument string loadLiteralExpression :: Maybe StdIO loadLiteralExpression = processExpr <$> getExpression -- \| The `--file` argument: read expressions from the files listed in the argument file loadExpressionFromFile :: Maybe StdIO loadExpressionFromFile = -- We can start use Text as in the base case, requires changing Path -> Text -- But that is a gradual process: -- https://github.com/haskell-nix/hnix/issues/912 (processSeveralFiles . (coerce . toString <$>) . lines <=< liftIO) . ( \case "-" -> Text.getContents _fp -> readFile _fp ) <$> getFromFile processExpr :: Text -> StdIO processExpr = handleResult mempty . parseNixTextLoc withEmptyNixContext = withNixContext mempty -- 2021-07-15: NOTE: @handleResult@ & @process@ - have atrocious size & compexity, they need to be decomposed & refactored. handleResult mpath = either ( \err -> bool errorWithoutStackTrace (liftIO . hPutStrLn stderr) isIgnoreErrors $ "Parse failed: " <> show err ) ( \expr -> do when isCheck $ do expr' <- liftIO $ reduceExpr mpath expr either (\err -> errorWithoutStackTrace $ "Type error: " <> ppShow err) ( liftIO . putStrLn . (<>) "Type of expression: " . ppShow . maybeToMonoid . Map.lookup @VarName @[Scheme] "it" . coerce ) $ HM.inferTop mempty $ curry one "it" $ stripAnnotation expr' -- liftIO $ putStrLn $ runST $ -- runLintM opts . renderSymbolic =<< lint opts expr catch (processCLIOptions mpath expr) $ \case NixException frames -> errorWithoutStackTrace . show =<< renderFrames @StdVal @StdThun frames when isRepl $ withEmptyNixContext $ bool Repl.main ((Repl.main' . pure) =<< nixEvalExprLoc (coerce mpath) expr) isEvaluate ) -- 2021-07-15: NOTE: Logic of CLI Option processing is scattered over several functions, needs to be consolicated. processCLIOptions :: Maybe Path -> NExprLoc -> StdIO processCLIOptions mpath expr | isEvaluate = if | isTrace -> evaluateExprWith nixTracingEvalExprLoc expr | Just path <- getReduce -> evaluateExprWith (reduction path . coerce) expr | null getArg || null getArgstr -> evaluateExprWith nixEvalExprLoc expr | otherwise -> processResult printer <=< nixEvalExprLoc (coerce mpath) $ expr | isXml = fail "Rendering expression trees to XML is not yet implemented" | isJson = fail "Rendering expression trees to JSON is not implemented" | getVerbosity >= DebugInfo = liftIO . putStr . ppShow . stripAnnotation $ expr | isCache, Just path <- mpath = liftIO . writeCache (replaceExtension path "nixc") $ expr | isParseOnly = void . liftIO . Exception.evaluate . force $ expr | otherwise = liftIO . renderIO stdout . layoutPretty (LayoutOptions $ AvailablePerLine 80 0.4) . prettyNix . stripAnnotation $ expr where evaluateExprWith evaluator = evaluateExpression (coerce mpath) evaluator printer printer :: StdVal -> StdIO printer | isFinder = findAttrs <=< fromValue @(AttrSet StdVal) | otherwise = printer' where -- 2021-05-27: NOTE: With naive fix of the #941 -- This is overall a naive printer implementation, as options should interact/respect one another. -- A nice question: "Should respect one another to what degree?": Go full combinator way, for which -- old Nix CLI is nototrious for (and that would mean to reimplement the old Nix CLI), -- OR: https://github.com/haskell-nix/hnix/issues/172 and have some sane standart/default behaviour for (most) keys. printer' | isXml = out (ignoreContext . toXML) normalForm | isJson = out (ignoreContext . mempty . toJSONNixString) normalForm | isStrict = out (show . prettyNValue) normalForm | isValues = out (show . prettyNValueProv) removeEffects | otherwise = out (show . prettyNValue) removeEffects where out :: (b -> Text) -> (a -> StandardIO b) -> a -> StdIO out transform val = liftIO . Text.putStrLn . transform <=< val findAttrs :: AttrSet StdVal -> StdIO findAttrs = go mempty where go :: Text -> AttrSet StdVal -> StdIO go prefix s = traverse_ ( \(k, mv) -> do let path = prefix <> k (report, descend) = filterEntry path k when report $ do liftIO $ Text.putStrLn path when descend $ maybe stub ( \case NVSet _ s' -> go (path <> ".") s' _ -> stub ) mv ) =<< traverse ( \(k, nv) -> (k,) <$> free ( \(StdThunk (extract -> Thunk _ _ ref)) -> do let path = prefix <> k (_, descend) = filterEntry path k val <- readRef @StandardIO ref bool (pure Nothing) (forceEntry path nv) ( descend && deferred (const False) (const True) val ) ) (pure . pure . Free) nv ) (sortWith fst $ M.toList $ M.mapKeys coerce s) where filterEntry path k = case (path, k) of ("stdenv", "stdenv") -> (True, True) (_, "stdenv") -> (False, False) (_, "out") -> (True, False) (_, "src") -> (True, False) (_, "mirrorsFile") -> (True, False) (_, "buildPhase") -> (True, False) (_, "builder") -> (False, False) (_, "drvPath") -> (False, False) (_, "outPath") -> (False, False) (_, "__impureHostDeps") -> (False, False) (_, "__sandboxProfile") -> (False, False) ("pkgs", "pkgs") -> (True, True) (_, "pkgs") -> (False, False) (_, "drvAttrs") -> (False, False) _ -> (True, True) forceEntry :: (MonadValue a StandardIO) => Text -> a -> StandardIO (Maybe a) forceEntry k v = catch (pure <$> demand v) fun where fun :: NixException -> StandardIO (Maybe a) fun (coerce -> frames) = do liftIO . Text.putStrLn . (("Exception forcing " <> k <> ": ") <>) . show =<< renderFrames @StdVal @StdThun frames pure Nothing reduction path mpathToContext annExpr = do eres <- withNixContext mpathToContext $ reducingEvalExpr evalContent mpathToContext annExpr handleReduced path eres handleReduced :: (MonadThrow m, MonadIO m) => Path -> (NExprLoc, Either SomeException (NValue t f m)) -> m (NValue t f m) handleReduced (coerce -> path) (expr', eres) = do liftIO $ do putStrLn $ "Wrote sifted expression tree to " <> path writeFile path $ show $ prettyNix $ stripAnnotation expr' either throwM pure eres ================================================ FILE: main/Repl.hs ================================================ {- This code was authored by: Stephen Diehl Kwang Yul Seo It was made available under the MIT license. See the src/Nix/Type directory for more details. -} {-# LANGUAGE MultiWayIf #-} module Repl ( main, main', ) where import Nix hiding (exec) import Nix.Prelude hiding (state) import Nix.Scope import Nix.Value.Monad (demand) import Data.Char (isSpace) import qualified Data.HashMap.Lazy as M import Data.List (dropWhileEnd) import qualified Data.Text as Text import qualified Data.Text.IO as Text import Data.Version (showVersion) import Paths_hnix (version) import Control.Monad.Catch import Prettyprinter ( Doc, space, ) import qualified Prettyprinter import qualified Prettyprinter.Render.Text as Prettyprinter import System.Console.Haskeline.Completion ( Completion (isFinished), completeWordWithPrev, listFiles, simpleCompletion, ) import System.Console.Repline ( Cmd, CompleterStyle (Prefix), CompletionFunc, ExitDecision (Exit), HaskelineT, MultiLine (MultiLine, SingleLine), evalRepl, ) import qualified System.Console.Repline as Console import qualified System.Exit as Exit import qualified System.IO.Error as Error -- | Repl entry point main :: (MonadNix e t f m, MonadIO m, MonadMask m) => m () main = main' Nothing {- | Principled version allowing to pass initial value for context. Passed value is stored in context with "input" key. -} main' :: (MonadNix e t f m, MonadIO m, MonadMask m) => Maybe (NValue t f m) -> m () main' iniVal = do s <- initState iniVal evalStateT ( evalRepl banner (cmd . fromString) options (pure commandPrefix) (pure "paste") completion (rcFile *> greeter) finalizer ) s where commandPrefix = ':' banner = pure . \case SingleLine -> "hnix> " MultiLine -> "| " greeter = liftIO $ putStrLn $ "Welcome to hnix " <> showVersion version <> ". For help type :help\n" finalizer = do liftIO $ putStrLn "Goodbye." pure Exit rcFile = do f <- liftIO $ readFile ".hnixrc" `catch` handleMissing traverse_ ( ( \case (prefixedCommand : xs) | Text.head prefixedCommand == commandPrefix -> do let arguments = unwords xs command = Text.tail prefixedCommand optMatcher command options arguments x -> cmd $ unwords x ) . words ) (lines f) handleMissing e | Error.isDoesNotExistError e = stub | otherwise = throwM e -- Replicated and slightly adjusted `optMatcher` from `System.Console.Repline` -- which doesn't export it. -- * @MonadIO m@ instead of @MonadHaskeline m@ -- * @putStrLn@ instead of @outputStrLn@ optMatcher :: (MonadIO m) => Text -> Console.Options m -> Text -> m () optMatcher s [] _ = liftIO $ Text.putStrLn $ "No such command :" <> s optMatcher s ((x, m) : xs) args | s `Text.isPrefixOf` fromString x = m $ toString args | otherwise = optMatcher s xs args -- * Types data IState t f m = IState { replIt :: Maybe NExprLoc -- ^ Last expression entered , replCtx :: Scope (NValue t f m) -- ^ Scope. Value environment. , replCfg :: ReplConfig -- ^ REPL configuration } deriving (Eq, Show) data ReplConfig = ReplConfig { cfgDebug :: Bool , cfgStrict :: Bool , cfgValues :: Bool } deriving (Eq, Show) defReplConfig :: ReplConfig defReplConfig = ReplConfig { cfgDebug = False , cfgStrict = False , cfgValues = False } -- | Create initial IState for REPL initState :: (MonadNix e t f m) => Maybe (NValue t f m) -> m (IState t f m) initState mIni = do builtins <- evalText "builtins" let scope = coerce $ M.fromList $ ("builtins", builtins) : fmap ("input",) (maybeToList mIni) opts <- askOptions pure $ IState Nothing scope defReplConfig { cfgStrict = isStrict opts , cfgValues = isValues opts } where evalText :: (MonadNix e t f m) => Text -> m (NValue t f m) evalText expr = either (\e -> fail $ toString $ "Impossible happened: Unable to parse expression - '" <> expr <> "' fail was " <> show e) evalExprLoc (parseNixTextLoc expr) type Repl e t f m = HaskelineT (StateT (IState t f m) m) -- * Execution exec :: forall e t f m. (MonadNix e t f m, MonadIO m) => Bool -> Text -> Repl e t f m (Maybe (NValue t f m)) exec update source = do -- Get the current interpreter state state <- get when (cfgDebug $ replCfg state) $ liftIO $ print state -- Parser ( returns AST as `NExprLoc` ) case parseExprOrBinding source of (Left err, _) -> do liftIO $ print err pure Nothing (Right expr, isBinding) -> do -- Type Inference ( returns Typing Environment ) -- -- import qualified Nix.Type.Env as Env -- import Nix.Type.Infer -- -- let tyctx' = inferTop mempty [("repl", stripAnnotation expr)] -- liftIO $ print tyctx' mVal <- lift $ lift $ try $ pushScope (replCtx state) (evalExprLoc expr) either ( \(NixException frames) -> do lift $ lift $ liftIO . print =<< renderFrames @(NValue t f m) @t frames pure Nothing ) ( \val -> do -- Update the interpreter state when (update && isBinding) $ do -- Set `replIt` to last entered expression put state{replIt = pure expr} -- If the result value is a set, update our context with it case val of NVSet _ (coerce -> scope) -> put state{replCtx = scope <> replCtx state} _ -> stub pure $ pure val ) mVal where -- If parsing fails, turn the input into singleton attribute set -- and try again. -- -- This allows us to handle assignments like @a = 42@ -- which get turned into @{ a = 42; }@ parseExprOrBinding i = either ( \e -> either (const (Left e, False)) -- return the first parsing failure (\e' -> (pure e', True)) (parseNixTextLoc $ toAttrSet i) ) (\expr -> (pure expr, False)) (parseNixTextLoc i) toAttrSet i = "{" <> i <> whenFalse ";" (Text.isSuffixOf ";" i) <> "}" cmd :: (MonadNix e t f m, MonadIO m) => Text -> Repl e t f m () cmd source = do mVal <- exec True source maybe stub printValue mVal printValue :: (MonadNix e t f m, MonadIO m) => NValue t f m -> Repl e t f m () printValue val = do cfg <- replCfg <$> get let g :: (MonadIO m) => Doc ann0 -> m () g = liftIO . print lift $ lift $ ( if | cfgStrict cfg -> g . prettyNValue <=< normalForm | cfgValues cfg -> g . prettyNValueProv <=< removeEffects | otherwise -> g . prettyNValue <=< removeEffects ) val -- * Commands -- | @:browse@ command browse :: (MonadNix e t f m, MonadIO m) => Text -> Repl e t f m () browse _ = do state <- get traverse_ ( \(k, v) -> do liftIO $ Text.putStr $ coerce k <> " = " printValue v ) (M.toList $ coerce $ replCtx state) -- | @:load@ command load :: (MonadNix e t f m, MonadIO m) => Path -> Repl e t f m () load path = do contents <- liftIO $ readFile $ trim path void $ exec True contents where trim :: Path -> Path trim = coerce . dropWhileEnd isSpace . dropWhile isSpace . coerce -- | @:type@ command typeof :: (MonadNix e t f m, MonadIO m) => Text -> Repl e t f m () typeof src = do state <- get mVal <- maybe (exec False src) (pure . pure) (M.lookup (coerce src) (coerce $ replCtx state)) traverse_ printValueType mVal where printValueType = liftIO . Text.putStrLn <=< lift . lift . showValueType -- | @:quit@ command quit :: (MonadNix e t f m, MonadIO m) => a -> Repl e t f m () quit _ = liftIO Exit.exitSuccess -- | @:set@ command setConfig :: (MonadNix e t f m, MonadIO m) => Text -> Repl e t f m () setConfig args = handlePresence (liftIO $ Text.putStrLn "No option to set specified") ( \(x : _xs) -> case filter ((== x) . helpSetOptionName) helpSetOptions of [opt] -> modify (\s -> s{replCfg = helpSetOptionFunction opt (replCfg s)}) _ -> liftIO $ Text.putStrLn "No such option" ) $ words args -- * Interactive Shell -- | Prefix tab completer defaultMatcher :: (MonadIO m) => [(String, CompletionFunc m)] defaultMatcher = one (":load", Console.fileCompleter) completion :: (MonadNix e t f m, MonadIO m) => CompleterStyle (StateT (IState t f m) m) completion = System.Console.Repline.Prefix (completeWordWithPrev (pure '\\') separators completeFunc) defaultMatcher where separators :: String separators = " \t[(,=+*&|}#?>:" {- | Main completion function Heavily inspired by Dhall Repl, with `algebraicComplete` adjusted to monadic variant able to `demand` thunks. -} completeFunc :: forall e t f m. (MonadNix e t f m, MonadIO m) => -- 2021-04-02: So far conversiton to Text here is not productive, -- since Haskeline uses String of all this. String -> String -> (StateT (IState t f m) m) [Completion] completeFunc reversedPrev word -- Commands | reversedPrev == ":" = pure . listCompletion $ toString . helpOptionName <$> (helpOptions :: HelpOptions e t f m) -- Files | any (`isPrefixOf` word) ["/", "./", "../", "~/"] = listFiles word -- Attributes of sets in REPL context | var : subFields <- Text.split (== '.') (fromString word) , isPresent subFields = do state <- get maybe stub ( \binding -> do candidates <- lift $ algebraicComplete subFields binding pure $ notFinished <$> listCompletion ( toString . (var <>) <$> candidates ) ) (M.lookup (coerce var) $ coerce $ replCtx state) -- Builtins, context variables | otherwise = do state <- get let scopeHashMap :: HashMap VarName (NValue t f m) scopeHashMap = coerce $ replCtx state contextKeys :: [VarName] contextKeys = M.keys scopeHashMap builtins :: AttrSet (NValue t f m) (Just (NVSet _ builtins)) = M.lookup "builtins" scopeHashMap shortBuiltins :: [VarName] shortBuiltins = M.keys builtins pure $ listCompletion $ toString <$> one "__includes" <> contextKeys <> shortBuiltins where listCompletion = fmap simpleCompletion . filter (word `isPrefixOf`) notFinished x = x{isFinished = False} algebraicComplete :: (MonadNix e t f m) => [Text] -> NValue t f m -> m [Text] algebraicComplete subFields val = let keys = fmap ("." <>) . M.keys withMap m = case subFields of [] -> pure $ keys m -- Stop on last subField (we care about the keys at this level) [_] -> pure $ keys m f : fs -> maybe stub ( (<<$>>) (("." <> f) <>) . algebraicComplete fs <=< demand ) (M.lookup (coerce f) m) in case val of NVSet _ xs -> withMap (M.mapKeys coerce xs) _ -> stub {- | HelpOption inspired by Dhall Repl with `Doc` instead of String for syntax and doc -} data HelpOption e t f m = HelpOption { helpOptionName :: Text , helpOptionSyntax :: Doc () , helpOptionDoc :: Doc () , helpOptionFunction :: Cmd (Repl e t f m) } type HelpOptions e t f m = [HelpOption e t f m] helpOptions :: (MonadNix e t f m, MonadIO m) => HelpOptions e t f m helpOptions = [ HelpOption "help" mempty "Print help text" (help helpOptions . fromString) , HelpOption "paste" mempty "Enter multi-line mode" (error "Unreachable") , HelpOption "load" "FILENAME" "Load .nix file into scope" (load . fromString) , HelpOption "browse" mempty "Browse bindings in interpreter context" (browse . fromString) , HelpOption "type" "EXPRESSION" "Evaluate expression or binding from context and print the type of the result value" (typeof . fromString) , HelpOption "quit" mempty "Quit interpreter" quit , HelpOption "set" mempty ( "Set REPL option" <> Prettyprinter.line <> "Available options:" <> Prettyprinter.line <> renderSetOptions helpSetOptions ) (setConfig . fromString) ] -- | Options for :set data HelpSetOption = HelpSetOption { helpSetOptionName :: Text , helpSetOptionSyntax :: Doc () , helpSetOptionDoc :: Doc () , helpSetOptionFunction :: ReplConfig -> ReplConfig } helpSetOptions :: [HelpSetOption] helpSetOptions = [ HelpSetOption "strict" mempty "Enable strict evaluation of REPL expressions" (\x -> x{cfgStrict = True}) , HelpSetOption "lazy" mempty "Disable strict evaluation of REPL expressions" (\x -> x{cfgStrict = False}) , HelpSetOption "values" mempty "Enable printing of value provenance information" (\x -> x{cfgValues = True}) , HelpSetOption "novalues" mempty "Disable printing of value provenance information" (\x -> x{cfgValues = False}) , HelpSetOption "debug" mempty "Enable printing of REPL debug information" (\x -> x{cfgDebug = True}) , HelpSetOption "nodebug" mempty "Disable REPL debugging" (\x -> x{cfgDebug = False}) ] renderSetOptions :: [HelpSetOption] -> Doc () renderSetOptions so = Prettyprinter.indent 4 $ Prettyprinter.vsep $ ( \h -> Prettyprinter.pretty (helpSetOptionName h) <> space <> helpSetOptionSyntax h <> Prettyprinter.line <> Prettyprinter.indent 4 (helpSetOptionDoc h) ) <$> so help :: (MonadNix e t f m, MonadIO m) => HelpOptions e t f m -> Text -> Repl e t f m () help hs _ = do liftIO $ putStrLn "Available commands:\n" traverse_ ( \h -> liftIO . Text.putStrLn . Prettyprinter.renderStrict . Prettyprinter.layoutPretty Prettyprinter.defaultLayoutOptions $ ":" <> Prettyprinter.pretty (helpOptionName h) <> space <> helpOptionSyntax h <> Prettyprinter.line <> Prettyprinter.indent 4 (helpOptionDoc h) ) hs options :: (MonadNix e t f m, MonadIO m) => Console.Options (Repl e t f m) options = (\h -> (toString $ helpOptionName h, helpOptionFunction h)) <$> helpOptions ================================================ FILE: release.nix ================================================ {}: let matrix = [ { compiler = "ghc863"; doStrict = false; doTracing = false; } { compiler = "ghc863"; doStrict = false; doTracing = true; } { compiler = "ghc844"; doStrict = false; doTracing = false; } { compiler = "ghc844"; doStrict = false; doTracing = true; } # Broken # { compiler = "ghc802"; doStrict = false; doTracing = false; } # { compiler = "ghc802"; doStrict = false; doTracing = true; } # Deprecated # { compiler = "ghc822"; doStrict = true; doTracing = false; } # { compiler = "ghc822"; doStrict = true; doTracing = true; } # Broken # { compiler = "ghcjs"; doStrict = false; doTracing = false; } ]; boolToString = x: if x then "true" else "false"; nameForConfig = {compiler, doStrict, doTracing}: builtins.concatStringsSep "-" [ compiler (boolToString doStrict) (boolToString doTracing) ]; in builtins.listToAttrs (map (args: { name = nameForConfig args; value = import ./. args; }) matrix) ================================================ FILE: shell.nix ================================================ attrs@{...}: let defaultAttrs = { # Defaults are put in this form deliberately. Details: #748 withHoogle = true; returnShellEnv = true; compiler = "ghc947"; }; in (import ./. (defaultAttrs // attrs)) ================================================ FILE: src/Nix/Atoms.hs ================================================ {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveAnyClass #-} module Nix.Atoms where import Codec.Serialise (Serialise) import Nix.Prelude import Data.Aeson.Types ( FromJSON, ToJSON, ) import Data.Binary (Binary) import Data.Data (Data) import Data.Fixed (mod') -- 2021-08-01: NOTE: Check the order effectiveness of NAtom constructors. {- | Atoms are values that evaluate to themselves. In other words - this is a constructors that are literals in Nix. This means that they appear in both the parsed AST (in the form of literals) and the evaluated form as themselves. Once HNix parsed or evaluated into atom - that is a literal further after, for any further evaluation it is in all cases stays constantly itself. "atom", Ancient Greek \( atomos \) - "indivisible" particle, indivisible expression. -} data NAtom = -- | An URI like @https://example.com@. NURI Text | -- | An integer. The c nix implementation currently only supports -- integers that fit in the range of 'Int64'. NInt Integer | -- | A floating point number NFloat Float | -- | Booleans. @false@ or @true@. NBool Bool | -- | Null values. There's only one of this variant: @null@. NNull deriving ( Eq , Ord , Generic , Typeable , Data , Show , Read , NFData , Hashable ) instance Serialise NAtom instance Binary NAtom instance ToJSON NAtom instance FromJSON NAtom -- | Translate an atom into its Nix representation. atomText :: NAtom -> Text atomText (NURI t) = t atomText (NInt i) = show i atomText (NFloat f) = showNixFloat f where showNixFloat :: Float -> Text showNixFloat x = bool (show x) (show (truncate x :: Int)) (x `mod'` 1 == 0) atomText (NBool b) = if b then "true" else "false" atomText NNull = "null" ================================================ FILE: src/Nix/Builtins.hs ================================================ {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE CPP #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE MonoLocalBinds #-} {-# LANGUAGE MultiWayIf #-} -- 2021-07-05: Due to hashing Haskell IT system situation, in HNix we currently ended-up with 2 hash package dependencies @{hashing, cryptonite}@ {-# LANGUAGE PackageImports #-} {-# LANGUAGE PartialTypeSignatures #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -fno-warn-name-shadowing #-} -- | Code that implements Nix builtins. Lists the functions that are built into the Nix expression evaluator. Some built-ins (aka `derivation`), are always in the scope, so they can be accessed by the name. To keap the namespace clean, most built-ins are inside the `builtins` scope - a set that contains all what is a built-in. module Nix.Builtins ( withNixContext, builtins, ) where import Control.Monad (foldM) import Control.Monad.Catch (MonadCatch (catch)) import Control.Monad.ListM (sortByM) import qualified Data.Aeson as A import GHC.Exception (ErrorCall (ErrorCall)) import Nix.Prelude import "hashing" Crypto.Hash import qualified "hashing" Crypto.Hash.MD5 as MD5 import qualified "hashing" Crypto.Hash.SHA1 as SHA1 import qualified "hashing" Crypto.Hash.SHA256 as SHA256 import qualified "hashing" Crypto.Hash.SHA512 as SHA512 #if MIN_VERSION_aeson(2,0,0) import qualified Data.Aeson.Key as AKM import qualified Data.Aeson.KeyMap as AKM #endif import Data.Align (alignWith) import Data.Array import Data.Bits import qualified Data.ByteString as B import Data.ByteString.Base16 as Base16 import Data.Char (isDigit) import Data.Fix (foldFix) import Data.Foldable (foldrM) import qualified Data.HashMap.Lazy as M import qualified Data.HashSet as HS import Data.List (partition) import Data.Scientific import qualified Data.Set as S import qualified Data.Text as Text import qualified Data.Text.Lazy.Builder as Builder import Data.Text.Read (decimal) import Data.These (These, fromThese) import qualified Data.Time.Clock.POSIX as Time import qualified Data.Vector as V import NeatInterpolation (text) import Nix.Atoms import Nix.Convert import Nix.Effects import Nix.Effects.Basic (fetchTarball) import qualified Nix.Eval as Eval import Nix.Exec import Nix.Expr.Types import Nix.Frames import Nix.Json import Nix.Normal import Nix.Options import Nix.Parser import Nix.Render import Nix.Scope import Nix.String import Nix.String.Coerce import Nix.Value import Nix.Value.Equal import Nix.Value.Monad import Nix.XML import System.Nix.Base32 as Base32 import System.PosixCompat.Files ( isDirectory, isRegularFile, isSymbolicLink, ) import Text.Regex.TDFA ( Regex, makeRegex, matchAllText, matchOnceText, ) import qualified Text.Show -- This is a big module. There is recursive reuse: -- @builtins -> builtinsList -> scopedImport -> withNixContext -> builtins@, -- since @builtins@ is self-recursive: aka we ship @builtins.builtins.builtins...@. -- * Internal -- ** Nix Builtins Haskell type level newtype Prim m a = Prim (m a) data BuiltinType = Normal | TopLevel data Builtin v = Builtin { _kind :: BuiltinType , mapping :: (VarName, v) } -- *** @class ToBuiltin@ and its instances -- | Types that support conversion to nix in a particular monad class ToBuiltin t f m a | a -> m where toBuiltin :: Text -> a -> m (NValue t f m) instance ( MonadNix e t f m , ToValue a m (NValue t f m) ) => ToBuiltin t f m (Prim m a) where toBuiltin _ p = toValue @a @m =<< coerce p instance ( MonadNix e t f m , FromValue a m (Deeper (NValue t f m)) , ToBuiltin t f m b ) => ToBuiltin t f m (a -> b) where toBuiltin name f = pure $ NVBuiltin (coerce name) $ toBuiltin name . f <=< fromValue . Deeper -- *** @WValue@ closure wrapper to have @Ord@ -- We wrap values solely to provide an Ord instance for genericClosure newtype WValue t f m = WValue (NValue t f m) instance (NVConstraint f) => Eq (WValue t f m) where WValue (NVConstant (NFloat x)) == WValue (NVConstant (NInt y)) = x == fromInteger y WValue (NVConstant (NInt x)) == WValue (NVConstant (NFloat y)) = fromInteger x == y WValue (NVConstant (NInt x)) == WValue (NVConstant (NInt y)) = x == y WValue (NVConstant (NFloat x)) == WValue (NVConstant (NFloat y)) = x == y WValue (NVPath x) == WValue (NVPath y) = x == y WValue (NVStr x) == WValue (NVStr y) = ignoreContext x == ignoreContext y _ == _ = False instance (NVConstraint f) => Ord (WValue t f m) where WValue (NVConstant (NFloat x)) <= WValue (NVConstant (NInt y)) = x <= fromInteger y WValue (NVConstant (NInt x)) <= WValue (NVConstant (NFloat y)) = fromInteger x <= y WValue (NVConstant (NInt x)) <= WValue (NVConstant (NInt y)) = x <= y WValue (NVConstant (NFloat x)) <= WValue (NVConstant (NFloat y)) = x <= y WValue (NVPath x) <= WValue (NVPath y) = x <= y WValue (NVStr x) <= WValue (NVStr y) = ignoreContext x <= ignoreContext y _ <= _ = False -- ** Helpers pattern NVBool :: (MonadNix e t f m) => Bool -> NValue t f m pattern NVBool a = NVConstant (NBool a) data NixPathEntryType = PathEntryPath | PathEntryURI deriving (Show, Eq) {- | @NIX_PATH@ is colon-separated, but can also contain URLs, which have a colon (i.e. @https://...@) -} uriAwareSplit :: Text -> [(Text, NixPathEntryType)] uriAwareSplit txt = case Text.break (== ':') txt of (e1, e2) | Text.null e2 -> one (e1, PathEntryPath) | "://" `Text.isPrefixOf` e2 -> let ((suffix, _) : path) = uriAwareSplit (Text.drop 3 e2) in (e1 <> "://" <> suffix, PathEntryURI) : path | otherwise -> (e1, PathEntryPath) : uriAwareSplit (Text.drop 1 e2) foldNixPath :: forall e t f m r. (MonadNix e t f m) => r -> (Path -> Maybe Text -> NixPathEntryType -> r -> m r) -> m r foldNixPath z f = do mres <- lookupVar "__includes" dirs <- maybe stub ((fromValue . Deeper) <=< demand) mres mPath <- getEnvVar "NIX_PATH" mDataDir <- getEnvVar "NIX_DATA_DIR" dataDir <- maybe getDataDir (pure . coerce . toString) mDataDir foldrM fun z $ (fromInclude . ignoreContext <$> dirs) <> uriAwareSplit `whenJust` mPath <> one (fromInclude $ "nix=" <> fromString (coerce dataDir) <> "/nix/corepkgs") where fromInclude :: Text -> (Text, NixPathEntryType) fromInclude x = (x,) $ bool PathEntryPath PathEntryURI ("://" `Text.isInfixOf` x) fun :: (Text, NixPathEntryType) -> r -> m r fun (x, ty) rest = case Text.splitOn "=" x of [p] -> f (coerce $ toString p) mempty ty rest [n, p] -> f (coerce $ toString p) (pure n) ty rest _ -> throwError $ ErrorCall $ "Unexpected entry in NIX_PATH: " <> show x attrsetGet :: (MonadNix e t f m) => VarName -> AttrSet (NValue t f m) -> m (NValue t f m) attrsetGet k s = maybe (throwError $ ErrorCall $ toString @Text $ "Attribute '" <> coerce k <> "' required") pure (M.lookup k s) data VersionComponent = -- | The string "pre" VersionComponentPre | -- | A string other than "pre" VersionComponentString !Text | -- | A number VersionComponentNumber !Integer deriving (Read, Eq, Ord) instance Show VersionComponent where show = \case VersionComponentPre -> "pre" VersionComponentString s -> show s VersionComponentNumber n -> show n splitVersion :: Text -> [VersionComponent] splitVersion s = ( \(x, xs) -> if | isRight eDigitsPart -> either (\e -> error $ "splitVersion: did hit impossible: '" <> fromString e <> "' while parsing '" <> s <> "'.") ( \res -> one (VersionComponentNumber $ fst res) <> splitVersion (snd res) ) eDigitsPart | x `elem` separators -> splitVersion xs | otherwise -> one charsPart <> splitVersion rest2 ) `whenJust` Text.uncons s where -- \| Based on https://github.com/NixOS/nix/blob/4ee4fda521137fed6af0446948b3877e0c5db803/src/libexpr/names.cc#L44 separators :: String separators = ".-" eDigitsPart :: Either String (Integer, Text) eDigitsPart = decimal @Integer $ s (charsSpan, rest2) = Text.span (\c -> not $ isDigit c || c `elem` separators) s charsPart :: VersionComponent charsPart = case charsSpan of "pre" -> VersionComponentPre xs' -> VersionComponentString xs' compareVersions :: Text -> Text -> Ordering compareVersions s1 s2 = fold $ (alignWith cmp `on` splitVersion) s1 s2 where cmp :: These VersionComponent VersionComponent -> Ordering cmp = uncurry compare . join fromThese (VersionComponentString mempty) splitDrvName :: Text -> (Text, Text) splitDrvName s = both (Text.intercalate sep) (namePieces, versionPieces) where sep = "-" pieces :: [Text] pieces = Text.splitOn sep s isFirstVersionPiece :: Text -> Bool isFirstVersionPiece p = maybe False (isDigit . fst) (Text.uncons p) -- Like 'break', but always puts the first item into the first result -- list breakAfterFirstItem :: (a -> Bool) -> [a] -> ([a], [a]) breakAfterFirstItem f = handlePresence mempty (\(h : t) -> let (a, b) = break f t in (h : a, b)) (namePieces, versionPieces) = breakAfterFirstItem isFirstVersionPiece pieces splitMatches :: forall e t f m. (MonadNix e t f m) => Int -> [[(ByteString, (Int, Int))]] -> ByteString -> [NValue t f m] splitMatches _ [] haystack = one $ thunkStr haystack splitMatches _ ([] : _) _ = fail "Fail in splitMatches: this should never happen!" splitMatches numDropped (((_, (start, len)) : captures) : mts) haystack = thunkStr before : caps : splitMatches (numDropped + relStart + len) mts (B.drop len rest) where relStart = max 0 start - numDropped (before, rest) = B.splitAt relStart haystack caps :: NValue t f m caps = NVList (f <$> captures) f :: (ByteString, (Int, b)) -> NValue t f m f (a, (s, _)) = bool NVNull (thunkStr a) (s >= 0) thunkStr :: (NVConstraint f) => ByteString -> NValue t f m thunkStr s = mkNVStrWithoutContext $ decodeUtf8 s hasKind :: forall a e t f m. (MonadNix e t f m, FromValue a m (NValue t f m)) => NValue t f m -> m (NValue t f m) hasKind = inHaskMay (isJust @a) absolutePathFromValue :: (MonadNix e t f m) => NValue t f m -> m Path absolutePathFromValue = \case NVStr ns -> do let path = coerce . toString $ ignoreContext ns when (not (isAbsolute path)) $ throwError $ ErrorCall $ "string " <> show path <> " doesn't represent an absolute path" pure path NVPath path -> pure path v -> throwError $ ErrorCall $ "expected a path, got " <> show v data FileType = FileTypeRegular | FileTypeDirectory | FileTypeSymlink | FileTypeUnknown deriving (Show, Read, Eq, Ord) instance (Convertible e t f m) => ToValue FileType m (NValue t f m) where toValue = toValue . mkNixStringWithoutContext . \case FileTypeRegular -> "regular" :: Text FileTypeDirectory -> "directory" FileTypeSymlink -> "symlink" FileTypeUnknown -> "unknown" -- ** Builtin functions derivationNix :: forall e t f m. (MonadNix e t f m, Scoped (NValue t f m) m) => m (NValue t f m) derivationNix = foldFix Eval.eval $$( do -- This is compiled in so that we only parse it once at compile-time. let Right expr = parseNixText [text| drvAttrs @ { outputs ? [ "out" ], ... }: let strict = derivationStrict drvAttrs; commonAttrs = drvAttrs // (builtins.listToAttrs outputsList) // { all = map (x: x.value) outputsList; inherit drvAttrs; }; outputToAttrListElement = outputName: { name = outputName; value = commonAttrs // { outPath = builtins.getAttr outputName strict; drvPath = strict.drvPath; type = "derivation"; inherit outputName; }; }; outputsList = map outputToAttrListElement outputs; in (builtins.head outputsList).value|] [||expr||] ) nixPathNix :: forall e t f m. (MonadNix e t f m) => m (NValue t f m) nixPathNix = fmap NVList $ foldNixPath mempty $ \p mn ty rest -> pure $ pure ( NVSet mempty ( M.fromList [ case ty of PathEntryPath -> ("path", NVPath p) PathEntryURI -> ("uri", mkNVStrWithoutContext $ fromString $ coerce p) , ("prefix", mkNVStrWithoutContext $ maybeToMonoid mn) ] ) ) <> rest toStringNix :: (MonadNix e t f m) => NValue t f m -> m (NValue t f m) toStringNix = toValue <=< coerceAnyToNixString callFunc DontCopyToStore hasAttrNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) hasAttrNix x y = do (coerce -> key) <- fromStringNoContext =<< fromValue x (aset, _) <- fromValue @(AttrSet (NValue t f m), PositionSet) y toValue $ M.member key aset hasContextNix :: (MonadNix e t f m) => NValue t f m -> m (NValue t f m) hasContextNix = inHask hasContext getAttrNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) getAttrNix x y = do (coerce -> key) <- fromStringNoContext =<< fromValue x (aset, _) <- fromValue @(AttrSet (NValue t f m), PositionSet) y attrsetGet key aset unsafeDiscardOutputDependencyNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) unsafeDiscardOutputDependencyNix nv = do (nc, ns) <- (getStringContext &&& ignoreContext) <$> fromValue nv toValue $ mkNixString (HS.map discard nc) ns where discard :: StringContext -> StringContext discard (StringContext AllOutputs a) = StringContext DirectPath a discard x = x unsafeGetAttrPosNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) unsafeGetAttrPosNix nvX nvY = do x <- demand nvX y <- demand nvY case (x, y) of (NVStr ns, NVSet apos _) -> maybe (pure NVNull) toValue (M.lookup @VarName (coerce $ ignoreContext ns) apos) _xy -> throwError $ ErrorCall $ "Invalid types for builtins.unsafeGetAttrPosNix: " <> show _xy -- This function is a bit special in that it doesn't care about the contents -- of the list. lengthNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) lengthNix = inHask (length :: [NValue t f m] -> Int) addNix :: (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) addNix nvX nvY = do x' <- demand nvX y' <- demand nvY case (x', y') of (NVConstant (NInt x), NVConstant (NInt y)) -> toValue (x + y :: Integer) (NVConstant (NFloat x), NVConstant (NInt y)) -> toValue $ x + fromInteger y (NVConstant (NInt x), NVConstant (NFloat y)) -> toValue $ fromInteger x + y (NVConstant (NFloat x), NVConstant (NFloat y)) -> toValue $ x + y (_x, _y) -> throwError $ Addition _x _y mulNix :: (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) mulNix nvX nvY = do x' <- demand nvX y' <- demand nvY case (x', y') of (NVConstant (NInt x), NVConstant (NInt y)) -> toValue (x * y :: Integer) (NVConstant (NFloat x), NVConstant (NInt y)) -> toValue (x * fromInteger y) (NVConstant (NInt x), NVConstant (NFloat y)) -> toValue (fromInteger x * y) (NVConstant (NFloat x), NVConstant (NFloat y)) -> toValue (x * y) (_x, _y) -> throwError $ Multiplication _x _y divNix :: (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) divNix nvX nvY = do x' <- demand nvX y' <- demand nvY case (x', y') of (NVConstant (NInt x), NVConstant (NInt y)) | y /= 0 -> toValue (floor (fromInteger x / fromInteger y :: Double) :: Integer) (NVConstant (NFloat x), NVConstant (NInt y)) | y /= 0 -> toValue $ x / fromInteger y (NVConstant (NInt x), NVConstant (NFloat y)) | y /= 0 -> toValue $ fromInteger x / y (NVConstant (NFloat x), NVConstant (NFloat y)) | y /= 0 -> toValue $ x / y (_x, _y) -> throwError $ Division _x _y anyNix :: (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) anyNix f = toValue <=< anyMNix fromValue <=< traverse (callFunc f) <=< fromValue where anyMNix :: (Monad m) => (a -> m Bool) -> [a] -> m Bool anyMNix _ [] = pure False anyMNix p (x : xs) = bool (anyMNix p xs) (pure True) =<< p x allNix :: (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) allNix f = toValue <=< allMNix fromValue <=< traverse (callFunc f) <=< fromValue where allMNix :: (Monad m) => (a -> m Bool) -> [a] -> m Bool allMNix _ [] = pure True allMNix p (x : xs) = bool (pure False) (allMNix p xs) =<< p x foldl'Nix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> NValue t f m -> m (NValue t f m) foldl'Nix f z xs = foldM go z =<< fromValue @[NValue t f m] xs where go b a = (`callFunc` a) =<< callFunc f b headNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) headNix = maybe (throwError $ ErrorCall "builtins.head: empty list") pure . viaNonEmpty head <=< fromValue @[NValue t f m] tailNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) tailNix = maybe (throwError $ ErrorCall "builtins.tail: empty list") (pure . NVList) . viaNonEmpty tail <=< fromValue @[NValue t f m] splitVersionNix :: (MonadNix e t f m) => NValue t f m -> m (NValue t f m) splitVersionNix v = do version <- fromStringNoContext =<< fromValue v pure $ NVList $ mkNVStrWithoutContext . show <$> splitVersion version compareVersionsNix :: (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) compareVersionsNix t1 t2 = do s1 <- mkText t1 s2 <- mkText t2 let cmpVers = case compareVersions s1 s2 of LT -> -1 EQ -> 0 GT -> 1 pure $ NVConstant $ NInt cmpVers where mkText = fromStringNoContext <=< fromValue parseDrvNameNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) parseDrvNameNix drvname = do s <- fromStringNoContext =<< fromValue drvname let (name :: Text, version :: Text) = splitDrvName s toValue @(AttrSet (NValue t f m)) $ M.fromList [ ( "name" :: VarName , mkNVStr name ) , ( "version" , mkNVStr version ) ] where mkNVStr = mkNVStrWithoutContext matchNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) matchNix pat str = do p <- fromStringNoContext =<< fromValue pat ns <- fromValue str -- NOTE: 2018-11-19: Currently prim_match in nix/src/libexpr/primops.cc -- ignores the context of its second argument. This is probably a bug but we're -- going to preserve the behavior here until it is fixed upstream. -- Relevant issue: https://github.com/NixOS/nix/issues/2547 let s = ignoreContext ns re = makeRegex p :: Regex mkMatch t = bool (pure NVNull) (toValue $ mkNixStringWithoutContext t) (not $ Text.null t) case matchOnceText re s of Just ("", sarr, "") -> do let submatches = fst <$> elems sarr NVList <$> traverse mkMatch ( case submatches of [] -> mempty [a] -> one a _ : xs -> xs -- return only the matched groups, drop the full string ) _ -> pure NVNull splitNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) splitNix pat str = do p <- fromStringNoContext =<< fromValue pat ns <- fromValue str -- NOTE: Currently prim_split in nix/src/libexpr/primops.cc ignores the -- context of its second argument. This is probably a bug but we're -- going to preserve the behavior here until it is fixed upstream. -- Relevant issue: https://github.com/NixOS/nix/issues/2547 let s = ignoreContext ns regex = makeRegex p :: Regex haystack = encodeUtf8 s pure $ NVList $ splitMatches 0 (elems <$> matchAllText regex haystack) haystack substringNix :: forall e t f m. (MonadNix e t f m) => Int -> Int -> NixString -> Prim m NixString substringNix start len str = Prim $ bool (throwError $ ErrorCall $ "builtins.substring: negative start position: " <> show start) (pure $ modifyNixContents (take . Text.drop start) str) (start >= 0) where take = bool id -- NOTE: negative values of 'len' are OK, and mean "take everything" (Text.take len) (len >= 0) attrNamesNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) attrNamesNix = coersion . inHask @(AttrSet (NValue t f m)) (fmap (mkNixStringWithoutContext . coerce) . sort . M.keys) where coersion = fmap (coerce :: CoerceDeeperToNValue t f m) attrValuesNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) attrValuesNix nvattrs = do attrs <- fromValue @(AttrSet (NValue t f m)) nvattrs toValue $ snd <$> sortOn (fst @VarName @(NValue t f m)) (M.toList attrs) mapNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) mapNix f = inHaskM @[NValue t f m] ( traverse ( defer . withFrame Debug (ErrorCall "While applying f in map:\n") . callFunc f ) ) mapAttrsNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) mapAttrsNix f xs = do nixAttrset <- fromValue @(AttrSet (NValue t f m)) xs let keyVals = M.toList nixAttrset keys = fst <$> keyVals applyFunToKeyVal (key, val) = do runFunForKey <- callFunc f $ mkNVStrWithoutContext (coerce key) callFunc runFunForKey val newVals <- traverse (defer @(NValue t f m) . withFrame Debug (ErrorCall "While applying f in mapAttrs:\n") . applyFunToKeyVal) keyVals toValue $ M.fromList $ zip keys newVals filterNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) filterNix f = inHaskM (filterM fh) where fh :: NValue t f m -> m Bool fh = fromValue <=< callFunc f catAttrsNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) catAttrsNix attrName xs = do n <- fromStringNoContext =<< fromValue attrName l <- fromValue @[NValue t f m] xs NVList . catMaybes <$> traverse (fmap (M.lookup @VarName $ coerce n) . fromValue <=< demand) l baseNameOfNix :: (MonadNix e t f m) => NValue t f m -> m (NValue t f m) baseNameOfNix x = do ns <- coerceStringlikeToNixString DontCopyToStore x pure $ NVStr $ modifyNixContents (fromString . coerce takeFileName . toString) ns bitAndNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) bitAndNix x y = do a <- fromValue @Integer x b <- fromValue @Integer y toValue $ a .&. b bitOrNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) bitOrNix x y = do a <- fromValue @Integer x b <- fromValue @Integer y toValue $ a .|. b bitXorNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) bitXorNix x y = do a <- fromValue @Integer x b <- fromValue @Integer y toValue $ a `xor` b builtinsBuiltinNix :: forall e t f m. (MonadNix e t f m) => m (NValue t f m) builtinsBuiltinNix = throwError $ ErrorCall "HNix does not provide builtins.builtins at the moment. Using builtins directly should be preferred" -- a safer version of `attrsetGet` attrGetOr :: forall e t f m v a. (MonadNix e t f m, FromValue v m (NValue t f m)) => a -> (v -> m a) -> VarName -> AttrSet (NValue t f m) -> m a attrGetOr fallback fun name attrs = maybe (pure fallback) (fun <=< fromValue) (M.lookup name attrs) -- NOTE: It is a part of the implementation taken from: -- https://github.com/haskell-nix/hnix/pull/755 -- look there for `sha256` and/or `filterSource` pathNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) pathNix arg = do attrs <- fromValue @(AttrSet (NValue t f m)) arg path <- fmap (coerce . toString) $ fromStringNoContext =<< coerceToPath =<< attrsetGet "path" attrs -- TODO: Fail on extra args -- XXX: This is a very common pattern, we could factor it out name <- toText <$> attrGetOr (takeFileName path) (fmap (coerce . toString) . fromStringNoContext) "name" attrs recursive <- attrGetOr True pure "recursive" attrs Right (coerce . toText . coerce @StorePath @String -> s) <- addToStore name (NarFile path) recursive False -- TODO: Ensure that s matches sha256 when not empty pure $ NVStr $ mkNixStringWithSingletonContext (StringContext DirectPath s) s where coerceToPath = coerceToString callFunc DontCopyToStore CoerceAny dirOfNix :: (MonadNix e t f m) => NValue t f m -> m (NValue t f m) dirOfNix nvdir = do dir <- demand nvdir case dir of NVStr ns -> pure $ NVStr $ modifyNixContents (fromString . coerce takeDirectory . toString) ns NVPath path -> pure $ NVPath $ takeDirectory path v -> throwError $ ErrorCall $ "dirOf: expected string or path, got " <> show v -- jww (2018-04-28): This should only be a string argument, and not coerced? unsafeDiscardStringContextNix :: (MonadNix e t f m) => NValue t f m -> m (NValue t f m) unsafeDiscardStringContextNix = inHask (mkNixStringWithoutContext . ignoreContext) -- | Evaluate `a` to WHNF to collect its topmost effect. seqNix :: (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) seqNix a b = b <$ demand a -- | Evaluate 'a' to NF to collect all of its effects, therefore data cycles are ignored. deepSeqNix :: (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) deepSeqNix a b = b <$ normalForm_ a elemNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) elemNix x = inHaskM (anyMNix $ valueEqM x) where anyMNix :: (Monad m) => (a -> m Bool) -> [a] -> m Bool anyMNix p = handlePresence (pure False) ( \(x : xss) -> bool (anyMNix p xss) (pure True) =<< p x ) elemAtNix :: (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) elemAtNix xs n = do n' <- fromValue n xs' <- fromValue xs maybe (throwError $ ErrorCall $ "builtins.elem: Index " <> show n' <> " too large for list of length " <> show (length xs')) pure (xs' !!? n') genListNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) genListNix f nixN = do n <- fromValue @Integer nixN bool (throwError $ ErrorCall $ "builtins.genList: Expected a non-negative number, got " <> show n) (toValue =<< traverse (defer . callFunc f <=< toValue) [0 .. n - 1]) (n >= 0) genericClosureNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) genericClosureNix c = do s <- fromValue @(AttrSet (NValue t f m)) c case (M.lookup "startSet" s, M.lookup "operator" s) of (Nothing, Nothing) -> throwError $ ErrorCall "builtins.genericClosure: Attributes 'startSet' and 'operator' required" (Nothing, Just _) -> throwError $ ErrorCall "builtins.genericClosure: Attribute 'startSet' required" (Just _, Nothing) -> throwError $ ErrorCall "builtins.genericClosure: Attribute 'operator' required" (Just startSet, Just operator) -> do ss <- fromValue @[NValue t f m] =<< demand startSet op <- demand operator let go :: Set (WValue t f m) -> [NValue t f m] -> m (Set (WValue t f m), [NValue t f m]) go ks [] = pure (ks, mempty) go ks (t : ts) = do v <- demand t k <- demand =<< attrsetGet "key" =<< fromValue @(AttrSet (NValue t f m)) v bool ( do checkComparable k $ handlePresence k (\(WValue j : _) -> j) (S.toList ks) (<<$>>) (v :) . go (S.insert (WValue k) ks) . (<>) ts =<< fromValue @[NValue t f m] =<< callFunc op v ) (go ks ts) (S.member (WValue k) ks) toValue @[NValue t f m] =<< snd <$> go mempty ss {- | Takes: 1. List of strings to match. 2. List of strings to replace corresponding match occurance. (arg 1 & 2 lists matched by index) 3. String to process -> returns the string with requested replacements. Example: builtins.replaceStrings ["ll" "e"] [" " "i"] "Hello world" == "Hi o world". -} replaceStringsNix :: (MonadNix e t f m) => NValue t f m -> NValue t f m -> NValue t f m -> m (NValue t f m) replaceStringsNix tfrom tto ts = do -- NixStrings have context - remember (fromKeys :: [NixString]) <- fromValue (Deeper tfrom) (toVals :: [NixString]) <- fromValue (Deeper tto) (string :: NixString) <- fromValue ts when (length fromKeys /= length toVals) $ throwError $ ErrorCall "builtins.replaceStrings: Arguments `from`&`to` construct a key-value map, so the number of their elements must always match." let -- 2021-02-18: NOTE: if there is no match - the process does not changes the context, simply slides along the string. -- So it isbe more effective to pass the context as the first argument. -- And moreover, the `passOneCharNgo` passively passes the context, to context can be removed from it and inherited directly. -- Then the solution would've been elegant, but the Nix bug prevents elegant implementation. go ctx input output = maybe -- Passively pass the chars passOneChar replace maybePrefixMatch where -- When prefix matched something - returns (match, replacement, remainder) maybePrefixMatch :: Maybe (Text, NixString, Text) maybePrefixMatch = formMatchReplaceTailInfo <$> find ((`Text.isPrefixOf` input) . fst) fromKeysToValsMap where formMatchReplaceTailInfo (m, r) = (m, r, Text.drop (Text.length m) input) fromKeysToValsMap = zip (ignoreContext <$> fromKeys) toVals -- Not passing args => It is constant that gets embedded into `go` => It is simple `go` tail recursion passOneChar = maybe (finish ctx output) -- The base case - there is no chars left to process -> finish (\(c, i) -> go ctx i (output <> Builder.singleton c)) -- If there are chars - pass one char & continue (Text.uncons input) -- chip first char -- 2021-02-18: NOTE: rly?: toStrict . toLazyText -- Maybe `text-builder`, `text-show`? finish ctx output = mkNixString ctx (toStrict $ Builder.toLazyText output) replace (key, replacementNS, unprocessedInput) = replaceWithNixBug unprocessedInput updatedOutput where replaceWithNixBug = bool (go updatedCtx) -- tail recursion -- Allowing match on "" is a inherited bug of Nix, -- when "" is checked - it always matches. And so - when it checks - it always insers a replacement, and then process simply passesthrough the char that was under match. -- -- repl> builtins.replaceStrings ["" "e"] [" " "i"] "Hello world" -- " H e l l o w o r l d " -- repl> builtins.replaceStrings ["ll" ""] [" " "i"] "Hello world" -- "iHie ioi iwioirilidi" -- 2021-02-18: NOTE: There is no tests for this bugPassOneChar -- augmented recursion isNixBugCase isNixBugCase = key == mempty updatedOutput = output <> replacement updatedCtx = ctx <> replacementCtx replacement = Builder.fromText $ ignoreContext replacementNS replacementCtx = getStringContext replacementNS -- The bug modifies the content => bug demands `pass` to be a real function => -- `go` calls `pass` function && `pass` calls `go` function -- => mutual recusion case, so placed separately. bugPassOneChar input output = maybe (finish updatedCtx output) -- The base case - there is no chars left to process -> finish (\(c, i) -> go updatedCtx i $ output <> Builder.singleton c) -- If there are chars - pass one char & continue (Text.uncons input) -- chip first char toValue $ go (getStringContext string) (ignoreContext string) mempty removeAttrsNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) removeAttrsNix set v = do (m, p) <- fromValue @(AttrSet (NValue t f m), PositionSet) set (nsToRemove :: [NixString]) <- fromValue $ Deeper v (coerce -> toRemove) <- traverse fromStringNoContext nsToRemove toValue (fun m toRemove, fun p toRemove) where fun :: forall k v. (Eq k, Hashable k) => HashMap k v -> [k] -> HashMap k v fun = foldl' (flip M.delete) intersectAttrsNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) intersectAttrsNix set1 set2 = do (s1, p1) <- fromValue @(AttrSet (NValue t f m), PositionSet) set1 (s2, p2) <- fromValue @(AttrSet (NValue t f m), PositionSet) set2 pure $ NVSet (p2 `M.intersection` p1) (s2 `M.intersection` s1) functionArgsNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) functionArgsNix nvfun = do fun <- demand nvfun case fun of NVClosure p _ -> toValue @(AttrSet (NValue t f m)) $ NVBool <$> case p of Param name -> one (name, False) ParamSet _ _ pset -> isJust <$> M.fromList pset _v -> throwError $ ErrorCall $ "builtins.functionArgs: expected function, got " <> show _v toFileNix :: (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) toFileNix name s = do name' <- fromStringNoContext =<< fromValue name s' <- fromValue s mres <- toFile_ (coerce $ toString name') (ignoreContext s') let storepath = coerce (fromString @Text) mres sc = StringContext DirectPath storepath toValue $ mkNixStringWithSingletonContext sc storepath toPathNix :: (MonadNix e t f m) => NValue t f m -> m (NValue t f m) toPathNix = inHask @Path id pathExistsNix :: (MonadNix e t f m) => NValue t f m -> m (NValue t f m) pathExistsNix nvpath = do path <- demand nvpath toValue =<< case path of NVPath p -> doesPathExist p NVStr ns -> doesPathExist $ coerce $ toString $ ignoreContext ns _v -> throwError $ ErrorCall $ "builtins.pathExists: expected path, got " <> show _v isPathNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) isPathNix = hasKind @Path isAttrsNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) isAttrsNix = hasKind @(AttrSet (NValue t f m)) isListNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) isListNix = hasKind @[NValue t f m] isIntNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) isIntNix = hasKind @Int isFloatNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) isFloatNix = hasKind @Float isBoolNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) isBoolNix = hasKind @Bool isNullNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) isNullNix = hasKind @() -- isString cannot use `hasKind` because it coerces derivationNixs to strings. isStringNix :: (MonadNix e t f m) => NValue t f m -> m (NValue t f m) isStringNix nv = do v <- demand nv toValue $ case v of NVStr{} -> True _ -> False isFunctionNix :: (MonadNix e t f m) => NValue t f m -> m (NValue t f m) isFunctionNix nv = do v <- demand nv toValue $ case v of NVClosure{} -> True _ -> False throwNix :: (MonadNix e t f m) => NValue t f m -> m (NValue t f m) throwNix = throwError . ErrorCall . toString . ignoreContext <=< coerceStringlikeToNixString CopyToStore {- | Implementation of Nix @import@ clause. Because Nix @import@s work strictly (import gets fully evaluated befor bringing it into the scope it was called from) - that property raises a requirement for execution phase of the interpreter go into evaluation phase & then also go into parsing phase on the imports. So it is not possible (more precise - not practical) to do a full parse Nix code phase fully & then go into evaluation phase. As it is not possible to "import them lazily", as import is strict & it is not possible to establish what imports whould be needed up until where it would be determined & they import strictly -} importNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) importNix = scopedImportNix $ NVSet mempty mempty {- | @scopedImport scope path@ An undocumented secret powerful function. At the same time it is strongly forbidden to be used, as prolonged use of it would bring devastating consequences. As it is essentially allows rewriting(redefinition) paradigm. Allows to import the environment into the scope of a file expression that gets imported. It is as if the contents at @path@ were given to @import@ wrapped as: @with scope; path@ meaning: > -- Nix pseudocode: > import (with scope; path) For example, it allows to use itself as: > bar = scopedImport pkgs ./bar.nix; > -- & declare @./bar.nix@ without a header, so as: > stdenv.mkDerivation { ... buildInputs = [ libfoo ]; } But that breaks the evaluation/execution sharing of the @import@s. Function also allows to redefine or extend the builtins. For instance, to trace all calls to function ‘map’: > let > overrides = { > map = f: xs: builtins.trace "call of map!" (map f xs); > # Propagate override by calls to import&scopedImport. > import = fn: scopedImport overrides fn; > scopedImport = attrs: fn: scopedImport (overrides // attrs) fn; > # Update ‘builtins’. > builtins = builtins // overrides; > }; > in scopedImport overrides ./bla.nix In the related matter the function can be added and passed around as builtin. -} scopedImportNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) scopedImportNix asetArg pathArg = do (coerce -> scope) <- fromValue @(AttrSet (NValue t f m)) asetArg p <- fromValue pathArg path <- pathToDefaultNix @t @f @m p path' <- maybe ( do traceM "No known current directory" pure path ) ( \res -> do p' <- fromValue @Path =<< demand res traceM $ "Current file being evaluated is: " <> show p' pure $ takeDirectory p' path ) =<< lookupVar "__cur_file" clearScopes @(NValue t f m) $ withNixContext (pure path') $ pushScope scope $ importPath @t @f @m path' getEnvNix :: (MonadNix e t f m) => NValue t f m -> m (NValue t f m) getEnvNix v = (toValue . mkNixStringWithoutContext . maybeToMonoid) =<< getEnvVar =<< fromStringNoContext =<< fromValue v sortNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) sortNix comp = inHaskM (sortByM cmp) where cmp :: NValue t f m -> NValue t f m -> m Ordering cmp a b = bool ( fmap (bool EQ GT) (compare b a) ) (pure LT) =<< compare a b where compare :: NValue t f m -> NValue t f m -> m Bool compare a2 a1 = fromValue =<< (`callFunc` a1) =<< callFunc comp a2 lessThanNix :: (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) lessThanNix ta tb = do va <- demand ta vb <- demand tb let badType = throwError $ ErrorCall $ "builtins.lessThan: expected two numbers or two strings, got '" <> show va <> "' and '" <> show vb <> "'." NVBool <$> case (va, vb) of (NVConstant ca, NVConstant cb) -> case (ca, cb) of (NInt a, NInt b) -> pure $ a < b (NInt a, NFloat b) -> pure $ fromInteger a < b (NFloat a, NInt b) -> pure $ a < fromInteger b (NFloat a, NFloat b) -> pure $ a < b _ -> badType (NVStr a, NVStr b) -> pure $ ignoreContext a < ignoreContext b _ -> badType -- | Helper function, generalization of @concat@ operations. concatWith :: forall e t f m. (MonadNix e t f m) => (NValue t f m -> m (NValue t f m)) -> NValue t f m -> m (NValue t f m) concatWith f = toValue . concat <=< traverse (fromValue @[NValue t f m] <=< f) <=< fromValue @[NValue t f m] {- | Nix function of Haskell: > concat :: [[a]] -> [a] Concatenate a list of lists into a single list. -} concatListsNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) concatListsNix = concatWith demand {- | Nix function of Haskell: > concatMap :: Foldable t => (a -> [b]) -> t a -> [b] -} concatMapNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) concatMapNix f = concatWith (callFunc f) listToAttrsNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) listToAttrsNix lst = do l <- fromValue @[NValue t f m] lst fmap (NVSet mempty . M.fromList . reverse) ( traverse ( \nvattrset -> do a <- fromValue @(AttrSet (NValue t f m)) =<< demand nvattrset (coerce -> name) <- fromStringNoContext =<< fromValue =<< demand =<< attrsetGet "name" a val <- attrsetGet "value" a pure (name, val) ) l ) -- prim_hashString from nix/src/libexpr/primops.cc -- fail if context in the algo arg -- propagate context from the s arg -- | The result coming out of hashString is base16 encoded hashStringNix :: forall e t f m. (MonadNix e t f m) => NixString -> NixString -> Prim m NixString hashStringNix nsAlgo ns = Prim $ do algo <- fromStringNoContext nsAlgo let f g = pure $ modifyNixContents g ns case algo of -- 2021-03-04: Pattern can not be taken-out because hashes represented as different types "md5" -> f (show . mkHash @MD5.MD5) "sha1" -> f (show . mkHash @SHA1.SHA1) "sha256" -> f (show . mkHash @SHA256.SHA256) "sha512" -> f (show . mkHash @SHA512.SHA512) _ -> throwError $ ErrorCall $ "builtins.hashString: expected \"md5\", \"sha1\", \"sha256\", or \"sha512\", got " <> show algo where -- This intermidiary `a` is only needed because of the type application mkHash :: (Show a, HashAlgorithm a) => Text -> a mkHash s = hash $ encodeUtf8 s {- | hashFileNix use hashStringNix to hash file content -} hashFileNix :: forall e t f m. (MonadNix e t f m) => NixString -> Path -> Prim m NixString hashFileNix nsAlgo nvfilepath = Prim $ hash =<< fileContent where hash = outPrim . hashStringNix nsAlgo outPrim (Prim x) = x fileContent :: m NixString fileContent = mkNixStringWithoutContext <$> Nix.Render.readFile nvfilepath {- | groupByNix Groups elements of list together by the string returned from the function f called on each element. It returns an attribute set where each attribute value contains the elements of list that are mapped to the same corresponding attribute name returned by f. -} groupByNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) groupByNix nvfun nvlist = do list <- demand nvlist fun <- demand nvfun (f, l) <- extractP (fun, list) NVSet mempty . fmap (NVList . reverse) . M.fromListWith (<>) <$> traverse (app f) l where app f x = do name <- fromValue @Text =<< f x pure (VarName name, one x) extractP (NVBuiltin _ f, NVList l) = pure (f, l) extractP (NVClosure _ f, NVList l) = pure (f, l) extractP _v = throwError $ ErrorCall $ "builtins.groupBy: expected function and list, got " <> show _v {- FOURMOLU_DISABLE -} placeHolderNix :: forall t f m e . MonadNix e t f m => NValue t f m -> m (NValue t f m) placeHolderNix p = do t <- fromStringNoContext =<< fromValue p h <- coerce @(Prim m NixString) @(m NixString) $ (hashStringNix `on` mkNixStringWithoutContext) "sha256" ("nix-output:" <> t) toValue $ mkNixStringWithoutContext $ Text.cons '/' $ Base32.encode -- Please, stop Text -> Bytestring here after migration to Text $ case Base16.decode (bytes h) of -- The result coming out of hashString is base16 encoded #if MIN_VERSION_base16_bytestring(1,0,0) -- Please, stop Text -> String here after migration to Text Left e -> error $ "Couldn't Base16 decode the text: '" <> body h <> "'.\nThe Left fail content: '" <> show e <> "'." Right d -> d #else (d, "") -> d (_, e) -> error $ "Couldn't Base16 decode the text: '" <> body h <> "'.\nUndecodable remainder: '" <> show e <> "'." #endif where bytes :: NixString -> ByteString bytes = encodeUtf8 . body body = ignoreContext {- FOURMOLU_ENABLE -} readFileNix :: (MonadNix e t f m) => NValue t f m -> m (NValue t f m) readFileNix = toValue <=< Nix.Render.readFile <=< absolutePathFromValue <=< demand findFileNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) findFileNix nvaset nvfilepath = do aset <- demand nvaset filePath <- demand nvfilepath case (aset, filePath) of (NVList x, NVStr ns) -> do mres <- findPath @t @f @m x $ coerce $ toString $ ignoreContext ns pure $ NVPath mres (NVList _, _y) -> throwError $ ErrorCall $ "expected a string, got " <> show _y (_x, NVStr _) -> throwError $ ErrorCall $ "expected a list, got " <> show _x (_x, _y) -> throwError $ ErrorCall $ "Invalid types for builtins.findFile: " <> show (_x, _y) readDirNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) readDirNix nvpath = do path <- absolutePathFromValue =<< demand nvpath items <- listDirectory path let -- \| Function indeed binds filepaths as keys ('VarNames') in Nix attrset. detectFileTypes :: Path -> m (VarName, FileType) detectFileTypes item = do s <- getSymbolicLinkStatus $ path item let t = if | isRegularFile s -> FileTypeRegular | isDirectory s -> FileTypeDirectory | isSymbolicLink s -> FileTypeSymlink | otherwise -> FileTypeUnknown pure (coerce @(String -> Text) fromString item, t) itemsWithTypes <- traverse detectFileTypes items (coerce :: CoerceDeeperToNValue t f m) <$> toValue (M.fromList itemsWithTypes) {- FOURMOLU_DISABLE -} fromJSONNix :: forall e t f m . MonadNix e t f m => NValue t f m -> m (NValue t f m) fromJSONNix nvjson = do j <- demand nvjson jText <- fromStringNoContext =<< fromValue j either (\ jsonError -> throwError $ ErrorCall $ "builtins.fromJSON: " <> jsonError) jsonToNValue -- do we really need to marshall Text -> ByteString -> Aeson.Value (that is a Text) (A.eitherDecodeStrict' @A.Value $ encodeUtf8 jText) where jsonToNValue :: (A.Value -> m (NValue t f m)) jsonToNValue = \case A.Object m -> traverseToNValue (NVSet mempty) #if MIN_VERSION_aeson(2,0,0) (M.mapKeys (coerce . AKM.toText) $ AKM.toHashMap m) #else (M.mapKeys coerce m) #endif A.Array l -> traverseToNValue NVList (V.toList l) A.String s -> pure $ mkNVStrWithoutContext s A.Number n -> pure $ NVConstant $ either NFloat NInt (floatingOrInteger n) A.Bool b -> pure $ NVBool b A.Null -> pure NVNull where traverseToNValue :: Traversable t0 => (t0 (NValue t f m) -> b) -> t0 A.Value -> m b traverseToNValue f v = f <$> traverse jsonToNValue v {- FOURMOLU_ENABLE -} toJSONNix :: (MonadNix e t f m) => NValue t f m -> m (NValue t f m) toJSONNix = (fmap NVStr . toJSONNixString) <=< demand toXMLNix :: (MonadNix e t f m) => NValue t f m -> m (NValue t f m) toXMLNix = (fmap (NVStr . toXML) . normalForm) <=< demand typeOfNix :: (MonadNix e t f m) => NValue t f m -> m (NValue t f m) typeOfNix nvv = do v <- demand nvv let detectType = case v of NVConstant a -> case a of NURI _ -> "string" NInt _ -> "int" NFloat _ -> "float" NBool _ -> "bool" NNull -> "null" NVStr _ -> "string" NVList _ -> "list" NVSet _ _ -> "set" NVClosure{} -> "lambda" NVPath _ -> "path" NVBuiltin _ _ -> "lambda" _ -> error "Pattern synonyms obscure complete patterns" toValue $ mkNixStringWithoutContext detectType tryEvalNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) tryEvalNix e = (`catch` (pure . onError)) (onSuccess <$> demand e) where onSuccess v = NVSet mempty $ M.fromList [ ("success", NVBool True) , ("value", v) ] onError :: SomeException -> NValue t f m onError _ = NVSet mempty $ M.fromList $ (,NVBool False) <$> [ "success" , "value" ] traceNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) traceNix msg action = do traceEffect @t @f @m . toString . ignoreContext =<< fromValue msg pure action -- Please, can function remember fail context addErrorContextNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> -- action m (NValue t f m) addErrorContextNix _ = pure execNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) execNix xs = -- 2018-11-19: NOTE: Still need to do something with the context here -- See prim_exec in nix/src/libexpr/primops.cc -- Requires the implementation of EvalState::realiseContext (exec . fmap ignoreContext) =<< traverse (coerceStringlikeToNixString DontCopyToStore) =<< fromValue @[NValue t f m] xs fetchurlNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) fetchurlNix = ( \case NVSet _ s -> fetch (M.lookup "sha256" s) =<< demand =<< attrsetGet "url" s v@NVStr{} -> fetch Nothing v v -> throwError $ ErrorCall $ "builtins.fetchurl: Expected URI or set, got " <> show v ) <=< demand where -- 2022-01-21: NOTE: Needs to check the hash match. fetch :: Maybe (NValue t f m) -> NValue t f m -> m (NValue t f m) fetch _msha = \case NVStr ns -> either -- msha throwError toValue =<< getURL =<< maybe (throwError $ ErrorCall "builtins.fetchurl: unsupported arguments to url") pure (getStringNoContext ns) v -> throwError $ ErrorCall $ "builtins.fetchurl: Expected URI or string, got " <> show v partitionNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) partitionNix f nvlst = do let match t = (,t) <$> (fromValue =<< callFunc f t) selection <- traverse match =<< fromValue @[NValue t f m] nvlst let (right, wrong) = partition fst selection makeSide = NVList . fmap snd toValue @(AttrSet (NValue t f m)) $ M.fromList [ ("right", makeSide right) , ("wrong", makeSide wrong) ] currentSystemNix :: (MonadNix e t f m) => m (NValue t f m) currentSystemNix = do os <- getCurrentSystemOS arch <- getCurrentSystemArch pure $ mkNVStrWithoutContext $ arch <> "-" <> os currentTimeNix :: (MonadNix e t f m) => m (NValue t f m) currentTimeNix = do opts <- askOptions toValue @Integer $ round $ Time.utcTimeToPOSIXSeconds $ getTime opts derivationStrictNix :: (MonadNix e t f m) => NValue t f m -> m (NValue t f m) derivationStrictNix = derivationStrict getRecursiveSizeNix :: (MonadIntrospect m, NVConstraint f) => a -> m (NValue t f m) getRecursiveSizeNix = fmap (NVConstant . NInt . fromIntegral) . recursiveSize getContextNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) getContextNix = \case (NVStr ns) -> NVSet mempty <$> traverseToValue (getNixLikeContext $ toNixLikeContext $ getStringContext ns) x -> throwError $ ErrorCall $ "Invalid type for builtins.getContext: " <> show x <=< demand appendContextNix :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) appendContextNix tx ty = do x <- demand tx y <- demand ty case (x, y) of (NVStr ns, NVSet _ attrs) -> do let getPathNOuts :: NValue t f m -> m NixLikeContextValue getPathNOuts tx = do x <- demand tx case x of NVSet _ atts -> do -- TODO: Fail for unexpected keys. let getK :: VarName -> m Bool getK k = maybe (pure False) (fromValue <=< demand) $ M.lookup k atts getOutputs :: m [Text] getOutputs = maybe stub ( \touts -> do outs <- demand touts case outs of NVList vs -> traverse (fmap ignoreContext . fromValue) vs _x -> throwError $ ErrorCall $ "Invalid types for context value outputs in builtins.appendContext: " <> show _x ) (M.lookup "outputs" atts) path <- getK "path" allOutputs <- getK "allOutputs" NixLikeContextValue path allOutputs <$> getOutputs _x -> throwError $ ErrorCall $ "Invalid types for context value in builtins.appendContext: " <> show _x addContext :: HashMap VarName NixLikeContextValue -> NixString addContext newContextValues = mkNixString ( fromNixLikeContext $ NixLikeContext $ M.unionWith (<>) newContextValues $ getNixLikeContext $ toNixLikeContext $ getStringContext ns ) $ ignoreContext ns toValue . addContext =<< traverse getPathNOuts attrs _xy -> throwError $ ErrorCall $ "Invalid types for builtins.appendContext: " <> show _xy nixVersionNix :: (MonadNix e t f m) => m (NValue t f m) nixVersionNix = toValue $ mkNixStringWithoutContext "2.3" langVersionNix :: (MonadNix e t f m) => m (NValue t f m) langVersionNix = toValue (5 :: Int) -- ** @builtinsList@ builtinsList :: forall e t f m. (MonadNix e t f m) => m [Builtin (NValue t f m)] builtinsList = sequenceA [ add TopLevel "abort" throwNix -- for now , add TopLevel "baseNameOf" baseNameOfNix , add0 TopLevel "derivation" derivationNix , add TopLevel "derivationStrict" derivationStrictNix , add TopLevel "dirOf" dirOfNix , add TopLevel "import" importNix , add TopLevel "isNull" isNullNix , add2 TopLevel "map" mapNix , add2 TopLevel "mapAttrs" mapAttrsNix , add TopLevel "placeholder" placeHolderNix , add2 TopLevel "removeAttrs" removeAttrsNix , add2 TopLevel "scopedImport" scopedImportNix , add TopLevel "throw" throwNix , add TopLevel "toString" toStringNix , add2 TopLevel "trace" traceNix , add0 Normal "nixVersion" nixVersionNix , add0 Normal "langVersion" langVersionNix , add2 Normal "add" addNix , add2 Normal "addErrorContext" addErrorContextNix , add2 Normal "all" allNix , add2 Normal "any" anyNix , add2 Normal "appendContext" appendContextNix , add Normal "attrNames" attrNamesNix , add Normal "attrValues" attrValuesNix , add2 Normal "bitAnd" bitAndNix , add2 Normal "bitOr" bitOrNix , add2 Normal "bitXor" bitXorNix , add0 Normal "builtins" builtinsBuiltinNix , add2 Normal "catAttrs" catAttrsNix , add' Normal "ceil" (arity1 (ceiling @Float @Integer)) , add2 Normal "compareVersions" compareVersionsNix , add Normal "concatLists" concatListsNix , add2 Normal "concatMap" concatMapNix , add' Normal "concatStringsSep" (arity2 intercalateNixString) , add0 Normal "currentSystem" currentSystemNix , add0 Normal "currentTime" currentTimeNix , add2 Normal "deepSeq" deepSeqNix , add2 Normal "div" divNix , add2 Normal "elem" elemNix , add2 Normal "elemAt" elemAtNix , add Normal "exec" execNix , add0 Normal "false" (pure $ NVBool False) , -- , add Normal "fetchGit" fetchGit -- , add Normal "fetchMercurial" fetchMercurial add Normal "fetchTarball" fetchTarball , add Normal "fetchurl" fetchurlNix , add2 Normal "filter" filterNix , -- , add Normal "filterSource" filterSource add2 Normal "findFile" findFileNix , add' Normal "floor" (arity1 (floor @Float @Integer)) , add3 Normal "foldl'" foldl'Nix , add Normal "fromJSON" fromJSONNix , -- , add Normal "fromTOML" fromTOML add Normal "functionArgs" functionArgsNix , add Normal "genericClosure" genericClosureNix , add2 Normal "genList" genListNix , add2 Normal "getAttr" getAttrNix , add Normal "getContext" getContextNix , add Normal "getEnv" getEnvNix , add2 Normal "groupBy" groupByNix , add2 Normal "hasAttr" hasAttrNix , add Normal "hasContext" hasContextNix , add' Normal "hashString" (hashStringNix @e @t @f @m) , add' Normal "hashFile" hashFileNix , add Normal "head" headNix , add2 Normal "intersectAttrs" intersectAttrsNix , add Normal "isAttrs" isAttrsNix , add Normal "isBool" isBoolNix , add Normal "isFloat" isFloatNix , add Normal "isFunction" isFunctionNix , add Normal "isInt" isIntNix , add Normal "isList" isListNix , add Normal "isString" isStringNix , add Normal "isPath" isPathNix , add Normal "length" lengthNix , add2 Normal "lessThan" lessThanNix , add Normal "listToAttrs" listToAttrsNix , add2 Normal "match" matchNix , add2 Normal "mul" mulNix , add0 Normal "nixPath" nixPathNix , add0 Normal "null" (pure NVNull) , add Normal "parseDrvName" parseDrvNameNix , add2 Normal "partition" partitionNix , add Normal "path" pathNix , add Normal "pathExists" pathExistsNix , add Normal "readDir" readDirNix , add Normal "readFile" readFileNix , add3 Normal "replaceStrings" replaceStringsNix , add2 Normal "seq" seqNix , add2 Normal "sort" sortNix , add2 Normal "split" splitNix , add Normal "splitVersion" splitVersionNix , add0 Normal "storeDir" (pure $ mkNVStrWithoutContext "/nix/store") , -- , add Normal "storePath" storePath add' Normal "stringLength" (arity1 $ Text.length . ignoreContext) , add' Normal "sub" (arity2 ((-) @Integer)) , add' Normal "substring" substringNix , add Normal "tail" tailNix , add2 Normal "toFile" toFileNix , add Normal "toJSON" toJSONNix , add Normal "toPath" toPathNix -- Deprecated in Nix: https://github.com/NixOS/nix/pull/2524 , add Normal "toXML" toXMLNix , add0 Normal "true" (pure $ NVBool True) , add Normal "tryEval" tryEvalNix , add Normal "typeOf" typeOfNix , add Normal "unsafeDiscardOutputDependency" unsafeDiscardOutputDependencyNix , add Normal "unsafeDiscardStringContext" unsafeDiscardStringContextNix , add2 Normal "unsafeGetAttrPos" unsafeGetAttrPosNix , add Normal "valueSize" getRecursiveSizeNix ] where arity0 :: a -> Prim m a arity0 = Prim . pure arity1 :: (a -> b) -> (a -> Prim m b) arity1 g = arity0 . g arity2 :: (a -> b -> c) -> (a -> b -> Prim m c) arity2 f = arity1 . f mkBuiltin :: BuiltinType -> VarName -> m (NValue t f m) -> m (Builtin (NValue t f m)) mkBuiltin t n v = wrap t n <$> mkThunk n v where wrap :: BuiltinType -> VarName -> v -> Builtin v wrap t n f = Builtin t (n, f) mkThunk :: VarName -> m (NValue t f m) -> m (NValue t f m) mkThunk n = defer . withFrame Info (ErrorCall $ "While calling builtin " <> toString n <> "\n") hAdd :: ( VarName -> fun -> m (NValue t f m) ) -> BuiltinType -> VarName -> fun -> m (Builtin (NValue t f m)) hAdd f t n v = mkBuiltin t n $ f n v add0 :: BuiltinType -> VarName -> m (NValue t f m) -> m (Builtin (NValue t f m)) add0 = hAdd (\_ x -> x) add :: BuiltinType -> VarName -> ( NValue t f m -> m (NValue t f m) ) -> m (Builtin (NValue t f m)) add = hAdd builtin add2 :: BuiltinType -> VarName -> ( NValue t f m -> NValue t f m -> m (NValue t f m) ) -> m (Builtin (NValue t f m)) add2 = hAdd builtin2 add3 :: BuiltinType -> VarName -> ( NValue t f m -> NValue t f m -> NValue t f m -> m (NValue t f m) ) -> m (Builtin (NValue t f m)) add3 = hAdd builtin3 add' :: (ToBuiltin t f m a) => BuiltinType -> VarName -> a -> m (Builtin (NValue t f m)) add' = hAdd (toBuiltin . coerce) -- * Exported -- | Evaluate expression in the default context. withNixContext :: forall e t f m r. (MonadNix e t f m, Has e Options) => Maybe Path -> m r -> m r withNixContext mpath action = do base <- builtins opts <- askOptions pushScope (one ("__includes", NVList $ mkNVStrWithoutContext . fromString . coerce <$> getInclude opts)) ( pushScopes base $ maybe id ( \path act -> do traceM $ "Setting __cur_file = " <> show path pushScope (one ("__cur_file", NVPath path)) act ) mpath action ) builtins :: forall e t f m. ( MonadNix e t f m , Scoped (NValue t f m) m ) => m (Scopes m (NValue t f m)) builtins = do ref <- defer $ NVSet mempty <$> buildMap (`pushScope` askScopes) . coerce . M.fromList . (one ("builtins", ref) <>) =<< topLevelBuiltins where buildMap :: m (HashMap VarName (NValue t f m)) buildMap = M.fromList . (mapping <$>) <$> builtinsList topLevelBuiltins :: m [(VarName, NValue t f m)] topLevelBuiltins = mapping <<$>> fullBuiltinsList fullBuiltinsList :: m [Builtin (NValue t f m)] fullBuiltinsList = nameBuiltins <<$>> builtinsList where nameBuiltins :: Builtin v -> Builtin v nameBuiltins b@(Builtin TopLevel _) = b nameBuiltins (Builtin Normal nB) = Builtin TopLevel $ first (coerce @(Text -> Text) ("__" <>)) nB ================================================ FILE: src/Nix/Cache.hs ================================================ {-# LANGUAGE CPP #-} -- | Reading and writing Nix cache files module Nix.Cache where {- FOURMOLU_DISABLE -} import Nix.Prelude import qualified Data.ByteString.Lazy as BSL import Nix.Expr.Types.Annotated #if defined (__linux__) -- This is about: https://hackage.haskell.org/package/compact #define USE_COMPACT 1 #endif #ifdef USE_COMPACT import qualified Data.Compact as C import qualified Data.Compact.Serialize as C #endif import qualified Codec.Serialise as S readCache :: Path -> IO NExprLoc readCache path = do #if USE_COMPACT eres <- C.unsafeReadCompact path either (\ err -> fail $ "Error reading cache file: " <> err) (\ expr -> pure $ C.getCompact expr) eres #else eres <- S.deserialiseOrFail <$> BSL.readFile (coerce path) either (\ err -> fail $ "Error reading cache file: " <> show err) pure eres #endif writeCache :: Path -> NExprLoc -> IO () writeCache path expr = #ifdef USE_COMPACT C.writeCompact path =<< C.compact expr #else BSL.writeFile (coerce path) (S.serialise expr) #endif ================================================ FILE: src/Nix/Cited/Basic.hs ================================================ {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE UndecidableInstances #-} module Nix.Cited.Basic where import Control.Comonad (Comonad) import Control.Comonad.Env (ComonadEnv) import Control.Monad.Catch hiding (catchJust) import Nix.Cited import Nix.Eval as Eval ( EvalFrame (EvaluatingExpr, ForcingExpr), ) import Nix.Exec import Nix.Expr.Types.Annotated import Nix.Frames import Nix.Options import Nix.Prelude import Nix.Thunk import Nix.Value -- * data type @Cited@ newtype Cited t f m a = Cited (NCited m (NValue t f m) a) deriving ( Generic , Typeable , Functor , Applicative , Foldable , Traversable , Comonad , ComonadEnv [Provenance m (NValue t f m)] ) -- ** Helpers {- | @Cited@ pattern. > pattern CitedP m a = Cited (NCited m a) -} pattern CitedP :: [Provenance m (NValue t f m)] -> a -> Cited t f m a pattern CitedP m a = Cited (NCited m a) {-# COMPLETE CitedP #-} {- | Take: 1. Provenence info. 2. Value (like thunk) -> Produce cited value (thunk) -} cite :: (Functor m) => [Provenance m (NValue t f m)] -> m a -> m (Cited t f m a) cite v = fmap (Cited . NCited v) -- ** instances instance HasCitations1 m (NValue t f m) (Cited t f m) where citations1 (Cited c) = citations c addProvenance1 x (Cited c) = Cited $ addProvenance x c instance ( Has e Options , Framed e m , MonadThunk t m v , Typeable m , Typeable f , Typeable u , MonadCatch m ) => MonadThunk (Cited u f m t) m v where thunk :: m v -> m (Cited u f m t) thunk mv = do opts <- askOptions bool (cite mempty) ( \mt -> do frames <- askFrames -- Gather the current evaluation context at the time of thunk -- creation, and record it along with the thunk. let fun :: SomeException -> [Provenance m (NValue u f m)] fun (fromException -> Just (EvaluatingExpr scope (Ann s e))) = one $ Provenance scope $ AnnF s (Nothing <$ e) fun _ = mempty ps :: [Provenance m (NValue u f m)] ps = foldMap (fun . frame) frames cite ps mt ) (isThunks opts) (thunk mv) thunkId :: Cited u f m t -> ThunkId m thunkId (CitedP _ t) = thunkId @_ @m t query :: m v -> Cited u f m t -> m v query m (CitedP _ t) = query m t -- \| The ThunkLoop exception is thrown as an exception with MonadThrow, -- which does not capture the current stack frame information to provide -- it in a NixException, so we catch and re-throw it here using -- 'throwError' from Frames.hs. force :: Cited u f m t -> m v force (CitedP ps t) = handleDisplayProvenance ps $ force t forceEff :: Cited u f m t -> m v forceEff (CitedP ps t) = handleDisplayProvenance ps $ forceEff t further :: Cited u f m t -> m (Cited u f m t) further (CitedP ps t) = cite ps $ further t -- ** Kleisli functor HOFs -- Please, do not use MonadThunkF for MonadThunk, later uses more straight-forward specialized line of functions. instance ( Has e Options , Framed e m , MonadThunkF t m v , Typeable m , Typeable f , Typeable u , MonadCatch m ) => MonadThunkF (Cited u f m t) m v where queryF :: (v -> m r) -> m r -> Cited u f m t -> m r queryF k m (CitedP _ t) = queryF k m t forceF :: (v -> m r) -> Cited u f m t -> m r forceF k (CitedP ps t) = handleDisplayProvenance ps $ forceF k t forceEffF :: (v -> m r) -> Cited u f m t -> m r forceEffF k (CitedP ps t) = handleDisplayProvenance ps $ forceEffF k t furtherF :: (m v -> m v) -> Cited u f m t -> m (Cited u f m t) furtherF k (CitedP ps t) = cite ps $ furtherF k t -- * Representation handleDisplayProvenance :: ( MonadCatch m , Typeable m , Typeable v , Has e Frames , MonadReader e m ) => [Provenance m v] -> m a -> m a handleDisplayProvenance ps f = catch (displayProvenance ps f) (throwError @ThunkLoop) displayProvenance :: ( MonadThrow m , MonadReader e m , Has e Frames , Typeable m , Typeable v ) => [Provenance m v] -> m a -> m a displayProvenance = handlePresence id ( \(Provenance scope e@(AnnF s _) : _) -> withFrame Info $ ForcingExpr scope $ wrapExprLoc s e ) ================================================ FILE: src/Nix/Cited.hs ================================================ {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -Wno-missing-signatures #-} module Nix.Cited where import Control.Comonad import Control.Comonad.Env import Lens.Family2.TH import Nix.Prelude import Control.Monad.Free (Free (Free, Pure)) import Nix.Expr.Types.Annotated import Nix.Scope import Nix.Value (NValue, NValue' (NValue')) data Provenance m v = Provenance { getLexicalScope :: Scopes m v , -- 2021-11-09: NOTE: Better name? getOriginExpr :: NExprLocF (Maybe v) -- ^ When calling the function x: x + 2 with argument x = 3, the -- 'originExpr' for the resulting value will be 3 + 2, while the -- 'contextExpr' will be @(x: x + 2) 3@, preserving not only the -- result of the call, but what was called and with what arguments. } deriving (Generic, Typeable, Show) data NCited m v a = NCited { getProvenance :: [Provenance m v] , getCited :: a } deriving (Generic, Typeable, Functor, Foldable, Traversable, Show) instance Applicative (NCited m v) where pure = NCited mempty (<*>) (NCited xs f) (NCited ys x) = NCited (xs <> ys) (f x) instance Comonad (NCited m v) where duplicate p = NCited (getProvenance p) p extract = getCited instance ComonadEnv [Provenance m v] (NCited m v) where ask = getProvenance $(makeLenses ''Provenance) $(makeLenses ''NCited) class HasCitations1 m v f where citations1 :: f a -> [Provenance m v] addProvenance1 :: Provenance m v -> f a -> f a class HasCitations m v a where citations :: a -> [Provenance m v] addProvenance :: Provenance m v -> a -> a instance HasCitations m v (NCited m v a) where citations = getProvenance addProvenance x (NCited p v) = NCited (x : p) v instance (HasCitations1 m v f) => HasCitations m v (NValue' t f m a) where citations (NValue' f) = citations1 f addProvenance x (NValue' f) = NValue' $ addProvenance1 x f instance (HasCitations1 m v f, HasCitations m v t) => HasCitations m v (NValue t f m) where citations (Pure t) = citations t citations (Free v) = citations v addProvenance x (Pure t) = Pure $ addProvenance x t addProvenance x (Free v) = Free $ addProvenance x v ================================================ FILE: src/Nix/Context.hs ================================================ module Nix.Context where import Nix.Expr.Types.Annotated ( SrcSpan, nullSpan, ) import Nix.Frames (Frames) import Nix.Options (Options) import Nix.Prelude import Nix.Scope (Scopes) -- 2021-07-18: NOTE: It should be Options -> Scopes -> Frames -> Source(span) data Context m t = Context { getOptions :: Options , getScopes :: Scopes m t , getSource :: SrcSpan , getFrames :: Frames } instance Has (Context m t) (Scopes m t) where hasLens f a = (\x -> a{getScopes = x}) <$> f (getScopes a) instance Has (Context m t) SrcSpan where hasLens f a = (\x -> a{getSource = x}) <$> f (getSource a) instance Has (Context m t) Frames where hasLens f a = (\x -> a{getFrames = x}) <$> f (getFrames a) instance Has (Context m t) Options where hasLens f a = (\x -> a{getOptions = x}) <$> f (getOptions a) newContext :: Options -> Context m t newContext o = Context o mempty nullSpan mempty ================================================ FILE: src/Nix/Convert.hs ================================================ {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE IncoherentInstances #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -fno-warn-name-shadowing #-} {- | Although there are a lot of instances in this file, really it's just a combinatorial explosion of the following combinations: - Several Haskell types being converted to/from Nix wrappers - Several types of Nix wrappers - Whether to be shallow or deep while unwrapping -} module Nix.Convert where import Control.Monad.Free import qualified Data.HashMap.Lazy as M import Nix.Atoms import Nix.Effects import Nix.Expr.Types import Nix.Frames import Nix.Prelude import Nix.String import Nix.Thunk (MonadThunk (force)) import Nix.Value import Nix.Value.Monad newtype Deeper a = Deeper a deriving (Typeable, Functor, Foldable, Traversable) type CoerceDeeperToNValue t f m = Deeper (NValue t f m) -> NValue t f m type CoerceDeeperToNValue' t f m = Deeper (NValue' t f m (NValue t f m)) -> NValue' t f m (NValue t f m) {- IMPORTANT NOTE We used to have Text instances of FromValue, ToValue, FromNix, and ToNix. However, we're removing these instances because they are dangerous due to the fact that they hide the way string contexts are handled. It's better to have to explicitly handle string context in a way that is appropriate for the situation. Do not add these instances back! -} type Convertible e t f m = (Framed e m, MonadDataErrorContext t f m, MonadThunk t m (NValue t f m)) -- | Transform Nix -> Hask. Run function. Convert Hask -> Nix. inHask :: forall a1 a2 v b m. (Monad m, FromValue a1 m v, ToValue a2 m b) => (a1 -> a2) -> v -> m b inHask f = toValue . f <=< fromValue inHaskM :: forall a1 a2 v b m. (Monad m, FromValue a1 m v, ToValue a2 m b) => (a1 -> m a2) -> v -> m b inHaskM f = toValue <=< f <=< fromValue -- | Maybe transform Nix -> Hask. Run function. Convert Hask -> Nix. inHaskMay :: forall a1 a2 v b m. (Monad m, FromValue a1 m v, ToValue a2 m b) => (Maybe a1 -> a2) -> v -> m b inHaskMay f = toValue . f <=< fromValueMay -- * FromValue class FromValue a m v where fromValue :: v -> m a fromValueMay :: v -> m (Maybe a) traverseFromValue :: ( Applicative m , Traversable t , FromValue b m a ) => t a -> m (Maybe (t b)) traverseFromValue = traverse2 fromValueMay traverseToValue :: ( Traversable t , Applicative f , ToValue a f b ) => t a -> f (t b) traverseToValue = traverse toValue -- Please, hide these helper function from export, to be sure they get optimized away. fromMayToValue :: forall t f m a e. ( Convertible e t f m , FromValue a m (NValue' t f m (NValue t f m)) ) => ValueType -> NValue' t f m (NValue t f m) -> m a fromMayToValue t v = maybe (throwError $ Expectation @t @f @m t (Free v)) pure =<< fromValueMay v fromMayToDeeperValue :: forall t f m a e m1. ( Convertible e t f m , FromValue (m1 a) m (Deeper (NValue' t f m (NValue t f m))) ) => ValueType -> Deeper (NValue' t f m (NValue t f m)) -> m (m1 a) fromMayToDeeperValue t v = maybe (throwError $ Expectation @t @f @m t $ Free $ (coerce :: CoerceDeeperToNValue' t f m) v) pure =<< fromValueMay v instance ( Convertible e t f m , MonadValue (NValue t f m) m , FromValue a m (NValue' t f m (NValue t f m)) ) => FromValue a m (NValue t f m) where fromValueMay = free (fromValueMay <=< force) fromValueMay <=< demand fromValue = free (fromValue <=< force) fromValue <=< demand instance ( Convertible e t f m , MonadValue (NValue t f m) m , FromValue a m (Deeper (NValue' t f m (NValue t f m))) ) => FromValue a m (Deeper (NValue t f m)) where fromValueMay :: Deeper (NValue t f m) -> m (Maybe a) fromValueMay (Deeper v) = free ((fromValueMay . Deeper) <=< force) -- these places are complex in types (fromValueMay . Deeper) =<< demand v fromValue (Deeper v) = free ((fromValue . Deeper) <=< force) (fromValue . Deeper) =<< demand v instance (Convertible e t f m) => FromValue () m (NValue' t f m (NValue t f m)) where fromValueMay = pure . \case NVConstant' NNull -> stub _ -> mempty fromValue = fromMayToValue TNull instance (Convertible e t f m) => FromValue Bool m (NValue' t f m (NValue t f m)) where fromValueMay = pure . \case NVConstant' (NBool b) -> pure b _ -> Nothing fromValue = fromMayToValue TBool instance (Convertible e t f m) => FromValue Int m (NValue' t f m (NValue t f m)) where fromValueMay = pure . \case NVConstant' (NInt b) -> pure $ fromInteger b _ -> Nothing fromValue = fromMayToValue TInt instance (Convertible e t f m) => FromValue Integer m (NValue' t f m (NValue t f m)) where fromValueMay = pure . \case NVConstant' (NInt b) -> pure b _ -> Nothing fromValue = fromMayToValue TInt instance (Convertible e t f m) => FromValue Float m (NValue' t f m (NValue t f m)) where fromValueMay = pure . \case NVConstant' (NFloat b) -> pure b NVConstant' (NInt i) -> pure $ fromInteger i _ -> Nothing fromValue = fromMayToValue TFloat instance ( Convertible e t f m , MonadValue (NValue t f m) m , MonadEffects t f m ) => FromValue NixString m (NValue' t f m (NValue t f m)) where fromValueMay = \case NVStr' ns -> pure $ pure ns NVPath' p -> (\path -> pure $ mkNixStringWithSingletonContext (StringContext DirectPath path) path) . fromString . coerce <$> addPath p NVSet' _ s -> maybe stub fromValueMay (M.lookup "outPath" s) _ -> stub -- 2021-07-18: NOTE: There may be cases where conversion wrongly marks the content to have a context. -- See: https://github.com/haskell-nix/hnix/pull/958#issuecomment-881949183 thread. fromValue = fromMayToValue $ TString HasContext instance (Convertible e t f m) => FromValue ByteString m (NValue' t f m (NValue t f m)) where fromValueMay = pure . \case NVStr' ns -> encodeUtf8 <$> getStringNoContext ns _ -> mempty fromValue = fromMayToValue $ TString mempty instance (Convertible e t f m) => FromValue Text m (NValue' t f m (NValue t f m)) where fromValueMay = pure . \case NVStr' ns -> getStringNoContext ns _ -> mempty fromValue = fromMayToValue $ TString mempty instance ( Convertible e t f m , MonadValue (NValue t f m) m ) => FromValue Path m (NValue' t f m (NValue t f m)) where fromValueMay = \case NVPath' p -> pure $ pure $ coerce p NVStr' ns -> pure $ coerce . toString <$> getStringNoContext ns NVSet' _ s -> maybe stub (fromValueMay @Path) (M.lookup "outPath" s) _ -> stub fromValue = fromMayToValue TPath instance (Convertible e t f m) => FromValue [NValue t f m] m (NValue' t f m (NValue t f m)) where fromValueMay = pure . \case NVList' l -> pure l _ -> mempty fromValue = fromMayToValue TList instance ( Convertible e t f m , FromValue a m (NValue t f m) ) => FromValue [a] m (Deeper (NValue' t f m (NValue t f m))) where fromValueMay = \case Deeper (NVList' l) -> traverseFromValue l _ -> stub fromValue = fromMayToDeeperValue TList instance (Convertible e t f m) => FromValue (AttrSet (NValue t f m)) m (NValue' t f m (NValue t f m)) where fromValueMay = pure . \case NVSet' _ s -> pure s _ -> mempty fromValue = fromMayToValue TSet instance ( Convertible e t f m , FromValue a m (NValue t f m) ) => FromValue (AttrSet a) m (Deeper (NValue' t f m (NValue t f m))) where fromValueMay = \case Deeper (NVSet' _ s) -> traverseFromValue s _ -> stub fromValue = fromMayToDeeperValue TSet instance (Convertible e t f m) => FromValue (AttrSet (NValue t f m), PositionSet) m (NValue' t f m (NValue t f m)) where fromValueMay = pure . \case NVSet' p s -> pure (s, p) _ -> mempty fromValue = fromMayToValue TSet instance ( Convertible e t f m , FromValue a m (NValue t f m) ) => FromValue (AttrSet a, PositionSet) m (Deeper (NValue' t f m (NValue t f m))) where fromValueMay = \case Deeper (NVSet' p s) -> (,p) <<$>> traverseFromValue s _ -> stub fromValue = fromMayToDeeperValue TSet -- This instance needs IncoherentInstances, and only because of ToBuiltin instance ( Convertible e t f m , FromValue a m (NValue' t f m (NValue t f m)) ) => FromValue a m (Deeper (NValue' t f m (NValue t f m))) where fromValueMay = fromValueMay . (coerce :: CoerceDeeperToNValue' t f m) fromValue = fromValue . (coerce :: CoerceDeeperToNValue' t f m) -- * ToValue class ToValue a m v where toValue :: a -> m v instance ( Convertible e t f m , ToValue a m (NValue' t f m (NValue t f m)) ) => ToValue a m (NValue t f m) where toValue v = Free <$> toValue v instance ( Convertible e t f m , ToValue a m (Deeper (NValue' t f m (NValue t f m))) ) => ToValue a m (Deeper (NValue t f m)) where toValue v = Free <<$>> toValue v instance (Convertible e t f m) => ToValue () m (NValue' t f m (NValue t f m)) where toValue = const $ pure NVNull' instance (Convertible e t f m) => ToValue Bool m (NValue' t f m (NValue t f m)) where toValue = pure . NVConstant' . NBool instance (Convertible e t f m) => ToValue Int m (NValue' t f m (NValue t f m)) where toValue = pure . NVConstant' . NInt . toInteger instance (Convertible e t f m) => ToValue Integer m (NValue' t f m (NValue t f m)) where toValue = pure . NVConstant' . NInt instance (Convertible e t f m) => ToValue Float m (NValue' t f m (NValue t f m)) where toValue = pure . NVConstant' . NFloat instance (Convertible e t f m) => ToValue NixString m (NValue' t f m (NValue t f m)) where toValue = pure . NVStr' instance (Convertible e t f m) => ToValue ByteString m (NValue' t f m (NValue t f m)) where toValue = pure . NVStr' . mkNixStringWithoutContext . decodeUtf8 instance (Convertible e t f m) => ToValue Text m (NValue' t f m (NValue t f m)) where toValue = pure . NVStr' . mkNixStringWithoutContext instance (Convertible e t f m) => ToValue Path m (NValue' t f m (NValue t f m)) where toValue = pure . NVPath' instance (Convertible e t f m) => ToValue StorePath m (NValue' t f m (NValue t f m)) where toValue = toValue @Path . coerce instance (Convertible e t f m) => ToValue NSourcePos m (NValue' t f m (NValue t f m)) where toValue (NSourcePos f l c) = do f' <- toValue $ mkNixStringWithoutContext $ fromString $ coerce f l' <- toValue $ unPos $ coerce l c' <- toValue $ unPos $ coerce c let pos = M.fromList [("file" :: VarName, f'), ("line", l'), ("column", c')] pure $ NVSet' mempty pos -- | With 'ToValue', we can always act recursively instance (Convertible e t f m) => ToValue [NValue t f m] m (NValue' t f m (NValue t f m)) where toValue = pure . NVList' instance ( Convertible e t f m , ToValue a m (NValue t f m) ) => ToValue [a] m (Deeper (NValue' t f m (NValue t f m))) where toValue l = Deeper . NVList' <$> traverseToValue l instance (Convertible e t f m) => ToValue (AttrSet (NValue t f m)) m (NValue' t f m (NValue t f m)) where toValue s = pure $ NVSet' mempty s instance (Convertible e t f m, ToValue a m (NValue t f m)) => ToValue (AttrSet a) m (Deeper (NValue' t f m (NValue t f m))) where toValue s = liftA2 (\v s -> Deeper $ NVSet' s v) (traverseToValue s) stub instance (Convertible e t f m) => ToValue (AttrSet (NValue t f m), PositionSet) m (NValue' t f m (NValue t f m)) where toValue (s, p) = pure $ NVSet' p s instance (Convertible e t f m, ToValue a m (NValue t f m)) => ToValue (AttrSet a, PositionSet) m (Deeper (NValue' t f m (NValue t f m))) where toValue (s, p) = liftA2 (\v s -> Deeper $ NVSet' s v) (traverseToValue s) (pure p) instance (Convertible e t f m) => ToValue NixLikeContextValue m (NValue' t f m (NValue t f m)) where toValue nlcv = do let g f = bool (pure Nothing) (pure <$> toValue True) (f nlcv) path <- g nlcvPath allOutputs <- g nlcvAllOutputs outputs <- do let outputs = mkNixStringWithoutContext <$> nlcvOutputs nlcv ts :: [NValue t f m] <- traverseToValue outputs handlePresence (pure Nothing) (fmap pure . toValue) ts pure $ NVSet' mempty $ M.fromList $ catMaybes [ ("path",) <$> path , ("allOutputs",) <$> allOutputs , ("outputs",) <$> outputs ] instance (Convertible e t f m) => ToValue () m (NExprF (NValue t f m)) where toValue = const . pure . NConstant $ NNull instance (Convertible e t f m) => ToValue Bool m (NExprF (NValue t f m)) where toValue = pure . NConstant . NBool ================================================ FILE: src/Nix/Effects/Basic.hs ================================================ {-# LANGUAGE CPP #-} module Nix.Effects.Basic where import Control.Monad (foldM) import qualified Data.HashMap.Lazy as M import Data.List.Split (splitOn) import qualified Data.Text as Text import GHC.Exception (ErrorCall (ErrorCall)) import Nix.Convert import Nix.Effects import Nix.Exec ( MonadNix, evalExprLoc, nixInstantiateExpr, ) import Nix.Expr.Types import Nix.Expr.Types.Annotated import Nix.Frames import Nix.Parser import Nix.Prelude import Nix.Render import Nix.Scope import Nix.String import Nix.Value import Nix.Value.Monad import Prettyprinter (fillSep) #ifdef MIN_VERSION_ghc_datasize import GHC.DataSize #endif defaultToAbsolutePath :: forall e t f m. (MonadNix e t f m) => Path -> m Path defaultToAbsolutePath origPath = do origPathExpanded <- expandHomePath origPath fmap removeDotDotIndirections . canonicalizePath =<< bool ( fmap ( origPathExpanded) $ maybe getCurrentDirectory ( ( \case NVPath s -> pure $ takeDirectory s val -> throwError $ ErrorCall $ "when resolving relative path, __cur_file is in scope, but is not a path; it is: " <> show val ) <=< demand ) =<< lookupVar "__cur_file" ) (pure origPathExpanded) (isAbsolute origPathExpanded) expandHomePath :: (MonadFile m) => Path -> m Path expandHomePath (coerce -> ('~' : xs)) = (<> coerce xs) <$> getHomeDirectory expandHomePath p = pure p {- | Incorrectly normalize paths by rewriting patterns like @a/b/..@ to @a@. This is incorrect on POSIX systems, because if @b@ is a symlink, its parent may be a different directory from @a@. See the discussion at https://hackage.haskell.org/package/directory-1.3.1.5/docs/System-Directory.html#v:canonicalizePath -} removeDotDotIndirections :: Path -> Path removeDotDotIndirections = coerce . intercalate "/" . go mempty . splitOn "/" . coerce where go s [] = reverse s go (_ : s) (".." : rest) = go s rest go s (this : rest) = go (this : s) rest infixr 9 () :: Path -> Path -> Path x y | isAbsolute y || "." `isPrefixOf` coerce y = x y | otherwise = joinByLargestOverlap x y where joinByLargestOverlap :: Path -> Path -> Path joinByLargestOverlap (splitDirectories -> xs) (splitDirectories -> ys) = joinPath $ case [xs <> drop (length tx) ys | tx <- tails xs, tx `elem` inits ys] of (r : _) -> r [] -> xs defaultFindEnvPath :: (MonadNix e t f m) => String -> m Path defaultFindEnvPath = findEnvPathM . coerce findEnvPathM :: forall e t f m. (MonadNix e t f m) => Path -> m Path findEnvPathM name = maybe (fail "impossible") ( \v -> do l <- fromValue @[NValue t f m] =<< demand v findPathBy nixFilePath l name ) =<< lookupVar "__nixPath" where nixFilePath :: (MonadEffects t f m) => Path -> m (Maybe Path) nixFilePath path = do absPath <- toAbsolutePath @t @f path isDir <- doesDirectoryExist absPath absFile <- bool (pure absPath) (toAbsolutePath @t @f $ absPath "default.nix") isDir (pure absFile `whenTrue`) <$> doesFileExist absFile findPathBy :: forall e t f m. (MonadNix e t f m) => (Path -> m (Maybe Path)) -> [NValue t f m] -> Path -> m Path findPathBy finder ls name = maybe (throwError $ ErrorCall $ "file ''" <> coerce name <> "'' was not found in the Nix search path (add it's using $NIX_PATH or -I)") pure =<< foldM fun mempty ls where fun :: (MonadNix e t f m) => Maybe Path -> NValue t f m -> m (Maybe Path) fun = maybe ( \nv -> do (s :: HashMap VarName (NValue t f m)) <- fromValue =<< demand nv p <- resolvePath s path <- fromValue =<< demand p maybe (tryPath path mempty) ( \nv' -> do mns <- fromValueMay @NixString =<< demand nv' tryPath path $ whenJust ( \nsPfx -> let pfx = ignoreContext nsPfx in pure $ coerce $ toString pfx `whenFalse` Text.null pfx ) mns ) (M.lookup "prefix" s) ) (const . pure . pure) tryPath :: Path -> Maybe Path -> m (Maybe Path) tryPath p (Just n) | n' : ns <- splitDirectories name , n == n' = finder $ p joinPath ns tryPath p _ = finder $ p name resolvePath :: HashMap VarName (NValue t f m) -> m (NValue t f m) resolvePath s = maybe ( maybe (throwError $ ErrorCall $ "__nixPath must be a list of attr sets with 'path' elements, but received: " <> show s) (defer . fetchTarball) (M.lookup "uri" s) ) pure (M.lookup "path" s) fetchTarball :: forall e t f m. (MonadNix e t f m) => NValue t f m -> m (NValue t f m) fetchTarball = \case NVSet _ s -> maybe (throwError $ ErrorCall "builtins.fetchTarball: Missing url attribute") (fetchFromString (M.lookup "sha256" s) <=< demand) (M.lookup "url" s) v@NVStr{} -> fetchFromString Nothing v v -> throwError $ ErrorCall $ "builtins.fetchTarball: Expected URI or set, got " <> show v <=< demand where fetchFromString :: Maybe (NValue t f m) -> NValue t f m -> m (NValue t f m) fetchFromString msha = \case NVStr ns -> fetch (ignoreContext ns) msha v -> throwError $ ErrorCall $ "builtins.fetchTarball: Expected URI or string, got " <> show v {- jww (2018-04-11): This should be written using pipes in another module fetch :: Text -> Maybe (NThunk m) -> m (NValue t f m) fetch uri msha = case takeExtension uri of ".tgz" -> undefined ".gz" -> undefined ".bz2" -> undefined ".xz" -> undefined ".tar" -> undefined ext -> throwError $ ErrorCall $ "builtins.fetchTarball: Unsupported extension '" <> ext <> "'" -} fetch :: Text -> Maybe (NValue t f m) -> m (NValue t f m) fetch uri = maybe ( nixInstantiateExpr $ "builtins.fetchTarball \"" <> uri <> "\"" ) ( \v -> do nsSha <- fromValue =<< demand v let sha = ignoreContext nsSha nixInstantiateExpr $ "builtins.fetchTarball { " <> "url = \"" <> uri <> "\"; " <> "sha256 = \"" <> sha <> "\"; }" ) defaultFindPath :: (MonadNix e t f m) => [NValue t f m] -> Path -> m Path defaultFindPath = findPathM findPathM :: forall e t f m. (MonadNix e t f m) => [NValue t f m] -> Path -> m Path findPathM = findPathBy existingPath where existingPath :: (MonadEffects t f m) => Path -> m (Maybe Path) existingPath path = do apath <- toAbsolutePath @t @f path doesExist <- doesPathExist apath pure $ pure apath `whenTrue` doesExist defaultImportPath :: (MonadNix e t f m, MonadState (HashMap Path NExprLoc, b) m) => Path -> m (NValue t f m) defaultImportPath path = do traceM $ "Importing file " <> coerce path withFrame Info (ErrorCall $ "While importing file " <> show path) $ evalExprLoc =<< ( maybe ( either (\err -> throwError $ ErrorCall . show $ fillSep ["Parse during import failed:", err]) ( \expr -> do modify $ first $ M.insert path expr pure expr ) =<< parseNixFileLoc path ) pure -- return expr . M.lookup path ) =<< gets fst defaultPathToDefaultNix :: (MonadNix e t f m) => Path -> m Path defaultPathToDefaultNix = pathToDefaultNixFile -- Given a path, determine the nix file to load pathToDefaultNixFile :: (MonadFile m) => Path -> m Path pathToDefaultNixFile p = do isDir <- doesDirectoryExist p pure $ p "default.nix" `whenTrue` isDir defaultTraceEffect :: (MonadPutStr m) => String -> m () defaultTraceEffect = Nix.Effects.putStrLn ================================================ FILE: src/Nix/Effects/Derivation.hs ================================================ {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE NamedFieldPuns #-} -- 2021-07-05: Due to hashing Haskell IT system situation, in HNix we currently ended-up with 2 hash package dependencies @{hashing, cryptonite}@ {-# LANGUAGE PackageImports #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TypeApplications #-} module Nix.Effects.Derivation (defaultDerivationStrict) where import Data.ByteArray (convert) import Data.ByteArray.Encoding (Base (Base16), convertToBase) import Data.Char ( isAlphaNum, isAscii, ) import Data.Default.Class (def) import Data.Foldable (foldl) import qualified Data.HashMap.Lazy as M import qualified Data.HashMap.Strict as MS (insert) import qualified Data.HashSet as S import qualified Data.Map.Strict as Map import qualified Data.Set as Set import qualified Data.Text as Text import GHC.Exception (ErrorCall (ErrorCall)) import Nix.Prelude hiding (readFile) import Text.Megaparsec import Text.Megaparsec.Char import qualified System.Nix.Base32 as Base32 import qualified "cryptonite" Crypto.Hash as Hash import Nix.Atoms import Nix.Convert import Nix.Effects import Nix.Exec ( MonadNix, callFunc, ) import Nix.Expr.Types hiding (Recursive) import Nix.Frames import Nix.Json (toJSONNixString) import Nix.Render import Nix.String import Nix.String.Coerce import Nix.Value import Nix.Value.Monad import Data.Dependent.Sum (DSum (..)) import qualified Data.Dependent.Sum as DSum import qualified System.Nix.Hash as Store import qualified System.Nix.StorePath as Store import qualified "crypton" Crypto.Hash as CryptonHash -- Type for fixed-output derivation hash digest -- Digest comes from crypton (Crypto.Hash.Digest) type HashDigest = DSum Store.HashAlgo CryptonHash.Digest -- Helper functions to work with HashDigest hashDigestAlgoText :: HashDigest -> Text hashDigestAlgoText (hashAlgo DSum.:=> _) = Store.algoToText hashAlgo hashDigestText :: HashDigest -> Text hashDigestText (_ DSum.:=> hashDigest) = Store.encodeDigestWith Store.NixBase32 hashDigest -- 2021-07-17: NOTE: Derivation consists of @"keys"@ @"vals"@ (of text), so underlining type boundary currently stops here. data Derivation = Derivation { name :: Text , outputs :: Map Text Text , inputs :: (Set Text, Map Text [Text]) , platform :: Text , builder :: Text -- should be typed as a store path , args :: [Text] , env :: Map Text Text , mFixed :: Maybe HashDigest -- Opaque type for hash digest , hashMode :: HashMode , useJson :: Bool } deriving (Show) data HashMode = Flat | Recursive deriving (Show, Eq) makeStorePathName :: (Framed e m) => Text -> m Store.StorePathName makeStorePathName name = case Store.mkStorePathName name of Left err -> throwError $ ErrorCall $ "Invalid name '" <> show name <> "' for use in a store path: " <> show err Right spname -> pure spname parsePath :: (Framed e m) => Text -> m Store.StorePath parsePath p = case Store.parsePath def (encodeUtf8 p) of Left err -> throwError $ ErrorCall $ "Cannot parse store path " <> show p <> ":\n" <> show err Right path -> pure path writeDerivation :: (Framed e m, MonadStore m) => Derivation -> m Store.StorePath writeDerivation drv@Derivation{inputs, name} = do let (inputSrcs, inputDrvs) = inputs referencePaths <- traverse parsePath (Set.toList $ inputSrcs <> Set.fromList (fst <$> Map.toList inputDrvs)) let references = S.fromList $ fmap (StorePath . fromString . decodeUtf8 . Store.storePathToRawFilePath def) referencePaths path <- addTextToStore (Text.append name ".drv") (unparseDrv drv) references False parsePath $ fromString $ coerce path {- | Traverse the graph of inputDrvs to replace fixed output derivations with their fixed output hash. this avoids propagating changes to their .drv when the output hash stays the same. -} hashDerivationModulo :: (MonadNix e t f m, MonadState (b, KeyMap Text) m) => Derivation -> m (Hash.Digest Hash.SHA256) hashDerivationModulo Derivation { mFixed = Just digest , outputs = _outputs , hashMode , name = _name } = do -- For fixed-output derivations, hash a special string encoding the content address -- Format: "fixed:out:::" -- This allows multiple derivations to share the same hash if they produce the same output let algoText = hashDigestAlgoText digest let hashText = hashDigestText digest let modePrefix = case hashMode of Recursive -> "r:" Flat -> mempty let toHash = "fixed:out:" <> modePrefix <> algoText <> ":" <> hashText pure $ Hash.hash @ByteString @Hash.SHA256 $ encodeUtf8 toHash hashDerivationModulo drv@Derivation { inputs = ( inputSrcs , inputDrvs ) } = do cache <- gets snd inputsModulo <- Map.fromList <$> traverse ( \(path, outs) -> maybe ( do drv' <- readDerivation $ coerce $ toString path digestValue <- hashDerivationModulo drv' -- Convert digest to base32 for Nix store paths (get raw bytes, not hex string) let hashBytes = convert digestValue :: ByteString let hash = Base32.encode hashBytes pure (hash, outs) ) (\hash -> pure (hash, outs)) (M.lookup path cache) ) (Map.toList inputDrvs) pure $ Hash.hash @ByteString @Hash.SHA256 $ encodeUtf8 $ unparseDrv $ drv{inputs = (inputSrcs, inputsModulo)} unparseDrv :: Derivation -> Text unparseDrv Derivation{..} = Text.append "Derive" $ parens [ -- outputs: [("out", "/nix/store/.....-out", "", ""), ...] serializeList $ produceOutputInfo <$> Map.toList outputs , -- inputDrvs serializeList $ ( \(path, outs) -> parens [s path, serializeList $ s <$> sort outs] ) <$> Map.toList (snd inputs) , -- inputSrcs serializeList $ s <$> Set.toList (fst inputs) , s platform , s builder , -- run script args serializeList $ s <$> args , -- env (key value pairs) serializeList $ (\(k, v) -> parens [s k, s v]) <$> Map.toList env ] where produceOutputInfo (outputName, outputPath) = parens $ (s <$>) $ ([outputName, outputPath] <>) $ maybe [mempty, mempty] ( \digest -> let algoText = hashDigestAlgoText digest hashText = hashDigestText digest modePrefix = if hashMode == Recursive then "r:" else mempty hashType = modePrefix <> algoText in [hashType, hashText] ) mFixed parens :: [Text] -> Text parens ts = Text.concat ["(", Text.intercalate "," ts, ")"] serializeList :: [Text] -> Text serializeList ls = Text.concat ["[", Text.intercalate "," ls, "]"] s = Text.cons '\"' . (`Text.snoc` '\"') . Text.concatMap escape escape :: Char -> Text escape '\\' = "\\\\" escape '\"' = "\\\"" escape '\n' = "\\n" escape '\r' = "\\r" escape '\t' = "\\t" escape c = one c readDerivation :: (Framed e m, MonadFile m) => Path -> m Derivation readDerivation path = do content <- readFile path either (\err -> throwError $ ErrorCall $ "Failed to parse " <> show path <> ":\n" <> show err) pure (parse derivationParser (coerce path) content) derivationParser :: Parsec () Text Derivation derivationParser = do _ <- "Derive(" fullOutputs <- serializeList $ (\[n, p, ht, h] -> (n, p, ht, h)) <$> parens s _ <- "," inputDrvs <- Map.fromList <$> serializeList (liftA2 (,) ("(" *> s <* ",") (serializeList s <* ")")) _ <- "," inputSrcs <- Set.fromList <$> serializeList s _ <- "," platform <- s _ <- "," builder <- s _ <- "," args <- serializeList s _ <- "," env <- fmap Map.fromList $ serializeList $ (\[a, b] -> (a, b)) <$> parens s _ <- ")" eof let outputs = Map.fromList $ (\(a, b, _, _) -> (a, b)) <$> fullOutputs let (mFixed, hashMode) = parseFixed fullOutputs let name = mempty -- FIXME (extract from file path ?) let useJson = one "__json" == Map.keys env pure $ Derivation{inputs = (inputSrcs, inputDrvs), ..} where s :: Parsec () Text Text s = fmap fromString $ string "\"" *> manyTill (escaped <|> regular) (string "\"") escaped = char '\\' *> ( '\n' <$ string "n" <|> '\r' <$ string "r" <|> '\t' <$ string "t" <|> anySingle ) regular = noneOf ['\\', '"'] wrap o c p = string o *> sepBy p (string ",") <* string c parens :: Parsec () Text a -> Parsec () Text [a] parens = wrap "(" ")" serializeList :: Parsec () Text a -> Parsec () Text [a] serializeList = wrap "[" "]" parseFixed :: [(Text, Text, Text, Text)] -> (Maybe HashDigest, HashMode) parseFixed fullOutputs = case fullOutputs of [("out", _path, rht, hash)] | rht /= mempty && hash /= mempty -> let (hashType, hashMode) = case Text.splitOn ":" rht of ["r", ht] -> (ht, Recursive) [ht] -> (ht, Flat) _ -> error $ "Unsupported hash type for output of fixed-output derivation in .drv file: " <> show fullOutputs in case Store.mkNamedDigest hashType hash of Left err -> error $ show $ "Unsupported hash " <> show (hashType <> ":" <> hash) <> " in .drv file: " <> err Right digest -> (Just digest, hashMode) _ -> (Nothing, Flat) defaultDerivationStrict :: forall e t f m b. (MonadNix e t f m, MonadState (b, KeyMap Text) m) => NValue t f m -> m (NValue t f m) defaultDerivationStrict val = do s <- M.mapKeys coerce <$> fromValue @(AttrSet (NValue t f m)) val (drv, ctx) <- runWithStringContextT' $ buildDerivationWithContext s drvName <- makeStorePathName $ name drv let inputs = toStorePaths ctx ifNotJsonModEnv f = bool f id (useJson drv) (env drv) -- Compute the output paths, and add them to the environment if needed. -- Also add the inputs, just computed from the strings contexts. drv' <- case mFixed drv of Just digest -> do -- Fixed-output derivation: output path is content-addressed outputPath <- makeFixedOutputPath drvName digest (hashMode drv) let outputs' = one ("out", outputPath) pure $ drv { inputs , outputs = outputs' , env = ifNotJsonModEnv (outputs' <>) } Nothing -> do hash <- hashDerivationModulo $ drv { inputs , -- , outputs = Map.map (const "") (outputs drv) -- not needed, this is already the case env = ifNotJsonModEnv ( \baseEnv -> foldl' (\m k -> Map.insert k mempty m) baseEnv (Map.keys $ outputs drv) ) } outputs' <- sequenceA $ Map.mapWithKey (\o _ -> makeOutputPath o hash drvName) $ outputs drv pure $ drv { inputs , outputs = outputs' , env = ifNotJsonModEnv (outputs' <>) } (coerce @Text @VarName -> drvPath) <- pathToText <$> writeDerivation drv' -- Memoize here, as it may be our last chance in case of readonly stores. digestValue <- hashDerivationModulo drv' -- Convert digest to base32 for Nix store paths (get raw bytes, not hex string) let drvHashBytes = convert digestValue :: ByteString let drvHash = Base32.encode drvHashBytes modify $ second $ MS.insert (coerce drvPath) drvHash let outputsWithContext = Map.mapWithKey (\out (coerce -> path) -> mkNixStringWithSingletonContext (StringContext (DerivationOutput out) drvPath) path) (outputs drv') drvPathWithContext = mkNixStringWithSingletonContext (StringContext AllOutputs drvPath) drvPath attrSet = NVStr <$> M.fromList (("drvPath", drvPathWithContext) : Map.toList outputsWithContext) -- TODO: Add location information for all the entries. -- here --v pure $ NVSet mempty $ M.mapKeys coerce attrSet where pathToText = decodeUtf8 . Store.storePathToRawFilePath def makeFixedOutputPath :: (Framed e m) => Store.StorePathName -> HashDigest -> HashMode -> m Text makeFixedOutputPath name digest mode = do -- For fixed-output derivations, the output path is computed from the content hash -- Format: "fixed:out::::/nix/store:" let algoText = hashDigestAlgoText digest let hashText = hashDigestText digest let modePrefix = case mode of Recursive -> "r:" Flat -> mempty let toHash = "fixed:out:" <> modePrefix <> algoText <> ":" <> hashText <> ":/nix/store:" <> Store.unStorePathName name -- Use SHA256 to compute the store path hash let hashPart = Store.mkStorePathHashPart @CryptonHash.SHA256 (encodeUtf8 toHash) let hashBase32 = Base32.encode $ Store.unStorePathHashPart hashPart pure $ "/nix/store/" <> hashBase32 <> "-" <> Store.unStorePathName name makeOutputPath o h n = do name <- makeStorePathName $ Store.unStorePathName n <> if o == "out" then mempty else "-" <> o -- Compute the output path hash according to Nix's algorithm: -- For non-fixed outputs, hash = sha256("output::sha256::/nix/store:") -- where outputPathName is the base name for "out", or base name + "-" + output name for other outputs -- Convert the hash digest to hex string (lowercase) let drvHashHex = decodeUtf8 (convertToBase Base16 h :: ByteString) -- The final name in the hash input must match the output-specific name (same as 'name') -- This is critical: Nix's makeOutputPath uses outputPathName(drvName, outputName) here let toHash = "output:" <> o <> ":sha256:" <> drvHashHex <> ":/nix/store:" <> Store.unStorePathName name -- Use hnix-store-core's mkStorePathHashPart which handles truncation and returns raw bytes -- Use crypton's SHA256 (compatible with hnix-store-core) let hashPart = Store.mkStorePathHashPart @CryptonHash.SHA256 (encodeUtf8 toHash) -- Extract raw bytes and base32-encode using Nix base32 let hashText = Base32.encode $ Store.unStorePathHashPart hashPart -- Build the store path pure $ "/nix/store/" <> hashText <> "-" <> Store.unStorePathName name toStorePaths :: HashSet StringContext -> (Set Text, Map Text [Text]) toStorePaths = foldl (flip addToInputs) mempty addToInputs :: (Bifunctor p) => StringContext -> p (Set Text) (Map Text [Text]) -> p (Set Text) (Map Text [Text]) addToInputs (StringContext kind (coerce -> path)) = case kind of DirectPath -> first $ Set.insert path DerivationOutput o -> second $ Map.insertWith (<>) path $ one o AllOutputs -> -- TODO: recursive lookup. See prim_derivationStrict -- XXX: When is this really used ? error "Not implemented: derivations depending on a .drv file are not yet supported." {- | Build a derivation in a context collecting string contexts. This is complex from a typing standpoint, but it allows to perform the full computation without worrying too much about all the string's contexts. -} buildDerivationWithContext :: forall e t f m. (MonadNix e t f m) => KeyMap (NValue t f m) -> WithStringContextT m Derivation buildDerivationWithContext drvAttrs = do -- Parse name first, so we can add an informative frame drvName <- getAttr "name" $ assertDrvStoreName <=< extractNixString withFrame' Info (ErrorCall $ "While evaluating derivation " <> show drvName) $ do useJson <- getAttrOr "__structuredAttrs" False pure ignoreNulls <- getAttrOr "__ignoreNulls" False pure args <- getAttrOr "args" mempty $ traverse (extractNixString <=< fromValue') builder <- getAttr "builder" extractNixString platform <- getAttr "system" $ assertNonNull <=< extractNoCtx mHash <- getAttrOr "outputHash" mempty $ (pure . pure) <=< extractNoCtx hashMode <- getAttrOr "outputHashMode" Flat $ parseHashMode <=< extractNoCtx outputs <- getAttrOr "outputs" (one "out") $ traverse (extractNoCtx <=< fromValue') mFixedOutput <- maybe (pure Nothing) ( \hash -> do when (outputs /= one "out") $ lift $ throwError $ ErrorCall "Multiple outputs are not supported for fixed-output derivations" hashType <- getAttr "outputHashAlgo" extractNoCtx -- mkNamedDigest returns Either String (DSum HashAlgo Digest) digest <- lift $ either (throwError . ErrorCall) pure $ Store.mkNamedDigest hashType hash pure $ Just digest ) mHash -- filter out null values if needed. attrs <- lift $ bool (pure drvAttrs) ( M.mapMaybe id <$> traverse ( fmap ( \case NVConstant NNull -> Nothing _value -> Just _value ) . demand ) drvAttrs ) ignoreNulls env <- if useJson then do jsonString :: NixString <- lift $ toJSONNixString $ NVSet mempty $ M.mapKeys coerce $ deleteKeys ["args", "__ignoreNulls", "__structuredAttrs"] attrs rawString :: Text <- extractNixString jsonString pure $ one ("__json", rawString) else traverse (extractNixString <=< lift . coerceAnyToNixString callFunc CopyToStore) $ Map.fromList $ M.toList $ deleteKeys ["args", "__ignoreNulls"] attrs pure $ Derivation { platform , builder , args , env , hashMode , useJson , name = drvName , outputs = Map.fromList $ (,mempty) <$> outputs , mFixed = mFixedOutput , inputs = mempty -- stub for now } where -- common functions, lifted to WithStringContextT fromValue' :: (FromValue a m (NValue' t f m (NValue t f m)), MonadNix e t f m) => NValue t f m -> WithStringContextT m a fromValue' = lift . fromValue withFrame' :: (Framed e m, Exception s) => NixLevel -> s -> WithStringContextT m a -> WithStringContextT m a withFrame' level f = join . lift . withFrame level f . pure -- shortcuts to get the (forced) value of an KeyMap field getAttrOr' :: forall v a. (MonadNix e t f m, FromValue v m (NValue' t f m (NValue t f m))) => Text -> m a -> (v -> WithStringContextT m a) -> WithStringContextT m a getAttrOr' n d f = case M.lookup n drvAttrs of Nothing -> lift d Just v -> withFrame' Info (ErrorCall $ "While evaluating attribute '" <> show n <> "'") $ f =<< fromValue' v getAttrOr n = getAttrOr' n . pure getAttr n = getAttrOr' n (throwError $ ErrorCall $ "Required attribute '" <> show n <> "' not found.") -- Test validity for fields assertDrvStoreName :: (MonadNix e t f m) => Text -> WithStringContextT m Text assertDrvStoreName name = lift $ do let invalid c = not $ isAscii c && (isAlphaNum c || c `elem` ("+-._?=" :: String)) -- isAlphaNum allows non-ascii chars. let failWith reason = throwError $ ErrorCall $ "Store name " <> show name <> " " <> reason when ("." `Text.isPrefixOf` name) $ failWith "cannot start with a period" when (Text.length name > 211) $ failWith "must be no longer than 211 characters" when (Text.any invalid name) $ failWith "contains some invalid character" when (".drv" `Text.isSuffixOf` name) $ failWith "is not allowed to end in '.drv'" pure name extractNoCtx :: (MonadNix e t f m) => NixString -> WithStringContextT m Text extractNoCtx ns = maybe (lift $ throwError $ ErrorCall $ "The string " <> show ns <> " is not allowed to have a context.") pure (getStringNoContext ns) assertNonNull :: (MonadNix e t f m) => Text -> WithStringContextT m Text assertNonNull t = do when (Text.null t) $ lift $ throwError $ ErrorCall "Value must not be empty" pure t parseHashMode :: (MonadNix e t f m) => Text -> WithStringContextT m HashMode parseHashMode = \case "flat" -> pure Flat "recursive" -> pure Recursive other -> lift $ throwError $ ErrorCall $ "Hash mode " <> show other <> " is not valid. It must be either 'flat' or 'recursive'" -- Other helpers deleteKeys :: [Text] -> KeyMap a -> KeyMap a deleteKeys keys attrSet = foldl' (flip M.delete) attrSet keys ================================================ FILE: src/Nix/Effects.hs ================================================ {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-orphans #-} module Nix.Effects where import qualified Data.HashSet as HS import qualified Data.Text as Text import GHC.Exception (ErrorCall (ErrorCall)) import Network.HTTP.Client hiding (Proxy, path) import Network.HTTP.Client.TLS import Network.HTTP.Types import Nix.Expr.Types.Annotated import Nix.Frames hiding (Proxy) import Nix.Parser import Nix.Prelude hiding ( print, putStrLn, ) import qualified Nix.Prelude as Prelude import Nix.Render import Nix.Utils.Fix1 import Nix.Value import qualified Paths_hnix import System.Exit import qualified System.Info import System.Process import Data.Default.Class (def) import Data.Some.Newtype (Some (..)) import qualified System.Nix.Hash as Store.Hash import qualified System.Nix.Nar as Store.Nar import qualified System.Nix.Store.Remote as Store.Remote import qualified System.Nix.StorePath as Store -- | A path into the nix store newtype StorePath = StorePath Path deriving (Eq, Ord, Show, Hashable) -- All of the following type classes defer to the underlying 'm'. -- * @class MonadEffects t f m@ class ( MonadFile m , MonadStore m , MonadPutStr m , MonadHttp m , MonadEnv m , MonadPaths m , MonadInstantiate m , MonadExec m , MonadIntrospect m ) => MonadEffects t f m where -- | Determine the absolute path in the current context. toAbsolutePath :: Path -> m Path findEnvPath :: String -> m Path -- | Having an explicit list of sets corresponding to the @NIX_PATH@ and a file path try to find an existing path. findPath :: [NValue t f m] -> Path -> m Path importPath :: Path -> m (NValue t f m) pathToDefaultNix :: Path -> m Path derivationStrict :: NValue t f m -> m (NValue t f m) -- 2021-04-01: for trace, so leaving String here traceEffect :: String -> m () -- ** Instances instance ( MonadFix1T t m , MonadStore m ) => MonadStore (Fix1T t m) where addToStore a b c d = lift $ addToStore a b c d addTextToStore' a b c d = lift $ addTextToStore' a b c d -- * @class MonadIntrospect m@ class (Monad m) => MonadIntrospect m where recursiveSize :: a -> m Word default recursiveSize :: (MonadTrans t, MonadIntrospect m', m ~ t m') => a -> m Word recursiveSize = lift . recursiveSize -- ** Instances {- FOURMOLU_DISABLE -} instance MonadIntrospect IO where recursiveSize = #ifdef MIN_VERSION_ghc_datasize recursiveSize #else const $ pure 0 #endif {- FOURMOLU_ENABLE -} deriving instance (MonadIntrospect (t (Fix1 t))) => MonadIntrospect (Fix1 t) deriving instance (MonadIntrospect (t (Fix1T t m) m)) => MonadIntrospect (Fix1T t m) -- * @class MonadExec m@ class (Monad m) => MonadExec m where exec' :: [Text] -> m (Either ErrorCall NExprLoc) default exec' :: (MonadTrans t, MonadExec m', m ~ t m') => [Text] -> m (Either ErrorCall NExprLoc) exec' = lift . exec' -- ** Instances instance MonadExec IO where exec' = \case [] -> pure $ Left $ ErrorCall "exec: missing program" (prog : args) -> do (exitCode, out, _) <- liftIO $ readProcessWithExitCode (toString prog) (toString <$> args) mempty let t = Text.strip $ fromString out emsg = "program[" <> prog <> "] args=" <> show args case exitCode of ExitSuccess -> pure $ if Text.null t then Left $ ErrorCall $ toString $ "exec has no output :" <> emsg else either (\err -> Left $ ErrorCall $ toString $ "Error parsing output of exec: " <> show err <> " " <> emsg) pure (parseNixTextLoc t) err -> pure $ Left $ ErrorCall $ toString $ "exec failed: " <> show err <> " " <> emsg deriving instance (MonadExec (t (Fix1 t))) => MonadExec (Fix1 t) deriving instance (MonadExec (t (Fix1T t m) m)) => MonadExec (Fix1T t m) -- * @class MonadInstantiate m@ class (Monad m) => MonadInstantiate m where instantiateExpr :: Text -> m (Either ErrorCall NExprLoc) default instantiateExpr :: (MonadTrans t, MonadInstantiate m', m ~ t m') => Text -> m (Either ErrorCall NExprLoc) instantiateExpr = lift . instantiateExpr -- ** Instances instance MonadInstantiate IO where instantiateExpr expr = do traceM $ "Executing: " <> show ["nix-instantiate", "--eval", "--expr ", expr] (exitCode, out, err) <- readProcessWithExitCode "nix-instantiate" ["--eval", "--expr", toString expr] mempty pure $ case exitCode of ExitSuccess -> either (\e -> Left $ ErrorCall $ "Error parsing output of nix-instantiate: " <> show e) pure (parseNixTextLoc $ fromString out) status -> Left $ ErrorCall $ "nix-instantiate failed: " <> show status <> ": " <> err deriving instance (MonadInstantiate (t (Fix1 t))) => MonadInstantiate (Fix1 t) deriving instance (MonadInstantiate (t (Fix1T t m) m)) => MonadInstantiate (Fix1T t m) -- * @class MonadEnv m@ class (Monad m) => MonadEnv m where getEnvVar :: Text -> m (Maybe Text) default getEnvVar :: (MonadTrans t, MonadEnv m', m ~ t m') => Text -> m (Maybe Text) getEnvVar = lift . getEnvVar getCurrentSystemOS :: m Text default getCurrentSystemOS :: (MonadTrans t, MonadEnv m', m ~ t m') => m Text getCurrentSystemOS = lift getCurrentSystemOS getCurrentSystemArch :: m Text default getCurrentSystemArch :: (MonadTrans t, MonadEnv m', m ~ t m') => m Text getCurrentSystemArch = lift getCurrentSystemArch -- ** Instances instance MonadEnv IO where getEnvVar = (<<$>>) fromString . lookupEnv . toString getCurrentSystemOS = pure $ fromString System.Info.os -- Invert the conversion done by GHC_CONVERT_CPU in GHC's aclocal.m4 getCurrentSystemArch = pure $ fromString $ case System.Info.arch of "i386" -> "i686" arch -> arch deriving instance (MonadEnv (t (Fix1 t))) => MonadEnv (Fix1 t) deriving instance (MonadEnv (t (Fix1T t m) m)) => MonadEnv (Fix1T t m) -- * @class MonadPaths m@ class (Monad m) => MonadPaths m where getDataDir :: m Path default getDataDir :: (MonadTrans t, MonadPaths m', m ~ t m') => m Path getDataDir = lift getDataDir -- ** Instances instance MonadPaths IO where getDataDir = coerce Paths_hnix.getDataDir deriving instance (MonadPaths (t (Fix1 t))) => MonadPaths (Fix1 t) deriving instance (MonadPaths (t (Fix1T t m) m)) => MonadPaths (Fix1T t m) -- * @class MonadHttp m@ class (Monad m) => MonadHttp m where getURL :: Text -> m (Either ErrorCall StorePath) default getURL :: (MonadTrans t, MonadHttp m', m ~ t m') => Text -> m (Either ErrorCall StorePath) getURL = lift . getURL baseNameOf :: Text -> Text baseNameOf a = Text.takeWhileEnd (/= '/') $ Text.dropWhileEnd (== '/') a -- conversion from Store.StorePath to Effects.StorePath, different type with the same name. toStorePath :: Store.StorePath -> StorePath toStorePath = StorePath . coerce . decodeUtf8 @FilePath @ByteString . Store.storePathToRawFilePath def -- ** Instances instance MonadHttp IO where getURL url = do let urlstr = toString url traceM $ "fetching HTTP URL: " <> urlstr req <- parseRequest urlstr manager <- bool (newManager defaultManagerSettings) newTlsManager (secure req) response <- httpLbs (req{method = "GET"}) manager let status = statusCode $ responseStatus response let body = responseBody response -- let digest::Hash.Digest Hash.SHA256 = Hash.hash $ (B.concat . BL.toChunks) body let name = baseNameOf url bool (pure $ Left $ ErrorCall $ "fail, got " <> show status <> " when fetching url = " <> urlstr) -- using addTextToStore' result in different hash from the addToStore. -- see https://github.com/haskell-nix/hnix/pull/1051#issuecomment-1031380804 (addToStore name (NarText $ toStrict body) False False) (status == 200) deriving instance (MonadHttp (t (Fix1 t))) => MonadHttp (Fix1 t) deriving instance (MonadHttp (t (Fix1T t m) m)) => MonadHttp (Fix1T t m) -- * @class MonadPutStr m@ class (Monad m, MonadIO m) => MonadPutStr m where -- TODO: Should this be used *only* when the Nix to be evaluated invokes a -- `trace` operation? -- 2021-04-01: Due to trace operation here, leaving it as String. putStr :: String -> m () default putStr :: (MonadTrans t, MonadPutStr m', m ~ t m') => String -> m () putStr = lift . Prelude.putStr -- ** Instances instance MonadPutStr IO where putStr = Prelude.putStr deriving instance (MonadPutStr (t (Fix1 t))) => MonadPutStr (Fix1 t) deriving instance (MonadPutStr (t (Fix1T t m) m)) => MonadPutStr (Fix1T t m) -- ** Functions putStrLn :: (MonadPutStr m) => String -> m () putStrLn = Nix.Effects.putStr . (<> "\n") print :: (MonadPutStr m, Show a) => a -> m () print = putStrLn . show -- * Store effects -- ** Data type synonyms type RecursiveFlag = Bool type RepairFlag = Bool type StorePathName = Text type PathFilter m = Path -> m Bool type StorePathSet = HS.HashSet StorePath -- ** @class MonadStore m@ data NarContent = NarFile Path | NarText ByteString -- | convert NarContent to NarSource needed in the store API toNarSource :: (MonadIO m) => NarContent -> Store.Nar.NarSource m toNarSource (NarFile path) = Store.Nar.dumpPath $ coerce path toNarSource (NarText text) = Store.Nar.dumpString text class (Monad m) => MonadStore m where -- | Copy the contents of a local path(Or pure text) to the store. The resulting store -- path is returned. Note: This does not support yet support the expected -- `filter` function that allows excluding some files. addToStore :: StorePathName -> NarContent -> RecursiveFlag -> RepairFlag -> m (Either ErrorCall StorePath) default addToStore :: (MonadTrans t, MonadStore m', m ~ t m') => StorePathName -> NarContent -> RecursiveFlag -> RepairFlag -> m (Either ErrorCall StorePath) addToStore a b c d = lift $ addToStore a b c d -- | Like addToStore, but the contents written to the output path is a -- regular file containing the given string. addTextToStore' :: StorePathName -> Text -> StorePathSet -> RepairFlag -> m (Either ErrorCall StorePath) default addTextToStore' :: (MonadTrans t, MonadStore m', m ~ t m') => StorePathName -> Text -> StorePathSet -> RepairFlag -> m (Either ErrorCall StorePath) addTextToStore' a b c d = lift $ addTextToStore' a b c d -- *** Instances instance MonadStore IO where addToStore name content recursive repair = case Store.mkStorePathName name of Left err -> pure $ Left $ ErrorCall $ "String '" <> show name <> "' is not a valid path name: " <> show err Right pathName -> do let ingestionMethod = if recursive then Store.Remote.FileIngestionMethod_FileRecursive else Store.Remote.FileIngestionMethod_Flat repairMode = if repair then Store.Remote.RepairMode_DoRepair else Store.Remote.RepairMode_DontRepair -- Use Some constructor with HashAlgo_SHA256 hashAlgo = Some Store.Hash.HashAlgo_SHA256 res <- Store.Remote.runStore $ Store.Remote.addToStore pathName (toNarSource content) ingestionMethod hashAlgo repairMode either Left -- err (pure . toStorePath) -- store path <$> parseStoreResult "addToStore" res addTextToStore' name text references repair = case Store.mkStorePathName name of Left err -> pure $ Left $ ErrorCall $ "String '" <> show name <> "' is not a valid path name: " <> show err Right pathName -> do let storeText = Store.Remote.StoreText pathName text repairMode = if repair then Store.Remote.RepairMode_DoRepair else Store.Remote.RepairMode_DontRepair -- Convert our StorePathSet (HashSet of StorePath) to HashSet of Store.StorePath storeDir = Store.StoreDir "/nix/store" storeRefs = HS.map (\(StorePath p) -> Store.parsePath storeDir (encodeUtf8 $ toText p)) references -- Filter out any parse failures and extract successful paths validRefs = HS.fromList $ rights $ HS.toList storeRefs res <- Store.Remote.runStore $ Store.Remote.addTextToStore storeText validRefs repairMode either Left -- err (pure . toStorePath) -- path <$> parseStoreResult "addTextToStore" res -- ** Functions -- Import DList type (it's re-exported as part of the Run type signature) parseStoreResult :: (Monad m) => Text -> (Either Store.Remote.RemoteStoreError a, loggers) -> m (Either ErrorCall a) parseStoreResult name (res, _logs) = pure $ either (\err -> Left $ ErrorCall $ "Failed to execute '" <> toString name <> "': " <> show err) pure res addTextToStore :: (Framed e m, MonadStore m) => StorePathName -> Text -> StorePathSet -> RepairFlag -> m StorePath addTextToStore a b c d = either throwError pure =<< addTextToStore' a b c d -- 2021-10-30: NOTE: Misleading name, please rename. -- | Add @Path@ into the Nix Store addPath :: (Framed e m, MonadStore m) => Path -> m StorePath addPath p = either throwError pure =<< addToStore (fromString $ coerce takeFileName p) (NarFile p) True False toFile_ :: (Framed e m, MonadStore m) => Path -> Text -> m StorePath toFile_ p contents = addTextToStore (fromString $ coerce p) contents mempty False ================================================ FILE: src/Nix/Eval.hs ================================================ {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE RankNTypes #-} module Nix.Eval where import Control.Monad (foldM) import Control.Monad.Fix (MonadFix) import qualified Data.HashMap.Lazy as M import Data.List (partition) import Data.Semialign.Indexed (ialignWith) import Data.These (These (..)) import GHC.Exception (ErrorCall (ErrorCall)) import Nix.Atoms import Nix.Convert import Nix.Expr.Strings (runAntiquoted) import Nix.Expr.Types import Nix.Expr.Types.Annotated import Nix.Frames import Nix.Prelude import Nix.Scope import Nix.String import Nix.Value.Monad import Relude.Extra (set) class (Show v, Monad m) => MonadEval v m where freeVariable :: VarName -> m v synHole :: VarName -> m v attrMissing :: NonEmpty VarName -> Maybe v -> m v evaledSym :: VarName -> v -> m v evalCurPos :: m v evalConstant :: NAtom -> m v evalString :: NString (m v) -> m v evalLiteralPath :: Path -> m v evalEnvPath :: Path -> m v evalUnary :: NUnaryOp -> v -> m v evalBinary :: NBinaryOp -> v -> m v -> m v -- ^ The second argument is an action because operators such as boolean && -- and || may not evaluate the second argument. evalWith :: m v -> m v -> m v evalIf :: v -> m v -> m v -> m v evalAssert :: v -> m v -> m v evalApp :: v -> m v -> m v evalAbs :: Params (m v) -> ( forall a. m v -> ( AttrSet (m v) -> m v -> m (a, v) ) -> m (a, v) ) -> m v {- evalSelect :: v -> NonEmpty Text -> Maybe (m v) -> m v evalHasAttr :: v -> NonEmpty Text -> m v -- | This and the following methods are intended to allow things like -- adding provenance information. evalListElem :: [m v] -> Int -> m v -> m v evalList :: [v] -> m v evalSetElem :: AttrSet (m v) -> Text -> m v -> m v evalSet :: AttrSet v -> PositionSet -> m v evalRecSetElem :: AttrSet (m v) -> Text -> m v -> m v evalRecSet :: AttrSet v -> PositionSet -> m v evalLetElem :: Text -> m v -> m v evalLet :: m v -> m v -} evalError :: (Exception s) => s -> m a type MonadNixEval v m = ( MonadEval v m , Scoped v m , MonadValue v m , MonadFix m , ToValue Bool m v , ToValue [v] m v , FromValue NixString m v , ToValue (AttrSet v, PositionSet) m v , FromValue (AttrSet v, PositionSet) m v ) data EvalFrame m v = EvaluatingExpr (Scopes m v) NExprLoc | ForcingExpr (Scopes m v) NExprLoc | Calling VarName SrcSpan | SynHole (SynHoleInfo m v) deriving (Show, Typeable) instance (Typeable m, Typeable v) => Exception (EvalFrame m v) data SynHoleInfo m v = SynHoleInfo { _synHoleInfo_expr :: NExprLoc , _synHoleInfo_scope :: Scopes m v } deriving (Show, Typeable) instance (Typeable m, Typeable v) => Exception (SynHoleInfo m v) -- jww (2019-03-18): By deferring only those things which must wait until -- context of us, this can be written as: -- eval :: forall v m . MonadNixEval v m => NExprF v -> m v eval :: forall v m. (MonadNixEval v m) => NExprF (m v) -> m v eval (NSym "__curPos") = evalCurPos eval (NSym var) = do mVal <- lookupVar var maybe (freeVariable var) (evaledSym var <=< demand) mVal eval (NConstant x) = evalConstant x eval (NStr str) = evalString str eval (NLiteralPath p) = evalLiteralPath p eval (NEnvPath p) = evalEnvPath p eval (NUnary op arg) = evalUnary op =<< arg eval (NApp fun arg) = do f <- fun scope <- askScopes evalApp f $ withScopes scope arg eval (NBinary op larg rarg) = do lav <- larg evalBinary op lav rarg eval (NSelect alt aset attr) = do let useAltOrReportMissing (s, ks) = fromMaybe (attrMissing ks $ pure s) alt eAttr <- evalSelect aset attr either useAltOrReportMissing id (coerce eAttr) eval (NHasAttr aset attr) = do eAttr <- evalSelect aset attr toValue $ isRight eAttr eval (NList l) = do scope <- askScopes toValue =<< traverse (defer @v @m . withScopes @v scope) l eval (NSet r binds) = do attrSet <- evalBinds (r == Recursive) $ desugarBinds (eval . NSet mempty) binds toValue attrSet eval (NLet binds body) = do (attrSet, _) <- evalBinds True binds pushScope (coerce attrSet) body eval (NIf cond t f) = do v <- cond evalIf v t f eval (NWith scope body) = evalWith scope body eval (NAssert cond body) = do x <- cond evalAssert x body eval (NAbs params body) = do -- It is the environment at the definition site, not the call site, that -- needs to be used when evaluating the body and default arguments, hence we -- defer here so the present scope is restored when the parameters and body -- are forced during application. curScope <- askScopes let withCurScope = withScopes curScope fun :: m v -> (AttrSet (m v) -> m v -> m r) -> m r fun arg k = withCurScope $ do (coerce -> newScopeToAdd) <- buildArgument params arg pushScope newScopeToAdd $ k (coerce $ withCurScope . inform <$> newScopeToAdd) body evalAbs params fun eval (NSynHole name) = synHole name {- | If you know that the 'scope' action will result in an 'AttrSet v', then this implementation may be used as an implementation for 'evalWith'. -} evalWithAttrSet :: forall v m. (MonadNixEval v m) => m v -> m v -> m v evalWithAttrSet aset body = do scopes <- askScopes -- The scope is deliberately wrapped in a thunk here, since it is demanded -- each time a name is looked up within the weak scope, and we want to be -- sure the action it evaluates is to force a thunk, so its value is only -- computed once. deferredAset <- defer $ withScopes scopes aset let weakscope = coerce . fst <$> (fromValue @(AttrSet v, PositionSet) =<< demand deferredAset) pushWeakScope weakscope body attrSetAlter :: forall v m. (MonadNixEval v m) => [VarName] -> NSourcePos -> AttrSet (m v) -> PositionSet -> m v -> m (AttrSet (m v), PositionSet) attrSetAlter ks' pos m' p' val = swap <$> go p' m' ks' where -- This `go` does traverse in disquise. Notice how it traverses `ks`. go :: PositionSet -> AttrSet (m v) -> [VarName] -> m (PositionSet, AttrSet (m v)) go _ _ [] = evalError @v $ ErrorCall "invalid selector with no components" go p m (k : ks) = bool (pure $ insertVal val) ( maybe (recurse mempty mempty) ( \x -> do -- 2021-10-12: NOTE: swapping sourcewide into (PositionSet, AttrSet) would optimize code and remove this `swap` (swap -> (sp, st)) <- fromValue @(AttrSet v, PositionSet) =<< x recurse sp $ demand <$> st ) ((`M.lookup` m) k) ) (isPresent ks) where insertVal :: m v -> (PositionSet, AttrSet (m v)) insertVal v = ( insertPos , insertV v ) where insertV v' = M.insert k v' m insertPos = M.insert k pos p recurse :: PositionSet -> AttrSet (m v) -> m ( PositionSet , AttrSet (m v) ) recurse p'' m'' = insertVal . ((toValue @(AttrSet v, PositionSet)) <=< ((,mempty) <$>) . sequenceA . snd) <$> go p'' m'' ks desugarBinds :: forall r. ([Binding r] -> r) -> [Binding r] -> [Binding r] desugarBinds embed = (`evalState` mempty) . traverse (findBinding <=< collect) where collect :: Binding r -> State (AttrSet (NSourcePos, [Binding r])) (Either VarName (Binding r)) collect (NamedVar (StaticKey x :| y : ys) val oldPosition) = do modify updateBindingInformation pure $ Left x where updateBindingInformation :: AttrSet (NSourcePos, [Binding r]) -> AttrSet (NSourcePos, [Binding r]) updateBindingInformation = M.insert x =<< maybe (mkBindingSingleton oldPosition) (\(foundPosition, newBindings) -> second (<> newBindings) $ mkBindingSingleton foundPosition) . M.lookup x mkBindingSingleton :: NSourcePos -> (NSourcePos, [Binding r]) mkBindingSingleton np = (np, one $ bindValAt np) where bindValAt :: NSourcePos -> Binding r bindValAt = NamedVar (y :| ys) val collect x = pure $ pure x findBinding :: Either VarName (Binding r) -> State (AttrSet (NSourcePos, [Binding r])) (Binding r) findBinding = either ( \x -> maybe (error $ "No binding " <> show x) (\(p, v) -> pure $ NamedVar (one $ StaticKey x) (embed v) p) =<< gets (M.lookup x) ) pure evalBinds :: forall v m. (MonadNixEval v m) => -- 2021-07-19: NOTE: Recutsivity data type Bool -> [Binding (m v)] -> -- 2021-07-19: NOTE: AttrSet is a Scope m (AttrSet v, PositionSet) evalBinds isRecursive binds = do scope <- askScopes buildResult scope . fold =<< (`traverse` moveOverridesLast binds) (applyBindToAdt scope) where buildResult :: Scopes m v -> [([VarName], NSourcePos, m v)] -> m (AttrSet v, PositionSet) buildResult scopes bindings = do (coerce -> scope, p) <- foldM insert mempty bindings res <- bool (traverse mkThunk) (loebM . fmap encapsulate) isRecursive scope pure (coerce res, p) where insert :: (AttrSet (m v), PositionSet) -> ([VarName], NSourcePos, m v) -> m (AttrSet (m v), PositionSet) insert (m, p) (path, pos, value) = attrSetAlter path pos m p value mkThunk = defer . withScopes scopes encapsulate f attrs = mkThunk $ pushScope attrs f applyBindToAdt :: Scopes m v -> Binding (m v) -> m [([VarName], NSourcePos, m v)] applyBindToAdt _ (NamedVar (StaticKey "__overrides" :| []) finalValue pos) = do (o', p') <- fromValue =<< finalValue -- jww (2018-05-09): What to do with the key position here? pure $ ( \(k, v) -> ( one k , fromMaybe pos $ M.lookup k p' , demand v ) ) <$> M.toList o' applyBindToAdt _ (NamedVar pathExpr finalValue pos) = ( \case -- When there are no path segments, e.g. `${null} = 5;`, we don't -- bind anything ([], _, _) -> mempty result -> one result ) <$> processAttrSetKeys pathExpr where processAttrSetKeys :: NAttrPath (m v) -> m ([VarName], NSourcePos, m v) processAttrSetKeys (h :| t) = maybe -- Empty attrset - return a stub. (pure (mempty, nullPos, toValue @(AttrSet v, PositionSet) mempty)) ( \k -> handlePresence -- No more keys in the attrset - return the result (pure (one k, pos, finalValue)) -- There are unprocessed keys in attrset - recurse appending the results ( \(x : xs) -> do (restOfPath, _, v) <- processAttrSetKeys (x :| xs) pure (k : restOfPath, pos, v) ) t ) =<< evalSetterKeyName h applyBindToAdt scopes (Inherit ms names pos) = pure $ processScope <$> names where processScope :: VarName -> ([VarName], NSourcePos, m v) processScope var = ( one var , pos , maybe (attrMissing (one var) Nothing) demand =<< maybe (withScopes scopes $ lookupVar var) ( \s -> do (coerce -> scope, _) <- fromValue @(AttrSet v, PositionSet) =<< s clearScopes $ pushScope @v scope $ lookupVar var ) ms ) moveOverridesLast = uncurry (<>) . partition ( \case NamedVar (StaticKey "__overrides" :| []) _ _ -> False _ -> True ) evalSelect :: forall v m. (MonadNixEval v m) => m v -> NAttrPath (m v) -> m (Either (v, NonEmpty VarName) (m v)) evalSelect aset attr = do s <- aset path <- traverse evalGetterKeyName attr extract path s where extract :: NonEmpty VarName -> v -> m (Either (v, NonEmpty VarName) (m v)) extract path@(k :| ks) x = maybe left ( maybe left ( handlePresence (pure . pure) (\(y : ys) -> (extract (y :| ys) =<<)) ks . demand ) . M.lookup k . fst ) =<< fromValueMay @(AttrSet v, PositionSet) x where left :: m (Either (v, NonEmpty VarName) b) left = pure $ Left (x, path) {- | Evaluate a component of an attribute path in a context where we are *retrieving* a value -} evalGetterKeyName :: forall v m. (MonadEval v m, FromValue NixString m v) => NKeyName (m v) -> m VarName evalGetterKeyName = maybe (evalError @v $ ErrorCall "value is null while a string was expected") pure <=< evalSetterKeyName {- | Evaluate a component of an attribute path in a context where we are *binding* a value -} evalSetterKeyName :: (MonadEval v m, FromValue NixString m v) => NKeyName (m v) -> m (Maybe VarName) evalSetterKeyName = \case StaticKey k -> pure $ pure k DynamicKey k -> coerce . ignoreContext <<$>> runAntiquoted "\n" assembleString (fromValueMay =<<) k assembleString :: forall v m. (MonadEval v m, FromValue NixString m v) => NString (m v) -> m (Maybe NixString) assembleString = fromParts . stringParts where fromParts :: [Antiquoted Text (m v)] -> m (Maybe NixString) fromParts xs = fold <<$>> traverse2 fun xs fun :: Antiquoted Text (m v) -> m (Maybe NixString) fun = runAntiquoted "\n" (pure . pure . mkNixStringWithoutContext) (fromValueMay =<<) buildArgument :: forall v m. (MonadNixEval v m) => Params (m v) -> m v -> m (AttrSet v) buildArgument params arg = do scope <- askScopes let argThunk = defer $ withScopes scope arg case params of Param name -> one . (name,) <$> argThunk ParamSet mname variadic pset -> do (args, _) <- fromValue @(AttrSet v, PositionSet) =<< arg let inject = maybe id (`M.insert` const argThunk) -- why insert into const? Thunk value getting magic point? mname loebM $ inject $ M.mapMaybe id $ ialignWith (assemble scope variadic) args $ M.fromList pset where assemble :: Scopes m v -> Variadic -> VarName -> These v (Maybe (m v)) -> Maybe (AttrSet v -> m v) assemble _ Variadic _ (This _) = Nothing assemble scope _ k t = pure $ case t of That Nothing -> const $ evalError @v $ ErrorCall $ "Missing value for parameter: ''" <> show k That (Just f) -> coerce $ defer . withScopes scope . (`pushScope` f) This _ -> const $ evalError @v $ ErrorCall $ "Unexpected parameter: " <> show k These x _ -> const $ pure x {- | Add source positions to @NExprLoc@. Takes @NExprLoc@, by itself takes source position informatoin, does transformation, returns @NExprLoc@ with source positions. Actually: > => (NExprLoc -> m a) > -> NExprLoc -> m a -} addSourcePositions :: (MonadReader e m, Has e SrcSpan) => Transform NExprLocF (m a) addSourcePositions f (v@(Ann ann _) :: NExprLoc) = local (set hasLens ann) $ f v addStackFrames :: forall v e m a. (Scoped v m, Framed e m, Typeable v, Typeable m) => TransformF NExprLoc (m a) addStackFrames f v = do scopes <- askScopes -- sectioning gives GHC optimization -- If opimization question would arrive again, check the @(`withFrameInfo` f v) $ EvaluatingExpr scopes v@ -- for possible @scopes@ implementation @v@ type arguments sharing between runs. (`withFrameInfo` f v) $ (`EvaluatingExpr` v) scopes where withFrameInfo = withFrame Info evalWithMetaInfo :: forall e v m. (MonadNixEval v m, Framed e m, Has e SrcSpan, Typeable m, Typeable v) => NExprLoc -> m v evalWithMetaInfo = adi addMetaInfo evalContent -- | Add source positions & frame context system. addMetaInfo :: forall v m e a. (Framed e m, Scoped v m, Has e SrcSpan, Typeable m, Typeable v) => TransformF NExprLoc (m a) addMetaInfo = addStackFrames @v . addSourcePositions -- | Takes annotated expression. Strip from annotation. Evaluate. evalContent :: (MonadNixEval v m) => AnnF ann NExprF (m v) -> m v evalContent = eval . stripAnnF ================================================ FILE: src/Nix/Exec.hs ================================================ {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE CPP #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE PartialTypeSignatures #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-orphans #-} {-# OPTIONS_GHC -fno-warn-name-shadowing #-} module Nix.Exec where import Control.Monad.Catch hiding (catchJust) import Control.Monad.Fix import Data.Fix import qualified Data.HashMap.Lazy as M import qualified Data.List.NonEmpty as NE import qualified Data.Text as Text import GHC.Exception (ErrorCall (ErrorCall)) import Nix.Atoms import Nix.Cited import Nix.Convert import Nix.Effects import Nix.Eval as Eval import Nix.Expr.Types import Nix.Expr.Types.Annotated import Nix.Frames import Nix.Options import Nix.Prelude hiding ( print, putStr, putStrLn, ) import Nix.Pretty import Nix.Render import Nix.Scope import Nix.String import Nix.String.Coerce import Nix.Thunk import Nix.Value import Nix.Value.Equal import Nix.Value.Monad import Prettyprinter import qualified Text.Show.Pretty as PS #ifdef MIN_VERSION_ghc_datasize import GHC.DataSize #endif type MonadCited t f m = ( HasCitations m (NValue t f m) t , HasCitations1 m (NValue t f m) f , MonadDataContext f m ) mkNVConstantWithProvenance :: (MonadCited t f m) => Scopes m (NValue t f m) -> SrcSpan -> NAtom -> NValue t f m mkNVConstantWithProvenance scopes span x = addProvenance (Provenance scopes . NConstantAnnF span $ x) $ NVConstant x mkNVStrWithProvenance :: (MonadCited t f m) => Scopes m (NValue t f m) -> SrcSpan -> NixString -> NValue t f m mkNVStrWithProvenance scopes span x = addProvenance (Provenance scopes . NStrAnnF span . DoubleQuoted . one . Plain . ignoreContext $ x) $ NVStr x mkNVPathWithProvenance :: (MonadCited t f m) => Scopes m (NValue t f m) -> SrcSpan -> Path -> Path -> NValue t f m mkNVPathWithProvenance scope span lit real = addProvenance (Provenance scope . NLiteralPathAnnF span $ lit) $ NVPath real mkNVClosureWithProvenance :: (MonadCited t f m) => Scopes m (NValue t f m) -> SrcSpan -> Params () -> (NValue t f m -> m (NValue t f m)) -> NValue t f m mkNVClosureWithProvenance scopes span x f = addProvenance (Provenance scopes $ NAbsAnnF span (Nothing <$ x) Nothing) $ NVClosure x f mkNVUnaryOpWithProvenance :: (MonadCited t f m) => Scopes m (NValue t f m) -> SrcSpan -> NUnaryOp -> Maybe (NValue t f m) -> NValue t f m -> NValue t f m mkNVUnaryOpWithProvenance scope span op val = addProvenance (Provenance scope $ NUnaryAnnF span op val) mkNVAppOpWithProvenance :: (MonadCited t f m) => Scopes m (NValue t f m) -> SrcSpan -> Maybe (NValue t f m) -> Maybe (NValue t f m) -> NValue t f m -> NValue t f m mkNVAppOpWithProvenance scope span lval rval = addProvenance (Provenance scope $ NAppAnnF span lval rval) mkNVBinaryOpWithProvenance :: (MonadCited t f m) => Scopes m (NValue t f m) -> SrcSpan -> NBinaryOp -> Maybe (NValue t f m) -> Maybe (NValue t f m) -> NValue t f m -> NValue t f m mkNVBinaryOpWithProvenance scope span op lval rval = addProvenance (Provenance scope $ NBinaryAnnF span op lval rval) type MonadCitedThunks t f m = ( MonadThunk t m (NValue t f m) , MonadDataErrorContext t f m , HasCitations m (NValue t f m) t , HasCitations1 m (NValue t f m) f ) type MonadNix e t f m = ( Has e SrcSpan , Has e Options , Scoped (NValue t f m) m , Framed e m , MonadFix m , MonadCatch m , MonadThrow m , Alternative m , MonadEffects t f m , MonadCitedThunks t f m , MonadValue (NValue t f m) m ) data ExecFrame t f m = Assertion SrcSpan (NValue t f m) deriving (Show, Typeable) instance (MonadDataErrorContext t f m) => Exception (ExecFrame t f m) nverr :: forall e t f s m a. (MonadNix e t f m, Exception s) => s -> m a nverr = evalError @(NValue t f m) askSpan :: forall e m. (MonadReader e m, Has e SrcSpan) => m SrcSpan askSpan = askLocal wrapExprLoc :: SrcSpan -> NExprLocF r -> NExprLoc wrapExprLoc span x = Fix $ NSymAnn span "" <$ x {-# INLINE wrapExprLoc #-} -- 2021-01-07: NOTE: This instance belongs to be beside MonadEval type class. -- Currently instance is stuck in orphanage between the requirements to be MonadEval, aka Eval stage, and emposed requirement to be MonadNix (Execution stage). MonadNix constraint tries to put the cart before horse and seems superflous, since Eval in Nix also needs and can throw exceptions. It is between `nverr` and `evalError`. instance (MonadNix e t f m) => MonadEval (NValue t f m) m where freeVariable var = nverr @e @t @f $ ErrorCall $ toString @Text $ "Undefined variable '" <> coerce var <> "'" synHole name = do span <- askSpan scope <- askScopes evalError @(NValue t f m) $ SynHole $ SynHoleInfo { _synHoleInfo_expr = NSynHoleAnn span name , _synHoleInfo_scope = scope } attrMissing ks ms = evalError @(NValue t f m) $ ErrorCall $ toString $ maybe ("Inheriting unknown attribute: " <> attr) (\s -> "Could not look up attribute " <> attr <> " in " <> show (prettyNValue s)) ms where attr = Text.intercalate "." $ NE.toList $ coerce ks evalCurPos = do scope <- askScopes span@(SrcSpan delta _) <- askSpan addProvenance @_ @_ @(NValue t f m) (Provenance scope . NSymAnnF span $ coerce @Text "__curPos") <$> toValue delta evaledSym name val = do scope <- askScopes span <- askSpan pure $ addProvenance @_ @_ @(NValue t f m) (Provenance scope $ NSymAnnF span name) val evalConstant c = do scope <- askScopes span <- askSpan pure $ mkNVConstantWithProvenance scope span c evalString = maybe (nverr $ ErrorCall "Failed to assemble string") ( \ns -> do scope <- askScopes span <- askSpan pure $ mkNVStrWithProvenance scope span ns ) <=< assembleString evalLiteralPath p = do scope <- askScopes span <- askSpan mkNVPathWithProvenance scope span p <$> toAbsolutePath @t @f @m p evalEnvPath p = do scope <- askScopes span <- askSpan mkNVPathWithProvenance scope span p <$> findEnvPath @t @f @m (coerce p) evalUnary op arg = do scope <- askScopes span <- askSpan execUnaryOp scope span op arg evalBinary op larg rarg = do scope <- askScopes span <- askSpan execBinaryOp scope span op larg rarg evalWith c b = do scope <- askScopes span <- askSpan let f = join $ addProvenance . Provenance scope . NWithAnnF span Nothing . pure f <$> evalWithAttrSet c b evalIf c tVal fVal = do scope <- askScopes span <- askSpan bl <- fromValue c let fun x y = addProvenance (Provenance scope $ NIfAnnF span (pure c) x y) falseVal = (fun Nothing =<< pure) <$> fVal trueVal = (flip fun Nothing =<< pure) <$> tVal bool falseVal trueVal bl evalAssert c body = do span <- askSpan b <- fromValue c bool (nverr $ Assertion span c) ( do scope <- askScopes join (addProvenance . Provenance scope . NAssertAnnF span (pure c) . pure) <$> body ) b evalApp f x = do scope <- askScopes span <- askSpan mkNVAppOpWithProvenance scope span (pure f) Nothing <$> (callFunc f =<< defer x) evalAbs :: Params (m (NValue t f m)) -> ( forall a. m (NValue t f m) -> ( AttrSet (m (NValue t f m)) -> m (NValue t f m) -> m (a, NValue t f m) ) -> m (a, NValue t f m) ) -> m (NValue t f m) evalAbs p k = do scope <- askScopes span <- askSpan pure $ mkNVClosureWithProvenance scope span (void p) (fmap snd . flip (k @()) (const (fmap (mempty,))) . pure) evalError = throwError infixl 1 `callFunc` callFunc :: forall e t f m. (MonadNix e t f m) => NValue t f m -> NValue t f m -> m (NValue t f m) callFunc fun arg = do frames <- askFrames when (length frames > 2000) $ throwError $ ErrorCall "Function call stack exhausted" fun' <- demand fun case fun' of NVBuiltin name f -> do span <- askSpan withFrame Info ((Calling @m @(NValue t f m)) name span) $ f arg -- Is this cool? NVClosure _params f -> f arg (NVSet _ m) | Just f <- M.lookup "__functor" m -> (`callFunc` arg) =<< (`callFunc` fun') f _x -> throwError $ ErrorCall $ "Attempt to call non-function: " <> show _x execUnaryOp :: forall e t f m. (Framed e m, MonadCited t f m, Show t) => Scopes m (NValue t f m) -> SrcSpan -> NUnaryOp -> NValue t f m -> m (NValue t f m) execUnaryOp scope span op arg = case arg of NVConstant c -> case (op, c) of (NNeg, NInt i) -> mkUnaryOp NInt negate i (NNeg, NFloat f) -> mkUnaryOp NFloat negate f (NNot, NBool b) -> mkUnaryOp NBool not b _seq -> throwError $ ErrorCall $ "unsupported argument type for unary operator " <> show _seq _x -> throwError $ ErrorCall $ "argument to unary operator must evaluate to an atomic type: " <> show _x where mkUnaryOp :: (a -> NAtom) -> (a -> a) -> a -> m (NValue t f m) mkUnaryOp c b a = pure . mkNVUnaryOpWithProvenance scope span op (pure arg) . NVConstant $ c (b a) execBinaryOp :: forall e t f m. (MonadNix e t f m, MonadEval (NValue t f m) m) => Scopes m (NValue t f m) -> SrcSpan -> NBinaryOp -> NValue t f m -> m (NValue t f m) -> m (NValue t f m) execBinaryOp scope span op lval rarg = case op of NEq -> helperEq id NNEq -> helperEq not NOr -> helperLogic flip True NAnd -> helperLogic id False NImpl -> helperLogic id True _ -> do rval <- rarg rval' <- demand rval lval' <- demand lval execBinaryOpForced scope span op lval' rval' where helperEq :: (Bool -> Bool) -> m (NValue t f m) helperEq flag = do rval <- rarg eq <- valueEqM lval rval boolOp rval $ flag eq helperLogic flp flag = flp bool (bypass flag) ( do rval <- rarg x <- fromValue rval boolOp rval x ) =<< fromValue lval boolOp rval = toBoolOp $ pure rval bypass = toBoolOp Nothing toBoolOp :: Maybe (NValue t f m) -> Bool -> m (NValue t f m) toBoolOp r b = pure $ mkNVBinaryOpWithProvenance scope span op (pure lval) r $ NVConstant $ NBool b execBinaryOpForced :: forall e t f m. (MonadNix e t f m, MonadEval (NValue t f m) m) => Scopes m (NValue t f m) -> SrcSpan -> NBinaryOp -> NValue t f m -> NValue t f m -> m (NValue t f m) execBinaryOpForced scope span op lval rval = case op of NLt -> mkCmpOp (<) NLte -> mkCmpOp (<=) NGt -> mkCmpOp (>) NGte -> mkCmpOp (>=) NMinus -> mkBinNumOp (-) NMult -> mkBinNumOp (*) NDiv -> mkBinNumOp' div (/) NConcat -> case (lval, rval) of (NVList ls, NVList rs) -> pure $ mkListP $ ls <> rs _ -> unsupportedTypes NUpdate -> case (lval, rval) of (NVSet lp ls, NVSet rp rs) -> pure $ mkSetP (rp <> lp) (rs <> ls) (NVSet lp ls, NVConstant NNull) -> pure $ mkSetP lp ls (NVConstant NNull, NVSet rp rs) -> pure $ mkSetP rp rs _ -> unsupportedTypes NPlus -> case (lval, rval) of (NVConstant _, NVConstant _) -> mkBinNumOp (+) (NVStr ls, NVStr rs) -> pure $ mkStrP (ls <> rs) (NVStr ls, NVPath p) -> mkStrP . (ls <>) <$> coercePathToNixString CopyToStore p (NVPath ls, NVStr rs) -> maybe (throwError $ ErrorCall "A string that refers to a store path cannot be appended to a path.") -- data/nix/src/libexpr/eval.cc:1412 (\rs2 -> mkPathP <$> toAbsolutePath @t @f (ls <> coerce (toString rs2))) (getStringNoContext rs) (NVPath ls, NVPath rs) -> mkPathP <$> toAbsolutePath @t @f (ls <> rs) (ls@NVSet{}, NVStr rs) -> mkStrP . (<> rs) <$> coerceAnyToNixString callFunc DontCopyToStore ls (NVStr ls, rs@NVSet{}) -> mkStrP . (ls <>) <$> coerceAnyToNixString callFunc DontCopyToStore rs _ -> unsupportedTypes _other -> shouldBeAlreadyHandled where addProv :: NValue t f m -> NValue t f m addProv = mkNVBinaryOpWithProvenance scope span op (pure lval) (pure rval) mkBoolP :: Bool -> m (NValue t f m) mkBoolP = pure . addProv . NVConstant . NBool mkIntP :: Integer -> m (NValue t f m) mkIntP = pure . addProv . NVConstant . NInt mkFloatP :: Float -> m (NValue t f m) mkFloatP = pure . addProv . NVConstant . NFloat mkListP :: [NValue t f m] -> NValue t f m mkListP = addProv . NVList mkStrP :: NixString -> NValue t f m mkStrP = addProv . NVStr mkPathP :: Path -> NValue t f m mkPathP = addProv . NVPath mkSetP :: (PositionSet -> AttrSet (NValue t f m) -> NValue t f m) mkSetP x s = addProv $ NVSet x s mkCmpOp :: (forall a. (Ord a) => a -> a -> Bool) -> m (NValue t f m) mkCmpOp op = case (lval, rval) of (NVConstant l, NVConstant r) -> mkBoolP $ l `op` r (NVStr l, NVStr r) -> mkBoolP $ l `op` r _ -> unsupportedTypes mkBinNumOp :: (forall a. (Num a) => a -> a -> a) -> m (NValue t f m) mkBinNumOp op = mkBinNumOp' op op mkBinNumOp' :: (Integer -> Integer -> Integer) -> (Float -> Float -> Float) -> m (NValue t f m) mkBinNumOp' intOp floatOp = case (lval, rval) of (NVConstant l, NVConstant r) -> case (l, r) of (NInt li, NInt ri) -> mkIntP $ li `intOp` ri (NInt li, NFloat rf) -> mkFloatP $ fromInteger li `floatOp` rf (NFloat lf, NInt ri) -> mkFloatP $ lf `floatOp` fromInteger ri (NFloat lf, NFloat rf) -> mkFloatP $ lf `floatOp` rf _ -> unsupportedTypes _ -> unsupportedTypes unsupportedTypes = throwError $ ErrorCall $ "Unsupported argument types for binary operator " <> show op <> ": " <> show lval <> ", " <> show rval shouldBeAlreadyHandled = throwError $ ErrorCall $ "This cannot happen: operator " <> show op <> " should have been handled in execBinaryOp." -- This function is here, rather than in 'Nix.String', because of the need to -- use 'throwError'. fromStringNoContext :: (Framed e m) => NixString -> m Text fromStringNoContext ns = maybe (throwError $ ErrorCall $ "expected string with no context, but got " <> show ns) pure (getStringNoContext ns) addTracing :: ( MonadNix e t f m , Has e Options , Alternative n , MonadReader Int n , MonadFail n ) => Alg NExprLocF (m a) -> Alg NExprLocF (n (m a)) addTracing k v = do depth <- ask guard $ depth < 2000 local succ $ do v'@(AnnF span x) <- sequenceA v pure $ do opts <- askOptions let rendered = bool (prettyNix $ Fix $ Fix (NSym "?") <$ x) (pretty $ PS.ppShow $ void x) (getVerbosity opts >= Chatty) msg x = pretty ("eval: " <> replicate depth ' ') <> x loc <- renderLocation span $ msg rendered <> " ...\n" putStr $ show loc res <- k v' print $ msg rendered <> " ...done" pure res evalWithTracingAndMetaInfo :: forall e t f m. (MonadNix e t f m) => NExprLoc -> ReaderT Int m (m (NValue t f m)) evalWithTracingAndMetaInfo = adi addMetaInfo (addTracing Eval.evalContent) where addMetaInfo :: (NExprLoc -> ReaderT r m a) -> NExprLoc -> ReaderT r m a addMetaInfo = (ReaderT .) . flip . (Eval.addMetaInfo .) . flip . (runReaderT .) evalExprLoc :: forall e t f m. (MonadNix e t f m) => NExprLoc -> m (NValue t f m) evalExprLoc expr = do opts <- askOptions let pTracedAdi = bool Eval.evalWithMetaInfo (join . (`runReaderT` (0 :: Int)) . evalWithTracingAndMetaInfo) (isTrace opts) pTracedAdi expr exec :: (MonadNix e t f m, MonadInstantiate m) => [Text] -> m (NValue t f m) exec args = either throwError evalExprLoc =<< exec' args -- Please, delete `nix` from the name nixInstantiateExpr :: (MonadNix e t f m, MonadInstantiate m) => Text -> m (NValue t f m) nixInstantiateExpr s = either throwError evalExprLoc =<< instantiateExpr s ================================================ FILE: src/Nix/Expr/Shorthands.hs ================================================ {- | Shorthands for making Nix expressions. Functions with an @F@ suffix return a more general type (base functor @F a@) without the outer 'Fix' wrapper that creates @a@. -} module Nix.Expr.Shorthands where import Data.Fix import Nix.Atoms import Nix.Expr.Types import Nix.Prelude -- * Basic expression builders -- | Put @NAtom@ as expression mkConst :: NAtom -> NExpr mkConst = Fix . NConstant -- | Put null. mkNull :: NExpr mkNull = Fix mkNullF -- | Put boolean. mkBool :: Bool -> NExpr mkBool = Fix . mkBoolF -- | Put integer. mkInt :: Integer -> NExpr mkInt = Fix . mkIntF -- | Put floating point number. mkFloat :: Float -> NExpr mkFloat = Fix . mkFloatF -- | Put a regular (double-quoted) string. mkStr :: Text -> NExpr mkStr = Fix . NStr . DoubleQuoted . whenText mempty (one . Plain) -- | Put an indented string. mkIndentedStr :: Int -> Text -> NExpr mkIndentedStr w = Fix . NStr . Indented w . whenText mempty (one . Plain) -- | Put a path. Use @True@ if the path should be read from the environment, else use @False@. mkPath :: Bool -> FilePath -> NExpr mkPath b = Fix . mkPathF b -- | Put a path expression which pulls from the @NIX_PATH@ @env@ variable. mkEnvPath :: FilePath -> NExpr mkEnvPath = Fix . mkEnvPathF -- | Put a path which references a relative path. mkRelPath :: FilePath -> NExpr mkRelPath = Fix . mkRelPathF -- | Put a variable (symbol). mkSym :: Text -> NExpr mkSym = Fix . mkSymF -- | Put syntactic hole. mkSynHole :: Text -> NExpr mkSynHole = Fix . mkSynHoleF mkSelector :: Text -> NAttrPath NExpr mkSelector = one . StaticKey . coerce {- | Put a binary operator. @since -} mkApp :: NExpr -> NExpr -> NExpr mkApp a = Fix . NApp a -- | Put an unary operator. -- @since 0.15.0 mkOp :: NUnaryOp -> NExpr -> NExpr mkOp op = Fix . NUnary op -- | Logical negation: @not@. mkNot :: NExpr -> NExpr mkNot = mkOp NNot {- | Number negation: @-@. Negation in the language works with integers and floating point. @since 0.15.0 -} mkNeg :: NExpr -> NExpr mkNeg = mkOp NNeg {- | Put a binary operator. @since 0.15.0 -} mkOp2 :: NBinaryOp -> NExpr -> NExpr -> NExpr mkOp2 op a = Fix . NBinary op a {- | > { x } @since 0.15.0 -} mkParamSet :: [(Text, Maybe NExpr)] -> Params NExpr mkParamSet pset = mkGeneralParamSet Nothing pset False {- | > { x, ... } @since 0.15.0 -} mkVariadicParamSet :: [(Text, Maybe NExpr)] -> Params NExpr mkVariadicParamSet pset = mkGeneralParamSet Nothing pset True {- | > s@{ x } @since 0.15.0 -} mkNamedParamSet :: Text -> [(Text, Maybe NExpr)] -> Params NExpr mkNamedParamSet name pset = mkGeneralParamSet (pure name) pset False {- | > s@{ x, ... } @since 0.15.0 -} mkNamedVariadicParamSet :: Text -> [(Text, Maybe NExpr)] -> Params NExpr mkNamedVariadicParamSet name params = mkGeneralParamSet (pure name) params True {- | Args: 1. Maybe name: > Nothing -> {} > Just "s" -> s@{} 2. key:expr pairs 3. Is variadic or not: > True -> {...} > False -> {} @since 0.15.0 -} mkGeneralParamSet :: Maybe Text -> [(Text, Maybe NExpr)] -> Bool -> Params NExpr mkGeneralParamSet mname params variadic = ParamSet (coerce mname) (Variadic `whenTrue` variadic) (coerce params) -- | > rec { .. } mkRecSet :: [Binding NExpr] -> NExpr mkRecSet = mkSet Recursive {- | Put a non-recursive set. > { .. } -} mkNonRecSet :: [Binding NExpr] -> NExpr mkNonRecSet = mkSet mempty -- | General set builder function. mkSet :: Recursivity -> [Binding NExpr] -> NExpr mkSet r = Fix . NSet r {- | Empty set. Monoid. Use @//@ operation (shorthand $//) to extend the set. @since 0.15.0 -} emptySet :: NExpr emptySet = mkNonRecSet mempty -- | Put a list. mkList :: [NExpr] -> NExpr mkList = Fix . NList -- @since 0.15.0 emptyList :: NExpr emptyList = mkList mempty {- | Wrap in a @let@. (Evaluate the second argument after introducing the bindings.) +------------------------+-----------------+ | Haskell | Nix | +========================+=================+ | @mkLets bindings expr@ | @let bindings;@ | | | @in expr@ | +------------------------+-----------------+ -} mkLets :: [Binding NExpr] -> NExpr -> NExpr mkLets bindings = Fix . NLet bindings {- | Create a @whith@: 1st expr - what to bring into the scope. 2nd - expression that recieves the scope extention. +--------------------+-------------------+ | Haskell | Nix | +====================+===================+ | @mkWith body main@ | @with body; expr@ | +--------------------+-------------------+ -} mkWith :: NExpr -> NExpr -> NExpr mkWith e = Fix . NWith e {- | Create an @assert@: 1st expr - asserting itself, must return @true@. 2nd - main expression to evaluated after assertion. +-----------------------+----------------------+ | Haskell | Nix | +=======================+======================+ | @mkAssert check eval@ | @assert check; eval@ | +-----------------------+----------------------+ -} mkAssert :: NExpr -> NExpr -> NExpr mkAssert e = Fix . NAssert e {- | Put: > if expr1 > then expr2 > else expr3 -} mkIf :: NExpr -> NExpr -> NExpr -> NExpr mkIf e1 e2 = Fix . NIf e1 e2 {- | Lambda function, analog of Haskell's @\\ x -> x@: +-----------------------+-----------+ | Haskell | Nix | +=======================+===========+ | @ mkFunction x expr @ | @x: expr@ | +-----------------------+-----------+ -} mkFunction :: Params NExpr -> NExpr -> NExpr mkFunction params = Fix . NAbs params {- | General dot-reference with optional alternative if the key does not exist. @since 0.15.0 -} getRefOrDefault :: Maybe NExpr -> NExpr -> Text -> NExpr getRefOrDefault alt obj = Fix . NSelect alt obj . mkSelector -- ** Base functor builders for basic expressions builders *sic -- | Unfixed @mkNull@. mkNullF :: NExprF a mkNullF = NConstant NNull -- | Unfixed @mkBool@. mkBoolF :: Bool -> NExprF a mkBoolF = NConstant . NBool -- | Unfixed @mkInt@. mkIntF :: Integer -> NExprF a mkIntF = NConstant . NInt -- | Unfixed @mkFloat@. mkFloatF :: Float -> NExprF a mkFloatF = NConstant . NFloat -- | Unfixed @mkPath@. mkPathF :: Bool -> FilePath -> NExprF a mkPathF False = NLiteralPath . coerce mkPathF True = NEnvPath . coerce -- | Unfixed @mkEnvPath@. mkEnvPathF :: FilePath -> NExprF a mkEnvPathF = mkPathF True -- | Unfixed @mkRelPath@. mkRelPathF :: FilePath -> NExprF a mkRelPathF = mkPathF False -- | Unfixed @mkSym@. mkSymF :: Text -> NExprF a mkSymF = NSym . coerce -- | Unfixed @mkSynHole@. mkSynHoleF :: Text -> NExprF a mkSynHoleF = NSynHole . coerce -- * Other -- (org this better/make a better name for section(s)) {- | An `inherit` clause with an expression to pull from. +------------------------+--------------------+------------+ | Hask | Nix | pseudocode | +========================+====================+============+ | @inheritFrom x [a, b]@ | @inherit (x) a b;@ | @a = x.a;@ | | | | @b = x.b;@ | +------------------------+--------------------+------------+ -} inheritFrom :: e -> [VarName] -> Binding e inheritFrom expr ks = Inherit (pure expr) ks nullPos {- | An `inherit` clause without an expression to pull from. +----------------------+----------------+------------------+ | Hask | Nix | pseudocode | +======================+================+==================+ | @inheritFrom [a, b]@ | @inherit a b;@ | @a = outside.a;@ | | | | @b = outside.b;@ | +----------------------+----------------+------------------+ -} inherit :: [VarName] -> Binding e inherit ks = Inherit Nothing ks nullPos -- | Nix @=@ (bind operator). ($=) :: Text -> NExpr -> Binding NExpr ($=) = bindTo infixr 2 $= -- | Shorthand for producing a binding of a name to an expression: Nix's @=@. bindTo :: Text -> NExpr -> Binding NExpr bindTo name x = NamedVar (mkSelector name) x nullPos {- | Append a list of bindings to a set or let expression. For example: adding `[a = 1, b = 2]` to `let c = 3; in 4` produces `let a = 1; b = 2; c = 3; in 4`. -} appendBindings :: [Binding NExpr] -> NExpr -> NExpr appendBindings newBindings (Fix e) = case e of NLet bindings e' -> mkLets (bindings <> newBindings) e' NSet recur bindings -> Fix $ NSet recur (bindings <> newBindings) _ -> error "Can only append bindings to a set or a let" -- | Applies a transformation to the body of a Nix function. modifyFunctionBody :: (NExpr -> NExpr) -> NExpr -> NExpr modifyFunctionBody transform (Fix (NAbs params body)) = mkFunction params $ transform body modifyFunctionBody _ _ = error "Not a function" -- | A @let@ statement with multiple assignments. letsE :: [(Text, NExpr)] -> NExpr -> NExpr letsE pairs = mkLets $ uncurry ($=) <$> pairs -- | Wrapper for a single-variable @let@. letE :: Text -> NExpr -> NExpr -> NExpr letE varName varExpr = letsE $ one (varName, varExpr) -- | Make a non-recursive attribute set. attrsE :: [(Text, NExpr)] -> NExpr attrsE pairs = mkNonRecSet $ uncurry ($=) <$> pairs -- | Make a recursive attribute set. recAttrsE :: [(Text, NExpr)] -> NExpr recAttrsE pairs = mkRecSet $ uncurry ($=) <$> pairs -- * Nix binary operators (@@) , ($==) , ($!=) , ($<) , ($<=) , ($>) , ($>=) , ($&&) , ($||) , ($->) , ($//) , ($+) , ($-) , ($*) , ($/) , ($++) :: NExpr -> NExpr -> NExpr -- 2021-07-10: NOTE: Probably the presedence of some operators is still needs to be tweaked. -- | Dot-reference into an attribute set: @attrSet.k@ (@.) :: NExpr -> Text -> NExpr (@.) = getRefOrDefault Nothing infix 9 @. {- | Dot-reference into an attribute set with alternative if the key does not exist. > s.x or y @since 0.15.0 -} (@.<|>) :: NExpr -> Text -> NExpr -> NExpr (@.<|>) obj name alt = getRefOrDefault (pure alt) obj name infix 9 @.<|> -- | Function application (@' '@ in @f x@) (@@) = mkApp infixl 8 @@ -- | List concatenation: @++@ ($++) = mkOp2 NConcat infixr 7 $++ -- | Multiplication: @*@ ($*) = mkOp2 NMult infixl 6 $* -- | Division: @/@ ($/) = mkOp2 NDiv infixl 6 $/ -- | Addition: @+@ ($+) = mkOp2 NPlus infixl 5 $+ -- | Subtraction: @-@ ($-) = mkOp2 NMinus infixl 5 $- -- | Extend/override the left attr set, with the right one: @//@ ($//) = mkOp2 NUpdate infixr 5 $// -- | Greater than: @>@ ($>) = mkOp2 NGt infix 4 $> -- | Greater than OR equal: @>=@ infix 4 $>= ($>=) = mkOp2 NGte -- | Less than OR equal: @<=@ ($<=) = mkOp2 NLte infix 4 $<= -- | Less than: @<@ ($<) = mkOp2 NLt infix 4 $< -- | Equality: @==@ ($==) = mkOp2 NEq infix 3 $== -- | Inequality: @!=@ ($!=) = mkOp2 NNEq infix 3 $!= -- | AND: @&&@ ($&&) = mkOp2 NAnd infixl 2 $&& -- | OR: @||@ ($||) = mkOp2 NOr infixl 2 $|| -- | Logical implication: @->@ ($->) = mkOp2 NImpl infix 1 $-> {- | Lambda function, analog of Haskell's @\\ x -> x@: +---------------+-----------+ | Haskell | Nix | +===============+===========+ | @x ==> expr @ | @x: expr@ | +---------------+-----------+ -} (==>) :: Params NExpr -> NExpr -> NExpr (==>) = mkFunction infixr 1 ==> -- * Under deprecation -- NOTE: Remove after 2023-07 {- | __@Deprecated@__: Please, use `mkOp` Put an unary operator. -} mkOper :: NUnaryOp -> NExpr -> NExpr mkOper = mkOp -- NOTE: Remove after 2023-07 {- | __@Deprecated@__: Please, use `mkOp2` | Put a binary operator. -} mkOper2 :: NBinaryOp -> NExpr -> NExpr -> NExpr mkOper2 = mkOp2 -- NOTE: Remove after 2023-07 {- | __@Deprecated@__: Please, use `mkOp2` | Nix binary operator builder. -} mkBinop :: NBinaryOp -> NExpr -> NExpr -> NExpr mkBinop = mkOp2 -- NOTE: Remove after 2023-07 {- | __@Deprecated@__: Please, use: * `mkParamSet` is for closed sets; * `mkVariadicSet` is for variadic; * `mkGeneralParamSet` a general constructor. -} mkParamset :: [(Text, Maybe NExpr)] -> Bool -> Params NExpr mkParamset params variadic = ParamSet Nothing (Variadic `whenTrue` variadic) (coerce params) ================================================ FILE: src/Nix/Expr/Strings.hs ================================================ -- | Functions for manipulating nix strings. module Nix.Expr.Strings where import Nix.Prelude import Relude.Unsafe as Unsafe -- Please, switch things to NonEmpty import Data.List ( dropWhileEnd, lookup, minimum, ) import qualified Data.Text as T import Nix.Expr.Types -- | Merge adjacent @Plain@ values with @<>@. mergePlain :: [Antiquoted Text r] -> [Antiquoted Text r] mergePlain [] = mempty mergePlain (Plain a : EscapedNewline : Plain b : xs) = mergePlain (Plain (a <> "\n" <> b) : xs) mergePlain (Plain a : Plain b : xs) = mergePlain (Plain (a <> b) : xs) mergePlain (x : xs) = x : mergePlain xs {- | Remove 'Plain' values equal to 'mempty', as they don't have any informational content. -} removeEmptyPlains :: [Antiquoted Text r] -> [Antiquoted Text r] removeEmptyPlains = filter f where f (Plain x) = x /= mempty f _ = True -- trimEnd xs -- | null xs = xs -- | otherwise = case last xs of -- Plain x -> init xs <> [Plain (T.dropWhileEnd (== ' ') x)] -- _ -> xs -- | Equivalent to case splitting on 'Antiquoted' strings. runAntiquoted :: v -> (v -> a) -> (r -> a) -> Antiquoted v r -> a runAntiquoted _ f _ (Plain v) = f v runAntiquoted nl f _ EscapedNewline = f nl runAntiquoted _ _ k (Antiquoted r) = k r -- | Split a stream representing a string with antiquotes on line breaks. splitLines :: forall r. [Antiquoted Text r] -> [[Antiquoted Text r]] splitLines = uncurry (flip (:)) . go where go :: [Antiquoted Text r] -> ([[Antiquoted Text r]], [Antiquoted Text r]) go (Plain t : xs) = (one (Plain l) <>) <$> foldr f (go xs) ls where (l : ls) = T.split (== '\n') t f prefix (finished, current) = ((Plain prefix : current) : finished, mempty) go (Antiquoted a : xs) = (one (Antiquoted a) <>) <$> go xs go (EscapedNewline : xs) = (one EscapedNewline <>) <$> go xs go [] = mempty {- | Join a stream of strings containing antiquotes again. This is the inverse of 'splitLines'. -} unsplitLines :: [[Antiquoted Text r]] -> [Antiquoted Text r] unsplitLines = intercalate $ one $ Plain "\n" -- | Form an indented string by stripping spaces equal to the minimal indent. stripIndent :: [Antiquoted Text r] -> NString r stripIndent [] = Indented 0 mempty stripIndent xs = Indented minIndent ( removeEmptyPlains $ mergePlain $ (snd <$>) $ dropWhileEnd cleanup $ pairWithLast $ unsplitLines ls' ) where pairWithLast ys = zip ( handlePresence Nothing (pure . Unsafe.last) <$> inits ys ) ys ls = stripEmptyOpening $ splitLines xs ls' = dropSpaces minIndent <$> ls minIndent = handlePresence 0 (minimum . (countSpaces . mergePlain <$>)) (stripEmptyLines ls) stripEmptyLines = filter $ \case [Plain t] -> not $ T.null $ T.strip t _ -> True stripEmptyOpening ([Plain t] : ts) | T.null (T.strip t) = ts stripEmptyOpening ts = ts countSpaces (Antiquoted _ : _) = 0 countSpaces (EscapedNewline : _) = 0 countSpaces (Plain t : _) = T.length . T.takeWhile (== ' ') $ t countSpaces [] = 0 dropSpaces 0 x = x dropSpaces n (Plain t : cs) = Plain (T.drop n t) : cs dropSpaces _ _ = fail "stripIndent: impossible" cleanup (Nothing, Plain y) = T.all (== ' ') y cleanup (Just (Plain x), Plain y) | "\n" `T.isSuffixOf` x = T.all (== ' ') y cleanup _ = False escapeCodes :: [(Char, Char)] escapeCodes = [('\n', 'n'), ('\r', 'r'), ('\t', 't'), ('"', '"'), ('$', '$'), ('\\', '\\')] fromEscapeCode :: Char -> Maybe Char fromEscapeCode = (`lookup` (swap <$> escapeCodes)) toEscapeCode :: Char -> Maybe Char toEscapeCode = (`lookup` escapeCodes) escapeMap :: [(Text, Text)] escapeMap = [("\n", "\\n"), ("\r", "\\r"), ("\t", "\\t"), ("\"", "\\\""), ("${", "\\${"), ("\\", "\\\\")] escapeString :: Text -> Text escapeString = applyAll (fmap (uncurry T.replace) escapeMap) ================================================ FILE: src/Nix/Expr/Types/Annotated.hs ================================================ {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TemplateHaskell #-} -- | The source location annotated nix expression type and supporting types. module Nix.Expr.Types.Annotated ( module Nix.Expr.Types.Annotated, module Data.Functor.Compose, ) where import Codec.Serialise import Control.DeepSeq import Data.Aeson ( FromJSON (..), ToJSON (..), ) import Data.Aeson.TH import Data.Binary (Binary (..)) import Data.Data import Data.Eq.Deriving import Data.Fix ( Fix (..), unfoldFix, ) import Data.Functor.Compose import Data.Hashable.Lifted import Data.Ord.Deriving import GHC.Generics import Nix.Atoms import Nix.Expr.Types import Nix.Prelude import Text.Read.Deriving import Text.Show.Deriving -- * data type @SrcSpan@ - a zone in a source file -- | Demarcation of a chunk in a source file. data SrcSpan = SrcSpan { getSpanBegin :: NSourcePos , getSpanEnd :: NSourcePos } deriving (Ord, Eq, Generic, Typeable, Data, Show, NFData, Hashable) -- ** Instances instance Semigroup SrcSpan where s1 <> s2 = SrcSpan (on min getSpanBegin s1 s2) (on max getSpanEnd s1 s2) instance Binary SrcSpan instance ToJSON SrcSpan instance FromJSON SrcSpan instance Serialise SrcSpan -- * data type @Ann@ -- 2021-08-02: NOTE: Annotation needs to be after what is annotated. {- | A type constructor applied to a type along with an annotation Intended to be used with 'Fix': @type MyType = Fix (Compose (AnnUnit Annotation) F)@ -} data AnnUnit ann expr = AnnUnit { annotation :: ann , annotated :: expr } deriving ( Eq , Ord , Data , Typeable , Hashable , Generic , Generic1 , NFData , Functor , Foldable , Traversable , Show , Read ) type AnnF ann f = Compose (AnnUnit ann) f -- | Pattern: @(Compose (AnnUnit _ _))@. pattern AnnF :: ann -> f a -> Compose (AnnUnit ann) f a pattern AnnF ann f = Compose (AnnUnit ann f) {-# COMPLETE AnnF #-} type Ann ann f = Fix (AnnF ann f) {- | Pattern: @Fix (Compose (AnnUnit _ _))@. Fix composes units of (annotations & the annotated) into one object. Giving annotated expression. -} pattern Ann :: forall ann (f :: Type -> Type). ann -> f (Ann ann f) -> Ann ann f pattern Ann ann a = Fix (AnnF ann a) {-# COMPLETE Ann #-} annUnitToAnn :: AnnUnit ann (f (Ann ann f)) -> Ann ann f annUnitToAnn (AnnUnit ann a) = Ann ann a -- ** Instances instance (NFData ann) => NFData1 (AnnUnit ann) instance (Binary ann, Binary a) => Binary (AnnUnit ann a) $(deriveEq1 ''AnnUnit) $(deriveEq2 ''AnnUnit) $(deriveOrd1 ''AnnUnit) $(deriveOrd2 ''AnnUnit) $(deriveRead1 ''AnnUnit) $(deriveRead2 ''AnnUnit) $(deriveShow1 ''AnnUnit) $(deriveShow2 ''AnnUnit) $(deriveJSON1 defaultOptions ''AnnUnit) $(deriveJSON2 defaultOptions ''AnnUnit) instance (Hashable ann) => Hashable1 (AnnUnit ann) instance (Serialise ann, Serialise a) => Serialise (AnnUnit ann a) -- ** @NExprLoc{,F}@ - annotated Nix expression type NExprLocF = AnnF SrcSpan NExprF instance (Serialise r) => Serialise (NExprLocF r) where encode (AnnF ann a) = encode ann <> encode a decode = liftA2 AnnF decode decode instance (Binary r) => Binary (NExprLocF r) -- | Annotated Nix expression (each subexpression direct to its source location). type NExprLoc = Fix NExprLocF instance Serialise NExprLoc instance Binary NExprLoc -- * Other stripAnnF :: AnnF ann f r -> f r stripAnnF = annotated . getCompose stripAnnotation :: (Functor f) => Ann ann f -> Fix f stripAnnotation = unfoldFix (stripAnnF . unFix) annNUnary :: AnnUnit SrcSpan NUnaryOp -> NExprLoc -> NExprLoc annNUnary (AnnUnit s1 u) e1@(Ann s2 _) = NUnaryAnn (s1 <> s2) u e1 {-# INLINE annNUnary #-} annNBinary :: AnnUnit SrcSpan NBinaryOp -> NExprLoc -> NExprLoc -> NExprLoc annNBinary (AnnUnit s1 b) e1@(Ann s2 _) e2@(Ann s3 _) = NBinaryAnn (s1 <> s2 <> s3) b e1 e2 annNSelect :: Maybe NExprLoc -> NExprLoc -> AnnUnit SrcSpan (NAttrPath NExprLoc) -> NExprLoc annNSelect Nothing e2@(Ann s2 _) (AnnUnit s1 ats) = NSelectAnn (s2 <> s1) Nothing e2 ats annNSelect (Just e3@(Ann s3 _)) e2@(Ann s2 _) (AnnUnit s1 ats) = NSelectAnn (s3 <> s2 <> s1) (pure e3) e2 ats annNHasAttr :: NExprLoc -> AnnUnit SrcSpan (NAttrPath NExprLoc) -> NExprLoc annNHasAttr e1@(Ann s1 _) (AnnUnit s2 ats) = NHasAttrAnn (s1 <> s2) e1 ats annNApp :: NExprLoc -> NExprLoc -> NExprLoc annNApp e1@(Ann s1 _) e2@(Ann s2 _) = NAppAnn (s1 <> s2) e1 e2 annNAbs :: AnnUnit SrcSpan (Params NExprLoc) -> NExprLoc -> NExprLoc annNAbs (AnnUnit s1 ps) e1@(Ann s2 _) = NAbsAnn (s1 <> s2) ps e1 annNStr :: AnnUnit SrcSpan (NString NExprLoc) -> NExprLoc annNStr (AnnUnit s1 s) = NStrAnn s1 s deltaInfo :: NSourcePos -> (Text, Int, Int) deltaInfo (NSourcePos fp l c) = (fromString $ coerce fp, unPos $ coerce l, unPos $ coerce c) annNNull :: NExprLoc annNNull = NConstantAnn nullSpan NNull {-# INLINE annNNull #-} nullSpan :: SrcSpan nullSpan = SrcSpan nullPos nullPos {-# INLINE nullSpan #-} -- ** Patterns -- *** Patterns to match on 'NExprLocF' constructions (for 'SrcSpan'-based annotations). pattern NConstantAnnF :: SrcSpan -> NAtom -> NExprLocF r pattern NConstantAnnF ann x = AnnF ann (NConstant x) pattern NStrAnnF :: SrcSpan -> NString r -> NExprLocF r pattern NStrAnnF ann x = AnnF ann (NStr x) pattern NSymAnnF :: SrcSpan -> VarName -> NExprLocF r pattern NSymAnnF ann x = AnnF ann (NSym x) pattern NListAnnF :: SrcSpan -> [r] -> NExprLocF r pattern NListAnnF ann x = AnnF ann (NList x) pattern NSetAnnF :: SrcSpan -> Recursivity -> [Binding r] -> NExprLocF r pattern NSetAnnF ann rec x = AnnF ann (NSet rec x) pattern NLiteralPathAnnF :: SrcSpan -> Path -> NExprLocF r pattern NLiteralPathAnnF ann x = AnnF ann (NLiteralPath x) pattern NEnvPathAnnF :: SrcSpan -> Path -> NExprLocF r pattern NEnvPathAnnF ann x = AnnF ann (NEnvPath x) pattern NUnaryAnnF :: SrcSpan -> NUnaryOp -> r -> NExprLocF r pattern NUnaryAnnF ann op x = AnnF ann (NUnary op x) pattern NAppAnnF :: SrcSpan -> r -> r -> NExprLocF r pattern NAppAnnF ann x y = AnnF ann (NApp x y) pattern NBinaryAnnF :: SrcSpan -> NBinaryOp -> r -> r -> NExprLocF r pattern NBinaryAnnF ann op x y = AnnF ann (NBinary op x y) pattern NSelectAnnF :: SrcSpan -> Maybe r -> r -> NAttrPath r -> NExprLocF r pattern NSelectAnnF ann v x p = AnnF ann (NSelect v x p) pattern NHasAttrAnnF :: SrcSpan -> r -> NAttrPath r -> NExprLocF r pattern NHasAttrAnnF ann x p = AnnF ann (NHasAttr x p) pattern NAbsAnnF :: SrcSpan -> Params r -> r -> NExprLocF r pattern NAbsAnnF ann x b = AnnF ann (NAbs x b) pattern NLetAnnF :: SrcSpan -> [Binding r] -> r -> NExprLocF r pattern NLetAnnF ann x b = AnnF ann (NLet x b) pattern NIfAnnF :: SrcSpan -> r -> r -> r -> NExprLocF r pattern NIfAnnF ann c t e = AnnF ann (NIf c t e) pattern NWithAnnF :: SrcSpan -> r -> r -> NExprLocF r pattern NWithAnnF ann x y = AnnF ann (NWith x y) pattern NAssertAnnF :: SrcSpan -> r -> r -> NExprLocF r pattern NAssertAnnF ann x y = AnnF ann (NAssert x y) pattern NSynHoleAnnF :: SrcSpan -> VarName -> NExprLocF r pattern NSynHoleAnnF ann x = AnnF ann (NSynHole x) {-# COMPLETE NConstantAnnF, NStrAnnF, NSymAnnF, NListAnnF, NSetAnnF, NLiteralPathAnnF, NEnvPathAnnF, NUnaryAnnF, NBinaryAnnF, NSelectAnnF, NHasAttrAnnF, NAbsAnnF, NLetAnnF, NIfAnnF, NWithAnnF, NAssertAnnF, NSynHoleAnnF #-} -- *** Patterns to match on 'NExprLoc' constructions (for 'SrcSpan'-based annotations). pattern NConstantAnn :: SrcSpan -> NAtom -> NExprLoc pattern NConstantAnn ann x = Ann ann (NConstant x) pattern NStrAnn :: SrcSpan -> NString NExprLoc -> NExprLoc pattern NStrAnn ann x = Ann ann (NStr x) pattern NSymAnn :: SrcSpan -> VarName -> NExprLoc pattern NSymAnn ann x = Ann ann (NSym x) pattern NListAnn :: SrcSpan -> [NExprLoc] -> NExprLoc pattern NListAnn ann x = Ann ann (NList x) pattern NSetAnn :: SrcSpan -> Recursivity -> [Binding NExprLoc] -> NExprLoc pattern NSetAnn ann rec x = Ann ann (NSet rec x) pattern NLiteralPathAnn :: SrcSpan -> Path -> NExprLoc pattern NLiteralPathAnn ann x = Ann ann (NLiteralPath x) pattern NEnvPathAnn :: SrcSpan -> Path -> NExprLoc pattern NEnvPathAnn ann x = Ann ann (NEnvPath x) pattern NUnaryAnn :: SrcSpan -> NUnaryOp -> NExprLoc -> NExprLoc pattern NUnaryAnn ann op x = Ann ann (NUnary op x) pattern NAppAnn :: SrcSpan -> NExprLoc -> NExprLoc -> NExprLoc pattern NAppAnn ann x y = Ann ann (NApp x y) pattern NBinaryAnn :: SrcSpan -> NBinaryOp -> NExprLoc -> NExprLoc -> NExprLoc pattern NBinaryAnn ann op x y = Ann ann (NBinary op x y) pattern NSelectAnn :: SrcSpan -> Maybe NExprLoc -> NExprLoc -> NAttrPath NExprLoc -> NExprLoc pattern NSelectAnn ann v x p = Ann ann (NSelect v x p) pattern NHasAttrAnn :: SrcSpan -> NExprLoc -> NAttrPath NExprLoc -> NExprLoc pattern NHasAttrAnn ann x p = Ann ann (NHasAttr x p) pattern NAbsAnn :: SrcSpan -> Params NExprLoc -> NExprLoc -> NExprLoc pattern NAbsAnn ann x b = Ann ann (NAbs x b) pattern NLetAnn :: SrcSpan -> [Binding NExprLoc] -> NExprLoc -> NExprLoc pattern NLetAnn ann x b = Ann ann (NLet x b) pattern NIfAnn :: SrcSpan -> NExprLoc -> NExprLoc -> NExprLoc -> NExprLoc pattern NIfAnn ann c t e = Ann ann (NIf c t e) pattern NWithAnn :: SrcSpan -> NExprLoc -> NExprLoc -> NExprLoc pattern NWithAnn ann x y = Ann ann (NWith x y) pattern NAssertAnn :: SrcSpan -> NExprLoc -> NExprLoc -> NExprLoc pattern NAssertAnn ann x y = Ann ann (NAssert x y) pattern NSynHoleAnn :: SrcSpan -> VarName -> NExprLoc pattern NSynHoleAnn ann x = Ann ann (NSynHole x) {-# COMPLETE NConstantAnn, NStrAnn, NSymAnn, NListAnn, NSetAnn, NLiteralPathAnn, NEnvPathAnn, NUnaryAnn, NBinaryAnn, NSelectAnn, NHasAttrAnn, NAbsAnn, NLetAnn, NIfAnn, NWithAnn, NAssertAnn, NSynHoleAnn #-} ================================================ FILE: src/Nix/Expr/Types.hs ================================================ {-# LANGUAGE CPP #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -Wno-missing-signatures #-} {-# OPTIONS_GHC -Wno-name-shadowing #-} {-# OPTIONS_GHC -Wno-orphans #-} {- | The Nix expression type and supporting types. [Brief introduction of the Nix expression language.](https://nixos.org/nix/manual/#ch-expression-language) This module is a beginning of a deep embedding (term) of a Nix language into Haskell. [Brief on shallow & deep embedding.](https://web.archive.org/web/20201112031804/https://alessandrovermeulen.me/2013/07/13/the-difference-between-shallow-and-deep-embedding/) (additiona info for dev): Big use of TemplateHaskell in the module requires proper (top-down) organization of declarations. -} module Nix.Expr.Types ( module Nix.Expr.Types, SourcePos (..), unPos, mkPos, ) where import Codec.Serialise (Serialise) import qualified Codec.Serialise as Serialise import Control.DeepSeq (NFData1 (..)) import Data.Aeson import Data.Aeson.TH (deriveJSON2) import Data.Binary (Binary) import qualified Data.Binary as Binary import Data.Data import Data.Eq.Deriving (deriveEq1, deriveEq2) import Data.Fix (Fix (..)) import Data.Functor.Classes import qualified Data.HashMap.Lazy as MapL import Data.Hashable.Lifted import qualified Data.List.NonEmpty as NE import Data.Ord.Deriving (deriveOrd1, deriveOrd2) import qualified Data.Set as Set import Data.Traversable (fmapDefault, foldMapDefault) import GHC.Generics import qualified Language.Haskell.TH.Syntax as TH import Lens.Family2 import Lens.Family2.TH import Nix.Atoms import Nix.Prelude import Text.Megaparsec.Pos ( Pos, SourcePos (SourcePos), mkPos, unPos, ) import Text.Read.Deriving (deriveRead1, deriveRead2) import qualified Text.Show import Text.Show.Deriving (deriveShow1, deriveShow2) import qualified Type.Reflection as Reflection #if !MIN_VERSION_text(1,2,4) -- NOTE: Remove package @th-lift-instances@ removing this import Instances.TH.Lift () -- importing Lift Text for GHC 8.6 #endif -- * utils newtype NPos = NPos Pos deriving ( Eq , Ord , Read , Show , Data , NFData , Generic ) instance Semigroup NPos where (NPos x) <> (NPos y) = NPos (x <> y) {- | Represents source positions. Source line & column positions change intensively during parsing, so they are declared strict to avoid memory leaks. The data type is a reimplementation of 'Text.Megaparsec.Pos' 'SourcePos'. -} data NSourcePos = NSourcePos { getSourceName :: Path -- ^ Name of source file , getSourceLine :: !NPos -- ^ Line number , getSourceColumn :: !NPos -- ^ Column number } deriving ( Eq , Ord , Read , Show , Data , NFData , Generic ) -- | Helper for 'SourcePos' -> 'NSourcePos' coersion. toNSourcePos :: SourcePos -> NSourcePos toNSourcePos (SourcePos f l c) = NSourcePos (coerce f) (coerce l) (coerce c) -- | Helper for 'NSourcePos' -> 'SourcePos' coersion. toSourcePos :: NSourcePos -> SourcePos toSourcePos (NSourcePos f l c) = SourcePos (coerce f) (coerce l) (coerce c) -- 2021-07-16: NOTE: Should replace @ParamSet@ List -- | > Hashmap VarName -- type synonym type AttrSet = HashMap VarName {- | Holds file positionng information for abstrations. A type synonym for @HashMap VarName NSourcePos@. -} type PositionSet = AttrSet NSourcePos -- ** Additional N{,Source}Pos instances -- Placed here because TH inference depends on declaration sequence. instance Serialise NPos where encode = Serialise.encode . unPos . coerce decode = coerce . mkPos <$> Serialise.decode instance Serialise NSourcePos where encode (NSourcePos f l c) = coerce $ Serialise.encode f <> Serialise.encode l <> Serialise.encode c decode = liftA3 NSourcePos Serialise.decode Serialise.decode Serialise.decode instance Hashable NPos where hashWithSalt salt = hashWithSalt salt . unPos . coerce instance Hashable NSourcePos where hashWithSalt salt (NSourcePos f l c) = salt `hashWithSalt` f `hashWithSalt` l `hashWithSalt` c instance Binary NPos where put = (Binary.put @Int) . unPos . coerce get = coerce . mkPos <$> Binary.get instance Binary NSourcePos instance ToJSON NPos where toJSON = toJSON . unPos . coerce instance ToJSON NSourcePos instance FromJSON NPos where parseJSON = coerce . fmap mkPos . parseJSON instance FromJSON NSourcePos -- * Components of Nix expressions -- NExpr is a composition of -- * direct reuse of the Haskell types (list, Path, Text) -- * NAtom -- * Types in this section -- * Fixpoint nature -- ** newtype VarName newtype VarName = VarName Text deriving ( Eq , Ord , Generic , Typeable , Data , NFData , Serialise , Binary , ToJSON , FromJSON , Show , Read , Hashable ) instance IsString VarName where fromString = coerce . fromString @Text instance ToString VarName where toString = toString @Text . coerce -- ** data Params -- *** utils -- This uses an association list because nix XML serialization preserves the -- order of the param set. type ParamSet r = [(VarName, Maybe r)] data Variadic = Closed | Variadic deriving ( Eq , Ord , Generic , Typeable , Data , NFData , Serialise , Binary , ToJSON , FromJSON , Show , Read , Hashable ) instance Semigroup Variadic where (<>) Closed Closed = Closed (<>) _ _ = Variadic instance Monoid Variadic where mempty = Closed -- *** data Params {- | @Params@ represents all the ways the formal parameters to a function can be represented. -} data Params r = -- | For functions with a single named argument, such as @x: x + 1@. -- -- > Param "x" ~ x Param !VarName | -- | Explicit parameters (argument must be a set). Might specify a name to -- bind to the set in the function body. The bool indicates whether it is -- variadic or not. -- -- > ParamSet Nothing False [("x",Nothing)] ~ { x } -- > ParamSet (pure "s") True [("x", pure y)] ~ s@{ x ? y, ... } ParamSet !(Maybe VarName) !Variadic !(ParamSet r) deriving ( Eq , Ord , Generic , Generic1 , Typeable , Data , NFData , NFData1 , Serialise , Binary , ToJSON , ToJSON1 , FromJSON , FromJSON1 , Functor , Foldable , Traversable , Show , Read , Hashable ) instance IsString (Params r) where fromString = Param . fromString $(deriveShow1 ''Params) $(deriveRead1 ''Params) $(deriveEq1 ''Params) $(deriveOrd1 ''Params) deriving instance Hashable1 Params -- *** lens traversals $(makeTraversals ''Params) -- ** data Antiquoted {- | 'Antiquoted' represents an expression that is either antiquoted (surrounded by ${...}) or plain (not antiquoted). -} data Antiquoted (v :: Type) (r :: Type) = Plain !v | -- | 'EscapedNewline' corresponds to the special newline form -- -- > ''\n -- -- in an indented string. It is equivalent to a single newline character: -- -- > ''''\n'' ≡ "\n" EscapedNewline | Antiquoted !r deriving ( Eq , Ord , Generic , Generic1 , Typeable , Data , NFData , NFData1 , Serialise , Binary , ToJSON , ToJSON1 , FromJSON , FromJSON1 , Functor , Foldable , Traversable , Show , Read , Hashable ) $(deriveShow1 ''Antiquoted) $(deriveShow2 ''Antiquoted) $(deriveRead1 ''Antiquoted) $(deriveRead2 ''Antiquoted) $(deriveEq1 ''Antiquoted) $(deriveEq2 ''Antiquoted) $(deriveOrd1 ''Antiquoted) $(deriveOrd2 ''Antiquoted) $(deriveJSON2 defaultOptions ''Antiquoted) instance Hashable2 Antiquoted where liftHashWithSalt2 ha _ salt (Plain a) = ha (salt `hashWithSalt` (0 :: Int)) a liftHashWithSalt2 _ _ salt EscapedNewline = salt `hashWithSalt` (1 :: Int) liftHashWithSalt2 _ hb salt (Antiquoted b) = hb (salt `hashWithSalt` (2 :: Int)) b deriving instance (Hashable v) => Hashable1 (Antiquoted (v :: Type)) -- *** lens traversals $(makeTraversals ''Antiquoted) -- ** data NString {- | An 'NString' is a list of things that are either a plain string or an antiquoted expression. After the antiquotes have been evaluated, the final string is constructed by concatenating all the parts. -} data NString r = -- | Strings wrapped with double-quotes (__@"@__) can contain literal newline -- characters, but the newlines are preserved and no indentation is stripped. -- -- > DoubleQuoted [Plain "x",Antiquoted y] ~ "x${y}" DoubleQuoted ![Antiquoted Text r] | -- | Strings wrapped with two single quotes (__@''@__) can contain newlines, and -- their indentation will be stripped, but the amount stripped is -- remembered. -- -- > Indented 1 [Plain "x"] ~ '' x'' -- > -- > Indented 0 [EscapedNewline] ~ ''''\n'' -- > -- > Indented 0 [Plain "x\n ",Antiquoted y] ~ '' -- > x -- > ${y}'' Indented !Int ![Antiquoted Text r] deriving ( Eq , Ord , Generic , Generic1 , Typeable , Data , NFData , NFData1 , Serialise , Binary , ToJSON , ToJSON1 , FromJSON , FromJSON1 , Functor , Foldable , Traversable , Show , Read , Hashable ) -- | For the the 'IsString' instance, we use a plain doublequoted string. instance IsString (NString r) where fromString "" = DoubleQuoted mempty fromString string = DoubleQuoted $ one $ Plain $ fromString string $(deriveShow1 ''NString) $(deriveRead1 ''NString) $(deriveEq1 ''NString) $(deriveOrd1 ''NString) deriving instance Hashable1 NString -- *** lens traversals $(makeTraversals ''NString) -- ** data NKeyName {- | A 'KeyName' is something that can appear on the left side of an equals sign. For example, @a@ is a 'KeyName' in @{ a = 3; }@, @let a = 3; in ...@, @{}.a@ or @{} ? a@. Nix supports both static keynames (just an identifier) and dynamic identifiers. Dynamic identifiers can be either a string (e.g.: @{ "a" = 3; }@) or an antiquotation (e.g.: @let a = "example"; in { ${a} = 3; }.example@). Note: There are some places where a dynamic keyname is not allowed. In particular, those include: * The RHS of a @binding@ inside @let@: @let ${"a"} = 3; in ...@ produces a syntax fail. * The attribute names of an 'inherit': @inherit ${"a"};@ is forbidden. Note: In Nix, a simple string without antiquotes such as @"foo"@ is allowed even if the context requires a static keyname, but the parser still considers it a 'DynamicKey' for simplicity. -} data NKeyName r = -- | -- > DynamicKey (Plain (DoubleQuoted [Plain "x"])) ~ "x" -- > DynamicKey (Antiquoted x) ~ ${x} -- > DynamicKey (Plain (DoubleQuoted [Antiquoted x])) ~ "${x}" DynamicKey !(Antiquoted (NString r) r) | -- | -- > StaticKey "x" ~ x StaticKey !VarName deriving ( Eq , Ord , Generic , Typeable , Data , NFData , Serialise , Binary , ToJSON , FromJSON , Show , Read , Hashable ) instance NFData1 NKeyName where liftRnf _ (StaticKey !_) = mempty liftRnf _ (DynamicKey (Plain !_)) = mempty liftRnf _ (DynamicKey EscapedNewline) = mempty liftRnf k (DynamicKey (Antiquoted r)) = k r -- | Most key names are just static text, so this instance is convenient. instance IsString (NKeyName r) where fromString = StaticKey . fromString instance Eq1 NKeyName where liftEq eq (DynamicKey a) (DynamicKey b) = liftEq2 (liftEq eq) eq a b liftEq _ (StaticKey a) (StaticKey b) = a == b liftEq _ _ _ = False -- | @since 0.10.1 instance Ord1 NKeyName where liftCompare cmp (DynamicKey a) (DynamicKey b) = liftCompare2 (liftCompare cmp) cmp a b liftCompare _ (DynamicKey _) (StaticKey _) = LT liftCompare _ (StaticKey _) (DynamicKey _) = GT liftCompare _ (StaticKey a) (StaticKey b) = compare a b instance Hashable1 NKeyName where liftHashWithSalt h salt (DynamicKey a) = liftHashWithSalt2 (liftHashWithSalt h) h (salt `hashWithSalt` (0 :: Int)) a liftHashWithSalt _ salt (StaticKey n) = salt `hashWithSalt` (1 :: Int) `hashWithSalt` n -- Deriving this instance automatically is not possible because @r@ -- occurs not only as last argument in @Antiquoted (NString r) r@ instance Show1 NKeyName where liftShowsPrec sp sl p = \case DynamicKey a -> showsUnaryWith (liftShowsPrec2 (liftShowsPrec sp sl) (liftShowList sp sl) sp sl) "DynamicKey" p a StaticKey t -> showsUnaryWith Text.Show.showsPrec "StaticKey" p t -- Deriving this instance automatically is not possible because @r@ -- occurs not only as last argument in @Antiquoted (NString r) r@ instance Functor NKeyName where fmap = fmapDefault -- Deriving this instance automatically is not possible because @r@ -- occurs not only as last argument in @Antiquoted (NString r) r@ instance Foldable NKeyName where foldMap = foldMapDefault -- Deriving this instance automatically is not possible because @r@ -- occurs not only as last argument in @Antiquoted (NString r) r@ instance Traversable NKeyName where traverse f = \case DynamicKey (Plain str) -> DynamicKey . Plain <$> traverse f str DynamicKey (Antiquoted e) -> DynamicKey . Antiquoted <$> f e DynamicKey EscapedNewline -> pure $ DynamicKey EscapedNewline StaticKey key -> pure $ StaticKey key -- *** lens traversals $(makeTraversals ''NKeyName) -- ** type NAttrPath {- | A selector (for example in a @let@ or an attribute set) is made up of strung-together key names. > StaticKey "x" :| [DynamicKey (Antiquoted y)] ~ x.${y} -} type NAttrPath r = NonEmpty (NKeyName r) -- ** data Binding #if !MIN_VERSION_hashable(1,3,1) -- Required by Hashable Binding deriving. There was none of this Hashable instance before mentioned version, remove this in year >2022 instance Hashable1 NonEmpty #endif -- | A single line of the bindings section of a let expression or of a set. data Binding r = -- | An explicit naming. -- -- > NamedVar (StaticKey "x" :| [StaticKey "y"]) z NSourcePos{} ~ x.y = z; NamedVar !(NAttrPath r) !r !NSourcePos | -- | Inheriting an attribute (binding) into the attribute set from the other scope (attribute set). No denoted scope means to inherit from the closest outside scope. -- -- +----------------------------------------------------------------+--------------------+-----------------------+ -- | Hask | Nix | pseudocode | -- +================================================================+====================+=======================+ -- | @Inherit Nothing [StaticKey "a"] NSourcePos{}@ | @inherit a;@ | @a = outside.a;@ | -- +----------------------------------------------------------------+--------------------+-----------------------+ -- | @Inherit (pure x) [StaticKey "a"] NSourcePos{}@ | @inherit (x) a;@ | @a = x.a;@ | -- +----------------------------------------------------------------+--------------------+-----------------------+ -- | @Inherit (pure x) [StaticKey "a", StaticKey "b"] NSourcePos{}@ | @inherit (x) a b;@ | @a = x.a;@ | -- | | | @b = x.b;@ | -- +----------------------------------------------------------------+--------------------+-----------------------+ -- -- (2021-07-07 use details): -- Inherits the position of the first name through @unsafeGetAttrPos@. The position of the scope inherited from else - the position of the first member of the binds list. Inherit !(Maybe r) ![VarName] !NSourcePos deriving ( Eq , Ord , Generic , Generic1 , Typeable , Data , NFData , NFData1 , Serialise , Binary , ToJSON , FromJSON , Functor , Foldable , Traversable , Show , Hashable ) $(deriveShow1 ''Binding) $(deriveEq1 ''Binding) $(deriveOrd1 ''Binding) -- x $(deriveJSON1 defaultOptions ''Binding) deriving instance Hashable1 Binding -- *** lens traversals $(makeTraversals ''Binding) -- ** data Recursivity {- | Distinguishes between recursive and non-recursive. Mainly for attribute sets. -} data Recursivity = -- | > { ... } NonRecursive | -- | > rec { ... } Recursive deriving ( Eq , Ord , Enum , Bounded , Generic , Typeable , Data , NFData , Serialise , Binary , ToJSON , FromJSON , Show , Read , Hashable ) instance Semigroup Recursivity where (<>) NonRecursive NonRecursive = NonRecursive (<>) _ _ = Recursive instance Monoid Recursivity where mempty = NonRecursive -- ** data NUnaryOp -- | There are two unary operations: logical not and integer negation. data NUnaryOp = -- | @-@ NNeg | -- | @!@ NNot deriving ( Eq , Ord , Enum , Bounded , Generic , Typeable , Data , NFData , Serialise , Binary , ToJSON , FromJSON , Show , Read , Hashable ) -- *** lens traversals $(makeTraversals ''NUnaryOp) -- ** data NBinaryOp -- | Binary operators expressible in the nix language. data NBinaryOp = -- | Equality (@==@) NEq | -- | Inequality (@!=@) NNEq | -- | Less than (@<@) NLt | -- | Less than or equal (@<=@) NLte | -- | Greater than (@>@) NGt | -- | Greater than or equal (@>=@) NGte | -- | Logical and (@&&@) NAnd | -- | Logical or (@||@) NOr | -- | Logical implication (@->@) NImpl | -- | Get the left attr set, extend it with the right one & override equal keys (@//@) NUpdate | -- | Addition (@+@) NPlus | -- | Subtraction (@-@) NMinus | -- | Multiplication (@*@) NMult | -- | Division (@/@) NDiv | -- | List concatenation (@++@) NConcat deriving ( Eq , Ord , Enum , Bounded , Generic , Typeable , Data , NFData , Serialise , Binary , ToJSON , FromJSON , Show , Read , Hashable ) -- *** lens traversals $(makeTraversals ''NBinaryOp) -- * data NExprF - Nix expressions, base functor {- | The main Nix expression type. As it is polimorphic, has a functor, which allows to traverse expressions and map functions over them. The actual 'NExpr' type is a fixed point of this functor, defined below. -} data NExprF r = -- | Constants: ints, floats, bools, URIs, and null. NConstant !NAtom | -- | A string, with interpolated expressions. NStr !(NString r) | -- | A variable. For example, in the expression @f a@, @f@ is represented -- as @NSym "f"@ and @a@ as @NSym "a"@. -- -- > NSym "x" ~ x NSym !VarName | -- | A list literal. -- -- > NList [x,y] ~ [ x y ] NList ![r] | -- | An attribute set literal -- -- > NSet Recursive [NamedVar x y _] ~ rec { x = y; } -- > NSet NonRecursive [Inherit Nothing [x] _] ~ { inherit x; } NSet !Recursivity ![Binding r] | -- | A path expression, which is evaluated to a store path. The path here -- can be relative, in which case it's evaluated relative to the file in -- which it appears. -- -- > NLiteralPath "/x" ~ /x -- > NLiteralPath "x/y" ~ x/y NLiteralPath !Path | -- | A path which refers to something in the Nix search path (the NIX_PATH -- environment variable. For example, @@. -- -- > NEnvPath "x" ~ NEnvPath !Path | -- | Functional application (aka F.A., apply a function to an argument). -- -- > NApp f x ~ f x NApp !r !r | -- | Application of a unary operator to an expression. -- -- > NUnary NNeg x ~ - x -- > NUnary NNot x ~ ! x NUnary !NUnaryOp !r | -- | Application of a binary operator to two expressions. -- -- > NBinary NPlus x y ~ x + y -- > NBinary NApp f x ~ f x NBinary !NBinaryOp !r !r | -- | Dot-reference into an attribute set, optionally providing an -- alternative if the key doesn't exist. -- -- > NSelect Nothing s (x :| []) ~ s.x -- > NSelect (pure y) s (x :| []) ~ s.x or y NSelect !(Maybe r) !r !(NAttrPath r) | -- | Ask if a set contains a given attribute path. -- -- > NHasAttr s (x :| []) ~ s ? x NHasAttr !r !(NAttrPath r) | -- | A function literal (lambda abstraction). -- -- > NAbs (Param "x") y ~ x: y NAbs !(Params r) !r | -- | Evaluate the second argument after introducing the bindings. -- -- > NLet [] x ~ let in x -- > NLet [NamedVar x y _] z ~ let x = y; in z -- > NLet [Inherit Nothing x _] y ~ let inherit x; in y NLet ![Binding r] !r | -- | If-then-else statement. -- -- > NIf x y z ~ if x then y else z NIf !r !r !r | -- | Evaluate an attribute set, bring its bindings into scope, and -- evaluate the second argument. -- -- > NWith x y ~ with x; y NWith !r !r | -- | Checks that the first argument is a predicate that is @true@ before evaluating the second argument. -- -- > NAssert x y ~ assert x; y NAssert !r !r | -- | Syntactic hole. -- -- See for context. -- -- > NSynHole "x" ~ ^x NSynHole !VarName deriving ( Eq , Ord , Generic , Generic1 , Typeable , Data , NFData , NFData1 , Serialise , Binary , ToJSON , FromJSON , Functor , Foldable , Traversable , Show , Hashable ) $(deriveShow1 ''NExprF) $(deriveEq1 ''NExprF) $(deriveOrd1 ''NExprF) -- x $(deriveJSON1 defaultOptions ''NExprF) deriving instance Hashable1 NExprF -- ** lens traversals $(makeTraversals ''NExprF) -- ** type NExpr -- | The monomorphic expression type is a fixed point of the polymorphic one. type NExpr = Fix NExprF {- | We make an `IsString` for expressions, where the string is interpreted as an identifier. This is the most common use-case... -} instance IsString NExpr where fromString = Fix . NSym . fromString instance Serialise NExpr {- FOURMOLU_DISABLE -} instance TH.Lift NExpr where lift = TH.dataToExpQ (\b -> do -- Binding on constructor ensures type match and gives type inference to TH. -- Reflection is the ability of a process to examine, introspect, and modify its own structure and behavior. -- Reflection is a key strategy in metaprogramming. -- HRefl <- Reflection.eqTypeRep (Reflection.typeRep @Text) (Reflection.typeOf b) pure [| $(TH.lift b) |] ) #if MIN_VERSION_template_haskell(2,17,0) liftTyped = TH.unsafeCodeCoerce . TH.lift #elif MIN_VERSION_template_haskell(2,16,0) liftTyped = TH.unsafeTExpCoerce . TH.lift #endif {- FOURMOLU_ENABLE -} -- ** Methods #if __GLASGOW_HASKELL__ >= 900 hashAt :: Functor f => VarName -> (Maybe v -> f (Maybe v)) -> AttrSet v -> f (AttrSet v) #else hashAt :: VarName -> Lens' (AttrSet v) (Maybe v) #endif hashAt = alterF where alterF :: (Functor f) => VarName -> (Maybe v -> f (Maybe v)) -> AttrSet v -> f (AttrSet v) alterF (coerce -> k) f m = maybe (MapL.delete k m) (\v -> MapL.insert k v m) <$> f (MapL.lookup k m) -- | Get the name out of the parameter (there might be none). paramName :: Params r -> Maybe VarName paramName (Param name) = pure name paramName (ParamSet mname _ _) = mname stringParts :: NString r -> [Antiquoted Text r] stringParts (DoubleQuoted parts) = parts stringParts (Indented _ parts) = parts stripPositionInfo :: NExpr -> NExpr stripPositionInfo = transport phi where transport f (Fix x) = Fix $ transport f <$> f x phi (NSet recur binds) = NSet recur $ erasePositions <$> binds phi (NLet binds body) = NLet (erasePositions <$> binds) body phi x = x erasePositions (NamedVar path r _pos) = NamedVar path r nullPos erasePositions (Inherit ms names _pos) = Inherit ms names nullPos nullPos :: NSourcePos nullPos = on (NSourcePos "") (coerce . mkPos) 1 1 -- * Dead code -- ** class NExprAnn class NExprAnn ann g | g -> ann where fromNExpr :: g r -> (NExprF r, ann) toNExpr :: (NExprF r, ann) -> g r -- ** Other ekey :: forall ann g. (NExprAnn ann g) => NonEmpty VarName -> NSourcePos -> Lens' (Fix g) (Maybe (Fix g)) ekey keys pos f e@(Fix x) | (NSet NonRecursive xs, ann) <- fromNExpr x = let vals :: [(Fix g, [VarName])] vals = do let keys' = NE.toList keys (ks, rest) <- zip (inits keys') (tails keys') handlePresence mempty ( \(j : js) -> do NamedVar ns v _p <- xs guard $ (j : js) == (NE.toList ns ^.. traverse . _StaticKey) pure (v, rest) ) ks in case vals of ((v, []) : _) -> fromMaybe e <$> f (pure v) ((v, r : rest) : _) -> ekey (r :| rest) pos f v _ -> maybe e ( \v -> let entry = NamedVar (StaticKey <$> keys) v pos in Fix $ toNExpr (NSet mempty $ one entry <> xs, ann) ) <$> f Nothing ekey _ _ f e = fromMaybe e <$> f Nothing getFreeVars :: NExpr -> Set VarName getFreeVars e = case unFix e of (NConstant _) -> mempty (NStr string) -> mapFreeVars string (NSym var) -> one var (NList list) -> mapFreeVars list (NSet NonRecursive bindings) -> bindFreeVars bindings (NSet Recursive bindings) -> diffBetween bindFreeVars bindDefs bindings (NLiteralPath _) -> mempty (NEnvPath _) -> mempty (NUnary _ expr) -> getFreeVars expr (NApp left right) -> collectFreeVars left right (NBinary _ left right) -> collectFreeVars left right (NSelect orExpr expr path) -> Set.unions [ getFreeVars expr , pathFree path , getFreeVars `whenJust` orExpr ] (NHasAttr expr path) -> getFreeVars expr <> pathFree path (NAbs (Param varname) expr) -> Set.delete varname (getFreeVars expr) (NAbs (ParamSet varname _ pset) expr) -> Set.difference -- Include all free variables from the expression and the default arguments (getFreeVars expr <> Set.unions (getFreeVars <$> mapMaybe snd pset)) -- But remove the argument name if existing, and all arguments in the parameter set ((one `whenJust` varname) <> Set.fromList (fst <$> pset)) (NLet bindings expr) -> Set.difference (getFreeVars expr <> bindFreeVars bindings) (bindDefs bindings) (NIf cond th el) -> Set.unions $ getFreeVars <$> [cond, th, el] -- Evaluation is needed to find out whether x is a "real" free variable in `with y; x`, we just include it -- This also makes sense because its value can be overridden by `x: with y; x` (NWith set expr) -> collectFreeVars set expr (NAssert assertion expr) -> collectFreeVars assertion expr (NSynHole _) -> mempty where diffBetween :: (a -> Set VarName) -> (a -> Set VarName) -> a -> Set VarName diffBetween g f b = Set.difference (g b) (f b) collectFreeVars :: NExpr -> NExpr -> Set VarName collectFreeVars = (<>) `on` getFreeVars bindDefs :: (Foldable t) => t (Binding NExpr) -> Set VarName bindDefs = foldMap bind1Def where bind1Def :: Binding r -> Set VarName bind1Def (Inherit Nothing _ _) = mempty bind1Def (Inherit (Just _) keys _) = Set.fromList keys bind1Def (NamedVar (StaticKey varname :| _) _ _) = one varname bind1Def (NamedVar (DynamicKey _ :| _) _ _) = mempty bindFreeVars :: (Foldable t) => t (Binding NExpr) -> Set VarName bindFreeVars = foldMap bind1Free where bind1Free :: Binding NExpr -> Set VarName bind1Free (Inherit Nothing keys _) = Set.fromList keys bind1Free (Inherit (Just scope) _ _) = getFreeVars scope bind1Free (NamedVar path expr _) = pathFree path <> getFreeVars expr pathFree :: NAttrPath NExpr -> Set VarName pathFree = foldMap mapFreeVars mapFreeVars :: (Foldable t) => t NExpr -> Set VarName mapFreeVars = foldMap getFreeVars ================================================ FILE: src/Nix/Expr.hs ================================================ -- | Wraps the expression submodules. module Nix.Expr ( module Nix.Expr.Types, module Nix.Expr.Types.Annotated, module Nix.Expr.Shorthands, ) where import Nix.Expr.Shorthands import Nix.Expr.Types import Nix.Expr.Types.Annotated ================================================ FILE: src/Nix/Frames.hs ================================================ {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE ExistentialQuantification #-} -- | Definitions of Frames. Frames are messages that gather and ship themself with a context related to the message. For example - the message about some exception would also gather, keep and bring with it the tracing information. module Nix.Frames ( NixLevel (..), Frames, askFrames, Framed, NixFrame (..), NixException (..), withFrame, throwError, module Data.Typeable, ) where import Control.Monad.Catch (MonadThrow (..)) import Data.Typeable hiding (typeOf) import Nix.Prelude import qualified Text.Show data NixLevel = Fatal | Error | Warning | Info | Debug deriving (Ord, Eq, Bounded, Enum, Show) data NixFrame = NixFrame { frameLevel :: NixLevel , frame :: SomeException } instance Show NixFrame where show (NixFrame level f) = "Nix frame at level " <> show level <> ": " <> show f type Frames = [NixFrame] askFrames :: forall e m. (MonadReader e m, Has e Frames) => m Frames askFrames = askLocal type Framed e m = (MonadReader e m, Has e Frames, MonadThrow m) newtype NixException = NixException Frames deriving (Show) instance Exception NixException withFrame :: forall s e m a. (Framed e m, Exception s) => NixLevel -> s -> m a -> m a withFrame level f = local $ over hasLens (NixFrame level (toException f) :) throwError :: forall s e m a. (Framed e m, Exception s, MonadThrow m) => s -> m a throwError err = do context <- askLocal traceM "Throwing fail..." throwM $ NixException $ NixFrame Error (toException err) : context ================================================ FILE: src/Nix/Fresh/Basic.hs ================================================ {-# LANGUAGE CPP #-} {-# OPTIONS_GHC -Wno-orphans #-} module Nix.Fresh.Basic where #if !MIN_VERSION_base(4,13,0) import Control.Monad.Fail ( MonadFail ) #endif import Nix.Effects import Nix.Fresh import Nix.Prelude import Nix.Render import Nix.Value type StdIdT = FreshIdT Int -- NOTE: These would be removed by: https://github.com/haskell-nix/hnix/pull/804 instance (MonadFail m, MonadFile m) => MonadFile (StdIdT m) instance (MonadIntrospect m) => MonadIntrospect (StdIdT m) instance (MonadStore m) => MonadStore (StdIdT m) instance (MonadPutStr m) => MonadPutStr (StdIdT m) instance (MonadHttp m) => MonadHttp (StdIdT m) instance (MonadEnv m) => MonadEnv (StdIdT m) instance (MonadPaths m) => MonadPaths (StdIdT m) instance (MonadInstantiate m) => MonadInstantiate (StdIdT m) instance (MonadExec m) => MonadExec (StdIdT m) instance (MonadEffects t f m, MonadDataContext f m) => MonadEffects t f (StdIdT m) where toAbsolutePath :: Path -> StdIdT m Path toAbsolutePath = lift . toAbsolutePath @t @f @m findEnvPath :: String -> StdIdT m Path findEnvPath = lift . findEnvPath @t @f @m findPath :: [NValue t f (StdIdT m)] -> Path -> StdIdT m Path findPath vs path = do i <- FreshIdT ask lift $ findPath @t @f @m (unliftNValue (`runFreshIdT` i) <$> vs) path importPath :: Path -> StdIdT m (NValue t f (StdIdT m)) importPath path = do i <- FreshIdT ask lift $ liftNValue (`runFreshIdT` i) <$> (importPath @t @f @m $ path) pathToDefaultNix :: Path -> StdIdT m Path pathToDefaultNix = lift . pathToDefaultNix @t @f @m derivationStrict :: NValue t f (StdIdT m) -> StdIdT m (NValue t f (StdIdT m)) derivationStrict v = do i <- FreshIdT ask let fresh :: FreshIdT Int m a -> m a fresh = (`runFreshIdT` i) lift $ liftNValue fresh <$> (derivationStrict @t @f @m . unliftNValue fresh $ v) traceEffect :: String -> StdIdT m () traceEffect = lift . traceEffect @t @f @m ================================================ FILE: src/Nix/Fresh.hs ================================================ {-# LANGUAGE CPP #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-orphans #-} module Nix.Fresh where import Control.Monad.Base (MonadBase (..)) import Control.Monad.Catch ( MonadCatch, MonadMask, MonadThrow, ) import Control.Monad.Fix (MonadFix) import Control.Monad.Ref ( MonadAtomicRef (..), MonadRef (Ref), ) import Nix.Prelude import Nix.Thunk newtype FreshIdT i m a = FreshIdT (ReaderT (Ref m i) m a) deriving ( Functor , Applicative , Alternative , Monad , MonadFail , MonadPlus , MonadFix , MonadRef , MonadAtomicRef , MonadIO , MonadCatch , MonadThrow , MonadMask ) instance MonadTrans (FreshIdT i) where lift = FreshIdT . lift instance (MonadBase b m) => MonadBase b (FreshIdT i m) where liftBase = FreshIdT . liftBase instance ( MonadAtomicRef m , Eq i , Ord i , Show i , Enum i , Typeable i ) => MonadThunkId (FreshIdT i m) where type ThunkId (FreshIdT i m) = i freshId = FreshIdT $ do v <- ask atomicModifyRef v (\i -> (succ i, i)) runFreshIdT :: (Functor m) => FreshIdT i m a -> Ref m i -> m a runFreshIdT = runReaderT . coerce ================================================ FILE: src/Nix/Json.hs ================================================ {-# LANGUAGE CPP #-} module Nix.Json where import qualified Data.Aeson as A import qualified Data.Aeson.Encoding as A import qualified Data.HashMap.Strict as HM import qualified Data.Vector as V import Nix.Prelude {- FOURMOLU_DISABLE -} #if MIN_VERSION_aeson(2,0,0) import qualified Data.Aeson.Key as AKM import qualified Data.Aeson.KeyMap as AKM #endif {- FOURMOLU_ENABLE -} import Nix.Atoms import Nix.Effects import Nix.Exec import Nix.Expr.Types import Nix.Frames import Nix.String import Nix.Value import Nix.Value.Monad {- FOURMOLU_DISABLE -} -- This was moved from Utils. toEncodingSorted :: A.Value -> A.Encoding toEncodingSorted = \case A.Object m -> A.pairs . foldMap (\(k, v) -> A.pair k $ toEncodingSorted v) . sortWith fst $ #if MIN_VERSION_aeson(2,0,0) AKM.toList #else HM.toList #endif m A.Array l -> A.list toEncodingSorted $ V.toList l v -> A.toEncoding v {- FOURMOLU_ENABLE -} toJSONNixString :: (MonadNix e t f m) => NValue t f m -> m NixString toJSONNixString = runWithStringContextT . fmap ( decodeUtf8 -- This is completely not optimal, but seems we do not have better encoding analog (except for @unsafe*@), Aeson gatekeeps through this. . A.encodingToLazyByteString . toEncodingSorted ) . toJSON {- FOURMOLU_DISABLE -} toJSON :: MonadNix e t f m => NValue t f m -> WithStringContextT m A.Value toJSON = \case NVConstant (NInt n) -> pure $ A.toJSON n NVConstant (NFloat n) -> pure $ A.toJSON n NVConstant (NBool b) -> pure $ A.toJSON b NVConstant NNull -> pure A.Null NVStr ns -> A.toJSON <$> extractNixString ns NVList l -> A.Array . V.fromList <$> traverse intoJson l NVSet _ m -> maybe (A.Object <$> traverse intoJson kmap) intoJson (lkup "outPath" kmap) where #if MIN_VERSION_aeson(2,0,0) lkup = AKM.lookup kmap = AKM.fromHashMap $ HM.mapKeys (AKM.fromText . coerce) m #else lkup = HM.lookup kmap = HM.mapKeys (coerce @VarName @Text) m #endif NVPath p -> do fp <- lift $ coerce <$> addPath p addSingletonStringContext $ StringContext DirectPath $ fromString fp pure $ A.toJSON fp v -> lift $ throwError $ CoercionToJson v where intoJson :: MonadNix e t f m => NValue t f m -> WithStringContextT m A.Value intoJson nv = join $ lift $ toJSON <$> demand nv {- FOURMOLU_ENABLE -} ================================================ FILE: src/Nix/Lint.hs ================================================ {-# LANGUAGE CPP #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-missing-methods #-} {-# OPTIONS_GHC -fno-warn-name-shadowing #-} module Nix.Lint where import Control.Exception (throw) import Control.Monad (foldM) import Control.Monad.Catch import Control.Monad.Fix import Control.Monad.Ref import Control.Monad.ST import qualified Data.HashMap.Lazy as M import GHC.Exception (ErrorCall (ErrorCall)) import Nix.Prelude -- Plese, use NonEmpty import Data.List (intersect) import qualified Data.List.NonEmpty as NE import qualified Data.Text as Text import Nix.Atoms import Nix.Context import Nix.Convert import Nix.Eval (MonadEval (..)) import qualified Nix.Eval as Eval import Nix.Expr.Types import Nix.Expr.Types.Annotated import Nix.Frames import Nix.Fresh import Nix.Options import Nix.Scope import Nix.String import Nix.Thunk import Nix.Thunk.Basic import Nix.Value.Monad import qualified Text.Show data TAtom = TInt | TFloat | TBool | TNull deriving (Show, Eq, Ord) data NTypeF (m :: Type -> Type) r = TConstant [TAtom] | TStr | TList r | TSet (Maybe (AttrSet r)) | TClosure (Params ()) | TPath | TBuiltin Text (Symbolic m -> m r) deriving (Functor) compareTypes :: NTypeF m r -> NTypeF m r -> Ordering compareTypes (TConstant _) (TConstant _) = EQ compareTypes (TConstant _) _ = LT compareTypes _ (TConstant _) = GT compareTypes TStr TStr = EQ compareTypes TStr _ = LT compareTypes _ TStr = GT compareTypes (TList _) (TList _) = EQ compareTypes (TList _) _ = LT compareTypes _ (TList _) = GT compareTypes (TSet _) (TSet _) = EQ compareTypes (TSet _) _ = LT compareTypes _ (TSet _) = GT compareTypes TClosure{} TClosure{} = EQ compareTypes TClosure{} _ = LT compareTypes _ TClosure{} = GT compareTypes TPath TPath = EQ compareTypes TPath _ = LT compareTypes _ TPath = GT compareTypes (TBuiltin _ _) (TBuiltin _ _) = EQ data NSymbolicF r = NAny | NMany [r] deriving (Show, Eq, Ord, Functor, Foldable, Traversable) type SThunk (m :: Type -> Type) = NThunkF m (Symbolic m) type SValue (m :: Type -> Type) = Ref m (NSymbolicF (NTypeF m (Symbolic m))) data Symbolic m = SV {getSV :: SValue m} | ST {getST :: SThunk m} instance Show (Symbolic m) where show _ = "" everyPossible :: (MonadAtomicRef m) => m (Symbolic m) everyPossible = packSymbolic NAny mkSymbolic :: (MonadAtomicRef m) => [NTypeF m (Symbolic m)] -> m (Symbolic m) mkSymbolic = packSymbolic . NMany mkSymbolic1 :: (MonadAtomicRef m) => NTypeF m (Symbolic m) -> m (Symbolic m) mkSymbolic1 = mkSymbolic . one packSymbolic :: (MonadAtomicRef m) => NSymbolicF (NTypeF m (Symbolic m)) -> m (Symbolic m) packSymbolic = fmap SV . newRef unpackSymbolic :: (MonadAtomicRef m, MonadThunkId m, MonadCatch m) => Symbolic m -> m (NSymbolicF (NTypeF m (Symbolic m))) unpackSymbolic = readRef . getSV <=< demand type MonadLint e m = ( Scoped (Symbolic m) m , Framed e m , MonadAtomicRef m , MonadCatch m , MonadThunkId m ) symerr :: forall e m a. (MonadLint e m) => Text -> m a symerr = evalError @(Symbolic m) . ErrorCall . toString renderSymbolic :: (MonadLint e m) => Symbolic m -> m Text renderSymbolic = ( \case NAny -> pure "" NMany xs -> Text.intercalate ", " <$> traverse ( \case TConstant ys -> pure $ Text.intercalate ", " ( fmap ( \case TInt -> "int" TFloat -> "float" TBool -> "bool" TNull -> "null" ) ys ) TStr -> pure "string" TList r -> fmap brackets $ renderSymbolic =<< demand r TSet Nothing -> pure "" TSet (Just s) -> braces . show <$> traverse (renderSymbolic <=< demand) s f@(TClosure p) -> do (args, sym) <- do f' <- mkSymbolic1 f lintApp (NAbs p mempty) f' everyPossible args' <- traverse renderSymbolic args sym' <- renderSymbolic sym pure $ parens $ show args' <> " -> " <> sym' TPath -> pure "path" TBuiltin _n _f -> pure "" ) xs ) <=< unpackSymbolic where between a b c = a <> b <> c parens = between "(" ")" brackets = between "[" "]" braces = between "{" "}" -- This function is order and uniqueness preserving (of types). merge :: forall e m. (MonadLint e m) => NExprF () -> [NTypeF m (Symbolic m)] -> [NTypeF m (Symbolic m)] -> m [NTypeF m (Symbolic m)] merge context = go where go :: [NTypeF m (Symbolic m)] -> [NTypeF m (Symbolic m)] -> m [NTypeF m (Symbolic m)] go [] _ = stub go _ [] = stub go xxs@(x : xs) yys@(y : ys) = case (x, y) of (TStr, TStr) -> (one TStr <>) <$> rest (TPath, TPath) -> (one TPath <>) <$> rest (TConstant ls, TConstant rs) -> (one (TConstant (ls `intersect` rs)) <>) <$> rest (TList l, TList r) -> do l' <- demand l r' <- demand r m <- defer $ unify context l' r' (one (TList m) <>) <$> rest (TSet x, TSet Nothing) -> (one (TSet x) <>) <$> rest (TSet Nothing, TSet x) -> (one (TSet x) <>) <$> rest (TSet (Just l), TSet (Just r)) -> do hm <- sequenceA $ M.intersectionWith ( \i j -> do i'' <- i j'' <- j defer $ unify context i'' j'' ) (fmap demand l) (fmap demand r) handlePresence id (const ((one (TSet $ pure hm) <>) <$>)) hm rest (TClosure{}, TClosure{}) -> throwError $ ErrorCall "Cannot unify functions" (TBuiltin _ _, TBuiltin _ _) -> throwError $ ErrorCall "Cannot unify builtin functions" _ | compareTypes x y == LT -> go xs yys | compareTypes x y == GT -> go xxs ys | otherwise -> error "impossible" where rest :: m [NTypeF m (Symbolic m)] rest = go xs ys {- mergeFunctions pl nl fl pr fr xs ys = do m <- sequenceA $ M.intersectionWith (\i j -> i >>= \i' -> j >>= \j' -> case (i', j') of (Nothing, Nothing) -> stub (_, Nothing) -> stub (Nothing, _) -> stub (Just i'', Just j'') -> pure . pure <$> unify context i'' j'') (pure <$> pl) (pure <$> pr) let Just m' = sequenceA $ M.filter isJust m if M.null m' then go xs ys else do g <- unify context fl fr (TClosure (ParamSet m' False nl) g :) <$> go xs ys -} -- | Result @== NMany []@ -> @unify@ fails. unify :: forall e m a. (MonadLint e m) => NExprF a -> Symbolic m -> Symbolic m -> m (Symbolic m) unify (void -> context) (SV x) (SV y) = do x' <- readRef x y' <- readRef y case (x', y') of (NAny, _) -> do writeRef x y' pure $ SV y (_, NAny) -> do writeRef y x' pure $ SV x (NMany xs, NMany ys) -> handlePresence ( -- x' <- renderSymbolic (Symbolic x) -- y' <- renderSymbolic (Symbolic y) throwError $ ErrorCall "Cannot unify " -- <> show x' <> " with " <> show y' -- <> " in context: " <> show context ) ( \m -> do let nm = NMany m writeRef x nm writeRef y nm packSymbolic nm ) =<< merge context xs ys unify _ _ _ = error "The unexpected hath transpired!" -- These aren't worth defining yet, because once we move to Hindley-Milner, -- we're not going to be managing Symbolic values this way anymore. instance ToValue Bool m (Symbolic m) instance ToValue [Symbolic m] m (Symbolic m) instance FromValue NixString m (Symbolic m) instance FromValue (AttrSet (Symbolic m), PositionSet) m (Symbolic m) instance ToValue (AttrSet (Symbolic m), PositionSet) m (Symbolic m) instance (MonadThunkId m, MonadAtomicRef m, MonadCatch m) => MonadValue (Symbolic m) m where defer :: m (Symbolic m) -> m (Symbolic m) defer = fmap ST . thunk demand :: Symbolic m -> m (Symbolic m) demand (ST v) = demand =<< force v demand (SV v) = pure (SV v) instance (MonadThunkId m, MonadAtomicRef m, MonadCatch m) => MonadValueF (Symbolic m) m where demandF :: (Symbolic m -> m r) -> Symbolic m -> m r demandF f (ST v) = demandF f =<< force v demandF f (SV v) = f (SV v) instance (MonadLint e m) => MonadEval (Symbolic m) m where freeVariable var = symerr $ "Undefined variable '" <> coerce var <> "'" attrMissing ks ms = evalError @(Symbolic m) . ErrorCall . toString $ maybe ("Inheriting unknown attribute: " <> attr) (\s -> "Could not look up attribute " <> attr <> " in " <> show s) ms where attr = Text.intercalate "." $ NE.toList $ coerce ks evalCurPos = do f <- mkSymbolic1 TPath l <- mkSymbolic1 $ TConstant $ one TInt c <- mkSymbolic1 $ TConstant $ one TInt mkSymbolic1 $ TSet . pure $ M.fromList [("file", f), ("line", l), ("col", c)] evalConstant c = mkSymbolic1 $ fun c where fun = \case NURI _ -> TStr NInt _ -> TConstant $ one TInt NFloat _ -> TConstant $ one TFloat NBool _ -> TConstant $ one TBool NNull -> TConstant $ one TNull evalString = const $ mkSymbolic1 TStr evalLiteralPath = const $ mkSymbolic1 TPath evalEnvPath = const $ mkSymbolic1 TPath evalUnary op arg = unify (NUnary op arg) arg =<< mkSymbolic1 (TConstant [TInt, TBool]) evalBinary = lintBinaryOp -- The scope is deliberately wrapped in a thunk here, since it is evaluated -- each time a name is looked up within the weak scope, and we want to be -- sure the action it evaluates is to force a thunk, so its value is only -- computed once. evalWith scope body = do s <- unpackSymbolic =<< demand =<< defer scope pushWeakScope ( case s of NMany [TSet (Just (coerce -> scope))] -> pure scope NMany [TSet Nothing] -> error "NYI: with unknown" _ -> throwError $ ErrorCall "scope must be a set in with statement" ) body evalIf cond t f = do t' <- t f' <- f let e = unify (NIf cond t' f') e t' f' <* (e cond =<< mkSymbolic1 (TConstant $ one TBool)) evalAssert cond body = do body' <- body body' <$ (unify (NAssert cond body') cond =<< mkSymbolic1 (TConstant $ one TBool)) evalApp = (fmap snd .) . lintApp (join NApp mempty) evalAbs params _ = mkSymbolic1 (TClosure $ void params) evalError = throwError {- FOURMOLU_DISABLE -} lintBinaryOp :: forall e m . (MonadLint e m, MonadEval (Symbolic m) m) => NBinaryOp -> Symbolic m -> m (Symbolic m) -> m (Symbolic m) lintBinaryOp op lsym rarg = do rsym <- rarg y <- defer everyPossible check lsym rsym $ case op of NEq -> [TConstant [TInt, TBool, TNull], TStr, TList y] NNEq -> [TConstant [TInt, TBool, TNull], TStr, TList y] NLt -> one $ TConstant [TInt, TBool, TNull] NLte -> one $ TConstant [TInt, TBool, TNull] NGt -> one $ TConstant [TInt, TBool, TNull] NGte -> one $ TConstant [TInt, TBool, TNull] NAnd -> one $ TConstant $ one TBool NOr -> one $ TConstant $ one TBool NImpl -> one $ TConstant $ one TBool -- jww (2018-04-01): NYI: Allow Path + Str NPlus -> [TConstant $ one TInt, TStr, TPath] NMinus -> one $ TConstant $ one TInt NMult -> one $ TConstant $ one TInt NDiv -> one $ TConstant $ one TInt NUpdate -> one $ TSet mempty NConcat -> one $ TList y #if __GLASGOW_HASKELL__ < 810 _ -> fail "Should not be possible" -- symerr or this fun signature should be changed to work in type scope #endif where check lsym rsym xs = do let contextUnify = unify $ NBinary op lsym rsym m <- mkSymbolic xs _ <- contextUnify lsym m _ <- contextUnify rsym m contextUnify lsym rsym {- FOURMOLU_ENABLE -} infixl 1 `lintApp` lintApp :: forall e m. (MonadLint e m) => NExprF () -> Symbolic m -> m (Symbolic m) -> m (HashMap VarName (Symbolic m), Symbolic m) lintApp context fun arg = ( \case NAny -> throwError $ ErrorCall "Cannot apply something not known to be a function" NMany xs -> do (args, ys) <- unzip <$> traverse ( \case TClosure _params -> ( \case NAny -> error "NYI" NMany [TSet (Just _)] -> error "NYI" NMany _ -> throwError $ ErrorCall "NYI: lintApp NMany not set" ) =<< unpackSymbolic =<< arg TBuiltin _ _f -> throwError $ ErrorCall "NYI: lintApp builtin" TSet _m -> throwError $ ErrorCall "NYI: lintApp Set" _x -> throwError $ ErrorCall "Attempt to call non-function" ) xs y <- everyPossible let firstArg = case args of (a : _) -> a [] -> error "lintApp: impossible - traverse over non-empty list produced empty result" (firstArg,) <$> foldM (unify context) y ys ) =<< unpackSymbolic fun newtype Lint s a = Lint {runLint :: ReaderT (Context (Lint s) (Symbolic (Lint s))) (FreshIdT Int (ST s)) a} deriving ( Functor , Applicative , Monad , MonadFix , MonadReader (Context (Lint s) (Symbolic (Lint s))) , MonadThunkId , MonadRef , MonadAtomicRef ) instance MonadThrow (Lint s) where throwM :: forall e a. (Exception e) => e -> Lint s a throwM e = Lint $ ReaderT $ const (throw e) instance MonadCatch (Lint s) where catch _m _h = Lint $ ReaderT $ const (error "Cannot catch in 'Lint s'") runLintM :: Options -> Lint s a -> ST s a runLintM opts action = runFreshIdT ((`runReaderT` newContext opts) $ runLint action) =<< newRef (1 :: Int) symbolicBaseEnv :: (Monad m) => m (Scopes m (Symbolic m)) symbolicBaseEnv = stub lint :: Options -> NExprLoc -> ST s (Symbolic (Lint s)) lint opts expr = runLintM opts $ do basis <- symbolicBaseEnv pushScopes basis ( adi Eval.addSourcePositions Eval.evalContent expr ) instance Scoped (Symbolic (Lint s)) (Lint s) where askScopes = askScopesReader clearScopes = clearScopesReader @(Lint s) @(Symbolic (Lint s)) pushScopes = pushScopesReader lookupVar = lookupVarReader ================================================ FILE: src/Nix/Normal.hs ================================================ {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeFamilies #-} {- | Code for normalization (reduction into a normal form) of Nix expressions. Nix language allows recursion, so some expressions do not converge. And so do not converge into a normal form. -} module Nix.Normal where import Control.Monad.Free (Free (..)) import Data.Set ( insert, member, ) import Nix.Cited import Nix.Frames import Nix.Prelude import Nix.Thunk import Nix.Value newtype NormalLoop t f m = NormalLoop (NValue t f m) deriving (Show) instance (MonadDataErrorContext t f m) => Exception (NormalLoop t f m) -- | Normalize the value as much as possible, leaving only detected cycles. normalizeValue :: forall e t m f. ( Framed e m , MonadThunk t m (NValue t f m) , MonadDataErrorContext t f m , Ord (ThunkId m) ) => NValue t f m -> m (NValue t f m) normalizeValue v = run $ iterNValueM run go (fmap Free . sequenceNValue' run) v where start = 0 :: Int maxDepth = 2000 table = mempty run :: ReaderT Int (StateT (Set (ThunkId m)) m) r -> m r run = (`evalStateT` table) . (`runReaderT` start) go :: ( NValue t f m -> ReaderT Int (StateT (Set (ThunkId m)) m) (NValue t f m) ) -> t -> ReaderT Int (StateT (Set (ThunkId m)) m) (NValue t f m) go k tnk = bool ( do i <- ask when (i > maxDepth) $ fail $ "Exceeded maximum normalization depth of " <> show maxDepth <> " levels." (lifted . lifted) (=<< force tnk) (local (+ 1) . k) ) (pure $ pure tnk) =<< seen tnk where seen :: t -> ReaderT Int (StateT (Set (ThunkId m)) m) Bool seen t = do let tnkid = thunkId t lift $ do thunkWasVisited <- gets $ member tnkid when (not thunkWasVisited) $ modify $ insert tnkid pure thunkWasVisited -- 2021-05-09: NOTE: This seems a bit excessive. If these functorial versions are not used for recursion schemes - just free from it. -- | Normalization HOF (functorial) version of @normalizeValue@. Accepts the special thunk operating/forcing/nirmalizing function & internalizes it. normalizeValueF :: forall e t m f. ( Framed e m , MonadThunk t m (NValue t f m) , MonadDataErrorContext t f m , Ord (ThunkId m) ) => (forall r. t -> (NValue t f m -> m r) -> m r) -> NValue t f m -> m (NValue t f m) normalizeValueF f = run . iterNValueM run go (fmap Free . sequenceNValue' run) where start = 0 :: Int maxDepth = 2000 table = mempty run :: ReaderT Int (StateT (Set (ThunkId m)) m) r -> m r run = (`evalStateT` table) . (`runReaderT` start) go :: ( NValue t f m -> ReaderT Int (StateT (Set (ThunkId m)) m) (NValue t f m) ) -> t -> ReaderT Int (StateT (Set (ThunkId m)) m) (NValue t f m) go k tnk = bool ( do i <- ask when (i > maxDepth) $ fail $ "Exceeded maximum normalization depth of " <> show maxDepth <> " levels." (lifted . lifted) (f tnk) (local (+ 1) . k) ) (pure $ pure tnk) =<< seen tnk where seen :: t -> ReaderT Int (StateT (Set (ThunkId m)) m) Bool seen t = do let tnkid = thunkId t lift $ do thunkWasVisited <- gets $ member tnkid when (not thunkWasVisited) $ modify $ insert tnkid pure thunkWasVisited {- | Normalize value. Detect cycles. If cycles were detected - put a stub on them. -} normalForm :: ( Framed e m , MonadThunk t m (NValue t f m) , MonadDataErrorContext t f m , HasCitations m (NValue t f m) t , HasCitations1 m (NValue t f m) f , Ord (ThunkId m) ) => NValue t f m -> m (NValue t f m) normalForm t = stubCycles <$> normalizeValue t -- | Monadic context of the result. normalForm_ :: ( Framed e m , MonadThunk t m (NValue t f m) , MonadDataErrorContext t f m , Ord (ThunkId m) ) => NValue t f m -> m () normalForm_ t = void $ normalizeValue t opaqueVal :: (NVConstraint f) => NValue t f m opaqueVal = mkNVStrWithoutContext "" -- | Detect cycles & stub them. stubCycles :: forall t f m. ( MonadDataContext f m , HasCitations m (NValue t f m) t , HasCitations1 m (NValue t f m) f ) => NValue t f m -> NValue t f m stubCycles = iterNValue ( \_ t -> Free $ NValue' $ foldl' (flip $ addProvenance1 @m @(NValue t f m)) cyc (citations @m @(NValue t f m) t) ) Free where Free (NValue' cyc) = opaqueVal thunkStubVal :: (NVConstraint f) => NValue t f m thunkStubVal = mkNVStrWithoutContext thunkStubText {- | Check if thunk @t@ is computed, then bind it into first arg. else bind the thunk stub val. -} bindComputedThunkOrStub :: ( NVConstraint f , MonadThunk t m (NValue t f m) ) => (NValue t f m -> m a) -> t -> m a bindComputedThunkOrStub = (<=< query (pure thunkStubVal)) removeEffects :: (MonadThunk t m (NValue t f m), MonadDataContext f m) => NValue t f m -> m (NValue t f m) removeEffects = iterNValueM id bindComputedThunkOrStub (fmap Free . sequenceNValue' id) dethunk :: (MonadThunk t m (NValue t f m), MonadDataContext f m) => t -> m (NValue t f m) dethunk = bindComputedThunkOrStub removeEffects ================================================ FILE: src/Nix/Options/Parser.hs ================================================ {-# LANGUAGE TemplateHaskell #-} -- | Code that configures presentation parser for the CLI options module Nix.Options.Parser where import Data.Char (isDigit) import qualified Data.Text as Text import Data.Time ( UTCTime, defaultTimeLocale, parseTimeOrError, ) import Data.Version (showVersion) import Development.GitRev ( gitBranch, gitCommitDate, gitHash, ) import GHC.Err (errorWithoutStackTrace) import Nix.Options import Nix.Prelude import Options.Applicative hiding (ParserResult (..)) import Paths_hnix (version) import Relude.Unsafe (read) decodeVerbosity :: Int -> Verbosity decodeVerbosity 0 = ErrorsOnly decodeVerbosity 1 = Informational decodeVerbosity 2 = Talkative decodeVerbosity 3 = Chatty decodeVerbosity 4 = DebugInfo decodeVerbosity _ = Vomit argPair :: Mod OptionFields (Text, Text) -> Parser (Text, Text) argPair = option $ do s <- str maybe (errorWithoutStackTrace "Format of --arg/--argstr in hnix is: name=expr") (pure . second Text.tail . (`Text.splitAt` s)) (Text.findIndex (== '=') s) nixOptions :: UTCTime -> Parser Options nixOptions current = Options . fromMaybe Informational <$> optional ( option ( do a <- str bool (fail "Argument to -v/--verbose must be a number") (pure $ decodeVerbosity $ read a) (all isDigit a) ) ( short 'v' <> long "verbose" <> help "Verbose output" ) ) <*> switch ( long "trace" <> help "Enable tracing code (even more can be seen if built with --flags=tracing)" ) <*> switch ( long "thunks" <> help "Enable reporting of thunk tracing as well as regular evaluation" ) <*> switch ( long "values" <> help "Enable reporting of value provenance in error messages" ) <*> switch ( long "scopes" <> help "Enable reporting of scopes in evaluation traces" ) <*> optional ( strOption ( long "reduce" <> help "When done evaluating, output the evaluated part of the expression to FILE" ) ) <*> switch ( long "reduce-sets" <> help "Reduce set members that aren't used; breaks if hasAttr is used" ) <*> switch ( long "reduce-lists" <> help "Reduce list members that aren't used; breaks if elemAt is used" ) <*> switch ( long "parse" <> help "Whether to parse the file (also the default right now)" ) <*> switch ( long "parse-only" <> help "Whether to parse only, no pretty printing or checking" ) <*> switch ( long "find" <> help "If selected, find paths within attr trees" ) <*> optional ( strOption ( long "find-file" <> help "Look up the given files in Nix's search path" ) ) <*> switch ( long "strict" <> help "When used with --eval, recursively evaluate list elements and attributes" ) <*> switch ( long "eval" <> help "Whether to evaluate, or just pretty-print" ) <*> switch ( long "json" <> help "Print the resulting value as an JSON representation" ) <*> switch ( long "xml" <> help "Print the resulting value as an XML representation" ) <*> optional ( strOption ( short 'A' <> long "attr" <> help "Select an attribute from the top-level Nix expression being evaluated" ) ) <*> many ( strOption ( short 'I' <> long "include" <> help "Add a path to the Nix expression search path" ) ) <*> switch ( long "check" <> help "Whether to check for syntax fails after parsing" ) <*> optional ( strOption ( long "read" <> help "Read in an expression tree from a binary cache" ) ) <*> switch ( long "cache" <> help "Write out the parsed expression tree to a binary cache" ) <*> switch ( long "repl" <> help "After performing any indicated actions, enter the REPL" ) <*> switch ( long "ignore-fails" <> help "Continue parsing files, even if there are fails" ) <*> optional ( strOption ( short 'E' <> long "expr" <> help "Expression to parse or evaluate" ) ) <*> many ( argPair ( long "arg" <> help "Argument to pass to an evaluated lambda" ) ) <*> many ( argPair ( long "argstr" <> help "Argument string to pass to an evaluated lambda" ) ) <*> optional ( strOption ( short 'f' <> long "file" <> help "Parse all of the files given in FILE; - means stdin" ) ) <*> option (parseTimeOrError True defaultTimeLocale "%Y/%m/%d %H:%M:%S" <$> str) ( long "now" <> value current <> help "Set current time for testing purposes" ) <*> many ( strArgument ( metavar "FILE" <> help "Path of file to parse" ) ) -- 2020-09-12: CLI --version option mechanism is tied to meta modules specificly generated by Cabal. It is possible to use Template Haskell to resolve the version, as also a g versionOpt :: Parser (a -> a) versionOpt = shortVersionOpt <*> debugVersionOpt where shortVersionOpt :: Parser (a -> a) shortVersionOpt = infoOption (showVersion version) ( long "version" <> help "Show release version" ) -- 2020-09-13: NOTE: Does not work for direct `nix-build`s, works for `nix-shell` `cabal` builds. debugVersionOpt :: Parser (a -> a) debugVersionOpt = infoOption ( fold [ "Version: " , showVersion version , "\nCommit: " , $(gitHash) , "\n date: " , $(gitCommitDate) , "\n branch: " , $(gitBranch) ] ) ( long "long-version" <> help "Show long debug version form" ) nixOptionsInfo :: UTCTime -> ParserInfo Options nixOptionsInfo current = info (helper <*> versionOpt <*> nixOptions current) (fullDesc <> progDesc mempty <> header "hnix") ================================================ FILE: src/Nix/Options.hs ================================================ {-# LANGUAGE StrictData #-} -- | Definitions & defaults for the CLI options module Nix.Options where import Data.Time import Nix.Prelude -- 2021-07-15: NOTE: What these are? They need to be documented. -- Also need better names. Foe example, Maybes & lists names need to show their type in the name. data Options = Options { getVerbosity :: Verbosity , isTrace :: Bool , isThunks :: Bool , isValues :: Bool , isShowScopes :: Bool , getReduce :: Maybe Path , isReduceSets :: Bool , isReduceLists :: Bool , isParse :: Bool , isParseOnly :: Bool , isFinder :: Bool , getFindFile :: Maybe Path , isStrict :: Bool , isEvaluate :: Bool , isJson :: Bool , isXml :: Bool , getAttr :: Maybe Text , getInclude :: [Path] , isCheck :: Bool , getReadFrom :: Maybe Path , isCache :: Bool , isRepl :: Bool , isIgnoreErrors :: Bool , getExpression :: Maybe Text , getArg :: [(Text, Text)] , getArgstr :: [(Text, Text)] , getFromFile :: Maybe Path , getTime :: UTCTime -- ^ The time can be set to reproduce time-dependent states. , getFilePaths :: [Path] } deriving (Show) defaultOptions :: UTCTime -> Options defaultOptions currentTime = Options { getVerbosity = ErrorsOnly , isTrace = False , isThunks = False , isValues = False , isShowScopes = False , getReduce = mempty , isReduceSets = False , isReduceLists = False , isParse = False , isParseOnly = False , isFinder = False , getFindFile = mempty , isStrict = False , isEvaluate = False , isJson = False , isXml = False , getAttr = mempty , getInclude = mempty , isCheck = False , getReadFrom = mempty , isCache = False , isRepl = False , isIgnoreErrors = False , getExpression = mempty , getArg = mempty , getArgstr = mempty , getFromFile = mempty , getTime = currentTime , getFilePaths = mempty } data Verbosity = ErrorsOnly | Informational | Talkative | Chatty | DebugInfo | Vomit deriving (Eq, Ord, Enum, Bounded, Show) askOptions :: forall e m. (MonadReader e m, Has e Options) => m Options askOptions = askLocal ================================================ FILE: src/Nix/Parser.hs ================================================ {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveAnyClass #-} {-# OPTIONS_GHC -fno-warn-name-shadowing #-} -- | Main module for parsing Nix expressions. module Nix.Parser ( parseNixFile, parseNixFileLoc, parseNixText, parseNixTextLoc, parseExpr, parseFromFileEx, Parser, parseFromText, Result, reservedNames, NAssoc (..), NOpPrecedence (..), NOpName (..), NSpecialOp (..), NOperatorDef (..), nixExpr, nixExprAlgebra, nixSet, nixBinders, nixSelector, nixSym, nixPath, nixString, nixUri, nixSearchPath, nixFloat, nixInt, nixBool, nixNull, whiteSpace, -- 2022-01-26: NOTE: Try to hide it after OperatorInfo is removed NOp (..), appOpDef, ) where import Data.Foldable (foldr1) import Nix.Prelude hiding ( many, some, (<|>), ) import Control.Monad (msum) import Control.Monad.Combinators.Expr ( Operator ( InfixL, InfixN, InfixR, Postfix, Prefix ), makeExprParser, ) import Data.Char ( isAlpha, isDigit, isSpace, ) import Data.Data (Data (..)) import Data.Fix (Fix (..)) import qualified Data.HashSet as HashSet import Data.List.Extra (groupSort) import qualified Data.Text as Text import Nix.Expr.Shorthands hiding (($>)) import Nix.Expr.Strings ( escapeCodes, mergePlain, removeEmptyPlains, stripIndent, ) import Nix.Expr.Types import Nix.Expr.Types.Annotated import Nix.Render (MonadFile ()) import Prettyprinter ( Doc, pretty, ) -- `parser-combinators` ships performance enhanced & MonadPlus-aware combinators. -- For example `some` and `many` impoted here. import Text.Megaparsec hiding ( State, (<|>), ) import Text.Megaparsec.Char ( char, letterChar, space1, ) import qualified Text.Megaparsec.Char.Lexer as Lexer type Parser = ParsecT Void Text (State SourcePos) -- * Utils -- | Different to @isAlphaNum@ isAlphanumeric :: Char -> Bool isAlphanumeric x = isAlpha x || isDigit x {-# INLINE isAlphanumeric #-} -- | Alternative "<|>" with additional preservation of 'MonadPlus' constraint. infixl 3 <|> (<|>) :: (MonadPlus m) => m a -> m a -> m a (<|>) = mplus -- ** Annotated annotateLocation1 :: Parser a -> Parser (AnnUnit SrcSpan a) annotateLocation1 p = do begin <- getSourcePos res <- p end <- get -- The state set before the last whitespace pure $ AnnUnit (SrcSpan (toNSourcePos begin) (toNSourcePos end)) res annotateLocation :: Parser (NExprF NExprLoc) -> Parser NExprLoc annotateLocation = (annUnitToAnn <$>) . annotateLocation1 annotateNamedLocation :: String -> Parser (NExprF NExprLoc) -> Parser NExprLoc annotateNamedLocation name = annotateLocation . label name -- ** Grammar reservedNames :: HashSet VarName reservedNames = HashSet.fromList ["let", "in", "if", "then", "else", "assert", "with", "rec", "inherit"] reservedEnd :: Char -> Bool reservedEnd x = isSpace x || (`elem` ("{([})];:.\"'," :: String)) x {-# INLINE reservedEnd #-} reserved :: Text -> Parser () reserved n = lexeme $ try $ chunk n *> lookAhead (void (satisfy reservedEnd) <|> eof) exprAfterSymbol :: Char -> Parser NExprLoc exprAfterSymbol p = symbol p *> nixExpr exprAfterReservedWord :: Text -> Parser NExprLoc exprAfterReservedWord word = reserved word *> nixExpr {- | A literal copy of @megaparsec@ one but with addition of the @\r@ for Windows EOL case (@\r\n@). Overall, parser should simply @\r\n -> \n@. -} skipLineComment' :: Tokens Text -> Parser () skipLineComment' prefix = chunk prefix *> void (takeWhileP (pure "character") $ \x -> x /= '\n' && x /= '\r') whiteSpace :: Parser () whiteSpace = do put =<< getSourcePos Lexer.space space1 lineCmnt blockCmnt where lineCmnt = skipLineComment' "#" blockCmnt = Lexer.skipBlockComment "/*" "*/" {- | Lexeme is a unit of the language. Convention is that after lexeme an arbitrary amount of empty entities (space, comments, line breaks) are allowed. This lexeme definition just skips over superflous @megaparsec: lexeme@ abstraction. -} lexeme :: Parser a -> Parser a lexeme p = p <* whiteSpace symbol :: Char -> Parser Char symbol = lexeme . char symbols :: Text -> Parser Text symbols = lexeme . chunk -- We restrict the type of 'parens' and 'brackets' here because if they were to -- take a 'Parser NExprLoc' argument they would parse additional text which -- wouldn't be captured in the source location annotation. -- -- Braces and angles in hnix don't enclose a single expression so this type -- restriction would not be useful. parens :: Parser (NExprF f) -> Parser (NExprF f) parens = on between symbol '(' ')' braces :: Parser a -> Parser a braces = on between symbol '{' '}' brackets :: Parser (NExprF f) -> Parser (NExprF f) brackets = on between symbol '[' ']' antiquotedIsHungryForTrailingSpaces :: Bool -> Parser (Antiquoted v NExprLoc) antiquotedIsHungryForTrailingSpaces hungry = Antiquoted <$> (antiStart *> nixExpr <* antiEnd) where antiStart :: Parser Text antiStart = label "${" $ symbols "${" antiEnd :: Parser Char antiEnd = label "}" $ bool id lexeme hungry (char '}') antiquotedLexeme :: Parser (Antiquoted v NExprLoc) antiquotedLexeme = antiquotedIsHungryForTrailingSpaces True antiquoted :: Parser (Antiquoted v NExprLoc) antiquoted = antiquotedIsHungryForTrailingSpaces False --------------------------------------------------------------------------------- -- * Parser parts -- ** Constrants nixNull :: Parser NExprLoc nixNull = annotateNamedLocation "null" $ mkNullF <$ reserved "null" nixBool :: Parser NExprLoc nixBool = annotateNamedLocation "bool" $ on (<|>) lmkBool (True, "true") (False, "false") where lmkBool (b, txt) = mkBoolF b <$ reserved txt integer :: Parser Integer integer = lexeme Lexer.decimal nixInt :: Parser NExprLoc nixInt = annotateNamedLocation "integer" $ mkIntF <$> integer float :: Parser Double float = lexeme Lexer.float nixFloat :: Parser NExprLoc nixFloat = annotateNamedLocation "float" $ try $ mkFloatF . realToFrac <$> float nixUri :: Parser NExprLoc nixUri = lexeme $ annotateLocation $ try $ do start <- letterChar protocol <- takeWhileP mempty $ \x -> isAlphanumeric x || (`elem` ("+-." :: String)) x _ <- single ':' address <- takeWhile1P mempty $ \x -> isAlphanumeric x || (`elem` ("%/?:@&=+$,-_.!~*'" :: String)) x pure . NStr . DoubleQuoted . one . Plain $ start `Text.cons` protocol <> ":" <> address -- ** Strings nixAntiquoted :: Parser a -> Parser (Antiquoted a NExprLoc) nixAntiquoted p = label "anti-quotation" $ antiquotedLexeme <|> Plain <$> p escapeCode :: Parser Char escapeCode = msum [c <$ char e | (c, e) <- escapeCodes] <|> anySingle stringChar :: Parser () -> Parser () -> Parser (Antiquoted Text NExprLoc) -> Parser (Antiquoted Text NExprLoc) stringChar end escStart esc = antiquoted <|> Plain . one <$> char '$' <|> esc <|> Plain . fromString <$> some plainChar where plainChar :: Parser Char plainChar = notFollowedBy (end <|> void (char '$') <|> escStart) *> anySingle doubleQuoted :: Parser (NString NExprLoc) doubleQuoted = label "double quoted string" $ DoubleQuoted . removeEmptyPlains . mergePlain <$> inQuotationMarks (many $ stringChar quotationMark (void $ char '\\') doubleEscape) where inQuotationMarks :: Parser a -> Parser a inQuotationMarks expr = quotationMark *> expr <* quotationMark quotationMark :: Parser () quotationMark = void $ char '"' doubleEscape :: Parser (Antiquoted Text r) doubleEscape = Plain . one <$> (char '\\' *> escapeCode) indented :: Parser (NString NExprLoc) indented = label "indented string" $ stripIndent <$> inIndentedQuotation (many $ join stringChar indentedQuotationMark indentedEscape) where -- \| Read escaping inside of the "'' ''" indentedEscape :: Parser (Antiquoted Text r) indentedEscape = try $ do indentedQuotationMark Plain <$> ("''" <$ char '\'' <|> "$" <$ char '$') <|> do c <- char '\\' *> escapeCode pure $ bool EscapedNewline (Plain $ one c) ('\n' /= c) -- \| Enclosed into indented quatation "'' ''" inIndentedQuotation :: Parser a -> Parser a inIndentedQuotation expr = indentedQuotationMark *> expr <* indentedQuotationMark -- \| Symbol "''" indentedQuotationMark :: Parser () indentedQuotationMark = label "\"''\"" . void $ chunk "''" nixString' :: Parser (NString NExprLoc) nixString' = label "string" $ lexeme $ doubleQuoted <|> indented nixString :: Parser NExprLoc nixString = annNStr <$> annotateLocation1 nixString' -- ** Names (variables aka symbols) identifier :: Parser VarName identifier = lexeme $ try $ do (coerce -> iD) <- liftA2 Text.cons (satisfy (\x -> isAlpha x || x == '_')) (takeWhileP mempty identLetter) guard $ not $ iD `HashSet.member` reservedNames pure iD where identLetter x = isAlphanumeric x || x == '_' || x == '\'' || x == '-' nixSym :: Parser NExprLoc nixSym = annotateLocation $ mkSymF <$> coerce identifier -- ** ( ) parens {- | 'nixExpr' returns an expression annotated with a source position, however this position doesn't include the parsed parentheses, so remove the "inner" location annotateion and annotate again, including the parentheses. -} nixParens :: Parser NExprLoc nixParens = annotateNamedLocation "parens" $ parens $ stripAnnF . unFix <$> nixExpr -- ** [ ] list nixList :: Parser NExprLoc nixList = annotateNamedLocation "list" $ brackets $ NList <$> many nixTerm -- ** { } set nixBinders :: Parser [Binding NExprLoc] nixBinders = (inherit <|> namedVar) `endBy` symbol ';' where inherit = do -- We can't use 'reserved' here because it would consume the whitespace -- after the keyword, which is not exactly the semantics of C++ Nix. try $ chunk "inherit" *> lookAhead (void $ satisfy reservedEnd) p <- getSourcePos x <- whiteSpace *> optional scope label "inherited binding" $ liftA2 (Inherit x) (many identifier) (pure (toNSourcePos p)) namedVar = do p <- getSourcePos label "variable binding" $ liftA3 NamedVar (annotated <$> nixSelector) (exprAfterSymbol '=') (pure (toNSourcePos p)) scope = label "inherit scope" nixParens nixSet :: Parser NExprLoc nixSet = annotateNamedLocation "set" $ isRec <*> braces nixBinders where isRec = label "recursive set" (reserved "rec" $> NSet Recursive) <|> pure (NSet mempty) -- ** /x/y/z literal Path pathChar :: Char -> Bool pathChar x = isAlphanumeric x || (`elem` ("._-+~" :: String)) x slash :: Parser Char slash = label "slash " $ try $ char '/' <* notFollowedBy (satisfy $ \x -> x == '/' || x == '*' || isSpace x) pathStr :: Parser Path pathStr = lexeme $ coerce . toString <$> liftA2 (<>) (takeWhileP mempty pathChar) ( Text.concat <$> some ( liftA2 Text.cons slash (takeWhile1P mempty pathChar) ) ) nixPath :: Parser NExprLoc nixPath = annotateNamedLocation "path" $ try $ mkPathF False <$> coerce pathStr -- ** <> environment path {- | A path surrounded by angle brackets, indicating that it should be looked up in the NIX_PATH environment variable at evaluation. -} nixSearchPath :: Parser NExprLoc nixSearchPath = annotateNamedLocation "spath" $ mkPathF True <$> try (lexeme $ char '<' *> many (satisfy pathChar <|> slash) <* char '>') -- ** Operators -- 2022-01-26: NOTE: Rename to 'literal' newtype NOpName = NOpName Text deriving (Eq, Ord, Generic, Typeable, Data, Show, NFData) instance IsString NOpName where fromString = coerce . fromString @Text instance ToString NOpName where toString = toString @Text . coerce operator :: NOpName -> Parser Text operator (coerce -> op) = case op of c@"-" -> c `without` '>' c@"/" -> c `without` '/' c@"<" -> c `without` '=' c@">" -> c `without` '=' n -> symbols n where without :: Text -> Char -> Parser Text without opChar noNextChar = lexeme . try $ chunk opChar <* notFollowedBy (char noNextChar) opWithLoc :: (AnnUnit SrcSpan o -> a) -> o -> NOpName -> Parser a opWithLoc f op name = f . (op <$) <$> annotateLocation1 (operator name) -- 2022-01-26: NOTE: Make presedence free and type safe by moving it into type level: -- https://youtu.be/qaPdg0mZavM?t=1757 -- https://wiki.haskell.org/The_Monad.Reader/Issue5/Number_Param_Types newtype NOpPrecedence = NOpPrecedence Int deriving (Eq, Ord, Generic, Bounded, Typeable, Data, Show, NFData) instance Enum NOpPrecedence where toEnum = coerce fromEnum = coerce instance Num NOpPrecedence where (+) = coerce ((+) @Int) (*) = coerce ((*) @Int) abs = coerce (abs @Int) signum = coerce (signum @Int) fromInteger = coerce (fromInteger @Int) negate = coerce (negate @Int) -- 2022-01-26: NOTE: This type belongs into 'Type.Expr' & be used in NExprF. data NAppOp = NAppOp deriving (Eq, Ord, Generic, Typeable, Data, Show, NFData) -- 2022-01-26: NOTE: This type belongs into 'Type.Expr' & be used in NExprF. data NSpecialOp = NHasAttrOp | NSelectOp | -- | For special handling of internal special cases. NTerm deriving (Eq, Ord, Generic, Typeable, Data, Show, NFData) data NAssoc = NAssocLeft | -- Nota bene: @parser-combinators@ named "associative property" as 'InfixN' stating it as "non-associative property". -- Binary operators having some associativity is a basis property in mathematical algebras in use (for example, in Category theory). Having no associativity in operators makes theory mostly impossible in use and so non-associativity is not encountered in notations, therefore under 'InfixN' @parser-combinators@ meant "associative". -- | Bidirectional associativity, or simply: associative property. NAssoc | NAssocRight deriving (Eq, Ord, Generic, Typeable, Data, Show, NFData) -- 2022-01-31: NOTE: This type and related typeclasses & their design, probably need a refinement. -- -- In the "Nix.Pretty", the code probably should be well-typed to the type of operations its processes. -- Therefor splitting operation types into separate types there is probably needed. -- -- After that: -- -- > { NAssoc, NOpPrecedence, NOpName } -- -- Can be formed into a type. -- -- Also 'NAppDef' really has only 1 implementation, @{ NAssoc, NOpPrecedence, NOpName }@ -- were added there only to make type uniformal. -- All impossible cases ideally should be unrepresentable. -- | Single operator grammar entries. data NOperatorDef = NAppDef NAppOp NAssoc NOpPrecedence NOpName | NUnaryDef NUnaryOp NAssoc NOpPrecedence NOpName | NBinaryDef NBinaryOp NAssoc NOpPrecedence NOpName | NSpecialDef NSpecialOp NAssoc NOpPrecedence NOpName -- 2022-01-26: NOTE: Ord can be the order of evaluation of precedence (which 'Pretty' printing also accounts for). deriving (Eq, Ord, Generic, Typeable, Data, Show, NFData) -- Supplied since its definition gets called/used frequently. -- | Functional application operator definition, left associative, high precedence. appOpDef :: NOperatorDef appOpDef = NAppDef NAppOp NAssocLeft 1 " " -- This defined as "2" in Nix lang spec. -- 2022-01-26: NOTE: When total - make sure to hide & inline all these instances to get free solution. {- | Class to get a private free construction to abstract away the gap between the Nix operation types 'NUnaryOp', 'NBinaryOp', 'NSpecialOp'. And in doing remove 'OperatorInfo' from existance. -} class NOp a where {-# MINIMAL getOpDef, getOpAssoc, getOpPrecedence, getOpName #-} getOpDef :: a -> NOperatorDef getOpAssoc :: a -> NAssoc getOpPrecedence :: a -> NOpPrecedence getOpName :: a -> NOpName instance NOp NAppOp where getOpDef NAppOp = appOpDef getOpAssoc _op = fun appOpDef where fun (NAppDef _op assoc _prec _name) = assoc fun _ = error "Impossible happened, funapp operation should been matched." getOpPrecedence _op = fun appOpDef where fun (NAppDef _op _assoc prec _name) = prec fun _ = error "Impossible happened, funapp operation should been matched." getOpName _ = fun appOpDef where fun (NAppDef _op _assoc _prec name) = name fun _ = error "Impossible happened, funapp operation should been matched." instance NOp NUnaryOp where getOpDef = \case NNeg -> NUnaryDef NNeg NAssocRight 3 "-" NNot -> NUnaryDef NNot NAssocRight 8 "!" getOpAssoc = fun . getOpDef where fun (NUnaryDef _op assoc _prec _name) = assoc fun _ = error "Impossible happened, unary operation should been matched." getOpPrecedence = fun . getOpDef where fun (NUnaryDef _op _assoc prec _name) = prec fun _ = error "Impossible happened, unary operation should been matched." getOpName = fun . getOpDef where fun (NUnaryDef _op _assoc _prec name) = name fun _ = error "Impossible happened, unary operation should been matched." instance NOp NBinaryOp where getOpDef = \case NConcat -> NBinaryDef NConcat NAssocRight 5 "++" NMult -> NBinaryDef NMult NAssocLeft 6 "*" NDiv -> NBinaryDef NDiv NAssocLeft 6 "/" NPlus -> NBinaryDef NPlus NAssocLeft 7 "+" NMinus -> NBinaryDef NMinus NAssocLeft 7 "-" NUpdate -> NBinaryDef NUpdate NAssocRight 9 "//" NLt -> NBinaryDef NLt NAssocLeft 10 "<" NLte -> NBinaryDef NLte NAssocLeft 10 "<=" NGt -> NBinaryDef NGt NAssocLeft 10 ">" NGte -> NBinaryDef NGte NAssocLeft 10 ">=" NEq -> NBinaryDef NEq NAssoc 11 "==" NNEq -> NBinaryDef NNEq NAssoc 11 "!=" NAnd -> NBinaryDef NAnd NAssocLeft 12 "&&" NOr -> NBinaryDef NOr NAssocLeft 13 "||" NImpl -> NBinaryDef NImpl NAssocRight 14 "->" getOpAssoc = fun . getOpDef where fun (NBinaryDef _op assoc _prec _name) = assoc fun _ = error "Impossible happened, binary operation should been matched." getOpPrecedence = fun . getOpDef where fun (NBinaryDef _op _assoc prec _name) = prec fun _ = error "Impossible happened, binary operation should been matched." getOpName = fun . getOpDef where fun (NBinaryDef _op _assoc _prec name) = name fun _ = error "Impossible happened, binary operation should been matched." instance NOp NSpecialOp where getOpDef = \case NSelectOp -> NSpecialDef NSelectOp NAssocLeft 1 "." NHasAttrOp -> NSpecialDef NHasAttrOp NAssocLeft 4 "?" NTerm -> NSpecialDef NTerm NAssocLeft 1 "???" getOpAssoc = fun . getOpDef where fun (NSpecialDef _op assoc _prec _name) = assoc fun _ = error "Impossible happened, special operation should been matched." getOpPrecedence = fun . getOpDef where fun (NSpecialDef _op _assoc prec _name) = prec fun _ = error "Impossible happened, special operation should been matched." getOpName = fun . getOpDef where fun (NSpecialDef _op _assoc _prec name) = name fun _ = error "Impossible happened, special operation should been matched." instance NOp NOperatorDef where getOpDef op = op getOpAssoc = \case (NAppDef _op assoc _prec _name) -> assoc (NUnaryDef _op assoc _prec _name) -> assoc (NBinaryDef _op assoc _prec _name) -> assoc (NSpecialDef _op assoc _prec _name) -> assoc getOpPrecedence = fun . getOpDef where fun (NAppDef _op _assoc prec _name) = prec fun (NUnaryDef _op _assoc prec _name) = prec fun (NBinaryDef _op _assoc prec _name) = prec fun (NSpecialDef _op _assoc prec _name) = prec getOpName = fun . getOpDef where fun (NAppDef _op _assoc _prec name) = name fun (NUnaryDef _op _assoc _prec name) = name fun (NBinaryDef _op _assoc _prec name) = name fun (NSpecialDef _op _assoc _prec name) = name prefix :: NUnaryOp -> Operator Parser NExprLoc prefix op = Prefix $ manyUnaryOp $ opWithLoc annNUnary op $ getOpName op -- postfix name op = (NUnaryDef name op, -- Postfix (opWithLoc annNUnary op name)) manyUnaryOp :: (MonadPlus f) => f (a -> a) -> f (a -> a) manyUnaryOp f = foldr1 (.) <$> some f binary :: NBinaryOp -> Operator Parser NExprLoc binary op = mapAssocToInfix (getOpAssoc op) $ opWithLoc annNBinary op (getOpName op) mapAssocToInfix :: NAssoc -> m (a -> a -> a) -> Operator m a mapAssocToInfix NAssocLeft = InfixL mapAssocToInfix NAssoc = InfixN mapAssocToInfix NAssocRight = InfixR -- ** x: y lambda function -- | Gets all of the arguments for a function. argExpr :: Parser (Params NExprLoc) argExpr = msum [ atLeft , onlyname , atRight ] <* symbol ':' where -- An argument not in curly braces. There's some potential ambiguity -- in the case of, for example `x:y`. Is it a lambda function `x: y`, or -- a URI `x:y`? Nix syntax says it's the latter. So we need to fail if -- there's a valid URI parse here. onlyname = msum [ nixUri *> unexpected (Label $ fromList "valid uri") , Param <$> identifier ] -- Parameters named by an identifier on the left (`args @ {x, y}`) atLeft = try $ do name <- identifier <* symbol '@' (variadic, pset) <- params pure $ ParamSet (pure name) variadic pset -- Parameters named by an identifier on the right, or none (`{x, y} @ args`) atRight = do (variadic, pset) <- params name <- optional $ symbol '@' *> identifier pure $ ParamSet name variadic pset -- Return the parameters set. params = braces getParams -- Collects the parameters within curly braces. Returns the parameters and -- an flag indication if the parameters are variadic. getParams :: Parser (Variadic, [(VarName, Maybe NExprLoc)]) getParams = go mempty where -- Attempt to parse `...`. If this succeeds, stop and return True. -- Otherwise, attempt to parse an argument, optionally with a -- default. If this fails, then return what has been accumulated -- so far. go :: [(VarName, Maybe NExprLoc)] -> Parser (Variadic, [(VarName, Maybe NExprLoc)]) go acc = ((Variadic, acc) <$ symbols "...") <|> getMore where getMore :: Parser (Variadic, [(VarName, Maybe NExprLoc)]) getMore = -- Could be nothing, in which just return what we have so far. option (mempty, acc) $ do -- Get an argument name and an optional default. pair <- liftA2 (,) identifier (optional $ exprAfterSymbol '?') let args = acc <> one pair -- Either return this, or attempt to get a comma and restart. option (mempty, args) $ symbol ',' *> go args nixLambda :: Parser NExprLoc nixLambda = liftA2 annNAbs (annotateLocation1 $ try argExpr) nixExpr -- ** let expression nixLet :: Parser NExprLoc nixLet = annotateNamedLocation "let block" $ reserved "let" *> (letBody <|> letBinders) where -- \| Expressions `let {..., body = ...}' are just desugared -- into `(rec {..., body = ...}).body'. letBody = (\expr -> NSelect Nothing expr (one $ StaticKey "body")) <$> attrset where attrset = annotateLocation $ NSet Recursive <$> braces nixBinders -- \| Regular `let` letBinders = liftA2 NLet nixBinders (exprAfterReservedWord "in") -- ** if then else nixIf :: Parser NExprLoc nixIf = annotateNamedLocation "if" $ liftA3 NIf (reserved "if" *> nixExpr) (exprAfterReservedWord "then") (exprAfterReservedWord "else") -- ** with nixWith :: Parser NExprLoc nixWith = annotateNamedLocation "with" $ liftA2 NWith (exprAfterReservedWord "with") (exprAfterSymbol ';') -- ** assert nixAssert :: Parser NExprLoc nixAssert = annotateNamedLocation "assert" $ liftA2 NAssert (exprAfterReservedWord "assert") (exprAfterSymbol ';') -- ** . - reference (selector) into attr selectorDot :: Parser () selectorDot = label "." $ try (symbol '.' *> notFollowedBy nixPath) keyName :: Parser (NKeyName NExprLoc) keyName = dynamicKey <|> staticKey where staticKey = StaticKey <$> identifier dynamicKey = DynamicKey <$> nixAntiquoted nixString' nixSelector :: Parser (AnnUnit SrcSpan (NAttrPath NExprLoc)) nixSelector = annotateLocation1 $ fromList <$> keyName `sepBy1` selectorDot nixSelect :: Parser NExprLoc -> Parser NExprLoc nixSelect term = do res <- liftA2 builder term ( optional $ liftA2 (flip (,)) (selectorDot *> nixSelector) (optional $ reserved "or" *> nixTerm) ) continues <- optional $ lookAhead selectorDot maybe id (const nixSelect) continues (pure res) where builder :: NExprLoc -> Maybe ( Maybe NExprLoc , AnnUnit SrcSpan (NAttrPath NExprLoc) ) -> NExprLoc builder t = maybe t (uncurry (`annNSelect` t)) -- ** _ - syntax hole nixSynHole :: Parser NExprLoc nixSynHole = annotateLocation $ mkSynHoleF <$> coerce (char '^' *> identifier) -- List of Nix operation parsers with their precedence. opParsers :: [(NOpPrecedence, Operator Parser NExprLoc)] opParsers = -- This is not parsed here, even though technically it's part of the -- expression table. The problem is that in some cases, such as list -- membership, it's also a term. And since terms are effectively the -- highest precedence entities parsed by the expression parser, it ends up -- working out that we parse them as a kind of "meta-term". -- {- 1 -} -- [ ( NSpecialDef "." NSelectOp NAssocLeft -- , Postfix $ -- do -- sel <- seldot *> selector -- mor <- optional (reserved "or" *> term) -- pure $ \x -> annNSelect x sel mor) -- ] -- NApp is left associative -- 2018-05-07: jwiegley: Thanks to Brent Yorgey for showing me this trick! specialBuilder NAppOp (InfixL $ annNApp <$ symbols mempty) <> specialBuilder NHasAttrOp (Postfix $ symbol '?' *> (flip annNHasAttr <$> nixSelector)) <> builder prefix <> builder binary where specialBuilder :: (NOp t) => t -> b -> [(NOpPrecedence, b)] specialBuilder op parser = one (entry op (const parser)) builder :: (Enum t, Bounded t, NOp t) => (t -> b) -> [(NOpPrecedence, b)] builder tp = fmap (`entry` tp) universe entry :: (NOp t) => t -> (t -> b) -> (NOpPrecedence, b) entry op parser = (getOpPrecedence op, parser op) -- ** Expr & its constituents (Language term, expr algebra) nixTerm :: Parser NExprLoc nixTerm = do c <- try . lookAhead . satisfy $ \x -> (`elem` ("({[ nixSelect nixParens '{' -> nixSelect nixSet '[' -> nixList '<' -> nixSearchPath '/' -> nixPath '"' -> nixString '\'' -> nixString '^' -> nixSynHole _ -> msum $ [nixSelect nixSet | c == 'r'] <> [nixPath | pathChar c] <> if isDigit c then [nixFloat, nixInt] else [nixUri | isAlpha c] <> [nixBool | c == 't' || c == 'f'] <> [nixNull | c == 'n'] <> one (nixSelect nixSym) -- | Bundles parsers into @[[]]@ based on precedence (form is required for `megaparsec`). nixOperators :: [[Operator Parser NExprLoc]] nixOperators = snd <$> groupSort opParsers {- | Nix expression algebra parser. "Expression algebra" is to explain @megaparsec@ use of the term "Expression" (parser for language algebraic coperators without any statements (without @let@ etc.)), which is essentially an algebra inside the language. -} nixExprAlgebra :: Parser NExprLoc nixExprAlgebra = makeExprParser nixTerm nixOperators nixExpr :: Parser NExprLoc nixExpr = keywords <|> nixLambda <|> nixExprAlgebra where keywords = nixLet <|> nixIf <|> nixAssert <|> nixWith -- * Parse type Result a = Either (Doc Void) a parseWith :: Parser a -> Path -> Text -> Either (Doc Void) a parseWith parser file input = either (Left . pretty . errorBundlePretty) pure $ (`evalState` initialPos (coerce file)) $ (`runParserT` coerce file) parser input parseFromFileEx :: (MonadFile m) => Parser a -> Path -> m (Result a) parseFromFileEx parser file = parseWith parser file <$> readFile file parseFromText :: Parser a -> Text -> Result a parseFromText = (`parseWith` "") fullContent :: Parser NExprLoc fullContent = whiteSpace *> nixExpr <* eof parseNixFile' :: (MonadFile m) => (Parser NExprLoc -> Parser a) -> Path -> m (Result a) parseNixFile' f = parseFromFileEx $ f fullContent parseNixFile :: (MonadFile m) => Path -> m (Result NExpr) parseNixFile = parseNixFile' (stripAnnotation <$>) parseNixFileLoc :: (MonadFile m) => Path -> m (Result NExprLoc) parseNixFileLoc = parseNixFile' id parseNixText' :: (Parser NExprLoc -> Parser a) -> Text -> Result a parseNixText' f = parseFromText $ f fullContent parseNixText :: Text -> Result NExpr parseNixText = parseNixText' (stripAnnotation <$>) parseNixTextLoc :: Text -> Result NExprLoc parseNixTextLoc = parseNixText' id parseExpr :: (MonadFail m) => Text -> m NExpr parseExpr = either (fail . show) pure . parseNixText ================================================ FILE: src/Nix/Prelude.hs ================================================ {- | This is a @Prelude@, but, please, do not put things in here, put them into "Nix.Utils". This module is a pass-through-multiplexer, between our custom code ("Nix.Utils") that shadows over the outside prelude that is in use ("Relude") "Prelude" module has a problem of being imported & used by other projects. "Nix.Utils" as a module with a regular name does not have that problem. -} module Nix.Prelude ( module Nix.Utils, module Relude, ) where import Nix.Utils import Relude hiding ( force, pass, readFile, trace, traceM, whenJust, whenNothing, ) ================================================ FILE: src/Nix/Pretty.hs ================================================ {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-name-shadowing #-} module Nix.Pretty where import Control.Monad.Free (Free (Free)) import Data.Fix ( Fix (..), foldFix, ) import Data.HashMap.Lazy (toList) import qualified Data.HashMap.Lazy as M import qualified Data.HashSet as HashSet import qualified Data.List.NonEmpty as NE import Data.Text ( replace, strip, ) import qualified Data.Text as Text import Nix.Atoms import Nix.Cited import Nix.Expr.Strings import Nix.Expr.Types import Nix.Expr.Types.Annotated import Nix.Normal import Nix.Parser import Nix.Prelude hiding (group, toList) import Nix.String import Nix.Thunk import Nix.Value import Prettyprinter hiding (list) {- | This type represents a pretty printed nix expression together with some information about the expression. -} data NixDoc ann = NixDoc { getDoc :: Doc ann -- ^ Rendered expression. Without surrounding parenthesis. , rootOp :: NOperatorDef -- ^ The root operator is the operator at the root of -- the expression tree. For example, in '(a * b) + c', '+' would be the root -- operator. It is needed to determine if we need to wrap the expression in -- parentheses. , wasPath :: Bool -- This is needed so that when a path is used in a selector path -- we can add brackets appropriately } {- | Represent Nix antiquotes. > > ${ expr } > -} antiquote :: NixDoc ann -> Doc ann antiquote x = "${" <> getDoc x <> "}" mkNixDoc :: NOperatorDef -> Doc ann -> NixDoc ann mkNixDoc o d = NixDoc{getDoc = d, rootOp = o, wasPath = False} {- | A simple expression is never wrapped in parentheses. The expression behaves as if its root operator had a precedence higher than all other operators (including function application). -} simpleExpr :: Doc ann -> NixDoc ann simpleExpr = mkNixDoc $ NSpecialDef NTerm NAssoc minBound "simple expr" pathExpr :: Doc ann -> NixDoc ann pathExpr d = (simpleExpr d){wasPath = True} {- | An expression that behaves as if its root operator had a precedence lower than all other operators. That ensures that the expression is wrapped in parentheses in almost always, but it's still rendered without parentheses in cases where parentheses are never required (such as in the LHS of a binding). -} leastPrecedence :: Doc ann -> NixDoc ann leastPrecedence = mkNixDoc $ NSpecialDef NTerm NAssoc maxBound "least precedence" data WrapMode = ProcessAllWrap | PrecedenceWrap deriving (Eq) needsParens :: WrapMode -> NOperatorDef -> NOperatorDef -> Bool needsParens mode host sub = getOpPrecedence host > getOpPrecedence sub || bool False ( NAssoc /= getOpAssoc host && on (==) getOpAssoc host sub && on (==) getOpPrecedence host sub ) (ProcessAllWrap == mode) maybeWrapDoc :: WrapMode -> NOperatorDef -> NixDoc ann -> Doc ann maybeWrapDoc mode host sub = bool parens id (needsParens mode host (rootOp sub)) (getDoc sub) {- | Determine if to return doc wraped into parens, according the given operator. -} wrap :: NOperatorDef -> NixDoc ann -> Doc ann wrap = maybeWrapDoc ProcessAllWrap precedenceWrap :: NOperatorDef -> NixDoc ann -> Doc ann precedenceWrap = maybeWrapDoc PrecedenceWrap -- Used in the selector case to print a path in a selector as -- "${./abc}" wrapPath :: NOperatorDef -> NixDoc ann -> Doc ann wrapPath op sub = bool (wrap op sub) (dquotes $ antiquote sub) (wasPath sub) -- | Handle Output representation of the string escape codes. prettyString :: NString (NixDoc ann) -> Doc ann prettyString (DoubleQuoted parts) = dquotes $ foldMap prettyPart parts where prettyPart (Plain t) = pretty $ escapeString t prettyPart EscapedNewline = "''\\n" prettyPart (Antiquoted r) = antiquote r prettyString (Indented _ parts) = group $ nest 2 $ vcat ["''", content, "''"] where content = vsep . fmap prettyLine . stripLastIfEmpty . splitLines $ parts stripLastIfEmpty :: [[Antiquoted Text r]] -> [[Antiquoted Text r]] stripLastIfEmpty = filter flt where flt :: [Antiquoted Text r] -> Bool flt [Plain t] | Text.null (strip t) = False flt _ = True prettyLine :: [Antiquoted Text (NixDoc ann)] -> Doc ann prettyLine = hcat . fmap prettyPart where prettyPart :: Antiquoted Text (NixDoc ann) -> Doc ann prettyPart (Plain t) = pretty . replace "${" "''${" . replace "''" "'''" $ t prettyPart EscapedNewline = "\\n" prettyPart (Antiquoted r) = antiquote r prettyVarName :: VarName -> Doc ann prettyVarName = pretty @Text . coerce prettyParams :: Params (NixDoc ann) -> Doc ann prettyParams (Param n) = prettyVarName n prettyParams (ParamSet mname variadic pset) = prettyParamSet variadic pset <> toDoc `whenJust` mname where toDoc :: VarName -> Doc ann toDoc (coerce -> name) = ("@" <> pretty name) `whenFalse` Text.null name prettyParamSet :: forall ann. Variadic -> ParamSet (NixDoc ann) -> Doc ann prettyParamSet variadic args = encloseSep "{ " (align " }") (align ", ") (fmap prettySetArg args <> one "..." `whenTrue` (variadic == Variadic)) where prettySetArg :: (VarName, Maybe (NixDoc ann)) -> Doc ann prettySetArg (n, maybeDef) = (prettyVarName n <>) $ ((" ? " <>) . getDoc) `whenJust` maybeDef prettyBind :: Binding (NixDoc ann) -> Doc ann prettyBind (NamedVar n v _p) = prettySelector n <> " = " <> getDoc v <> ";" prettyBind (Inherit s ns _p) = "inherit " <> scope <> align (fillSep $ prettyVarName <$> ns) <> ";" where scope = ((<> " ") . parens . getDoc) `whenJust` s prettyKeyName :: NKeyName (NixDoc ann) -> Doc ann prettyKeyName (StaticKey key) = bool "\"\"" ( bool id dquotes (HashSet.member key reservedNames) (prettyVarName key) ) (not $ Text.null $ coerce key) prettyKeyName (DynamicKey key) = runAntiquoted (DoubleQuoted $ one $ Plain "\n") prettyString antiquote key prettySelector :: NAttrPath (NixDoc ann) -> Doc ann prettySelector = hcat . punctuate "." . fmap prettyKeyName . NE.toList prettyAtom :: NAtom -> NixDoc ann prettyAtom = simpleExpr . pretty . atomText prettyNix :: NExpr -> Doc ann prettyNix = getDoc . foldFix exprFNixDoc prettyOriginExpr :: forall t f m ann. (HasCitations1 m (NValue t f m) f) => NExprLocF (Maybe (NValue t f m)) -> Doc ann prettyOriginExpr = getDoc . go where go :: NExprLocF (Maybe (NValue t f m)) -> NixDoc ann go = exprFNixDoc . stripAnnF . fmap render where render :: Maybe (NValue t f m) -> NixDoc ann render Nothing = simpleExpr "_" render (Just (Free (reverse . citations @m -> p : _))) = go (getOriginExpr p) render _ = simpleExpr "?" -- render (Just (NValue (citations -> ps))) = -- simpleExpr $ foldr ((\x y -> vsep [x, y]) . parens . indent 2 . getDoc -- . go . originExpr) -- mempty (reverse ps) {- | Takes original expression from inside provenance information. Prettifies that expression. -} prettyExtractFromProvenance :: forall t f m ann. (HasCitations1 m (NValue t f m) f) => [Provenance m (NValue t f m)] -> Doc ann prettyExtractFromProvenance = sep . fmap (prettyOriginExpr . getOriginExpr) exprFNixDoc :: forall ann. NExprF (NixDoc ann) -> NixDoc ann exprFNixDoc = \case NConstant atom -> prettyAtom atom NStr str -> simpleExpr $ prettyString str NList xs -> prettyContainer "[" (precedenceWrap appOpDef) "]" xs NSet NonRecursive xs -> prettyContainer "{" prettyBind "}" xs NSet Recursive xs -> prettyContainer "rec {" prettyBind "}" xs NAbs args body -> leastPrecedence $ nest 2 $ vsep [ prettyParams args <> ":" , getDoc body ] NApp fun arg -> mkNixDoc appOpDef (wrap appOpDef fun <> " " <> precedenceWrap appOpDef arg) NBinary op r1 r2 -> mkNixDoc opDef $ hsep [ pickWrapMode NAssocLeft r1 , pretty @Text $ coerce @NOpName $ getOpName op , pickWrapMode NAssocRight r2 ] where opDef = getOpDef op pickWrapMode :: NAssoc -> NixDoc ann -> Doc ann pickWrapMode x = bool wrap precedenceWrap (getOpAssoc opDef /= x) opDef NUnary op r1 -> mkNixDoc opDef $ pretty @Text (coerce $ getOpName op) <> wrap opDef r1 where opDef = getOpDef op NSelect o r' attr -> maybe (mkNixDoc selectOp) (const leastPrecedence) o $ wrapPath selectOp (mkNixDoc selectOp (wrap appOpDef r')) <> "." <> prettySelector attr <> ((" or " <>) . precedenceWrap appOpDef) `whenJust` o where selectOp :: NOperatorDef selectOp = getOpDef NSelectOp NHasAttr r attr -> mkNixDoc hasAttrOp (wrap hasAttrOp r <> " ? " <> prettySelector attr) where hasAttrOp :: NOperatorDef hasAttrOp = getOpDef NHasAttrOp NEnvPath p -> simpleExpr $ pretty @String $ "<" <> coerce p <> ">" NLiteralPath p -> pathExpr $ pretty @FilePath $ coerce $ case p of "./" -> "./." "../" -> "../." ".." -> "../." path -> bool ("./" <> path) path (any (`isPrefixOf` coerce path) ["/", "~/", "./", "../"]) NSym name -> simpleExpr $ prettyVarName name NLet binds body -> leastPrecedence $ group $ vsep [ "let" , indent 2 (vsep $ fmap prettyBind binds) , "in " <> getDoc body ] NIf cond trueBody falseBody -> leastPrecedence $ group $ nest 2 ifThenElse where ifThenElse :: Doc ann ifThenElse = sep [ "if " <> getDoc cond , align $ "then " <> getDoc trueBody , align $ "else " <> getDoc falseBody ] NWith scope body -> prettyAddScope "with " scope body NAssert cond body -> prettyAddScope "assert " cond body NSynHole name -> simpleExpr $ pretty @Text ("^" <> coerce name) where prettyContainer h f t c = handlePresence (simpleExpr (h <> t)) (const $ simpleExpr $ group $ nest 2 (h <> line <> vsep (f <$> c)) <> line <> t) c prettyAddScope h c b = leastPrecedence $ vsep [h <> getDoc c <> ";", align $ getDoc b] valueToExpr :: forall t f m. (MonadDataContext f m) => NValue t f m -> NExpr valueToExpr = iterNValueByDiscardWith thk (Fix . phi) where thk = Fix . NSym $ "" phi :: NValue' t f m NExpr -> NExprF NExpr phi (NVConstant' a) = NConstant a phi (NVStr' ns) = NStr $ DoubleQuoted $ one $ Plain $ ignoreContext ns phi (NVList' l) = NList l phi (NVSet' p s) = NSet mempty [ NamedVar (one $ StaticKey k) v (fromMaybe nullPos $ (`M.lookup` p) k) | (k, v) <- toList s ] phi (NVClosure' _ _) = NSym "" phi (NVPath' p) = NLiteralPath p phi (NVBuiltin' name _) = NSym $ coerce ((mappend @Text) "builtins.") name prettyNValue :: forall t f m ann. (MonadDataContext f m) => NValue t f m -> Doc ann prettyNValue = prettyNix . valueToExpr {- | During the output, which can print only representation of value, lazy thunks need to looked into & so - be evaluated (*sic) This type is a simple manual witness "is the thunk gets shown". -} data ValueOrigin = WasThunk | Value deriving (Eq) prettyProv :: forall t f m ann. ( HasCitations m (NValue t f m) t , HasCitations1 m (NValue t f m) f , MonadThunk t m (NValue t f m) , MonadDataContext f m ) => -- | Was thunk? ValueOrigin -> NValue t f m -> Doc ann prettyProv wasThunk v = handlePresence id ( \ps pv -> fillSep [ pv , indent 2 $ "(" <> ("thunk " `whenTrue` (wasThunk == WasThunk) <> "from: " <> prettyExtractFromProvenance ps) <> ")" ] ) (citations @m @(NValue t f m) v) (prettyNValue v) prettyNValueProv :: forall t f m ann. ( HasCitations m (NValue t f m) t , HasCitations1 m (NValue t f m) f , MonadThunk t m (NValue t f m) , MonadDataContext f m ) => NValue t f m -> Doc ann prettyNValueProv = prettyProv Value prettyNThunk :: forall t f m ann. ( HasCitations m (NValue t f m) t , HasCitations1 m (NValue t f m) f , MonadThunk t m (NValue t f m) , MonadDataContext f m ) => t -> m (Doc ann) prettyNThunk t = prettyProv WasThunk <$> dethunk t -- | This function is used only by the testing code. printNix :: forall t f m. (MonadDataContext f m) => NValue t f m -> Text printNix = iterNValueByDiscardWith thunkStubText phi where phi :: NValue' t f m Text -> Text phi (NVConstant' a) = atomText a phi (NVStr' ns) = "\"" <> escapeString (ignoreContext ns) <> "\"" phi (NVList' l) = "[ " <> unwords l <> " ]" phi (NVSet' _ s) = "{ " <> fold [ check k <> " = " <> v <> "; " | (coerce -> k, v) <- sort $ toList s ] <> "}" where check :: Text -> Text check v = fromMaybe v (tryRead @Int <|> tryRead @Float) where tryRead :: forall a. (Read a, Show a) => Maybe Text tryRead = fmap ((\s -> "\"" <> s <> "\"") . show) $ readMaybe @a $ toString v phi NVClosure'{} = "<>" phi (NVPath' fp) = fromString $ coerce fp phi (NVBuiltin' name _) = "< coerce name <> ">>" ================================================ FILE: src/Nix/Reduce.hs ================================================ {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE CPP #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE PartialTypeSignatures #-} {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -fno-warn-name-shadowing #-} {- | This module provides a "reducing" expression evaluator, which reduces away pure, non self-referential aspects of an expression tree, yielding a new expression tree. It does not yet attempt to reduce everything possible, and will always yield a tree with the same meaning as the original. It should be seen as an opportunistic simplifier, but which gives up easily if faced with any potential for ambiguity in the result. -} module Nix.Reduce ( reduceExpr, reducingEvalExpr, ) where import Control.Monad.Catch (MonadCatch (catch)) import Nix.Prelude #if !MIN_VERSION_base(4,12,0) import Prelude hiding ( fail ) import Control.Monad.Fail #endif import Control.Monad.Fix (MonadFix) import Data.Fix ( Fix (..), foldFix, foldFixM, ) import qualified Data.HashMap.Internal as HM ( fromList, insert, lookup, singleton, ) import qualified Data.List.NonEmpty as NE import Nix.Atoms import Nix.Effects.Basic (pathToDefaultNixFile) import Nix.Expr.Types import Nix.Expr.Types.Annotated import Nix.Frames import Nix.Options ( Options, askOptions, isReduceLists, isReduceSets, ) import Nix.Parser import Nix.Scope import System.Directory import qualified Text.Show newtype Reducer m a = Reducer { runReducer :: ReaderT ( Maybe Path , Scopes (Reducer m) NExprLoc ) ( StateT ( HashMap Path NExprLoc , HashMap Text Text ) m ) a } deriving ( Functor , Applicative , Alternative , Monad , MonadPlus , MonadFix , MonadIO , MonadFail , MonadReader (Maybe Path, Scopes (Reducer m) NExprLoc) , MonadState (HashMap Path NExprLoc, HashMap Text Text) ) staticImport :: forall m. ( MonadIO m , Scoped NExprLoc m , MonadFail m , MonadReader (Maybe Path, Scopes m NExprLoc) m , MonadState (HashMap Path NExprLoc, HashMap Text Text) m ) => SrcSpan -> Path -> m NExprLoc staticImport pann path = do mfile <- asks fst path' <- liftIO $ pathToDefaultNixFile path path'' <- liftIO $ pathToDefaultNixFile =<< coerce canonicalizePath (maybe id (() . takeDirectory) mfile path') let importIt :: m NExprLoc importIt = do liftIO $ putStrLn $ "Importing file " <> coerce path'' eres <- liftIO $ parseNixFileLoc path'' either (\err -> fail $ "Parse failed: " <> show err) ( \x -> do let pos = join (NSourcePos "Reduce.hs") $ (coerce . mkPos) 1 span = join SrcSpan pos cur = NamedVar (one $ StaticKey "__cur_file") (NLiteralPathAnn pann path'') pos x' = NLetAnn span (one cur) x modify $ first $ HM.insert path'' x' local (const (pure path'', mempty)) $ do x'' <- foldFix reduce x' modify $ first $ HM.insert path'' x'' pure x'' ) eres imports <- gets fst maybe importIt pure (HM.lookup path'' imports) -- gatherNames :: NExprLoc -> HashSet VarName -- gatherNames = foldFix $ \case -- NSymAnnF _ var -> S.singleton var -- AnnF _ x -> fold x reduceExpr :: (MonadIO m, MonadFail m) => Maybe Path -> NExprLoc -> m NExprLoc reduceExpr mpath expr = (`evalStateT` mempty) . (`runReaderT` (mpath, mempty)) . runReducer $ foldFix reduce expr reduce :: forall m. ( MonadIO m , Scoped NExprLoc m , MonadFail m , MonadReader (Maybe Path, Scopes m NExprLoc) m , MonadState (HashMap Path NExprLoc, HashMap Text Text) m ) => NExprLocF (m NExprLoc) -> m NExprLoc {- | Reduce the variable to its value if defined. Leave it as it is otherwise. -} reduce (NSymAnnF ann var) = fromMaybe (NSymAnn ann var) <$> lookupVar var -- \| Reduce binary and integer negation. reduce (NUnaryAnnF uann op arg) = do x <- arg pure $ case (op, x) of (NNeg, NConstantAnn cann (NInt n)) -> NConstantAnn cann $ NInt $ negate n (NNot, NConstantAnn cann (NBool b)) -> NConstantAnn cann $ NBool $ not b _ -> NUnaryAnn uann op x -- \| Reduce function applications. -- -- * Reduce an import to the actual imported expression. -- -- * Reduce a lambda function by adding its name to the local -- scope and recursively reducing its body. reduce (NAppAnnF bann fun arg) = ( \case f@(NSymAnn _ "import") -> ( \case -- NEnvPathAnn pann origPath -> staticImport pann origPath NLiteralPathAnn pann origPath -> staticImport pann origPath v -> pure $ NAppAnn bann f v ) =<< arg NAbsAnn _ (Param name) body -> do x <- arg pushScope (coerce $ HM.singleton name x) (foldFix reduce body) f -> NAppAnn bann f <$> arg ) =<< fun -- \| Reduce an integer addition to its result. reduce (NBinaryAnnF bann op larg rarg) = do lval <- larg rval <- rarg pure $ case (op, lval, rval) of (NPlus, NConstantAnn ann (NInt x), NConstantAnn _ (NInt y)) -> NConstantAnn ann $ NInt $ x + y _ -> NBinaryAnn bann op lval rval -- \| Reduce a select on a Set by substituting the set to the selected value. -- -- Before applying this reduction, we need to ensure that: -- -- 1. The selected expr is indeed a set. -- 2. The selection AttrPath is a list of StaticKeys. -- 3. The selected AttrPath exists in the set. reduce base@(NSelectAnnF _ _ _ attrs) | sAttrPath $ NE.toList attrs = do (NSelectAnnF _ _ aset attrs) <- sequenceA base inspectSet (unFix aset) attrs | otherwise = sId where sId = reduceLayer base -- The selection AttrPath is composed of StaticKeys. sAttrPath (StaticKey _ : xs) = sAttrPath xs sAttrPath [] = True sAttrPath _ = False -- Find appropriate bind in set's binds. findBind [] _ = Nothing findBind (x : xs) attrs@(a :| _) = case x of n@(NamedVar (a' :| _) _ _) | a' == a -> pure n _ -> findBind xs attrs -- Follow the attrpath recursively in sets. inspectSet (NSetAnnF _ NonRecursive binds) attrs = case findBind binds attrs of Just (NamedVar _ e _) -> case NE.uncons attrs of (_, Just attrs) -> inspectSet (unFix e) attrs _ -> pure e _ -> sId inspectSet _ _ = sId -- reduce (NHasAttr aset attr) = -- \| Reduce a set by inlining its binds outside of the set -- if none of the binds inherit the super set. reduce e@(NSetAnnF ann r binds) = bool -- Encountering a 'rec set' construction eliminates any hope of inlining -- definitions. mExprLoc ( bool (reduceLayer e) mExprLoc usesInherit ) (r == NonRecursive) where mExprLoc :: m NExprLoc mExprLoc = clearScopes @NExprLoc $ NSetAnn ann r <$> traverse sequenceA binds usesInherit = any ( \case Inherit{} -> True _ -> False ) binds -- Encountering a 'with' construction eliminates any hope of inlining -- definitions. reduce (NWithAnnF ann scope body) = clearScopes @NExprLoc $ liftA2 (NWithAnn ann) scope body -- \| Reduce a let binds section by pushing lambdas, -- constants and strings to the body scope. reduce (NLetAnnF ann binds body) = do binds' <- traverse sequenceA binds body' <- (`pushScope` body) . coerce . HM.fromList . catMaybes =<< traverse ( \case NamedVar (StaticKey name :| []) def _pos -> let defcase = \case d@NAbsAnn{} -> pure (name, d) d@NConstantAnn{} -> pure (name, d) d@NStrAnn{} -> pure (name, d) _ -> Nothing in defcase <$> def _ -> pure Nothing ) binds -- let names = gatherNames body' -- binds' <- traverse sequenceA binds <&> \b -> flip filter b $ \case -- NamedVar (StaticKey name _ :| []) _ -> -- name `S.member` names -- _ -> True pure $ NLetAnn ann binds' body' -- where -- go m [] = pure m -- go m (x:xs) = case x of -- NamedVar (StaticKey name _ :| []) def -> do -- v <- pushScope m def -- go (M.insert name v m) xs -- _ -> go m xs -- \| Reduce an if to the relevant path if -- the condition is a boolean constant. reduce e@(NIfAnnF _ b t f) = ( \case NConstantAnn _ (NBool b') -> bool f t b' _ -> reduceLayer e ) =<< b -- \| Reduce an assert atom to its encapsulated -- symbol if the assertion is a boolean constant. reduce e@(NAssertAnnF _ b body) = ( \case NConstantAnn _ (NBool True) -> body _ -> reduceLayer e ) =<< b reduce (NAbsAnnF ann params body) = do params' <- sequenceA params -- Make sure that variable definitions in scope do not override function -- arguments. let scope = coerce $ case params' of Param name -> one (name, NSymAnn ann name) ParamSet _ _ pset -> HM.fromList $ (\(k, _) -> (k, NSymAnn ann k)) <$> pset NAbsAnn ann params' <$> pushScope scope body reduce v = reduceLayer v reduceLayer :: (Traversable f1, Applicative f2) => f1 (f2 (Fix f1)) -> f2 (Fix f1) reduceLayer v = Fix <$> sequenceA v -- newtype FlaggedF f r = FlaggedF { flagged :: (IORef Bool, f r) } newtype FlaggedF f r = FlaggedF (IORef Bool, f r) deriving (Functor, Foldable, Traversable) instance (Show (f r)) => Show (FlaggedF f r) where show (FlaggedF (_, x)) = show x type Flagged f = Fix (FlaggedF f) flagExprLoc :: (MonadIO n, Traversable f) => Fix f -> n (Flagged f) flagExprLoc = foldFixM $ \x -> do flag <- liftIO $ newIORef False pure $ coerce (flag, x) -- stripFlags :: Functor f => Flagged f -> Fix f -- stripFlags = foldFix $ Fix . snd . flagged pruneTree :: (MonadIO n) => Options -> Flagged NExprLocF -> n (Maybe NExprLoc) pruneTree opts = foldFixM $ \(FlaggedF (b, Compose x)) -> bool Nothing (annUnitToAnn <$> traverse prune x) <$> liftIO (readIORef b) where prune :: NExprF (Maybe NExprLoc) -> Maybe (NExprF NExprLoc) prune = \case NStr str -> pure $ NStr $ pruneString str NHasAttr (Just aset) attr -> pure $ NHasAttr aset $ pruneKeyName <$> attr NAbs params (Just body) -> pure $ NAbs (pruneParams params) body NList l -> pure $ NList $ bool (fromMaybe annNNull <$>) catMaybes (isReduceLists opts) -- Reduce list members that aren't used; breaks if elemAt is used l NSet recur binds -> pure $ NSet recur $ bool (fromMaybe annNNull <<$>>) (mapMaybe sequenceA) (isReduceSets opts) -- Reduce set members that aren't used; breaks if hasAttr is used binds NLet binds (Just body@(Ann _ x)) -> pure $ handlePresence x (`NLet` body) (mapMaybe pruneBinding binds) NSelect alt (Just aset) attr -> pure $ NSelect (join alt) aset $ pruneKeyName <$> attr -- If the function was never called, it means its argument was in a -- thunk that was forced elsewhere. NApp Nothing (Just _) -> Nothing -- These are the only short-circuiting binary operators NBinary NAnd (Just (Ann _ larg)) _ -> pure larg NBinary NOr (Just (Ann _ larg)) _ -> pure larg -- The idea behind emitted a binary operator where one side may be -- invalid is that we're trying to emit what will reproduce whatever -- fail the user encountered, which means providing all aspects of -- the evaluation path they ultimately followed. NBinary op Nothing (Just rarg) -> pure $ NBinary op annNNull rarg NBinary op (Just larg) Nothing -> pure $ NBinary op larg annNNull -- If the scope of a with was never referenced, it's not needed NWith Nothing (Just (Ann _ body)) -> pure body NAssert Nothing _ -> fail "How can an assert be used, but its condition not?" NAssert _ (Just (Ann _ body)) -> pure body NAssert (Just cond) _ -> pure $ NAssert cond annNNull NIf Nothing _ _ -> fail "How can an if be used, but its condition not?" NIf _ Nothing (Just (Ann _ f)) -> pure f NIf _ (Just (Ann _ t)) Nothing -> pure t x -> sequenceA x pruneString :: NString (Maybe NExprLoc) -> NString NExprLoc pruneString (DoubleQuoted xs) = DoubleQuoted $ mapMaybe pruneAntiquotedText xs pruneString (Indented n xs) = Indented n $ mapMaybe pruneAntiquotedText xs pruneAntiquotedText :: Antiquoted Text (Maybe NExprLoc) -> Maybe (Antiquoted Text NExprLoc) pruneAntiquotedText (Plain v) = pure $ Plain v pruneAntiquotedText EscapedNewline = pure EscapedNewline pruneAntiquotedText (Antiquoted (Just k)) = pure $ Antiquoted k pruneAntiquotedText (Antiquoted Nothing) = Nothing pruneAntiquoted :: Antiquoted (NString (Maybe NExprLoc)) (Maybe NExprLoc) -> Maybe (Antiquoted (NString NExprLoc) NExprLoc) pruneAntiquoted (Plain v) = pure $ Plain $ pruneString v pruneAntiquoted EscapedNewline = pure EscapedNewline pruneAntiquoted (Antiquoted (Just k)) = pure $ Antiquoted k pruneAntiquoted (Antiquoted Nothing) = Nothing pruneKeyName :: NKeyName (Maybe NExprLoc) -> NKeyName NExprLoc pruneKeyName (StaticKey n) = StaticKey n pruneKeyName (DynamicKey k) | Just k' <- pruneAntiquoted k = DynamicKey k' | otherwise = StaticKey "" pruneParams :: Params (Maybe NExprLoc) -> Params NExprLoc pruneParams (Param n) = Param n pruneParams (ParamSet mname variadic pset) = ParamSet mname variadic (reduceOrPassMode <$> pset) where reduceOrPassMode = second $ bool fmap ((pure .) . maybe annNNull) (isReduceSets opts) -- Reduce set members that aren't used; breaks if hasAttr is used (fromMaybe annNNull) pruneBinding :: Binding (Maybe NExprLoc) -> Maybe (Binding NExprLoc) pruneBinding (NamedVar _ Nothing _) = Nothing pruneBinding (NamedVar xs (Just x) pos) = pure $ NamedVar (pruneKeyName <$> xs) x pos pruneBinding (Inherit _ [] _) = Nothing pruneBinding (Inherit (join -> Nothing) _ _) = Nothing pruneBinding (Inherit (join -> m) xs pos) = pure $ Inherit m xs pos reducingEvalExpr :: (Framed e m, Has e Options, Exception r, MonadCatch m, MonadIO m) => (NExprLocF (m a) -> m a) -> Maybe Path -> NExprLoc -> m (NExprLoc, Either r a) reducingEvalExpr eval mpath expr = do expr' <- flagExprLoc =<< liftIO (reduceExpr mpath expr) eres <- (`catch` pure . Left) $ pure <$> foldFix (addEvalFlags eval) expr' opts <- askOptions expr'' <- pruneTree opts expr' pure (fromMaybe annNNull expr'', eres) where addEvalFlags k (FlaggedF (b, x)) = liftIO (writeIORef b True) *> k x instance (Monad m) => Scoped NExprLoc (Reducer m) where askScopes = askScopesReader clearScopes = clearScopesReader @(Reducer m) @NExprLoc pushScopes = pushScopesReader lookupVar = lookupVarReader ================================================ FILE: src/Nix/Render/Frame.hs ================================================ {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE CPP #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE MultiWayIf #-} {-# LANGUAGE TypeFamilies #-} -- | Code for rendering/representation of the messages packaged with their context (Frames). module Nix.Render.Frame where import Data.Fix (Fix (..)) import GHC.Exception (ErrorCall) import Nix.Eval hiding (addMetaInfo) import Nix.Exec import Nix.Expr.Types import Nix.Expr.Types.Annotated import Nix.Frames import Nix.Normal import Nix.Options import Nix.Prelude hiding (Comparison) import Nix.Pretty import Nix.Render import Nix.Thunk import Nix.Value import Prettyprinter hiding (list) import Text.Megaparsec.Pos (sourcePosPretty) import qualified Text.Show as Text import qualified Text.Show.Pretty as PS renderFrames :: forall v t f e m ann. ( MonadReader e m , Has e Options , MonadFile m , MonadCitedThunks t f m , Typeable v ) => Frames -> m (Doc ann) renderFrames [] = stub renderFrames xss@(x : xs) = do opts <- askOptions let verbosity :: Verbosity verbosity = getVerbosity opts renderedFrames <- if | verbosity <= ErrorsOnly -> render1 x -- 2021-10-22: NOTE: List reverse is completely conterproductive. `reverse` of list famously neest to traverse the whole list to take the last element | verbosity <= Informational -> (foldMap renderPosition (reverse xs) <>) <$> render1 x | otherwise -> foldMapM render1 (reverse xss) pure $ handlePresence mempty vsep renderedFrames where render1 :: NixFrame -> m [Doc ann1] render1 = renderFrame @v @t @f renderPosition :: NixFrame -> [Doc ann] renderPosition = whenJust (\pos -> one ("While evaluating at " <> pretty (sourcePosPretty $ toSourcePos pos) <> colon)) . framePos @v @m framePos :: forall v (m :: Type -> Type). (Typeable m, Typeable v) => NixFrame -> Maybe NSourcePos framePos (NixFrame _ f) = ( \case EvaluatingExpr _ (Ann (SrcSpan beg _) _) -> pure beg _ -> Nothing ) =<< fromException @(EvalFrame m v) f renderFrame :: forall v t f e m ann. ( MonadReader e m , Has e Options , MonadFile m , MonadCitedThunks t f m , Typeable v ) => NixFrame -> m [Doc ann] renderFrame (NixFrame level f) | Just (e :: EvalFrame m v) <- fromException f = renderEvalFrame level e | Just (e :: ThunkLoop) <- fromException f = renderThunkLoop level e | Just (e :: ValueFrame t f m) <- fromException f = renderValueFrame level e | Just (e :: NormalLoop t f m) <- fromException f = renderNormalLoop level e | Just (e :: ExecFrame t f m) <- fromException f = renderExecFrame level e | Just (e :: ErrorCall) <- fromException f = pure $ one $ pretty (Text.show e) | Just (e :: SynHoleInfo m v) <- fromException f = pure $ one $ pretty (Text.show e) | otherwise = fail $ "Unrecognized frame: " <> show f wrapExpr :: NExprF r -> NExpr wrapExpr x = Fix (Fix (NSym "") <$ x) renderEvalFrame :: forall e m v ann. (MonadReader e m, Has e Options, MonadFile m) => NixLevel -> EvalFrame m v -> m [Doc ann] renderEvalFrame level f = do opts <- askOptions let addMetaInfo :: ([Doc ann] -> [Doc ann]) -> SrcSpan -> Doc ann -> m [Doc ann] addMetaInfo trans loc = fmap (trans . one) . renderLocation loc case f of EvaluatingExpr scope e@(Ann loc _) -> addMetaInfo (scopeInfo <>) loc =<< renderExpr level "While evaluating" "Expression" e where scopeInfo :: [Doc ann] scopeInfo = one (pretty $ Text.show scope) `whenTrue` isShowScopes opts ForcingExpr _scope e@(Ann loc _) | isThunks opts -> addMetaInfo id loc =<< renderExpr level "While forcing thunk from" "Forcing thunk" e Calling name loc -> addMetaInfo id loc $ "While calling `builtins." <> prettyVarName name <> "`" SynHole synfo -> sequenceA [ renderLocation loc =<< renderExpr level "While evaluating" "Syntactic Hole" e , pure $ pretty $ Text.show $ _synHoleInfo_scope synfo ] where e@(Ann loc _) = _synHoleInfo_expr synfo ForcingExpr _ _ -> stub renderExpr :: (MonadReader e m, Has e Options, MonadFile m) => NixLevel -> Text -> Text -> NExprLoc -> m (Doc ann) renderExpr _level longLabel shortLabel e@(Ann _ x) = do opts <- askOptions let verbosity :: Verbosity verbosity = getVerbosity opts expr :: NExpr expr = stripAnnotation e concise = prettyNix $ Fix $ Fix (NSym "") <$ x chatty = bool (pretty $ PS.ppShow expr) (prettyNix expr) (verbosity == Chatty) pure $ bool (pretty shortLabel <> fillSep [": ", concise]) (vsep [pretty (longLabel <> ":\n>>>>>>>>"), indent 2 chatty, "<<<<<<<<"]) (verbosity >= Chatty) renderValueFrame :: forall e t f m ann. (MonadReader e m, Has e Options, MonadFile m, MonadCitedThunks t f m) => NixLevel -> ValueFrame t f m -> m [Doc ann] renderValueFrame level = fmap one . \case ForcingThunk _t -> pure "ForcingThunk" -- jww (2019-03-18): NYI ConcerningValue _v -> pure "ConcerningValue" Comparison _ _ -> pure "Comparing" Addition _ _ -> pure "Adding" Division _ _ -> pure "Dividing" Multiplication _ _ -> pure "Multiplying" Coercion x y -> pure $ fold [desc, pretty (describeValue x), " to ", pretty (describeValue y)] where desc = bool "While coercing " "Cannot coerce " (level <= Error) CoercionToJson v -> ("CoercionToJson " <>) <$> dumbRenderValue v CoercionFromJson _j -> pure "CoercionFromJson" Expectation t v -> (msg <>) <$> dumbRenderValue v where msg = "Expected " <> pretty (describeValue t) <> ", but saw " -- 2021-10-28: NOTE: notice it ignores `level`, `longlabel` & `shortlabel`, to underline that `dumbRenderValue` synonym was created renderValue :: forall e t f m ann. (MonadReader e m, Has e Options, MonadFile m, MonadCitedThunks t f m) => NixLevel -> Text -> Text -> NValue t f m -> m (Doc ann) renderValue _level _longLabel _shortLabel v = do opts <- askOptions bool prettyNValue prettyNValueProv (isValues opts) <$> removeEffects v dumbRenderValue :: forall e t f m ann. (MonadReader e m, Has e Options, MonadFile m, MonadCitedThunks t f m) => (NValue t f m -> m (Doc ann)) dumbRenderValue = renderValue Info mempty mempty renderExecFrame :: (MonadReader e m, Has e Options, MonadFile m, MonadCitedThunks t f m) => NixLevel -> ExecFrame t f m -> m [Doc ann] renderExecFrame _level (Assertion ann v) = fmap one $ renderLocation ann . fillSep . on (<>) one "Assertion failed:" =<< dumbRenderValue v renderThunkLoop :: (MonadReader e m, Has e Options, MonadFile m, Show (ThunkId m)) => NixLevel -> ThunkLoop -> m [Doc ann] renderThunkLoop _level (ThunkLoop n) = pure . one . pretty $ "Infinite recursion in thunk " <> n renderNormalLoop :: (MonadReader e m, Has e Options, MonadFile m, MonadCitedThunks t f m) => NixLevel -> NormalLoop t f m -> m [Doc ann] renderNormalLoop _level (NormalLoop v) = one . ("Infinite recursion during normalization forcing " <>) <$> dumbRenderValue v ================================================ FILE: src/Nix/Render.hs ================================================ {-# LANGUAGE CPP #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE MultiWayIf #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} module Nix.Render where import qualified Data.Set as Set import qualified Data.Text as Text import Nix.Expr.Types ( NPos (..), NSourcePos (..), ) import Nix.Expr.Types.Annotated import Nix.Prelude import Nix.Utils.Fix1 ( Fix1T, MonadFix1T, ) import Prettyprinter import qualified System.Directory as S import qualified System.PosixCompat.Files as S import Text.Megaparsec.Error import Text.Megaparsec.Pos class (MonadFail m, MonadIO m) => MonadFile m where readFile :: Path -> m Text default readFile :: (MonadTrans t, MonadIO m', MonadFile m', m ~ t m') => Path -> m Text readFile = liftIO . Nix.Prelude.readFile listDirectory :: Path -> m [Path] default listDirectory :: (MonadTrans t, MonadFile m', m ~ t m') => Path -> m [Path] listDirectory = lift . listDirectory getCurrentDirectory :: m Path default getCurrentDirectory :: (MonadTrans t, MonadFile m', m ~ t m') => m Path getCurrentDirectory = lift getCurrentDirectory canonicalizePath :: Path -> m Path default canonicalizePath :: (MonadTrans t, MonadFile m', m ~ t m') => Path -> m Path canonicalizePath = lift . canonicalizePath getHomeDirectory :: m Path default getHomeDirectory :: (MonadTrans t, MonadFile m', m ~ t m') => m Path getHomeDirectory = lift getHomeDirectory doesPathExist :: Path -> m Bool default doesPathExist :: (MonadTrans t, MonadFile m', m ~ t m') => Path -> m Bool doesPathExist = lift . doesPathExist doesFileExist :: Path -> m Bool default doesFileExist :: (MonadTrans t, MonadFile m', m ~ t m') => Path -> m Bool doesFileExist = lift . doesFileExist doesDirectoryExist :: Path -> m Bool default doesDirectoryExist :: (MonadTrans t, MonadFile m', m ~ t m') => Path -> m Bool doesDirectoryExist = lift . doesDirectoryExist getSymbolicLinkStatus :: Path -> m S.FileStatus default getSymbolicLinkStatus :: (MonadTrans t, MonadFile m', m ~ t m') => Path -> m S.FileStatus getSymbolicLinkStatus = lift . getSymbolicLinkStatus instance MonadFile IO where readFile = Nix.Prelude.readFile listDirectory = coerce S.listDirectory getCurrentDirectory = coerce S.getCurrentDirectory canonicalizePath = coerce S.canonicalizePath getHomeDirectory = coerce S.getHomeDirectory doesPathExist = coerce S.doesPathExist doesFileExist = coerce S.doesFileExist doesDirectoryExist = coerce S.doesDirectoryExist getSymbolicLinkStatus = coerce S.getSymbolicLinkStatus instance (MonadFix1T t m, MonadIO (Fix1T t m), MonadFail (Fix1T t m), MonadFile m) => MonadFile (Fix1T t m) posAndMsg :: NSourcePos -> Doc a -> ParseError s Void posAndMsg (NSourcePos _ (coerce -> lineNo) _) msg = FancyError (unPos lineNo) (Set.fromList $ one (ErrorFail (show msg) :: ErrorFancy Void)) renderLocation :: (MonadFile m) => SrcSpan -> Doc a -> m (Doc a) renderLocation (SrcSpan (NSourcePos file (coerce -> begLine) (coerce -> begCol)) (NSourcePos file' (coerce -> endLine) (coerce -> endCol))) msg | file == file' && file == "" && begLine == endLine = pure $ "In raw input string at position " <> pretty (unPos begCol) | file /= "" && file == file' = bool (pure msg) ( do txt <- sourceContext file begLine begCol endLine endCol msg pure $ vsep [ "In file " <> errorContext file begLine begCol endLine endCol <> ":" , txt ] ) =<< doesFileExist file renderLocation (SrcSpan beg end) msg = fail $ "Don't know how to render range from " <> show beg <> " to " <> show end <> " for fail: " <> show msg errorContext :: Path -> Pos -> Pos -> Pos -> Pos -> Doc a errorContext (coerce @Path @FilePath -> path) bl bc _el _ec = pretty path <> ":" <> pretty (unPos bl) <> ":" <> pretty (unPos bc) sourceContext :: (MonadFile m) => Path -> Pos -> Pos -> Pos -> Pos -> Doc a -> m (Doc a) sourceContext path (unPos -> begLine) (unPos -> _begCol) (unPos -> endLine) (unPos -> _endCol) msg = do let beg' = max 1 $ begLine - 3 end' = endLine + 3 ls <- fmap pretty . take (end' - beg') . drop (pred beg') . lines <$> Nix.Render.readFile path let longest = Text.length $ show $ beg' + length ls - 1 pad :: Int -> Text pad n = let ns :: Text ns = show n nsp = Text.replicate (longest - Text.length ns) " " <> ns in if | n == begLine && n == endLine -> "==> " <> nsp <> " | " | n >= begLine && n <= endLine -> " > " <> nsp <> " | " | otherwise -> " " <> nsp <> " | " composeLine n l = one (pretty (pad n) <> l) <> whenTrue ( one $ pretty $ Text.replicate (Text.length (pad n) - 3) " " <> "|" <> Text.replicate (_begCol + 1) " " <> Text.replicate (_endCol - _begCol) "^" ) (begLine == endLine && n == endLine) -- XXX: Consider inserting the message here when it is small enough. -- ATM some messages are so huge that they take prevalence over the source listing. -- ++ [ indent (length $ pad n) msg | n == endLine ] ls' = fold $ zipWith composeLine [beg' ..] ls pure $ vsep $ ls' <> one (indent (Text.length $ pad begLine) msg) ================================================ FILE: src/Nix/Scope.hs ================================================ {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE UndecidableInstances #-} module Nix.Scope where import qualified Data.HashMap.Lazy as M import Lens.Family2 import Nix.Expr.Types import Nix.Prelude import qualified Text.Show -- 2021-07-19: NOTE: Scopes can gain from sequentiality, HashMap (aka AttrSet) may not be proper to it. newtype Scope a = Scope (AttrSet a) deriving ( Eq , Ord , Generic , Typeable , NFData , Read , Hashable , Semigroup , Monoid , Functor , Foldable , Traversable , One ) instance Show (Scope a) where show (Scope m) = show $ M.keys m scopeLookup :: VarName -> [Scope a] -> Maybe a scopeLookup key = foldr fun Nothing where fun :: Scope a -> Maybe a -> Maybe a fun (Scope m) rest = M.lookup key m <|> rest data Scopes m a = Scopes { lexicalScopes :: [Scope a] , dynamicScopes :: [m (Scope a)] } instance Show (Scopes m a) where show (Scopes m a) = "Scopes: " <> show m <> ", and " <> show (length a) <> " with-scopes" instance Semigroup (Scopes m a) where Scopes ls lw <> Scopes rs rw = Scopes (ls <> rs) (lw <> rw) instance Monoid (Scopes m a) where mempty = emptyScopes emptyScopes :: Scopes m a emptyScopes = Scopes mempty mempty class Scoped a m | m -> a where askScopes :: m (Scopes m a) clearScopes :: m r -> m r pushScopes :: Scopes m a -> m r -> m r lookupVar :: VarName -> m (Maybe a) askScopesReader :: forall m a e. ( MonadReader e m , Has e (Scopes m a) ) => m (Scopes m a) askScopesReader = askLocal clearScopesReader :: forall m a e r. ( MonadReader e m , Has e (Scopes m a) ) => m r -> m r clearScopesReader = local $ set hasLens $ emptyScopes @m @a pushScope :: (Scoped a m) => Scope a -> m r -> m r pushScope scope = pushScopes $ Scopes (one scope) mempty pushWeakScope :: ( Functor m , Scoped a m ) => m (Scope a) -> m r -> m r pushWeakScope scope = pushScopes $ Scopes mempty $ one scope pushScopesReader :: ( MonadReader e m , Has e (Scopes m a) ) => Scopes m a -> m r -> m r pushScopesReader s = local $ over hasLens (s <>) lookupVarReader :: forall m a e. ( MonadReader e m , Has e (Scopes m a) ) => VarName -> m (Maybe a) lookupVarReader k = do mres <- asks $ scopeLookup k . lexicalScopes @m . view hasLens maybe ( do ws <- asks $ dynamicScopes . view hasLens foldr ( \weakscope rest -> do mres' <- M.lookup k . coerce @(Scope a) <$> weakscope maybe rest (pure . pure) mres' ) (pure Nothing) ws ) (pure . pure) mres withScopes :: (Scoped a m) => Scopes m a -> m r -> m r withScopes scopes = clearScopes . pushScopes scopes ================================================ FILE: src/Nix/Standard.hs ================================================ {-# LANGUAGE CPP #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-orphans #-} module Nix.Standard where import Control.Comonad (Comonad) import Control.Comonad.Env (ComonadEnv) import Control.Monad.Catch ( MonadCatch, MonadMask, MonadThrow, ) import Nix.Prelude #if !MIN_VERSION_base(4,13,0) import Control.Monad.Fail ( MonadFail ) #endif import Control.Monad.Fix (MonadFix) import Control.Monad.Free (Free (Free)) import Control.Monad.Ref ( MonadAtomicRef, MonadRef (newRef), ) import Nix.Cited import Nix.Cited.Basic import Nix.Context import Nix.Effects import Nix.Effects.Basic import Nix.Effects.Derivation import Nix.Expr.Types.Annotated import Nix.Fresh import Nix.Fresh.Basic import Nix.Options import Nix.Render import Nix.Scope import Nix.Thunk import Nix.Thunk.Basic import Nix.Utils.Fix1 (Fix1T (Fix1T)) import Nix.Value import Nix.Value.Monad import qualified Text.Show newtype StdCited m a = StdCited (Cited (StdThunk m) (StdCited m) m a) deriving ( Generic , Typeable , Functor , Applicative , Comonad , ComonadEnv [Provenance m (StdValue m)] , Foldable , Traversable ) newtype StdThunk m = StdThunk (StdCited m (NThunkF m (StdValue m))) type StdValue' m = NValue' (StdThunk m) (StdCited m) m (StdValue m) type StdValue m = NValue (StdThunk m) (StdCited m) m type StandardIO = StandardT (StdIdT IO) type StdVal = StdValue StandardIO type StdThun = StdThunk StandardIO type StdIO = StandardIO () {- | Type alias: > Cited (StdThunk m) (StdCited m) m (NThunkF m (StdValue m)) -} type CitedStdThunk m = Cited (StdThunk m) (StdCited m) m (NThunkF m (StdValue m)) instance Show (StdThunk m) where show _ = toString thunkStubText instance HasCitations1 m (StdValue m) (StdCited m) where citations1 (StdCited c) = citations1 c addProvenance1 x (StdCited c) = StdCited $ addProvenance1 x c instance HasCitations m (StdValue m) (StdThunk m) where citations (StdThunk c) = citations1 c addProvenance x (StdThunk c) = StdThunk $ addProvenance1 x c instance (MonadReader (Context m (StdValue m)) m) => Scoped (StdValue m) m where askScopes = askScopesReader clearScopes = clearScopesReader @m @(StdValue m) pushScopes = pushScopesReader lookupVar = lookupVarReader instance ( MonadFix m , MonadFile m , MonadCatch m , MonadEnv m , MonadPaths m , MonadExec m , MonadHttp m , MonadInstantiate m , MonadIntrospect m , MonadPlus m , MonadPutStr m , MonadStore m , MonadAtomicRef m , Typeable m , Scoped (StdValue m) m , MonadReader (Context m (StdValue m)) m , MonadState (HashMap Path NExprLoc, HashMap Text Text) m , MonadDataErrorContext (StdThunk m) (StdCited m) m , MonadThunk (StdThunk m) m (StdValue m) , MonadValue (StdValue m) m ) => MonadEffects (StdThunk m) (StdCited m) m where toAbsolutePath = defaultToAbsolutePath findEnvPath = defaultFindEnvPath findPath = defaultFindPath importPath = defaultImportPath pathToDefaultNix = defaultPathToDefaultNix derivationStrict = defaultDerivationStrict traceEffect = defaultTraceEffect -- 2021-07-24: -- This instance currently is to satisfy @MonadThunk@ requirements for @normalForm@ function. -- As it is seen from the instance - it does superficial type class jump. -- It is just a type boundary for thunking. instance ( Typeable m , MonadThunkId m , MonadAtomicRef m , MonadCatch m , MonadReader (Context m (StdValue m)) m ) => MonadThunk (StdThunk m) m (StdValue m) where thunkId :: StdThunk m -> ThunkId m thunkId = thunkId @(CitedStdThunk m) . coerce {-# INLINE thunkId #-} thunk :: m (StdValue m) -> m (StdThunk m) thunk = fmap coerce . thunk @(CitedStdThunk m) {-# INLINE thunk #-} query :: m (StdValue m) -> StdThunk m -> m (StdValue m) query b = query @(CitedStdThunk m) b . coerce {-# INLINE query #-} force :: StdThunk m -> m (StdValue m) force = force @(CitedStdThunk m) . coerce {-# INLINE force #-} forceEff :: StdThunk m -> m (StdValue m) forceEff = forceEff @(CitedStdThunk m) . coerce {-# INLINE forceEff #-} further :: StdThunk m -> m (StdThunk m) further = fmap coerce . further @(CitedStdThunk m) . coerce {-# INLINE further #-} -- * @instance MonadThunkF@ (Kleisli functor HOFs) -- | This is a functorized version in CPS. -- Please do not use MonadThunkF instances to define MonadThunk. as MonadThunk uses specialized functions. instance ( Typeable m , MonadThunkId m , MonadAtomicRef m , MonadCatch m , MonadReader (Context m (StdValue m)) m ) => MonadThunkF (StdThunk m) m (StdValue m) where queryF :: ( StdValue m -> m r ) -> m r -> StdThunk m -> m r queryF k b = queryF @(CitedStdThunk m) k b . coerce forceF :: ( StdValue m -> m r ) -> StdThunk m -> m r forceF k = forceF @(CitedStdThunk m) k . coerce forceEffF :: ( StdValue m -> m r ) -> StdThunk m -> m r forceEffF k = forceEffF @(CitedStdThunk m) k . coerce furtherF :: ( m (StdValue m) -> m (StdValue m) ) -> StdThunk m -> m (StdThunk m) furtherF k = fmap coerce . furtherF @(CitedStdThunk m) k . coerce -- * @instance MonadValue (StdValue m) m@ instance ( MonadAtomicRef m , MonadCatch m , Typeable m , MonadReader (Context m (StdValue m)) m , MonadThunkId m ) => MonadValue (StdValue m) m where defer :: m (StdValue m) -> m (StdValue m) defer = fmap (pure . coerce) . thunk @(CitedStdThunk m) demand :: StdValue m -> m (StdValue m) demand = go -- lock to ensure no type class jumps. where go :: StdValue m -> m (StdValue m) go = free (go <=< force @(CitedStdThunk m) . coerce) (pure . Free) inform :: StdValue m -> m (StdValue m) inform = go -- lock to ensure no type class jumps. where go :: StdValue m -> m (StdValue m) go = free ((pure . coerce <$>) . (further @(CitedStdThunk m) . coerce)) ((Free <$>) . bindNValue' id go) -- * @instance MonadValueF (StdValue m) m@ instance ( MonadAtomicRef m , MonadCatch m , Typeable m , MonadReader (Context m (StdValue m)) m , MonadThunkId m ) => MonadValueF (StdValue m) m where demandF :: ( StdValue m -> m r ) -> StdValue m -> m r demandF f = f <=< demand informF :: ( m (StdValue m) -> m (StdValue m) ) -> StdValue m -> m (StdValue m) informF f = f . inform {------------------------------------------------------------------------} -- jww (2019-03-22): NYI -- whileForcingThunk -- :: forall t f m s e r . (Exception s, Convertible e t f m) => s -> m r -> m r -- whileForcingThunk frame = -- withFrame Debug (ForcingThunk @t @f @m) . withFrame Debug frame newtype StandardTF r m a = StandardTF ( ReaderT (Context r (StdValue r)) (StateT (HashMap Path NExprLoc, HashMap Text Text) m) a ) deriving ( Functor , Applicative , Alternative , Monad , MonadFail , MonadPlus , MonadFix , MonadIO , MonadCatch , MonadThrow , MonadMask , MonadReader (Context r (StdValue r)) , MonadState (HashMap Path NExprLoc, HashMap Text Text) ) instance MonadTrans (StandardTF r) where lift = StandardTF . lift . lift {-# INLINE lift #-} instance (MonadPutStr r, MonadPutStr m) => MonadPutStr (StandardTF r m) instance (MonadHttp r, MonadHttp m) => MonadHttp (StandardTF r m) instance (MonadEnv r, MonadEnv m) => MonadEnv (StandardTF r m) instance (MonadPaths r, MonadPaths m) => MonadPaths (StandardTF r m) instance (MonadInstantiate r, MonadInstantiate m) => MonadInstantiate (StandardTF r m) instance (MonadExec r, MonadExec m) => MonadExec (StandardTF r m) instance (MonadIntrospect r, MonadIntrospect m) => MonadIntrospect (StandardTF r m) --------------------------------------------------------------------------------- type StandardT m = Fix1T StandardTF m instance MonadTrans (Fix1T StandardTF) where lift = Fix1T . lift {-# INLINE lift #-} instance (MonadThunkId m) => MonadThunkId (StandardT m) where type ThunkId (StandardT m) = ThunkId m mkStandardT :: ReaderT (Context (StandardT m) (StdValue (StandardT m))) (StateT (HashMap Path NExprLoc, HashMap Text Text) m) a -> StandardT m a mkStandardT = coerce runStandardT :: StandardT m a -> ReaderT (Context (StandardT m) (StdValue (StandardT m))) (StateT (HashMap Path NExprLoc, HashMap Text Text) m) a runStandardT = coerce runWithBasicEffects :: (MonadIO m, MonadAtomicRef m) => Options -> StandardT (StdIdT m) a -> m a runWithBasicEffects opts = fun . (`evalStateT` mempty) . (`runReaderT` newContext opts) . runStandardT where fun action = runFreshIdT action =<< newRef (1 :: Int) runWithBasicEffectsIO :: Options -> StandardIO a -> IO a runWithBasicEffectsIO = runWithBasicEffects ================================================ FILE: src/Nix/String/Coerce.hs ================================================ {-# LANGUAGE CPP #-} module Nix.String.Coerce where import Control.Monad.Catch (MonadThrow) import qualified Data.HashMap.Lazy as M import GHC.Exception (ErrorCall (ErrorCall)) import Nix.Atoms import Nix.Effects import Nix.Expr.Types (VarName) import Nix.Frames import Nix.Prelude import Nix.String import Nix.Value import Nix.Value.Monad #ifdef MIN_VERSION_ghc_datasize import GHC.DataSize #endif -- | Data type to avoid boolean blindness on what used to be called coerceMore data CoercionLevel = -- | Coerce only stringlike types: strings, paths CoerceStringlike | -- | Coerce everything but functions CoerceAny deriving (Eq, Ord, Enum, Bounded) -- | Data type to avoid boolean blindness on what used to be called copyToStore data CopyToStoreMode = -- | Add paths to the store as they are encountered CopyToStore | -- | Add paths to the store as they are encountered DontCopyToStore deriving (Eq, Ord, Enum, Bounded) -- 2021-10-30: NOTE: This seems like metafunction that really is a bunch of functions thrown together. -- Both code blocks are `\case` - which means they can be or 2 functions, or just as well can be one `\case` that goes through all of them and does not require a `CoercionLevel`. Use of function shows that - the `CoercionLevel` not once was used polymorphically. -- Also `CopyToStoreMode` acts only in case of `NVPath` - that is a separate function coerceToString :: forall e t f m. ( Framed e m , MonadStore m , MonadThrow m , MonadDataErrorContext t f m , MonadValue (NValue t f m) m ) => (NValue t f m -> NValue t f m -> m (NValue t f m)) -> CopyToStoreMode -> CoercionLevel -> NValue t f m -> m NixString coerceToString call ctsm clevel = bool (coerceAnyToNixString call ctsm) (coerceStringlikeToNixString ctsm) (clevel == CoerceStringlike) coerceAnyToNixString :: forall e t f m. ( Framed e m , MonadStore m , MonadThrow m , MonadDataErrorContext t f m , MonadValue (NValue t f m) m ) => (NValue t f m -> NValue t f m -> m (NValue t f m)) -> CopyToStoreMode -> NValue t f m -> m NixString coerceAnyToNixString call ctsm = go where go :: NValue t f m -> m NixString go x = coerceAny =<< demand x where coerceAny :: NValue t f m -> m NixString coerceAny = \case -- TODO Return a singleton for "" and "1" NVConstant (NBool b) -> castToNixString $ "1" `whenTrue` b NVConstant (NInt n) -> castToNixString $ show n NVConstant (NFloat n) -> castToNixString $ show n NVConstant NNull -> castToNixString mempty NVList l -> nixStringUnwords <$> traverse go l v@(NVSet _ s) -> fromMaybe (err v) $ continueOnKey (`call` v) "__toString" <|> continueOnKey pure "outPath" where continueOnKey :: (NValue t f m -> m (NValue t f m)) -> VarName -> Maybe (m NixString) continueOnKey f = fmap (go <=< f) . (`M.lookup` s) err v' = throwError $ ErrorCall $ "Expected a Set that has `__toString` or `outpath`, but saw: " <> show v' v -> coerceStringlike v where castToNixString = pure . mkNixStringWithoutContext nixStringUnwords = intercalateNixString $ mkNixStringWithoutContext " " coerceStringlike :: NValue t f m -> m NixString coerceStringlike = coerceStringlikeToNixString ctsm coerceStringlikeToNixString :: forall e t f m. ( Framed e m , MonadStore m , MonadThrow m , MonadDataErrorContext t f m , MonadValue (NValue t f m) m ) => CopyToStoreMode -> NValue t f m -> m NixString coerceStringlikeToNixString ctsm = ( \case NVStr ns -> pure ns NVPath p -> coercePathToNixString ctsm p v -> throwError $ ErrorCall $ "Expected a path or string, but saw: " <> show v ) <=< demand {- | Convert @Path@ into @NixString@. With an additional option to store the resolved path into Nix Store. -} coercePathToNixString :: (MonadStore m, Framed e m) => CopyToStoreMode -> Path -> m NixString coercePathToNixString = bool (pure . mkNixStringWithoutContext . fromString . coerce) ((storePathToNixString <$>) . addPath) . (CopyToStore ==) where storePathToNixString :: StorePath -> NixString storePathToNixString (fromString . coerce -> sp) = (mkNixStringWithSingletonContext . StringContext DirectPath) sp sp ================================================ FILE: src/Nix/String.hs ================================================ {-# LANGUAGE GeneralizedNewtypeDeriving #-} module Nix.String ( NixString, getStringContext, mkNixString, StringContext (..), ContextFlavor (..), NixLikeContext (..), NixLikeContextValue (..), toNixLikeContext, fromNixLikeContext, hasContext, intercalateNixString, getStringNoContext, ignoreContext, mkNixStringWithoutContext, mkNixStringWithSingletonContext, modifyNixContents, WithStringContext, WithStringContextT (..), extractNixString, addStringContext, addSingletonStringContext, runWithStringContextT, runWithStringContextT', runWithStringContext, runWithStringContext', ) where import Control.Monad.Writer (MonadWriter (tell), WriterT (..)) import qualified Data.HashMap.Lazy as M import qualified Data.HashSet as S import qualified Data.Text as Text import Nix.Expr.Types ( AttrSet, VarName (..), ) import Nix.Prelude hiding (TVar, Type) -- * Types -- ** Context -- | A Nix 'StringContext' ... data StringContext = StringContext { getStringContextFlavor :: !ContextFlavor , getStringContextPath :: !VarName } deriving (Eq, Ord, Show, Generic) instance Hashable StringContext -- | A 'ContextFlavor' describes the sum of possible derivations for string contexts data ContextFlavor = DirectPath | AllOutputs | DerivationOutput !Text deriving (Show, Eq, Ord, Generic) instance Hashable ContextFlavor newtype NixLikeContext = NixLikeContext { getNixLikeContext :: AttrSet NixLikeContextValue } deriving (Eq, Ord, Show, Generic) data NixLikeContextValue = NixLikeContextValue { nlcvPath :: !Bool , nlcvAllOutputs :: !Bool , nlcvOutputs :: ![Text] } deriving (Show, Eq, Ord, Generic) instance Semigroup NixLikeContextValue where a <> b = NixLikeContextValue { nlcvPath = nlcvPath a || nlcvPath b , nlcvAllOutputs = nlcvAllOutputs a || nlcvAllOutputs b , nlcvOutputs = nlcvOutputs a <> nlcvOutputs b } instance Monoid NixLikeContextValue where mempty = NixLikeContextValue False False mempty -- ** StringContext accumulator -- | A monad for accumulating string context while producing a result string. newtype WithStringContextT m a = WithStringContextT (WriterT (S.HashSet StringContext) m a) deriving (Functor, Applicative, Monad, MonadTrans, MonadWriter (S.HashSet StringContext)) type WithStringContext = WithStringContextT Identity -- ** NixString data NixString = NixString { getStringContext :: !(S.HashSet StringContext) , getStringContent :: !Text } deriving (Eq, Ord, Show, Generic) instance Semigroup NixString where NixString s1 t1 <> NixString s2 t2 = NixString (s1 <> s2) (t1 <> t2) instance Monoid NixString where mempty = NixString mempty mempty instance Hashable NixString -- * Functions -- ** Makers -- | Constructs NixString without a context mkNixStringWithoutContext :: Text -> NixString mkNixStringWithoutContext = NixString mempty -- | Create NixString using a singleton context mkNixStringWithSingletonContext :: StringContext -> VarName -> NixString mkNixStringWithSingletonContext c s = NixString (one c) (coerce @VarName @Text s) -- | Create NixString from a Text and context mkNixString :: S.HashSet StringContext -> Text -> NixString mkNixString = NixString -- ** Checkers -- | Returns True if the NixString has an associated context hasContext :: NixString -> Bool hasContext (NixString c _) = isPresent c -- ** Getters fromNixLikeContext :: NixLikeContext -> S.HashSet StringContext fromNixLikeContext = S.fromList . (uncurry toStringContexts <=< M.toList . getNixLikeContext) -- | Extract the string contents from a NixString that has no context getStringNoContext :: NixString -> Maybe Text getStringNoContext (NixString c s) | null c = pure s | otherwise = mempty -- | Extract the string contents from a NixString even if the NixString has an associated context ignoreContext :: NixString -> Text ignoreContext (NixString _ s) = s -- | Get the contents of a 'NixString' and write its context into the resulting set. extractNixString :: (Monad m) => NixString -> WithStringContextT m Text extractNixString (NixString c s) = WithStringContextT $ s <$ tell c -- ** Setters -- this really should be 2 args, then with @toStringContexts path@ laziness it would tail recurse. -- for now tuple dissected internaly with laziness preservation. toStringContexts :: VarName -> NixLikeContextValue -> [StringContext] toStringContexts path = go where go :: NixLikeContextValue -> [StringContext] go cv = case cv of NixLikeContextValue True _ _ -> mkLstCtxFor DirectPath cv{nlcvPath = False} NixLikeContextValue _ True _ -> mkLstCtxFor AllOutputs cv{nlcvAllOutputs = False} NixLikeContextValue _ _ ls | isPresent ls -> mkCtxFor . DerivationOutput <$> ls _ -> mempty where mkCtxFor :: ContextFlavor -> StringContext mkCtxFor context = StringContext context path mkLstCtxFor :: ContextFlavor -> NixLikeContextValue -> [StringContext] mkLstCtxFor t c = one (mkCtxFor t) <> go c toNixLikeContextValue :: StringContext -> (NixLikeContextValue, VarName) toNixLikeContextValue sc = ( case getStringContextFlavor sc of DirectPath -> NixLikeContextValue True False mempty AllOutputs -> NixLikeContextValue False True mempty DerivationOutput t -> NixLikeContextValue False False $ one t , getStringContextPath sc ) toNixLikeContext :: S.HashSet StringContext -> NixLikeContext toNixLikeContext stringContext = NixLikeContext $ S.foldr fun mempty stringContext where fun :: (StringContext -> AttrSet NixLikeContextValue -> AttrSet NixLikeContextValue) fun sc = uncurry (M.insertWith (<>)) (swap $ toNixLikeContextValue sc) -- | Add 'StringContext's into the resulting set. addStringContext :: (Monad m) => S.HashSet StringContext -> WithStringContextT m () addStringContext = WithStringContextT . tell -- | Add a 'StringContext' into the resulting set. addSingletonStringContext :: (Monad m) => StringContext -> WithStringContextT m () addSingletonStringContext = WithStringContextT . tell . one -- | Run an action producing a string with a context and put those into a 'NixString'. runWithStringContextT :: (Monad m) => WithStringContextT m Text -> m NixString runWithStringContextT (WithStringContextT m) = uncurry (flip NixString) <$> runWriterT m -- | Run an action producing a string with a context and put those into a 'NixString'. runWithStringContext :: WithStringContextT Identity Text -> NixString runWithStringContext = runIdentity . runWithStringContextT -- ** Modifiers -- | Modify the string part of the NixString, leaving the context unchanged modifyNixContents :: (Text -> Text) -> NixString -> NixString modifyNixContents f (NixString c s) = NixString c (f s) {- | Run an action that manipulates nix strings, and collect the contexts encountered. Warning: this may be unsafe, depending on how you handle the resulting context list. -} runWithStringContextT' :: (Monad m) => WithStringContextT m a -> m (a, S.HashSet StringContext) runWithStringContextT' (WithStringContextT m) = runWriterT m {- | Run an action that manipulates nix strings, and collect the contexts encountered. Warning: this may be unsafe, depending on how you handle the resulting context list. -} runWithStringContext' :: WithStringContextT Identity a -> (a, S.HashSet StringContext) runWithStringContext' = runIdentity . runWithStringContextT' -- | Combine NixStrings with a separator intercalateNixString :: NixString -> [NixString] -> NixString intercalateNixString _ [] = mempty intercalateNixString _ [ns] = ns intercalateNixString sep nss = uncurry NixString $ mapPair ( S.unions . (one (getStringContext sep) <>) . (getStringContext <$>) , Text.intercalate (getStringContent sep) . (getStringContent <$>) ) $ dup nss ================================================ FILE: src/Nix/TH.hs ================================================ {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -Wno-missing-fields #-} {-# OPTIONS_GHC -Wno-type-defaults #-} module Nix.TH where import Data.Fix (Fix (Fix)) import Data.Generics.Aliases (extQ) import qualified Data.Set as Set import Language.Haskell.TH import Language.Haskell.TH.Quote import Nix.Atoms import Nix.Expr.Types import Nix.Expr.Types.Annotated import Nix.Parser import Nix.Prelude removeMissingNames :: Set VarName -> Q (Set VarName) removeMissingNames = fmap Set.fromAscList . filterM (fmap isJust . lookupValueName . toString) . Set.toAscList quoteExprExp :: String -> ExpQ quoteExprExp s = do expr <- parseExpr $ fromString s vars <- removeMissingNames $ getFreeVars expr dataToExpQ (extQOnFreeVars metaExp vars) expr quoteExprPat :: String -> PatQ quoteExprPat s = do expr <- parseExpr @Q $ fromString s vars <- removeMissingNames $ getFreeVars expr dataToPatQ (extQOnFreeVars @_ @NExprLoc @PatQ metaPat vars) expr -- | Helper function. extQOnFreeVars :: (Typeable b, Typeable loc) => (Set VarName -> loc -> Maybe q) -> Set VarName -> b -> Maybe q extQOnFreeVars f = extQ (const Nothing) . f class ToExpr a where toExpr :: a -> NExpr instance ToExpr NExpr where toExpr = id instance ToExpr VarName where toExpr = Fix . NSym instance {-# OVERLAPPING #-} ToExpr String where toExpr = Fix . NStr . fromString instance ToExpr Text where toExpr = toExpr . toString instance ToExpr Int where toExpr = Fix . NConstant . NInt . fromIntegral instance ToExpr Bool where toExpr = Fix . NConstant . NBool instance ToExpr Integer where toExpr = Fix . NConstant . NInt instance ToExpr Float where toExpr = Fix . NConstant . NFloat instance (ToExpr a) => ToExpr [a] where toExpr = Fix . NList . fmap toExpr instance (ToExpr a) => ToExpr (NonEmpty a) where toExpr = toExpr . toList instance ToExpr () where toExpr = const $ Fix $ NConstant NNull instance (ToExpr a) => ToExpr (Maybe a) where toExpr = maybe (toExpr (mempty :: ())) toExpr instance (ToExpr a, ToExpr b) => ToExpr (Either a b) where toExpr = either toExpr toExpr metaExp :: Set VarName -> NExpr -> Maybe ExpQ metaExp fvs (Fix (NSym x)) | x `Set.member` fvs = pure [|toExpr $(varE (mkName $ toString x))|] metaExp _ _ = Nothing metaPat :: Set VarName -> NExprLoc -> Maybe PatQ metaPat fvs (NSymAnn _ x) | x `Set.member` fvs = pure $ varP $ mkName $ toString x metaPat _ _ = Nothing -- Use of @QuasiQuoter@ requires @String@. -- After @Text -> String@ migrations done, _maybe_ think to use @QuasiText@. nix :: QuasiQuoter nix = QuasiQuoter{quoteExp = quoteExprExp, quotePat = quoteExprPat} ================================================ FILE: src/Nix/Thunk/Basic.hs ================================================ {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-unused-do-bind #-} module Nix.Thunk.Basic ( NThunkF (..), Deferred (..), deferred, MonadBasicThunk, ) where import Control.Monad.Catch ( MonadCatch (..), MonadThrow (throwM), ) import Control.Monad.Ref ( MonadAtomicRef (atomicModifyRef), MonadRef (Ref, newRef, readRef, writeRef), ) import Nix.Prelude import Nix.Thunk import qualified Text.Show -- * Data type @Deferred@ {- | Data is computed OR in a lazy thunk state which is still not evaluated. -} data Deferred m v = Computed v | Deferred (m v) deriving (Functor, Foldable, Traversable) -- ** Utils {- | Apply second if @Deferred@, otherwise (@Computed@) - apply first. Analog of @either@ for @Deferred = Computed|Deferred@. -} deferred :: (v -> b) -> (m v -> b) -> Deferred m v -> b deferred f1 f2 = \case Computed v -> f1 v Deferred action -> f2 action {-# INLINE deferred #-} -- * Thunk references & lock handling {- | Thunk resource reference (@ref-tf: Ref m@), and as such also also hold a @Bool@ lock flag. -} type ThunkRef m = Ref m Bool -- | Reference (@ref-tf: Ref m v@) to a value that the thunk holds. type ThunkValueRef m v = Ref m (Deferred m v) -- | @ref-tf@ lock instruction for @Ref m@ (@ThunkRef@). lockVal :: Bool -> (Bool, Bool) lockVal = (True,) -- | @ref-tf@ unlock instruction for @Ref m@ (@ThunkRef@). unlockVal :: Bool -> (Bool, Bool) unlockVal = (False,) -- | Takes @ref-tf: Ref m@ reference, returns Bool result of the operation. lock :: ( MonadBasicThunk m , MonadCatch m ) => ThunkRef m -> m Bool lock r = atomicModifyRef r lockVal -- | Takes @ref-tf: Ref m@ reference, returns Bool result of the operation. unlock :: ( MonadBasicThunk m , MonadCatch m ) => ThunkRef m -> m Bool unlock r = atomicModifyRef r unlockVal -- * Data type for thunks: @NThunkF@ -- | The type of very basic thunks data NThunkF m v = Thunk (ThunkId m) (ThunkRef m) (ThunkValueRef m v) instance (Eq v, Eq (ThunkId m)) => Eq (NThunkF m v) where Thunk x _ _ == Thunk y _ _ = x == y instance Show (NThunkF m v) where show Thunk{} = toString thunkStubText type MonadBasicThunk m = (MonadThunkId m, MonadAtomicRef m) -- ** @instance MonadThunk NThunkF@ instance (MonadBasicThunk m, MonadCatch m) => MonadThunk (NThunkF m v) m v where thunkId :: NThunkF m v -> ThunkId m thunkId (Thunk n _ _) = n thunk :: m v -> m (NThunkF m v) thunk action = do freshThunkId <- freshId liftA2 (Thunk freshThunkId) (newRef False) (newRef $ Deferred action) query :: m v -> NThunkF m v -> m v query vStub (Thunk _ _ lTValRef) = deferred pure (const vStub) =<< readRef lTValRef force :: NThunkF m v -> m v force = forceMain forceEff :: NThunkF m v -> m v forceEff = forceMain further :: NThunkF m v -> m (NThunkF m v) further t@(Thunk _ _ ref) = const (pure t) =<< atomicModifyRef ref dup -- *** United body of `force*` {- | Always returns computed @m v@. Checks if resource is computed, if not - with locking evaluates the resource. -} forceMain :: forall v m. ( MonadBasicThunk m , MonadCatch m ) => NThunkF m v -> m v forceMain (Thunk tIdV tRefV tValRefV) = deferred pure computeW =<< readRef tValRefV where computeW :: m v -> m v computeW vDefferred = do locked <- lock tRefV bool lockFailedV ( do v <- vDefferred `catch` bindFailedW writeRef tValRefV $ Computed v -- Proclaim value computed unlockRef pure v ) $ not locked where lockFailedV :: m a lockFailedV = throwM $ ThunkLoop $ show tIdV bindFailedW :: SomeException -> m b bindFailedW (e :: SomeException) = do unlockRef throwM e unlockRef :: m Bool unlockRef = unlock tRefV {-# INLINE forceMain #-} -- it is big function, but internal, and look at its use. -- ** Kleisli functor HOFs: @instance MonadThunkF NThunkF@ instance (MonadBasicThunk m, MonadCatch m) => MonadThunkF (NThunkF m v) m v where queryF :: (v -> m r) -> m r -> NThunkF m v -> m r queryF k n (Thunk _ thunkRef thunkValRef) = do locked <- lock thunkRef bool n go (not locked) where go = do eres <- readRef thunkValRef res <- deferred k (const n) eres unlockRef pure res unlockRef = unlock thunkRef forceF :: (v -> m a) -> NThunkF m v -> m a forceF k = k <=< force forceEffF :: (v -> m r) -> NThunkF m v -> m r forceEffF k = k <=< forceEff furtherF :: (m v -> m v) -> NThunkF m v -> m (NThunkF m v) furtherF k t@(Thunk _ _ ref) = do _modifiedIt <- atomicModifyRef ref $ \x -> deferred (const (x, x)) (\d -> (Deferred (k d), x)) x pure t ================================================ FILE: src/Nix/Thunk.hs ================================================ {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} module Nix.Thunk where import Control.Monad.Trans.Writer (WriterT) import Nix.Prelude import qualified Text.Show -- ** @class MonadThunkId@ & @instances@ class ( Monad m , Eq (ThunkId m) , Ord (ThunkId m) , Show (ThunkId m) , Typeable (ThunkId m) ) => MonadThunkId m where type ThunkId m :: Type freshId :: m (ThunkId m) default freshId :: ( MonadThunkId m' , MonadTrans t , m ~ t m' , ThunkId m ~ ThunkId m' ) => m (ThunkId m) freshId = lift freshId -- *** Instances instance (MonadThunkId m) => MonadThunkId (ReaderT r m) where type ThunkId (ReaderT r m) = ThunkId m instance ( Monoid w , MonadThunkId m ) => MonadThunkId (WriterT w m) where type ThunkId (WriterT w m) = ThunkId m instance (MonadThunkId m) => MonadThunkId (ExceptT e m) where type ThunkId (ExceptT e m) = ThunkId m instance (MonadThunkId m) => MonadThunkId (StateT s m) where type ThunkId (StateT s m) = ThunkId m -- ** @class MonadThunk@ class (MonadThunkId m) => MonadThunk t m a | t -> m , t -> a where -- | Return thunk ID. thunkId :: t -> ThunkId m -- | Create new thunk thunk :: m a -> m t -- | Non-blocking query. -- If thunk got computed -- then return its value -- otherwise return default value (1st arg). query :: m a -> t -> m a force :: t -> m a forceEff :: t -> m a -- | Modify the action to be performed by the thunk. For some implicits -- this modifies the thunk, for others it may create a new thunk. further :: t -> m t -- ** @class MonadThunk@ -- | Class of Kleisli functors for easiness of customized implementation developlemnt. class MonadThunkF t m a | t -> m, t -> a where queryF :: (a -> m r) -> m r -> t -> m r forceF :: (a -> m r) -> t -> m r forceEffF :: (a -> m r) -> t -> m r furtherF :: (m a -> m a) -> t -> m t -- ** @newtype ThunkLoop@ newtype ThunkLoop = ThunkLoop Text -- contains rendering of ThunkId deriving (Typeable) instance Show ThunkLoop where show (ThunkLoop i) = toString $ "ThunkLoop " <> i instance Exception ThunkLoop -- ** Utils thunkStubText :: Text thunkStubText = "" ================================================ FILE: src/Nix/Type/Assumption.hs ================================================ {-# LANGUAGE TypeFamilies #-} {- | Basing on the Nix (Hindley–Milner) type system (that provides decidable type inference): gathering assumptions (inference evidence) about polymorphic types. -} module Nix.Type.Assumption ( Assumption (..), empty, lookup, remove, extend, keys, merge, singleton, ) where import Nix.Prelude hiding ( Type, empty, ) import Nix.Expr.Types import Nix.Type.Type newtype Assumption = Assumption [(VarName, Type)] deriving (Eq, Show) -- We pretend that Assumptions can be inconsistent (nonunique keys), -- (just like people in real life). -- The consistency between assumptions is the inference responcibility. instance Semigroup Assumption where (<>) = merge instance Monoid Assumption where mempty = empty instance One Assumption where type OneItem Assumption = (VarName, Type) one vt = Assumption $ one vt -- 2022-01-12: NOTE: `empty` implies Alternative. Either have Alternative or use `mempty` empty :: Assumption empty = Assumption mempty extend :: Assumption -> (VarName, Type) -> Assumption extend a vt = one (coerce vt) <> a remove :: Assumption -> VarName -> Assumption remove a var = coerce rmVar a where rmVar :: [(VarName, Type)] -> [(VarName, Type)] rmVar = filter ((/=) var . fst) lookup :: VarName -> Assumption -> [Type] lookup key a = snd <$> filter ((==) key . fst) (coerce a) merge :: Assumption -> Assumption -> Assumption merge = coerce ((<>) @[(VarName, Type)]) singleton :: VarName -> Type -> Assumption singleton = curry one keys :: Assumption -> [VarName] keys (Assumption a) = fst <$> a ================================================ FILE: src/Nix/Type/Env.hs ================================================ {-# LANGUAGE TypeFamilies #-} module Nix.Type.Env ( Env (..), empty, lookup, remove, extend, extends, merge, mergeEnvs, singleton, keys, fromList, toList, ) where import Nix.Prelude hiding ( empty, fromList, toList, ) import Nix.Expr.Types import Nix.Type.Type import qualified Data.Map as Map -- * Typing Environment newtype Env = TypeEnv (Map VarName [Scheme]) deriving (Eq, Show) instance Semigroup Env where -- \| Right-biased merge (override). Analogous to @//@ in @Nix@ -- Since nature of environment is to update & grow. (<>) = mergeRight instance Monoid Env where mempty = empty instance One Env where type OneItem Env = (VarName, Scheme) one (x, y) = TypeEnv $ one (x, one y) empty :: Env empty = TypeEnv mempty extend :: Env -> (VarName, [Scheme]) -> Env extend env (x, s) = coerce (Map.insert x s) env remove :: Env -> VarName -> Env remove env var = TypeEnv $ Map.delete var $ coerce env extends :: Env -> [(VarName, [Scheme])] -> Env extends env xs = fromList xs <> coerce env lookup :: VarName -> Env -> Maybe [Scheme] lookup key tys = Map.lookup key $ coerce tys merge :: Env -> Env -> Env merge a b = TypeEnv $ coerce a <> coerce b mergeRight :: Env -> Env -> Env mergeRight = flip merge mergeEnvs :: [Env] -> Env mergeEnvs = foldl' (<>) mempty singleton :: VarName -> Scheme -> Env singleton = curry one keys :: Env -> [VarName] keys (TypeEnv env) = Map.keys env fromList :: [(VarName, [Scheme])] -> Env fromList xs = coerce $ Map.fromList xs toList :: Env -> [(VarName, [Scheme])] toList (TypeEnv env) = Map.toList env ================================================ FILE: src/Nix/Type/Infer.hs ================================================ {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE CPP #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiWayIf #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -Wno-name-shadowing #-} module Nix.Type.Infer ( Constraint (..), TypeError (..), InferError (..), Subst (..), inferTop, ) where import Control.Monad.Catch ( MonadCatch (..), MonadThrow (..), ) import Control.Monad.Except (MonadError (catchError, throwError)) import Control.Monad.Fix (MonadFix) import Control.Monad.Logic import Control.Monad.Ref ( MonadAtomicRef (..), MonadRef (..), ) import Control.Monad.ST ( ST, runST, ) import Data.Fix (foldFix) import qualified Data.HashMap.Lazy as M import Data.List ( delete, intersect, (!!), (\\), ) import qualified Data.List as List import qualified Data.Map as Map import Data.Maybe (fromJust) import qualified Data.Set as Set import Nix.Atoms import Nix.Convert import Nix.Eval (MonadEval (..)) import qualified Nix.Eval as Eval ( eval, evalWithAttrSet, ) import Nix.Expr.Types import Nix.Fresh import Nix.Prelude hiding ( Constraint, TVar, Type, ) import Nix.Scope import Nix.String import Nix.Type.Assumption hiding (extend) import qualified Nix.Type.Assumption as Assumption import Nix.Type.Env import qualified Nix.Type.Env as Env import Nix.Type.Type import Nix.Value.Monad normalizeScheme :: Scheme -> Scheme normalizeScheme (Forall _ body) = Forall (snd <$> ord) (normtype body) where ord = zip (ordNub $ fv body) (TV . fromString <$> letters) fv (TVar a) = one a fv (a :~> b) = on (<>) fv a b fv (TCon _) = mempty fv (TSet _ a) = foldMap fv $ M.elems a fv (TList a) = foldMap fv a fv (TMany ts) = foldMap fv ts normtype (a :~> b) = normtype a :~> normtype b normtype (TCon a) = TCon a normtype (TSet b a) = TSet b $ normtype <$> a normtype (TList a) = TList $ normtype <$> a normtype (TMany ts) = TMany $ normtype <$> ts normtype (TVar a) = maybe (error "type variable not in signature") TVar (List.lookup a ord) generalize :: Set.Set TVar -> Type -> Scheme generalize free t = Forall as t where as = Set.toList $ free `Set.difference` ftv t -- | Canonicalize and return the polymorphic toplevel type. closeOver :: Type -> Scheme closeOver = normalizeScheme . generalize mempty -- When `[]` becomes `NonEmpty` - function becomes just `all` -- | Check if all elements are of the same type. allSameType :: [Type] -> Bool allSameType = allSame where allSame :: (Eq a) => [a] -> Bool allSame [] = True allSame (x : xs) = all (x ==) xs -- * data type @TypeError@ data TypeError = UnificationFail Type Type | InfiniteType TVar Type | UnboundVariables [VarName] | Ambigious [Constraint] | UnificationMismatch [Type] [Type] deriving (Eq, Show, Ord) -- * @InferError@ data InferError = TypeInferenceErrors [TypeError] | TypeInferenceAborted | forall s. (Exception s) => EvaluationError s typeError :: (MonadError InferError m) => TypeError -> m () typeError err = throwError $ TypeInferenceErrors $ one err -- ** Instances deriving instance Show InferError instance Exception InferError instance Semigroup InferError where (<>) = const instance Monoid InferError where mempty = TypeInferenceAborted -- * @InferState@: inference state -- | Inference state (stage). newtype InferState = InferState Int deriving (Eq, Num, Enum, Ord) instance Semigroup InferState where (<>) = (+) instance Monoid InferState where mempty = 0 -- | Initial inference state initInfer :: InferState initInfer = InferState 0 letters :: [String] letters = do l <- [1 ..] replicateM l ['a' .. 'z'] freshTVar :: (MonadState InferState m) => m TVar freshTVar = do s <- get put $ succ s pure $ TV $ fromString $ letters !! coerce s fresh :: (MonadState InferState m) => m Type fresh = TVar <$> freshTVar intoFresh :: (Traversable t, MonadState InferState f) => t a -> f (t Type) intoFresh = traverse (const fresh) instantiate :: (MonadState InferState m) => Scheme -> m Type instantiate (Forall as t) = fmap ((`apply` t) . coerce . Map.fromList . zip as) (intoFresh as) -- * @Constraint@ data type data Constraint = EqConst Type Type | ExpInstConst Type Scheme | ImpInstConst Type (Set.Set TVar) Type deriving (Show, Eq, Ord) -- * @Subst@ data type -- | Substitution of the basic type definition by a type variable. newtype Subst = Subst (Map TVar Type) deriving (Eq, Ord, Show, Semigroup, Monoid) -- | Compose substitutions compose :: Subst -> Subst -> Subst compose a@(Subst s2) (Subst s1) = coerce $ -- apply a <$> (s2 <> s1) -- * class @Substitutable@ class Substitutable a where apply :: Subst -> a -> a -- ** Instances instance Substitutable TVar where apply (Subst s) a = tv where (TVar tv) = Map.findWithDefault (TVar a) a s instance Substitutable Type where apply _ (TCon a) = TCon a apply s (TSet b a) = TSet b $ apply s <$> a apply s (TList a) = TList $ apply s <$> a apply (Subst s) t@(TVar a) = Map.findWithDefault t a s apply s (t1 :~> t2) = ((:~>) `on` apply s) t1 t2 apply s (TMany ts) = TMany $ apply s <$> ts instance Substitutable Scheme where apply (Subst s) (Forall as t) = Forall as $ apply s' t where s' = Subst $ foldr Map.delete s as instance Substitutable Constraint where apply s (EqConst t1 t2) = on EqConst (apply s) t1 t2 apply s (ExpInstConst t sc) = ExpInstConst (apply s t) (apply s sc) apply s (ImpInstConst t1 ms t2) = ImpInstConst (apply s t1) (apply s ms) (apply s t2) instance (Substitutable a) => Substitutable [a] where apply = fmap . apply instance (Ord a, Substitutable a) => Substitutable (Set.Set a) where apply = Set.map . apply -- * data type @Judgment@ data Judgment s = Judgment { assumptions :: Assumption , typeConstraints :: [Constraint] , inferredType :: Type } deriving (Show) inferred :: Type -> Judgment s inferred = Judgment mempty mempty -- * @InferT@: inference monad type InferTInternals s m a = ReaderT (Set.Set TVar, Scopes (InferT s m) (Judgment s)) (StateT InferState (ExceptT InferError m)) a -- | Inference monad newtype InferT s m a = InferT { getInfer :: InferTInternals s m a } deriving ( Functor , Applicative , Alternative , Monad , MonadPlus , MonadFix , MonadReader (Set.Set TVar, Scopes (InferT s m) (Judgment s)) , MonadFail , MonadState InferState , MonadError InferError ) extendMSet :: forall s m a. (Monad m) => TVar -> InferT s m a -> InferT s m a extendMSet x = coerce putSetElementM where putSetElementM :: InferTInternals s m a -> InferTInternals s m a putSetElementM = local (first . Set.insert $ x) -- ** Instances instance MonadTrans (InferT s) where lift = InferT . lift . lift . lift instance (MonadRef m) => MonadRef (InferT s m) where type Ref (InferT s m) = Ref m newRef x = liftInfer $ newRef x readRef x = liftInfer $ readRef x writeRef x y = liftInfer $ writeRef x y instance (MonadAtomicRef m) => MonadAtomicRef (InferT s m) where atomicModifyRef x f = liftInfer $ do res <- snd . f <$> readRef x _ <- modifyRef x $ fst . f pure res instance (Monad m) => MonadThrow (InferT s m) where throwM = throwError . EvaluationError instance (Monad m) => MonadCatch (InferT s m) where catch m h = catchError m $ \case EvaluationError e -> maybe (error $ "Exception was not an exception: " <> show e) h (fromException $ toException e) err -> error $ "Unexpected error: " <> show err -- instance MonadThunkId m => MonadThunkId (InferT s m) where -- type ThunkId (InferT s m) = ThunkId m instance (Monad m) => FromValue NixString (InferT s m) (Judgment s) where fromValueMay _ = stub fromValue _ = error "Unused" instance (MonadInfer m) => FromValue ( AttrSet (Judgment s) , PositionSet ) (InferT s m) (Judgment s) where fromValueMay (Judgment _ _ (TSet _ xs)) = do let sing = const inferred pure $ pure (M.mapWithKey sing xs, mempty) fromValueMay _ = stub fromValue = pure . maybeToMonoid <=< fromValueMay foldInitializedWith :: (Traversable t, Applicative f) => (t c -> c) -> (b -> c) -> (a -> f b) -> t a -> f c foldInitializedWith fld getter init = -- maybe here is some law? fmap fld . traverse (fmap getter . init) toJudgment :: forall t m s. (Traversable t, Monad m) => (t Type -> Type) -> t (Judgment s) -> InferT s m (Judgment s) toJudgment c xs = liftA3 Judgment (foldWith fold assumptions) (foldWith fold typeConstraints) (foldWith c inferredType) where foldWith :: (t a -> a) -> (Judgment s -> a) -> InferT s m a foldWith g f = foldInitializedWith g f demand xs instance (MonadInfer m) => ToValue (AttrSet (Judgment s), PositionSet) (InferT s m) (Judgment s) where toValue :: (AttrSet (Judgment s), PositionSet) -> InferT s m (Judgment s) toValue (xs, _) = toJudgment (TSet Variadic) xs -- why variadic? Probably `Closed` (`mempty`)? instance (MonadInfer m) => ToValue [Judgment s] (InferT s m) (Judgment s) where toValue = toJudgment TList instance (MonadInfer m) => ToValue Bool (InferT s m) (Judgment s) where toValue _ = pure $ inferred typeBool instance (Monad m) => Scoped (Judgment s) (InferT s m) where askScopes = askScopesReader clearScopes = clearScopesReader @(InferT s m) @(Judgment s) pushScopes = pushScopesReader lookupVar = lookupVarReader -- newtype JThunkT s m = JThunk (NThunkF (InferT s m) (Judgment s)) -- 2021-02-22: NOTE: Seems like suporflous instance instance (Monad m) => MonadValue (Judgment s) (InferT s m) where defer :: InferT s m (Judgment s) -> InferT s m (Judgment s) defer = id demand :: Judgment s -> InferT s m (Judgment s) demand = pure inform :: Judgment s -> InferT s m (Judgment s) inform = pure -- 2021-02-22: NOTE: Seems like suporflous instance instance (Monad m) => MonadValueF (Judgment s) (InferT s m) where demandF :: ( Judgment s -> InferT s m r ) -> Judgment s -> InferT s m r demandF f = f informF :: ( InferT s m (Judgment s) -> InferT s m (Judgment s) ) -> Judgment s -> InferT s m (Judgment s) informF f = f . pure {- instance MonadInfer m => MonadThunk (JThunkT s m) (InferT s m) (Judgment s) where thunkId (JThunk x) = thunkId x thunk = fmap JThunk . thunk query b (JThunk x) = query b x -- If we have a thunk loop, we just don't know the type. force (JThunk t) = catch (force t) $ \(_ :: ThunkLoop) -> f =<< Judgment mempty mempty <$> fresh -- If we have a thunk loop, we just don't know the type. forceEff (JThunk t) = catch (forceEff t) $ \(_ :: ThunkLoop) -> f =<< Judgment mempty mempty <$> fresh -} polymorphicVar :: (MonadInfer m) => VarName -> InferT s m (Judgment s) polymorphicVar var = fmap (join $ (`Judgment` mempty) . curry one var) fresh constInfer :: (Applicative f) => Type -> b -> f (Judgment s) constInfer x = const $ pure $ inferred x instance (MonadInfer m) => MonadEval (Judgment s) (InferT s m) where freeVariable = polymorphicVar synHole = polymorphicVar -- If we fail to look up an attribute, we just don't know the type. attrMissing _ _ = inferred <$> fresh evaledSym _ = pure evalCurPos = pure $ inferred $ TSet mempty $ M.fromList [ ("file", typePath) , ("line", typeInt) , ("col", typeInt) ] evalConstant c = pure $ inferred $ fun c where fun = \case NURI _ -> typeString NInt _ -> typeInt NFloat _ -> typeFloat NBool _ -> typeBool NNull -> typeNull evalString = constInfer typeString evalLiteralPath = constInfer typePath evalEnvPath = constInfer typePath evalUnary op (Judgment as1 cs1 t1) = (Judgment as1 =<< (cs1 <>) . (`unops` op) . (t1 :~>)) <$> fresh evalBinary op (Judgment as1 cs1 t1) e2 = do Judgment as2 cs2 t2 <- e2 (Judgment (as1 <> as2) =<< ((cs1 <> cs2) <>) . (`binops` op) . ((t1 :~> t2) :~>)) <$> fresh evalWith = Eval.evalWithAttrSet evalIf (Judgment as1 cs1 t1) t f = do Judgment as2 cs2 t2 <- t Judgment as3 cs3 t3 <- f pure $ Judgment (as1 <> as2 <> as3) (cs1 <> cs2 <> cs3 <> [EqConst t1 typeBool, EqConst t2 t3]) t2 evalAssert (Judgment as1 cs1 t1) body = do Judgment as2 cs2 t2 <- body pure $ Judgment (as1 <> as2) (cs1 <> cs2 <> one (EqConst t1 typeBool)) t2 evalApp (Judgment as1 cs1 t1) e2 = do Judgment as2 cs2 t2 <- e2 tv <- fresh pure $ Judgment (as1 <> as2) (cs1 <> cs2 <> one (EqConst t1 (t2 :~> tv))) tv evalAbs (Param x) k = do a <- freshTVar let tv = TVar a ((), Judgment as cs t) <- extendMSet a $ k (pure (join ((`Judgment` mempty) . curry one x) tv)) $ const $ fmap (mempty,) pure $ Judgment (as `Assumption.remove` x) (cs <> [EqConst t' tv | t' <- Assumption.lookup x as]) (tv :~> t) evalAbs (ParamSet _mname variadic pset) k = do js <- foldInitializedWith fold one intoFresh pset let f (as1, t1) (k, t) = (as1 <> one (k, t), M.insert k t t1) (env, tys) = foldl' f mempty js arg = pure $ Judgment env mempty $ TSet Variadic tys call = k arg $ \args b -> (args,) <$> b names = fst <$> js (args, Judgment as cs t) <- foldr (extendMSet . (\(TVar a) -> a) . snd) call js ty <- foldInitializedWith (TSet variadic) inferredType id args pure $ Judgment (foldl' Assumption.remove as names) (cs <> [EqConst t' (tys M.! x) | x <- names, t' <- Assumption.lookup x as]) (ty :~> t) evalError = throwError . EvaluationError -- * class @FreeTypeVars@ class FreeTypeVars a where ftv :: a -> Set.Set TVar occursCheck :: (FreeTypeVars a) => TVar -> a -> Bool occursCheck a t = a `Set.member` ftv t -- ** Instances instance FreeTypeVars Type where ftv TCon{} = mempty ftv (TVar a) = one a ftv (TSet _ a) = Set.unions $ ftv <$> M.elems a ftv (TList a) = Set.unions $ ftv <$> a ftv (t1 :~> t2) = ftv t1 <> ftv t2 ftv (TMany ts) = Set.unions $ ftv <$> ts instance FreeTypeVars TVar where ftv = one instance FreeTypeVars Scheme where ftv (Forall as t) = ftv t `Set.difference` Set.fromList as instance (FreeTypeVars a) => FreeTypeVars [a] where ftv = foldr ((<>) . ftv) mempty instance (Ord a, FreeTypeVars a) => FreeTypeVars (Set.Set a) where ftv = foldr ((<>) . ftv) mempty -- * class @ActiveTypeVars@ class ActiveTypeVars a where atv :: a -> Set.Set TVar -- ** Instances instance ActiveTypeVars Constraint where atv (EqConst t1 t2) = ftv t1 <> ftv t2 atv (ImpInstConst t1 ms t2) = ftv t1 <> (ftv ms `Set.intersection` ftv t2) atv (ExpInstConst t s) = ftv t <> ftv s instance (ActiveTypeVars a) => ActiveTypeVars [a] where atv = foldr ((<>) . atv) mempty -- * Other type MonadInfer m = ( {- MonadThunkId m,-} MonadAtomicRef m , MonadFix m ) -- | Run the inference monad runInfer' :: (MonadInfer m) => InferT s m a -> m (Either InferError a) runInfer' = runExceptT . (`evalStateT` initInfer) . (`runReaderT` mempty) . getInfer runInfer :: (forall s. InferT s (FreshIdT Int (ST s)) a) -> Either InferError a runInfer m = runST $ runFreshIdT (runInfer' m) =<< newRef (1 :: Int) inferType :: forall s m. (MonadInfer m) => Env -> NExpr -> InferT s m [(Subst, Type)] inferType env ex = do Judgment as cs t <- infer ex let unbounds :: Set VarName unbounds = (Set.difference `on` Set.fromList) (Assumption.keys as) (Env.keys env) when (isPresent unbounds) $ typeError $ UnboundVariables $ ordNub $ Set.toList unbounds inferState <- get let cs' = [ ExpInstConst t s | (x, ss) <- Env.toList env , s <- ss , t <- Assumption.lookup x as ] evalResult = (`evalState` inferState) . runSolver $ second (`apply` t) . join (,) <$> solve (cs <> cs') either (throwError . TypeInferenceErrors) pure evalResult -- | Solve for the toplevel type of an expression in a given environment inferExpr :: Env -> NExpr -> Either InferError [Scheme] inferExpr env ex = closeOver . uncurry apply <<$>> runInfer (inferType env ex) unops :: Type -> NUnaryOp -> [Constraint] unops u1 op = one $ EqConst u1 $ case op of NNot -> mkUnaryConstr typeBool NNeg -> TMany $ mkUnaryConstr <$> [typeInt, typeFloat] where mkUnaryConstr :: Type -> Type mkUnaryConstr = typeFun . mk2same where mk2same :: a -> NonEmpty a mk2same a = a :| one a binops :: Type -> NBinaryOp -> [Constraint] binops u1 op = if -- Equality tells nothing about the types, because any two types are allowed. | op `elem` [NEq, NNEq] -> mempty | op `elem` [NGt, NGte, NLt, NLte] -> inequality | op `elem` [NAnd, NOr, NImpl] -> gate | op == NConcat -> concatenation | op `elem` [NMinus, NMult, NDiv] -> arithmetic | op == NUpdate -> rUnion | op == NPlus -> addition | otherwise -> fail "GHC so far can not infer that this pattern match is full, so make it happy." where mk3 :: a -> a -> a -> NonEmpty a mk3 a b c = a :| [b, c] mk3same :: a -> NonEmpty a mk3same a = a :| [a, a] allConst :: Type -> [Constraint] allConst = one . EqConst u1 . typeFun . mk3same gate = allConst typeBool concatenation = allConst typeList eqConstrMtx :: [NonEmpty Type] -> [Constraint] eqConstrMtx = one . EqConst u1 . TMany . fmap typeFun inequality = eqConstrMtx [ mk3 typeInt typeInt typeBool , mk3 typeFloat typeFloat typeBool , mk3 typeInt typeFloat typeBool , mk3 typeFloat typeInt typeBool ] arithmetic = eqConstrMtx [ mk3same typeInt , mk3same typeFloat , mk3 typeInt typeFloat typeFloat , mk3 typeFloat typeInt typeFloat ] rUnion = eqConstrMtx [ mk3same typeSet , mk3 typeSet typeNull typeSet , mk3 typeNull typeSet typeSet ] addition = eqConstrMtx [ mk3same typeInt , mk3same typeFloat , mk3 typeInt typeFloat typeFloat , mk3 typeFloat typeInt typeFloat , mk3same typeString , mk3same typePath , mk3 typeString typeString typePath ] liftInfer :: (Monad m) => m a -> InferT s m a liftInfer = InferT . lift . lift . lift -- * Other infer :: (MonadInfer m) => NExpr -> InferT s m (Judgment s) infer = foldFix Eval.eval inferTop :: Env -> [(VarName, NExpr)] -> Either InferError Env inferTop env [] = pure env inferTop env ((name, ex) : xs) = (\ty -> inferTop (extend env (name, ty)) xs) =<< inferExpr env ex -- * Other newtype Solver m a = Solver (LogicT (StateT [TypeError] m) a) deriving ( Functor , Applicative , Alternative , Monad , MonadPlus , MonadLogic , MonadState [TypeError] ) runSolver :: forall m a. (Monad m) => Solver m a -> m (Either [TypeError] [a]) runSolver (Solver s) = uncurry report <$> runStateT (observeAllT s) mempty where report :: [a] -> [TypeError] -> Either [TypeError] [a] report xs e = handlePresence (Left $ ordNub e) pure xs -- ** Instances instance MonadTrans Solver where lift = Solver . lift . lift instance (Monad m) => MonadError TypeError (Solver m) where throwError err = Solver $ lift (modify (err :)) *> mempty catchError _ _ = error "This is never used" -- * Other bind :: (Monad m) => TVar -> Type -> Solver m Subst bind a t | t == TVar a = stub | occursCheck a t = throwError $ InfiniteType a t | otherwise = pure $ Subst $ one (a, t) considering :: [a] -> Solver m a considering xs = Solver $ LogicT $ \c n -> foldr c n xs unifies :: (Monad m) => Type -> Type -> Solver m Subst unifies t1 t2 | t1 == t2 = stub unifies (TVar v) t = v `bind` t unifies t (TVar v) = v `bind` t unifies (TList xs) (TList ys) | allSameType xs && allSameType ys = case (xs, ys) of (x : _, y : _) -> unifies x y _ -> stub | length xs == length ys = unifyMany xs ys -- Putting a statement that lists of different lengths containing various types would not -- be unified. unifies t1@(TList _) t2@(TList _) = throwError $ UnificationFail t1 t2 unifies (TSet Variadic _) (TSet Variadic _) = stub unifies (TSet Closed s) (TSet Closed b) | null (M.keys b \\ M.keys s) = stub unifies (TSet _ a) (TSet _ b) | (M.keys a `intersect` M.keys b) == M.keys b = stub unifies (t1 :~> t2) (t3 :~> t4) = unifyMany [t1, t2] [t3, t4] unifies (TMany t1s) t2 = considering t1s >>- (`unifies` t2) unifies t1 (TMany t2s) = considering t2s >>- unifies t1 unifies t1 t2 = throwError $ UnificationFail t1 t2 unifyMany :: (Monad m) => [Type] -> [Type] -> Solver m Subst unifyMany [] [] = stub unifyMany (t1 : ts1) (t2 : ts2) = do su1 <- unifies t1 t2 su2 <- (unifyMany `on` apply su1) ts1 ts2 pure $ compose su1 su2 unifyMany t1 t2 = throwError $ UnificationMismatch t1 t2 nextSolvable :: [Constraint] -> (Constraint, [Constraint]) nextSolvable = fromJust . find solvable . pickFirstOne where pickFirstOne :: (Eq a) => [a] -> [(a, [a])] pickFirstOne xs = [(x, ys) | x <- xs, let ys = delete x xs] solvable :: (Constraint, [Constraint]) -> Bool solvable (EqConst{}, _) = True solvable (ExpInstConst{}, _) = True solvable (ImpInstConst _t1 ms t2, cs) = null $ (ms `Set.difference` ftv t2) `Set.intersection` atv cs solve :: forall m. (MonadState InferState m) => [Constraint] -> Solver m Subst solve [] = stub solve cs = solve' $ nextSolvable cs where solve' (ImpInstConst t1 ms t2, cs) = solve (ExpInstConst t1 (generalize ms t2) : cs) solve' (ExpInstConst t s, cs) = do s' <- lift $ instantiate s solve (EqConst t s' : cs) solve' (EqConst t1 t2, cs) = ( \su1 -> (pure . compose su1) -<< solve ((`apply` cs) su1) ) -<< unifies t1 t2 infixr 1 -<< -- | @LogicT@ fair conjunction, since library has only @>>-@ (-<<) :: (Monad m) => (a -> Solver m b) -> Solver m a -> Solver m b (-<<) = flip (>>-) ================================================ FILE: src/Nix/Type/LICENSE ================================================ Copyright (c) 2014-2015, Stephen Diehl Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: src/Nix/Type/Type.hs ================================================ {- | The basis of the Nix type system (type-level). Based on the Hindley–Milner type system. Therefore -> from this the type inference follows. -} module Nix.Type.Type where import Nix.Expr.Types import Nix.Prelude hiding (TVar, Type) -- | Hindrey-Milner type interface -- | Type variable in the Nix type system. newtype TVar = TV Text deriving (Show, Eq, Ord) -- | The basic type definitions in the Nix type system (type-level code). data Type = -- | Type variable in the Nix type system. TVar TVar | -- | Concrete (non-polymorphic, constant) type in the Nix type system. TCon Text | -- | Heterogeneous map in the Nix type system. @True@ -> variadic. TSet Variadic (AttrSet Type) | -- | Heterogeneous list in the Nix type system. TList [Type] | -- | Type arrow (@Type -> Type@) in the Nix type system. (:~>) Type Type | -- | Variant type (term). Since relating to Nix type system, more precicely - -- dynamic types in dynamicly typed language (which is Nix). TMany [Type] deriving (Show, Eq, Ord) infixr 1 :~> {- | Hindley–Milner type system uses "scheme" term for "polytypes". Types containing @forall@ quantifiers: @forall a . a@. Note: HM allows only top-level @forall@ quantification, so no @RankNTypes@ in it. -} data Scheme = -- | @Forall [TVar] Type@: the Nix type system @forall vars. type@. Forall [TVar] Type deriving (Show, Eq, Ord) -- | Concrete types in the Nix type system. typeNull, typeBool, typeInt, typeFloat, typeString, typePath :: Type typeNull = TCon "null" typeBool = TCon "boolean" typeInt = TCon "integer" typeFloat = TCon "float" typeString = TCon "string" typePath = TCon "path" -- This models a set that unifies with any other set. typeSet :: Type typeSet = TSet mempty mempty typeList :: Type typeList = TList mempty typeFun :: NonEmpty Type -> Type typeFun (head_ :| tail_) = foldr (:~>) head_ tail_ ================================================ FILE: src/Nix/Unused.hs ================================================ {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -Wno-missing-signatures #-} {- | This module holds unused code. So, if someone wants something - look here, use it & move to appropriate place. -} module Nix.Unused where import Control.Monad.Free (Free (..)) import Data.Fix (Fix (..)) import Lens.Family2.TH (makeLensesBy) import Nix.Prelude -- * From "Nix.Utils" -- | > type AlgM f m a = f a -> m a type AlgM f m a = f a -> m a whenFree :: (Monoid b) => (f (Free f a) -> b) -> Free f a -> b whenFree = free mempty {-# INLINE whenFree #-} whenPure :: (Monoid b) => (a -> b) -> Free f a -> b whenPure f = free f mempty {-# INLINE whenPure #-} {- | Replace: @Pure a -> a@ @Free -> Fix@ -} freeToFix :: (Functor f) => (a -> Fix f) -> Free f a -> Fix f freeToFix f = go where go = free f $ Fix . (go <$>) {- | Replace: @a -> Pure a@ @Fix -> Free@ -} fixToFree :: (Functor f) => Fix f -> Free f a fixToFree = Free . go where go (Fix f) = Free . go <$> f loeb :: (Functor f) => f (f a -> a) -> f a loeb x = go where go = ($ go) <$> x adiM :: ( Traversable t , Monad m ) => Transform t (m a) -> AlgM t m a -> Fix t -> m a adiM g f = g $ f <=< traverse (adiM g f) . unFix para :: (Functor f) => (f (Fix f, a) -> a) -> Fix f -> a para f = f . fmap (id &&& para f) . unFix paraM :: (Traversable f, Monad m) => (f (Fix f, a) -> m a) -> Fix f -> m a paraM f = f <=< traverse (\x -> (x,) <$> paraM f x) . unFix cataP :: (Functor f) => (Fix f -> f a -> a) -> Fix f -> a cataP f x = f x . fmap (cataP f) . unFix $ x cataPM :: (Traversable f, Monad m) => (Fix f -> f a -> m a) -> Fix f -> m a cataPM f x = f x <=< traverse (cataPM f) . unFix $ x $(makeLensesBy (\n -> pure $ "_" <> n) ''Fix) ================================================ FILE: src/Nix/Utils/Fix1.hs ================================================ {-# LANGUAGE CPP #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} module Nix.Utils.Fix1 ( Fix1 (..), Fix1T (..), MonadFix1T, ) where import Control.Monad.Catch ( MonadCatch, MonadMask, MonadThrow, ) import Control.Monad.Fix (MonadFix) import Control.Monad.Ref ( MonadAtomicRef (..), MonadRef (..), ) import Nix.Prelude {- | The fixpoint combinator. Courtesy of Gregory Malecha. https://gist.github.com/gmalecha/ceb3778b9fdaa4374976e325ac8feced -} newtype Fix1 (t :: (k -> Type) -> k -> Type) (a :: k) = Fix1 {unFix1 :: t (Fix1 t) a} deriving instance Generic (Fix1 t a) deriving instance (Functor (t (Fix1 t))) => Functor (Fix1 t) deriving instance (Applicative (t (Fix1 t))) => Applicative (Fix1 t) deriving instance (Alternative (t (Fix1 t))) => Alternative (Fix1 t) deriving instance (Monad (t (Fix1 t))) => Monad (Fix1 t) deriving instance (MonadPlus (t (Fix1 t))) => MonadPlus (Fix1 t) deriving instance (MonadFix (t (Fix1 t))) => MonadFix (Fix1 t) deriving instance (MonadIO (t (Fix1 t))) => MonadIO (Fix1 t) deriving instance (MonadCatch (t (Fix1 t))) => MonadCatch (Fix1 t) deriving instance (MonadThrow (t (Fix1 t))) => MonadThrow (Fix1 t) deriving instance (MonadReader e (t (Fix1 t))) => MonadReader e (Fix1 t) deriving instance (MonadState s (t (Fix1 t))) => MonadState s (Fix1 t) newtype Fix1T (t :: (k -> Type) -> (Type -> Type) -> k -> Type) (m :: Type -> Type) (a :: k) = Fix1T {unFix1T :: t (Fix1T t m) m a} deriving instance Generic (Fix1T t m m) deriving instance (Functor (t (Fix1T t m) m)) => Functor (Fix1T t m) deriving instance (Applicative (t (Fix1T t m) m)) => Applicative (Fix1T t m) deriving instance (Alternative (t (Fix1T t m) m)) => Alternative (Fix1T t m) deriving instance (Monad (t (Fix1T t m) m)) => Monad (Fix1T t m) deriving instance (MonadFail (t (Fix1T t m) m)) => MonadFail (Fix1T t m) deriving instance (MonadPlus (t (Fix1T t m) m)) => MonadPlus (Fix1T t m) deriving instance (MonadFix (t (Fix1T t m) m)) => MonadFix (Fix1T t m) deriving instance (MonadIO (t (Fix1T t m) m)) => MonadIO (Fix1T t m) deriving instance (MonadCatch (t (Fix1T t m) m)) => MonadCatch (Fix1T t m) deriving instance (MonadThrow (t (Fix1T t m) m)) => MonadThrow (Fix1T t m) deriving instance (MonadMask (t (Fix1T t m) m)) => MonadMask (Fix1T t m) deriving instance (MonadReader e (t (Fix1T t m) m)) => MonadReader e (Fix1T t m) deriving instance (MonadState s (t (Fix1T t m) m)) => MonadState s (Fix1T t m) type MonadFix1T t m = (MonadTrans (Fix1T t), Monad (t (Fix1T t m) m)) instance ( MonadFix1T t m , MonadRef m ) => MonadRef (Fix1T t m) where type Ref (Fix1T t m) = Ref m newRef = lift . newRef {-# INLINE newRef #-} readRef = lift . readRef {-# INLINE readRef #-} writeRef r = lift . writeRef r {-# INLINE writeRef #-} instance ( MonadFix1T t m , MonadAtomicRef m ) => MonadAtomicRef (Fix1T t m) where atomicModifyRef r = lift . atomicModifyRef r {-# INLINE atomicModifyRef #-} {- newtype Flip (f :: i -> j -> *) (a :: j) (b :: i) = Flip { unFlip :: f b a } -- | Natural Transformations -- ( Included from -- [compdata](https://hackage.haskell.org/package/compdata) -- ) type (:->) f g = forall a. f a -> g a class HFunctor f where hfmap :: a :-> b -> f a :-> f b -} ================================================ FILE: src/Nix/Utils.hs ================================================ {-# LANGUAGE CPP #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {- | This is a module of custom "Prelude" code. It is for import for projects other then @HNix@. For @HNix@ - this module gets reexported by "Prelude", so for @HNix@ please fix-up pass-through there. -} module Nix.Utils ( stub, pass, dup, both, mapPair, iterateN, nestM, applyAll, traverse2, lifted, whenTrue, whenFalse, whenJust, isPresent, handlePresence, whenText, free, Path (..), isAbsolute, (), joinPath, splitDirectories, takeDirectory, takeFileName, takeBaseName, takeExtension, takeExtensions, addExtension, dropExtensions, replaceExtension, readFile, Alg, Transform, TransformF, loebM, adi, Has (..), askLocal, KeyMap, trace, traceM, module X, ) where import Relude hiding ( force, pass, readFile, trace, traceM, whenJust, whenNothing, ) import Codec.Serialise (Serialise) import Control.Monad (foldM) import Control.Monad.Fix (MonadFix (..)) import Control.Monad.Free (Free (..)) import Control.Monad.Trans.Control (MonadTransControl (..)) import qualified Data.Aeson as A import Data.Binary (Binary) import Data.Data (Data) import Data.Fix (Fix (..)) import qualified Data.Text as Text import Lens.Family2 as X ( Lens', LensLike', over, view, ) import Lens.Family2.Stock ( _1, _2, ) import qualified System.FilePath as FilePath #if ENABLE_TRACING import qualified Relude.Debug as X #else -- Well, since it is currently CPP intermingled with Debug.Trace, required to use String here. trace :: String -> a -> a trace = const id {-# inline trace #-} traceM :: Monad m => String -> m () traceM = const stub {-# inline traceM #-} #endif -- * Helpers -- After migration from the @relude@ - @relude: pass -> stub@ -- | @pure mempty@: Short-curcuit, stub. stub :: (Applicative f, Monoid a) => f a stub = pure mempty {-# INLINE stub #-} -- | Alias for 'stub', since "Relude" has more specialized @pure ()@. pass :: (Applicative f) => f () pass = stub {-# INLINE pass #-} -- | Duplicates object into a tuple. dup :: a -> (a, a) dup x = (x, x) {-# INLINE dup #-} {- | Apply a single function to both components of a pair. > both succ (1,2) == (2,3) Taken From package @extra@ -} both :: (a -> b) -> (a, a) -> (b, b) both f (x, y) = (f x, f y) {-# INLINE both #-} {- | Gives tuple laziness. Takem from @utility-ht@. -} mapPair :: (a -> c, b -> d) -> (a, b) -> (c, d) mapPair ~(f, g) ~(a, b) = (f a, g b) {-# INLINE mapPair #-} iterateN :: forall a. -- | Recursively apply 'Int' times Int -> -- | the function (a -> a) -> -- | starting from argument a -> a iterateN n f x = -- It is hard to read - yes. It is a non-recursive momoized action - yes. fix ((<*> (0 /=)) . ((bool x . f) .) . (. pred)) n nestM :: (Monad m) => -- | Recursively apply 'Int' times Int -> -- | function (Kleisli arrow). (a -> m a) -> -- | to value a -> -- | & join layers of 'm' m a nestM 0 _ x = pure x nestM n f x = foldM (const . f) x $ replicate @() n mempty -- fuses. But also, can it be fix join? {-# INLINE nestM #-} -- | In `foldr` order apply functions. applyAll :: (Foldable t) => t (a -> a) -> a -> a applyAll = flip (foldr id) traverse2 :: ( Applicative m , Applicative n , Traversable t ) => -- | Run function that runs 2 'Applicative' actions ( a -> m (n b) ) -> -- | on every element in 'Traversable' t a -> -- | collect the results. m (n (t b)) traverse2 f x = sequenceA <$> traverse f x -- 2021-08-21: NOTE: Someone needs to put in normal words, what this does. -- This function is pretty spefic & used only once, in "Nix.Normal". lifted :: (MonadTransControl u, Monad (u m), Monad m) => ((a -> m (StT u b)) -> m (StT u b)) -> (a -> u m b) -> u m b lifted f k = restoreT . pure =<< liftWith (\run -> f (run . k)) -- * Eliminators whenTrue :: (Monoid a) => a -> Bool -> a whenTrue = bool mempty {-# INLINE whenTrue #-} whenFalse :: (Monoid a) => a -> Bool -> a whenFalse f = bool f mempty {-# INLINE whenFalse #-} whenJust :: (Monoid b) => (a -> b) -> Maybe a -> b whenJust = maybe mempty {-# INLINE whenJust #-} isPresent :: (Foldable t) => t a -> Bool isPresent = not . null {-# INLINE isPresent #-} -- | 'maybe'-like eliminator, for foldable empty/inhabited structures. handlePresence :: (Foldable t) => b -> (t a -> b) -> t a -> b handlePresence d f t = bool d (f t) (isPresent t) {-# INLINE handlePresence #-} whenText :: a -> (Text -> a) -> Text -> a whenText e f t = bool e (f t) (not $ Text.null t) -- | Lambda analog of @maybe@ or @either@ for Free monad. free :: (a -> b) -> (f (Free f a) -> b) -> Free f a -> b free fP fF fr = case fr of Pure a -> fP a Free fa -> fF fa {-# INLINE free #-} -- * Path -- | Explicit type boundary between FilePath & String. newtype Path = Path FilePath deriving ( Eq , Ord , Generic , Typeable , Data , NFData , Serialise , Binary , A.ToJSON , A.FromJSON , Show , Read , Hashable , Semigroup , Monoid ) instance ToText Path where toText = toText @String . coerce instance IsString Path where fromString = coerce -- ** Path functions -- | This set of @Path@ funcs is to control system filepath types & typesafety and to easily migrate from FilePath to anything suitable (like @path@ or so). -- | 'Path's 'FilePath.isAbsolute'. isAbsolute :: Path -> Bool isAbsolute = coerce FilePath.isAbsolute -- | 'Path's 'FilePath.()'. () :: Path -> Path -> Path () = coerce (FilePath.) infixr 5 -- | 'Path's 'FilePath.joinPath'. joinPath :: [Path] -> Path joinPath = coerce FilePath.joinPath -- | 'Path's 'FilePath.splitDirectories'. splitDirectories :: Path -> [Path] splitDirectories = coerce FilePath.splitDirectories -- | 'Path's 'FilePath.takeDirectory'. takeDirectory :: Path -> Path takeDirectory = coerce FilePath.takeDirectory -- | 'Path's 'FilePath.takeFileName'. takeFileName :: Path -> Path takeFileName = coerce FilePath.takeFileName -- | 'Path's 'FilePath.takeBaseName'. takeBaseName :: Path -> String takeBaseName = coerce FilePath.takeBaseName -- | 'Path's 'FilePath.takeExtension'. takeExtension :: Path -> String takeExtension = coerce FilePath.takeExtensions -- | 'Path's 'FilePath.takeExtensions'. takeExtensions :: Path -> String takeExtensions = coerce FilePath.takeExtensions -- | 'Path's 'FilePath.addExtensions'. addExtension :: Path -> String -> Path addExtension = coerce FilePath.addExtension -- | 'Path's 'FilePath.dropExtensions'. dropExtensions :: Path -> Path dropExtensions = coerce FilePath.dropExtensions -- | 'Path's 'FilePath.replaceExtension'. replaceExtension :: Path -> String -> Path replaceExtension = coerce FilePath.replaceExtension -- | 'Path's 'FilePath.readFile'. readFile :: (MonadIO m) => Path -> m Text readFile = fmap decodeUtf8 . readFileBS . coerce -- * Recursion scheme {- | F-algebra defines how to reduce the fixed-point of a functor to a value. > type Alg f a = f a -> a -} type Alg f a = f a -> a {- | Do according transformation. It is a transformation of a recursion scheme. See @TransformF@. -} type Transform f a = TransformF (Fix f) a {- | Do according transformation. It is a transformation between functors. -} type TransformF f a = (f -> a) -> f -> a loebM :: (MonadFix m, Traversable t) => t (t a -> m a) -> m (t a) loebM f = mfix $ \a -> (`traverse` f) ($ a) {-# INLINE loebM #-} {- | adi is Abstracting Definitional Interpreters: https://arxiv.org/abs/1707.04755 All ADI does is interleaves every layer of evaluation by inserting intermitten layers between them, in that way the evaluation can be extended/embelished in any way wanted. Look at its use to see great examples. Essentially, it does for evaluation what recursion schemes do for representation: allows threading layers through existing structure, only in this case through behavior. -} adi :: (Functor f) => Transform f a -> Alg f a -> Fix f -> a adi g f = g $ f . (adi g f <$>) . unFix -- * Has lens class Has a b where hasLens :: Lens' a b instance Has a a where hasLens f = f instance Has (a, b) a where hasLens = _1 instance Has (a, b) b where hasLens = _2 -- | Retrive monad state by 'Lens''. askLocal :: (MonadReader t m, Has t a) => m a askLocal = asks $ view hasLens -- * Other -- | > Hashmap Text -- type synonym type KeyMap = HashMap Text ================================================ FILE: src/Nix/Value/Equal.hs ================================================ {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -Wno-missing-pattern-synonym-signatures #-} module Nix.Value.Equal where import Control.Comonad (Comonad (extract)) import Control.Monad.Free (Free (Free, Pure)) import Control.Monad.Trans.Except (throwE) import qualified Data.HashMap.Lazy as HashMap.Lazy import Data.Semialign ( Align, Semialign (align), ) import Data.These (These (These)) import Nix.Atoms import Nix.Expr.Types (AttrSet) import Nix.Frames import Nix.Prelude hiding (Comparison) import Nix.String import Nix.Thunk import Nix.Value checkComparable :: ( Framed e m , MonadDataErrorContext t f m ) => NValue t f m -> NValue t f m -> m () checkComparable x y = case (x, y) of (NVConstant (NInt _), NVConstant (NInt _)) -> stub (NVConstant (NInt _), NVConstant (NFloat _)) -> stub (NVConstant (NFloat _), NVConstant (NInt _)) -> stub (NVConstant (NFloat _), NVConstant (NFloat _)) -> stub (NVStr _, NVStr _) -> stub (NVPath _, NVPath _) -> stub _ -> throwError $ Comparison x y {- | Checks whether two containers are equal, using the given item equality predicate. If there are any item slots that don't match between the two containers, the result will be @False@. -} alignEqM :: (Align f, Traversable f, Monad m) => (a -> b -> m Bool) -> f a -> f b -> m Bool alignEqM eq fa fb = fmap (isRight @() @()) $ runExceptT $ traverse_ (guard <=< lift . uncurry eq) =<< traverse ( \case These a b -> pure (a, b) _ -> throwE mempty ) (Data.Semialign.align fa fb) alignEq :: (Align f, Traversable f) => (a -> b -> Bool) -> f a -> f b -> Bool alignEq eq fa fb = runIdentity $ alignEqM ((Identity .) . eq) fa fb isDerivationM :: (Monad m) => ( t -> m (Maybe NixString) ) -> AttrSet t -> m Bool isDerivationM f m = maybe False -- (2019-03-18): -- We should probably really make sure the context is empty here -- but the C++ implementation ignores it. ((==) "derivation" . ignoreContext) . join <$> traverse f (HashMap.Lazy.lookup "type" m) isDerivation :: (Monad m) => ( t -> Maybe NixString ) -> AttrSet t -> Bool isDerivation f = runIdentity . isDerivationM (Identity . f) valueFEqM :: (Monad n) => ( AttrSet a -> AttrSet a -> n Bool ) -> ( a -> a -> n Bool ) -> NValueF p m a -> NValueF p m a -> n Bool valueFEqM attrsEq eq = curry $ \case (NVConstantF (NFloat x), NVConstantF (NInt y)) -> pure $ x == fromInteger y (NVConstantF (NInt x), NVConstantF (NFloat y)) -> pure $ fromInteger x == y (NVConstantF lc, NVConstantF rc) -> pure $ lc == rc (NVStrF ls, NVStrF rs) -> pure $ (\i -> i ls == i rs) ignoreContext (NVListF ls, NVListF rs) -> alignEqM eq ls rs (NVSetF _ lm, NVSetF _ rm) -> attrsEq lm rm (NVPathF lp, NVPathF rp) -> pure $ lp == rp _ -> pure False valueFEq :: (AttrSet a -> AttrSet a -> Bool) -> (a -> a -> Bool) -> NValueF p m a -> NValueF p m a -> Bool valueFEq attrsEq eq x y = runIdentity $ valueFEqM ((Identity .) . attrsEq) ((Identity .) . eq) x y compareAttrSetsM :: (Monad m) => (t -> m (Maybe NixString)) -> (t -> t -> m Bool) -> AttrSet t -> AttrSet t -> m Bool compareAttrSetsM f eq lm rm = bool compareAttrs (fromMaybe compareAttrs equalOutPaths) =<< areDerivations where areDerivations = on (liftA2 (&&)) (isDerivationM f) lm rm equalOutPaths = on (liftA2 eq) (HashMap.Lazy.lookup "outPath") lm rm compareAttrs = alignEqM eq lm rm compareAttrSets :: (t -> Maybe NixString) -> (t -> t -> Bool) -> AttrSet t -> AttrSet t -> Bool compareAttrSets f eq lm rm = runIdentity $ compareAttrSetsM (Identity . f) ((Identity .) . eq) lm rm valueEqM :: forall t f m. (MonadThunk t m (NValue t f m), NVConstraint f) => NValue t f m -> NValue t f m -> m Bool valueEqM (Pure x) (Pure y) = thunkEqM x y valueEqM (Pure x) y@(Free _) = thunkEqM x =<< thunk (pure y) valueEqM x@(Free _) (Pure y) = (`thunkEqM` y) =<< thunk (pure x) valueEqM (Free (NValue' (extract -> x))) (Free (NValue' (extract -> y))) = valueFEqM (compareAttrSetsM findNVStr valueEqM) valueEqM x y where findNVStr :: NValue t f m -> m (Maybe NixString) findNVStr = free ( pure . ( \case NVStr s -> pure s _ -> mempty ) <=< force ) ( pure . \case NVStr' s -> pure s _ -> mempty ) -- This function has mutual recursion with `valueEqM`, and this function so far is not used across the project, -- but that one is. thunkEqM :: (MonadThunk t m (NValue t f m), NVConstraint f) => t -> t -> m Bool thunkEqM lt rt = do lv <- force lt rv <- force rt let unsafePtrEq = bool (valueEqM lv rv) (pure True) $ on (==) thunkId lt rt case (lv, rv) of (NVClosure _ _, NVClosure _ _) -> unsafePtrEq (NVList _, NVList _) -> unsafePtrEq (NVSet _ _, NVSet _ _) -> unsafePtrEq _ -> valueEqM lv rv ================================================ FILE: src/Nix/Value/Monad.hs ================================================ module Nix.Value.Monad where -- * @MonadValue@ - a main implementation class class MonadValue v m where -- | Wrap value into a thunk. defer :: m v -> m v -- | Force the evaluation of the value. demand :: v -> m v -- | If 'v' is a thunk, 'inform' allows us to modify the action to be -- performed by the thunk, perhaps by enriching it with scope info, for -- example. inform :: v -> m v -- * @MonadValueF@ - a Kleisli-able customization class class MonadValueF v m where demandF :: (v -> m r) -> v -> m r informF :: (m v -> m v) -> v -> m v ================================================ FILE: src/Nix/Value.hs ================================================ {-# LANGUAGE CPP #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -Wno-missing-pattern-synonym-signatures #-} {-# OPTIONS_GHC -Wno-missing-signatures #-} -- | The core of the type system, Nix language values module Nix.Value where import Control.Comonad ( Comonad, extract, ) import Control.Monad.Free ( Free (..), hoistFree, iter, iterM, ) import qualified Data.Aeson as Aeson import Data.Functor.Classes ( Eq1 (liftEq), Show1, liftShowsPrec, showsUnaryWith, ) import Lens.Family2.Stock (_2) import Lens.Family2.TH ( makeLenses, makeTraversals, ) import Nix.Atoms import Nix.Expr.Types import Nix.Prelude import Nix.String import Nix.Thunk import Text.Show ( showParen, showString, showsPrec, ) import qualified Text.Show -- * @__NValueF__@: Base functor (F) {- | An NValueF p m r represents all the possible types of Nix values. Is is the base functor to form the Free monad of nix expressions. The parameter `r` represents Nix values in their final form (NValue). The parameter `p` represents exactly the same type, but is kept separate or it would prevent NValueF from being a proper functor. It is intended to be hard-coded to the same final type as r. `m` is the monad in which evaluations will run. -} {- | An NValue' t f m a is a magic layer between NValueF and the Free monad construction. It fixes the `p` parameter of NValueF to the final NValue type, making the definition of NValue' and NValue depend on each other in a recursive fashion. It also introduces a `f` parameter for a custom functor that can be used to wrap each intermediate value in the reduced expression tree. This is where expression evaluations can store annotations and other useful information. `t` is not really used here, but is needed to type the (NValue t f m) used to tie the knot of the `p` parameter in the inner NValueF. `a` is will be an `NValue t f m` when NValue' functor is turned into a Free monad. -} {- | 'NValue t f m' is the most reduced form of a 'NExpr' after evaluation is completed. It is a layer cake of NValueF base values, wrapped in the f functor and into the Free recursive construction. Concretely, an NValue t f m can either be a thunk, representing a value yet to be evaluated (Pure t), or a know value in WHNF (Free (NValue' t f m (NValue t f m))) = (Free (f (NValueF NValue m NValue)) That is, a base value type, wrapped into the generic `f` functor, and based on other NValue's, which can in turn be either thunks, or more already WHNF evaluated values. As an example, the value `[1]` will be represented as Free (f (NVListF [ (Free (f (NVConstantF (NInt 1)))) ])) Should this 1 be a laziy and yet unevaluated value, it would be represented as Free (f (NVListF [ (Pure t) ])) Where the t is evaluator dependant, and should contain anough information to be evaluated to an NValue when needed. `demand` of `force` are used to turn a potential thunk into a `m (NValue t f m)`. Of course, trees can be much bigger. The number of layers and type aliases for similar things is huge, so this module provides ViewPatterns for each NValueF constructor. For example, the pattern NVStr' ns matches a NValue' containing an NVStrF, and bind that NVStrF to ns, ignoring the f functor inside. Similarly, the pattern NVStr ns (without prime mark) will match the inner NVstrF value inside an NValue. Of course, the patterns are declined for all the NValueF constructors. The non primed version also has an NVThunk t pattern to account for the possibility of an NValue to no be fully evaluated yet, as opposed to an NValue'. -} data NValueF p m r = NVConstantF NAtom | -- | A string has a value and a context, which can be used to record what a -- string has been build from NVStrF NixString | NVPathF Path | NVListF [r] | -- | -- Quite frequently actions/processing happens with values -- (for example - forcing of values & recreation of the monad), -- but @SourcePos@ does not change then. NVSetF PositionSet (AttrSet r) | -- | A function is a closed set of parameters representing the "call -- signature", used at application time to check the type of arguments -- passed to the function. Since it supports default values which may -- depend on other values within the final argument set, this -- dependency is represented as a set of pending evaluations. The -- arguments are finally normalized into a set which is passed to the -- function. -- -- Note that 'm r' is being used here because effectively a function -- and its set of default arguments is "never fully evaluated". This -- enforces in the type that it must be re-evaluated for each call. NVClosureF (Params ()) (p -> m r) | -- | A builtin function is itself already in normal form. Also, it may -- or may not choose to evaluate its argument in the production of a -- result. NVBuiltinF VarName (p -> m r) deriving (Generic, Typeable, Functor) -- ** Eq instance (Eq r) => Eq (NValueF p m r) where (==) (NVConstantF x) (NVConstantF y) = x == y (==) (NVStrF x) (NVStrF y) = x == y (==) (NVPathF x) (NVPathF y) = x == y (==) (NVListF x) (NVListF y) = x == y (==) (NVSetF _ x) (NVSetF _ y) = x == y (==) _ _ = False -- ** Eq1 instance Eq1 (NValueF p m) where liftEq _ (NVConstantF x) (NVConstantF y) = x == y liftEq _ (NVStrF x) (NVStrF y) = x == y liftEq _ (NVPathF x) (NVPathF y) = x == y liftEq eq (NVListF x) (NVListF y) = liftEq eq x y liftEq eq (NVSetF _ x) (NVSetF _ y) = liftEq eq x y liftEq _ _ _ = False -- ** Show instance (Show r) => Show (NValueF p m r) where showsPrec d = \case (NVConstantF atom) -> showsCon1 "NVConstant" atom (NVStrF ns) -> showsCon1 "NVStr" $ ignoreContext ns (NVListF lst) -> showsCon1 "NVList" lst (NVSetF _ attrs) -> showsCon1 "NVSet" attrs (NVClosureF params _) -> showsCon1 "NVClosure" params (NVPathF path) -> showsCon1 "NVPath" path (NVBuiltinF name _) -> showsCon1 "NVBuiltin" name where showsCon1 :: (Show a) => String -> a -> String -> String showsCon1 con a = showParen (d > 10) $ showString (con <> " ") . showsPrec 11 a -- ** Foldable -- | Folds what the value is known to contain at time of fold. instance Foldable (NValueF p m) where foldMap f = \case NVConstantF _ -> mempty NVStrF _ -> mempty NVPathF _ -> mempty NVClosureF _ _ -> mempty NVBuiltinF _ _ -> mempty NVListF l -> foldMap f l NVSetF _ s -> foldMap f s -- ** Traversable -- | @sequence@ sequenceNValueF :: (Functor n, Monad m, Applicative n) => (forall x. n x -> m x) -> NValueF p m (n a) -> n (NValueF p m a) sequenceNValueF transform = \case NVConstantF a -> pure $ NVConstantF a NVStrF s -> pure $ NVStrF s NVPathF p -> pure $ NVPathF p NVListF l -> NVListF <$> sequenceA l NVSetF p s -> NVSetF p <$> sequenceA s NVClosureF p g -> pure $ NVClosureF p (transform <=< g) NVBuiltinF s g -> pure $ NVBuiltinF s (transform <=< g) -- ** Monad -- | @bind@ bindNValueF :: (Monad m, Monad n) => -- | Transform @n@ into @m@. (forall x. n x -> m x) -> -- | A Kleisli arrow (see 'Control.Arrow.Kleisli' & Kleisli catagory). (a -> n b) -> -- | "Unfixed" (openly recursive) value of an embedded Nix language. NValueF p m a -> -- | An implementation of @transform (f =<< x)@ for embedded Nix language values. n (NValueF p m b) bindNValueF transform f = \case NVConstantF a -> pure $ NVConstantF a NVStrF s -> pure $ NVStrF s NVPathF p -> pure $ NVPathF p NVListF l -> NVListF <$> traverse f l NVSetF p s -> NVSetF p <$> traverse f s NVClosureF p g -> pure $ NVClosureF p (transform . f <=< g) NVBuiltinF s g -> pure $ NVBuiltinF s (transform . f <=< g) -- *** MonadTrans -- | @lift@ liftNValueF :: (MonadTrans u, Monad m) => NValueF p m a -> NValueF p (u m) a liftNValueF = hoistNValueF lift -- **** MonadTransUnlift -- | @unlift@ unliftNValueF :: (MonadTrans u, Monad m) => (forall x. u m x -> m x) -> NValueF p (u m) a -> NValueF p m a unliftNValueF = hoistNValueF -- **** Utils -- | Back & forth hoisting in the monad stack hoistNValueF :: (forall x. m x -> n x) -> NValueF p m a -> NValueF p n a hoistNValueF lft = \case -- Pass-through the: -- [ NVConstantF a -- , NVStrF s -- , NVPathF p -- , NVListF l -- , NVSetF p s -- ] NVConstantF a -> NVConstantF a NVStrF s -> NVStrF s NVPathF p -> NVPathF p NVListF l -> NVListF l NVSetF p s -> NVSetF p s NVBuiltinF s g -> NVBuiltinF s (lft . g) NVClosureF p g -> NVClosureF p (lft . g) {-# INLINE hoistNValueF #-} -- * @__NValue'__@: forming the (F(A)) {- | NVConstraint constraint the f layer in @NValue'@. It makes bijection between sub category of Hask and Nix Value possible. 'Comonad' enable Nix Value to Hask part. 'Applicative' enable Hask to Nix Value part. -} type NVConstraint f = (Comonad f, Applicative f) {- | At the time of constructor, the expected arguments to closures are values that may contain thunks. The type of such thunks are fixed at that time. -} newtype NValue' t f m a = NValue' { _nValue :: f (NValueF (NValue t f m) m a) -- ^ Applying F-algebra Base functor data type (@NValueF@) to the F-algebra carrier (@NValue@), forming the \( F(A)-> A \)). } deriving (Generic, Typeable, Functor, Foldable) instance (NVConstraint f, Show a) => Show (NValue' t f m a) where show (NValue' (extract -> v)) = show v -- ** Show1 instance (NVConstraint f) => Show1 (NValue' t f m) where liftShowsPrec sp sl p = \case NVConstant' atom -> showsUnaryWith showsPrec "NVConstantF" p atom NVStr' ns -> showsUnaryWith showsPrec "NVStrF" p $ ignoreContext ns NVList' lst -> showsUnaryWith (liftShowsPrec sp sl) "NVListF" p lst NVSet' _ attrs -> showsUnaryWith (liftShowsPrec sp sl) "NVSetF" p attrs NVPath' path -> showsUnaryWith showsPrec "NVPathF" p path NVClosure' c _ -> showsUnaryWith showsPrec "NVClosureF" p c NVBuiltin' name _ -> showsUnaryWith showsPrec "NVBuiltinF" p name -- ** Traversable -- | @sequence@ sequenceNValue' :: (Functor n, Traversable f, Monad m, Applicative n) => (forall x. n x -> m x) -> NValue' t f m (n a) -> n (NValue' t f m a) sequenceNValue' transform (NValue' v) = NValue' <$> traverse (sequenceNValueF transform) v -- ** Profunctor -- | @lmap@ lmapNValueF :: (Functor m) => (b -> a) -> NValueF a m r -> NValueF b m r lmapNValueF f = \case NVConstantF a -> NVConstantF a NVStrF s -> NVStrF s NVPathF p -> NVPathF p NVListF l -> NVListF l NVSetF p s -> NVSetF p s NVClosureF p g -> NVClosureF p (g . f) NVBuiltinF s g -> NVBuiltinF s (g . f) -- ** Free -- | @iter@ iterNValue' :: forall t f m a r. (MonadDataContext f m) => ((NValue' t f m a -> r) -> a -> r) -> (NValue' t f m r -> r) -> NValue' t f m a -> r iterNValue' k f = fix ((f .) . fmap . k) -- *** Utils -- | @hoistFree@: Back & forth hoisting in the monad stack hoistNValue' :: (Functor m, Functor n, Functor f) => (forall x. n x -> m x) -> (forall x. m x -> n x) -> NValue' t f m a -> NValue' t f n a hoistNValue' run lft (NValue' v) = NValue' $ lmapNValueF (hoistNValue lft run) . hoistNValueF lft <$> v {-# INLINE hoistNValue' #-} -- ** Monad -- | @bind@ bindNValue' :: (Traversable f, Monad m, Monad n) => (forall x. n x -> m x) -> (a -> n b) -> NValue' t f m a -> n (NValue' t f m b) bindNValue' transform f (NValue' v) = NValue' <$> traverse (bindNValueF transform f) v -- *** MonadTrans -- | @lift@ liftNValue' :: (MonadTrans u, Monad m, Functor (u m), Functor f) => (forall x. u m x -> m x) -> NValue' t f m a -> NValue' t f (u m) a liftNValue' run = hoistNValue' run lift -- **** MonadTransUnlift -- | @unlift@ unliftNValue' :: (MonadTrans u, Monad m, Functor (u m), Functor f) => (forall x. u m x -> m x) -> -- aka "run" NValue' t f (u m) a -> NValue' t f m a unliftNValue' = hoistNValue' lift -- ** Bijective Hask subcategory <-> @NValue'@ -- *** @F: Hask subcategory <-> NValue'@ -- #mantra# {- $Patterns @F: Hask <-> NValue'@ Since Haskell and Nix are both recursive purely functional lazy languages. And since recursion-schemes. It is possible to create a direct functor between the Hask and Nix categories. Or make Nix a DLS language of Haskell, embed it into a Hask, if you would like. Of course, we mean: pick Hask subcategory and form Nix Category from it. Take subcategory of Hask, and by applying functor to it - have a Nix Category. Wouldn't it be cool and fast? In fact - it is what we do here. Since it is a proper way of scientific implementation, we would eventually form a lawful functor. Module pattens use @language PatternSynonyms@: bidirectional synonyms (@<-@), and @ViewPatterns@: (@->@) at the same time. @ViewPatterns Control.Comonad.extract@ extracts from the @NValue (Free (NValueF a))@ the @NValueF a@. Which is @NValueF p m r@. Since it extracted from the @NValue@, which is formed by \( (F a -> a) F a \) in the first place. So @NValueF p m r@ which is extracted here, internally holds the next NValue. Facts of bijection between Hask subcategory objects and Nix objects, and between Hask subcategory morphisms and Nix morphisms are seen blow: -} -- | Using of Nulls is generally discouraged (in programming language design et al.), but, if you need it. pattern NVNull' :: (NVConstraint w) => NValue' t w m a pattern NVNull' = NVConstant' NNull -- | Haskell constant to the Nix constant, pattern NVConstant' :: (NVConstraint w) => NAtom -> NValue' t w m a pattern NVConstant' x <- NValue' (extract -> NVConstantF x) where NVConstant' = NValue' . pure . NVConstantF -- | Haskell text & context to the Nix text & context, pattern NVStr' :: (NVConstraint w) => NixString -> NValue' t w m a pattern NVStr' ns <- NValue' (extract -> NVStrF ns) where NVStr' = NValue' . pure . NVStrF -- | Haskell @Path@ to the Nix path, pattern NVPath' :: (NVConstraint w) => Path -> NValue' t w m a pattern NVPath' x <- NValue' (extract -> NVPathF x) where NVPath' = NValue' . pure . NVPathF . coerce -- | Haskell @[]@ to the Nix @[]@, pattern NVList' :: (NVConstraint w) => [a] -> NValue' t w m a pattern NVList' l <- NValue' (extract -> NVListF l) where NVList' = NValue' . pure . NVListF -- | Haskell key-value to the Nix key-value, pattern NVSet' :: (NVConstraint w) => PositionSet -> AttrSet a -> NValue' t w m a pattern NVSet' p s <- NValue' (extract -> NVSetF p s) where NVSet' p s = NValue' $ pure $ NVSetF p s -- | Haskell closure to the Nix closure, pattern NVClosure' :: (NVConstraint w) => Params () -> (NValue t w m -> m a) -> NValue' t w m a pattern NVClosure' x f <- NValue' (extract -> NVClosureF x f) where NVClosure' x f = NValue' $ pure $ NVClosureF x f -- | Haskell functions to the Nix functions! pattern NVBuiltin' :: (NVConstraint w) => VarName -> (NValue t w m -> m a) -> NValue' t w m a pattern NVBuiltin' name f <- NValue' (extract -> NVBuiltinF name f) where NVBuiltin' name f = NValue' $ pure $ NVBuiltinF name f {-# COMPLETE NVConstant', NVStr', NVPath', NVList', NVSet', NVClosure', NVBuiltin' #-} -- * @__NValue__@: Nix language values {- | 'NValue t f m' is a value in head normal form (it means only the tip of it has been evaluated to the normal form, while the rest of it is in lazy not evaluated form (thunk), this known as WHNF). An action 'm (NValue t f m)' is a pending evaluation that has yet to be performed. An 't' is either: * a pending evaluation. * a value in head normal form. The 'Free' structure is used here to represent the possibility that Nix language allows cycles that may appear during normalization. -} type NValue t f m = Free (NValue' t f m) t -- ** Free -- | HOF of @iter@ from @Free@ iterNValue :: forall t f m r. (MonadDataContext f m) => ((NValue t f m -> r) -> t -> r) -> (NValue' t f m r -> r) -> NValue t f m -> r iterNValue k f = fix ((iter f .) . fmap . k) -- already almost iterNValue' iterNValueByDiscardWith :: (MonadDataContext f m) => r -> (NValue' t f m r -> r) -> NValue t f m -> r iterNValueByDiscardWith = iterNValue . const . const -- | HOF of @iterM@ from @Free@ iterNValueM :: (MonadDataContext f m, Monad n) => (forall x. n x -> m x) -> ((NValue t f m -> n r) -> t -> n r) -> (NValue' t f m (n r) -> n r) -> NValue t f m -> n r iterNValueM transform k f = fix (((iterM f <=< go) .) . fmap . k) where go (Pure x) = Pure <$> x -- It should be a 'sequenceA' if to remote 'transform' form function. go (Free fa) = Free <$> bindNValue' transform go fa -- *** Utils -- | @hoistFree@, Back & forth hoisting in the monad stack hoistNValue :: (Functor m, Functor n, Functor f) => (forall x. n x -> m x) -> (forall x. m x -> n x) -> NValue t f m -> NValue t f n hoistNValue run lft = hoistFree $ hoistNValue' run lft {-# INLINE hoistNValue #-} -- ** MonadTrans -- | @lift@ liftNValue :: (MonadTrans u, Monad m, Functor (u m), Functor f) => (forall x. u m x -> m x) -> NValue t f m -> NValue t f (u m) liftNValue f = hoistNValue f lift -- *** MonadTransUnlift -- | @unlift@ unliftNValue :: (MonadTrans u, Monad m, Functor (u m), Functor f) => (forall x. u m x -> m x) -> -- aka "run" NValue t f (u m) -> NValue t f m unliftNValue = hoistNValue lift -- ** Methods @F: Hask → NValue@ -- {- $Methods @F: Hask → NValue@ The morphisms of the functor @Hask → NValue@. Continuation of the mantra: "Nix.Value#mantra" -} -- | Using of Nulls is generally discouraged (in programming language design et al.), but, if you need it. mkNVStrWithoutContext :: (NVConstraint f) => Text -> NValue t f m mkNVStrWithoutContext = NVStr . mkNixStringWithoutContext builtin :: forall m f t. (MonadThunk t m (NValue t f m), MonadDataContext f m) => -- | function name VarName -> -- | unary function ( NValue t f m -> m (NValue t f m) ) -> m (NValue t f m) builtin = (pure .) . NVBuiltin builtin2 :: (MonadThunk t m (NValue t f m), MonadDataContext f m) => -- | function name VarName -> -- | binary function ( NValue t f m -> NValue t f m -> m (NValue t f m) ) -> m (NValue t f m) builtin2 = ((.) <*> (.)) . builtin builtin3 :: (MonadThunk t m (NValue t f m), MonadDataContext f m) => -- | function name VarName -> -- | ternary function ( NValue t f m -> NValue t f m -> NValue t f m -> m (NValue t f m) ) -> m (NValue t f m) builtin3 = liftA2 (.) -- compose 2 together builtin ((.) . builtin2) -- *** @F: Evaluation -> NValue@ pattern NVNull = Free NVNull' pattern NVThunk t = Pure t pattern NVValue v = Free v {-# COMPLETE NVThunk, NVValue, NVNull #-} pattern NVConstant x = Free (NVConstant' x) pattern NVStr ns = Free (NVStr' ns) pattern NVPath x = Free (NVPath' x) pattern NVList l = Free (NVList' l) pattern NVSet s x = Free (NVSet' s x) pattern NVBuiltin name f = Free (NVBuiltin' name f) pattern NVClosure x f = Free (NVClosure' x f) {-# COMPLETE NVThunk, NVConstant, NVStr, NVPath, NVList, NVSet, NVClosure, NVBuiltin #-} -- * @TStringContext@ data TStringContext = NoContext | HasContext deriving (Show) instance Semigroup TStringContext where (<>) NoContext NoContext = NoContext (<>) _ _ = HasContext instance Monoid TStringContext where mempty = NoContext -- * @ValueType@ data ValueType = TInt | TFloat | TBool | TNull | TString TStringContext | TList | TSet | TClosure | TPath | TBuiltin deriving (Show) -- | Determine type of a value valueType :: NValueF a m r -> ValueType valueType = \case NVConstantF a -> case a of NURI _ -> TString mempty NInt _ -> TInt NFloat _ -> TFloat NBool _ -> TBool NNull -> TNull NVStrF ns -> TString $ HasContext `whenTrue` hasContext ns NVListF{} -> TList NVSetF{} -> TSet NVClosureF{} -> TClosure NVPathF{} -> TPath NVBuiltinF{} -> TBuiltin -- | Describe type value describeValue :: ValueType -> Text describeValue = \case TInt -> "an integer" TFloat -> "a float" TBool -> "a boolean" TNull -> "a null" TString NoContext -> "a string with no context" TString HasContext -> "a string" TList -> "a list" TSet -> "an attr set" TClosure -> "a function" TPath -> "a path" TBuiltin -> "a builtin function" showValueType :: (MonadThunk t m (NValue t f m), Comonad f) => NValue t f m -> m Text showValueType (Pure t) = showValueType =<< force t showValueType (Free (NValue' (extract -> v))) = pure $ describeValue $ valueType v -- * @ValueFrame@ data ValueFrame t f m = ForcingThunk t | ConcerningValue (NValue t f m) | Comparison (NValue t f m) (NValue t f m) | Addition (NValue t f m) (NValue t f m) | Multiplication (NValue t f m) (NValue t f m) | Division (NValue t f m) (NValue t f m) | Coercion ValueType ValueType | CoercionToJson (NValue t f m) | CoercionFromJson Aeson.Value | Expectation ValueType (NValue t f m) deriving (Typeable) deriving instance (NVConstraint f, Show t) => Show (ValueFrame t f m) -- * @MonadDataContext@ type MonadDataContext f (m :: Type -> Type) = (Comonad f, Applicative f, Traversable f, Monad m) -- * @MonadDataErrorContext@ type MonadDataErrorContext t f m = (Show t, Typeable t, Typeable m, Typeable f, MonadDataContext f m, MonadFail m) instance (MonadDataErrorContext t f m) => Exception (ValueFrame t f m) -- * @instance Eq NValue'@ instance (Eq a, Comonad f) => Eq (NValue' t f m a) where (==) (NValue' (extract -> x)) (NValue' (extract -> y)) = x == y -- * @instance Eq1 NValue'@ -- TH derivable works only after MonadDataContext instance (Comonad f) => Eq1 (NValue' t f m) where liftEq eq (NValue' (extract -> x)) (NValue' (extract -> y)) = liftEq eq x y -- * @NValueF@ traversals, getter & setters -- | Make traversals for Nix traversable structures. $(makeTraversals ''NValueF) -- | Make lenses for the Nix values $(makeLenses ''NValue') {- | Lens-generated getter-setter function for a traversable NValue' key-val structures. Nix value analogue of the @Data-Aeson-Lens@:@key :: AsValue t => Text -> Traversal' t Value@. -} key :: (Traversable f, Applicative g) => VarName -> LensLike' g (NValue' t f m a) (Maybe a) key k = nValue . traverse . _NVSetF . _2 . hashAt k ================================================ FILE: src/Nix/Var.hs ================================================ {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE ConstraintKinds #-} {-# OPTIONS_GHC -Wno-orphans #-} {-# OPTIONS_GHC -Wno-unused-top-binds #-} module Nix.Var () where import Control.Monad.Ref import Data.GADT.Compare (GEq (..)) import Data.STRef (STRef) import Nix.Prelude import Type.Reflection ((:~:) (Refl)) import Unsafe.Coerce (unsafeCoerce) eqVar :: (GEq (Ref m)) => Ref m a -> Ref m a -> Bool eqVar a b = isJust $ geq a b -- TODO: Upstream GEq instances -- Upstream thread: https://github.com/haskellari/some/pull/34 instance GEq IORef where geq = gEqual instance GEq (STRef s) where geq = gEqual -- | Simply a helper function gEqual :: (Eq a) => a -> b -> Maybe c gEqual a b = bool Nothing (pure $ unsafeCoerce Refl) (a == unsafeCoerce b) ================================================ FILE: src/Nix/XML.hs ================================================ module Nix.XML (toXML) where import qualified Data.HashMap.Lazy as M import Nix.Atoms import Nix.Expr.Types import Nix.Prelude import Nix.String import Nix.Value import Text.XML.Light ( Attr (Attr), Content (Elem), Element (Element), ppElement, unqual, ) toXML :: forall t f m. (MonadDataContext f m) => NValue t f m -> NixString toXML = runWithStringContext . fmap pp . iterNValueByDiscardWith cyc phi where cyc = pure $ mkEVal "string" "" pp :: Element -> Text pp e = heading <> fromString ( ppElement $ mkE "expr" (one $ Elem e) ) <> "\n" where heading = "\n" phi :: NValue' t f m (WithStringContext Element) -> WithStringContext Element phi = \case NVConstant' a -> pure $ case a of NURI t -> mkEVal "string" t NInt n -> mkEVal "int" $ show n NFloat f -> mkEVal "float" $ show f NBool b -> mkEVal "bool" $ if b then "true" else "false" NNull -> mkE "null" mempty NVStr' str -> mkEVal "string" <$> extractNixString str NVList' l -> mkE "list" . fmap Elem <$> sequenceA l NVSet' _ s -> mkE "attrs" . fmap mkElem' . sortWith fst . M.toList <$> sequenceA s where mkElem' :: (VarName, Element) -> Content mkElem' (k, v) = Elem $ Element (unqual "attr") (one $ Attr (unqual "name") $ toString k) (one $ Elem v) Nothing NVClosure' p _ -> pure $ mkE "function" (paramsXML p) NVPath' fp -> pure $ mkEVal "path" $ fromString $ coerce fp NVBuiltin' name _ -> pure $ mkEName "function" name mkE :: Text -> [Content] -> Element mkE (toString -> n) c = Element (unqual n) mempty c Nothing mkElem :: Text -> Text -> Text -> Element mkElem (toString -> n) (toString -> a) (toString -> v) = Element (unqual n) (one $ Attr (unqual a) v) mempty Nothing mkEVal :: Text -> Text -> Element mkEVal = (`mkElem` "value") mkEName :: Text -> VarName -> Element mkEName x (coerce -> y) = (`mkElem` "name") x y paramsXML :: Params r -> [Content] paramsXML (Param name) = one $ Elem $ mkEName "varpat" name paramsXML (ParamSet mname variadic pset) = one $ Elem $ Element (unqual "attrspat") (battr <> nattr) (paramSetXML pset) Nothing where battr = one (Attr (unqual "ellipsis") "1") `whenTrue` (variadic == Variadic) nattr = (one . Attr (unqual "name") . toString) `whenJust` mname paramSetXML :: ParamSet r -> [Content] paramSetXML = fmap (Elem . mkEName "attr" . fst) ================================================ FILE: src/Nix.hs ================================================ module Nix ( module Nix.Cache, module Nix.Exec, module Nix.Expr.Types, module Nix.Expr.Shorthands, module Nix.Expr.Types.Annotated, module Nix.Frames, module Nix.Render.Frame, module Nix.Normal, module Nix.Options, module Nix.String, module Nix.Parser, module Nix.Pretty, module Nix.Reduce, module Nix.Thunk, module Nix.Value, module Nix.XML, withNixContext, nixEvalExpr, nixEvalExprLoc, nixTracingEvalExprLoc, evaluateExpression, processResult, ) where import Data.Fix (Fix) import qualified Data.HashMap.Lazy as M import qualified Data.Text as Text import qualified Data.Text.Read as Text import GHC.Err (errorWithoutStackTrace) import Nix.Builtins import Nix.Cache import qualified Nix.Eval as Eval import Nix.Exec import Nix.Expr.Shorthands import Nix.Expr.Types import Nix.Expr.Types.Annotated import Nix.Frames import Nix.Normal import Nix.Options import Nix.Parser import Nix.Prelude import Nix.Pretty import Nix.Reduce import Nix.Render.Frame import Nix.String import Nix.Thunk import Nix.Value import Nix.Value.Monad import Nix.XML import Relude.Unsafe ((!!)) {- | This is the entry point for all evaluations, whatever the expression tree type. It sets up the common Nix environment and applies the transformations, allowing them to be easily composed. -} nixEval :: (MonadNix e t f m, Has e Options, Functor g) => Transform g (m a) -> Alg g (m a) -> Maybe Path -> Fix g -> m a nixEval transform alg mpath = withNixContext mpath . adi transform alg -- | Evaluate a nix expression in the default context nixEvalExpr :: (MonadNix e t f m, Has e Options) => Maybe Path -> NExpr -> m (NValue t f m) nixEvalExpr = nixEval id Eval.eval -- | Evaluate a nix expression in the default context nixEvalExprLoc :: forall e t f m. (MonadNix e t f m, Has e Options) => Maybe Path -> NExprLoc -> m (NValue t f m) nixEvalExprLoc = nixEval Eval.addMetaInfo Eval.evalContent {- | Evaluate a nix expression with tracing in the default context. Note that this function doesn't do any tracing itself, but 'evalExprLoc' will be 'tracing' is set to 'True' in the Options structure (accessible through 'MonadNix'). All this function does is provide the right type class context. -} nixTracingEvalExprLoc :: (MonadNix e t f m, Has e Options, MonadIO m, Alternative m) => Maybe Path -> NExprLoc -> m (NValue t f m) nixTracingEvalExprLoc mpath = withNixContext mpath . evalExprLoc evaluateExpression :: (MonadNix e t f m, Has e Options) => Maybe Path -> (Maybe Path -> NExprLoc -> m (NValue t f m)) -> (NValue t f m -> m a) -> NExprLoc -> m a evaluateExpression mpath evaluator handler expr = do opts <- askOptions (coerce -> args) <- (traverse . traverse) eval' $ (second parseArg <$> getArg opts) <> (second mkStr <$> getArgstr opts) f <- evaluator mpath expr f' <- demand f val <- case f' of NVClosure _ g -> g $ NVSet mempty $ M.fromList args _ -> pure f processResult handler val where parseArg s = either (errorWithoutStackTrace . show) id (parseNixText s) eval' = normalForm <=< nixEvalExpr mpath processResult :: forall e t f m a. (MonadNix e t f m, Has e Options) => (NValue t f m -> m a) -> NValue t f m -> m a processResult h val = do opts <- askOptions maybe (h val) (\(coerce . Text.splitOn "." -> keys) -> processKeys keys val) (getAttr opts) where processKeys :: [VarName] -> NValue t f m -> m a processKeys kys v = handlePresence (h v) ( \((k : ks) :: [VarName]) -> do v' <- demand v case (k, v') of (Text.decimal . coerce -> Right (n, ""), NVList xs) -> processKeys ks $ xs !! n (_, NVSet _ xs) -> maybe (errorWithoutStackTrace $ "Set does not contain key ''" <> show k <> "''.") (processKeys ks) (M.lookup k xs) (_, _) -> errorWithoutStackTrace $ "Expected a set or list for selector '" <> show k <> "', but got: " <> show v ) kys ================================================ FILE: tests/EvalTests.hs ================================================ {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -Wno-missing-signatures #-} module EvalTests ( tests, genEvalCompareTests, ) where import Control.Monad.Catch import Data.List ((\\)) import qualified Data.Set as S import Data.Time import NeatInterpolation (text) import Nix import Nix.Prelude import Nix.Standard import Nix.Value.Equal import qualified System.Directory as D import Test.Tasty import Test.Tasty.HUnit import Test.Tasty.TH import TestCommon case_basic_sum = constantEqualText "2" "1 + 1" case_basic_div = constantEqualText "3" "builtins.div 6 2" case_zero_div = traverse_ assertNixEvalThrows [ "builtins.div 1 0" , "builtins.div 1.0 0" , "builtins.div 1 0.0" , "builtins.div 1.0 0.0" ] case_bit_ops = traverse_ (uncurry constantEqualText) [ ("0", "builtins.bitAnd 1 0") , ("1", "builtins.bitOr 1 1") , ("3", "builtins.bitXor 1 2") ] case_basic_function = constantEqualText "2" "(a: a) 2" case_set_attr = constantEqualText "2" "{ a = 2; }.a" case_function_set_arg = constantEqualText "2" "({ a }: 2) { a = 1; }" case_function_set_two_arg = constantEqualText "2" "({ a, b ? 3 }: b - a) { a = 1; }" case_function_set_two_arg_default_scope = constantEqualText "2" "({ x ? 1, y ? x * 3 }: y - x) {}" case_function_default_env = constantEqualText "2" "let default = 2; in ({ a ? default }: a) {}" case_function_definition_uses_environment = constantEqualText "3" "let f = (let a=1; in x: x+a); in f 2" case_function_atpattern = -- jww (2018-05-09): This should be constantEqualText constantEqualText' "2" "(({a}@attrs:attrs) {a=2;}).a" case_function_ellipsis = -- jww (2018-05-09): This should be constantEqualText constantEqualText' "2" "(({a, ...}@attrs:attrs) {a=0; b=2;}).b" case_function_default_value_not_in_atpattern = constantEqualText "false" "({a ? 2}@attrs: attrs ? a) {}" case_function_arg_shadowing = constantEqualText "6" "(y: y: x: x: x + y) 1 2 3 4" case_function_recursive_args = constantEqualText "2" "({ x ? 1, y ? x * 3}: y - x) {}" case_function_recursive_sets = constantEqualText "[ [ 6 4 100 ] 4 ]" [text| let x = rec { y = 2; z = { w = 4; }; v = rec { u = 6; t = [ u z.w s ]; }; }; s = 100; in [ x.v.t x.z.w ] |] case_nested_with = constantEqualText "2" "with { x = 1; }; with { x = 2; }; x" case_with_strictness = constantEqualText "5" "let x = with x; with { a = 5; }; a; in x" case_match_failure_null = constantEqualText "null" "builtins.match \"ab\" \"abc\"" case_find_file_success_no_prefix = constantEqualText "./tests/files/findFile.nix" "builtins.findFile [{ path=\"./tests/files\"; prefix=\"\"; }] \"findFile.nix\"" case_find_file_success_with_prefix = constantEqualText "./tests/files/findFile.nix" "builtins.findFile [{ path=\"./tests/files\"; prefix=\"nix\"; }] \"nix/findFile.nix\"" case_find_file_success_folder = constantEqualText "./tests/files" "builtins.findFile [{ path=\"./tests\"; prefix=\"\"; }] \"files\"" case_find_file_failure_not_found = assertNixEvalThrows "builtins.findFile [{ path=\"./tests/files\"; prefix=\"\"; }] \"not_found.nix\"" case_find_file_failure_invalid_arg_1 = assertNixEvalThrows "builtins.findFile 1 \"files\"" case_find_file_failure_invalid_arg_2 = assertNixEvalThrows "builtins.findFile [{ path=\"./tests/files\"; prefix=\"\"; }] 2" case_find_file_failure_invalid_arg_no_path = assertNixEvalThrows "builtins.findFile [{ prefix=\"\"; }] \"files\"" case_infinite_recursion = assertNixEvalThrows "let foo = a: bar a; bar = a: foo a; in foo 3" case_nested_let = constantEqualText "3" "let a = 3; x.x = 2; in a" case_nested_nested_let = constantEqualText "3" "let a = 3; x.x = let b = a; in b; c = x.x; in c" case_inherit_in_rec_set = constantEqualText "1" "let x = 1; in (rec { inherit x; }).x" case_lang_version = constantEqualText "5" "builtins.langVersion" case_rec_set_attr_path_simpl = constantEqualText "123" [text| let x = rec { foo.number = 123; foo.function = y: foo.number; }; in x.foo.function 1 |] case_inherit_from_set_has_no_scope = constantEqualText' "false" [text| (builtins.tryEval ( let x = 1; y = { z = 2; }; in { inherit (y) x; }.x )).success |] -- github/orblivion (2018-08-05): Adding these failing tests so we fix this feature -- -- case_overrides = -- constantEqualText' "2" [text| -- let -- -- overrides = { a = 2; }; -- -- in (rec { -- __overrides = overrides; -- x = a; -- a = 1; -- }.__overrides.a) -- |] -- case_inherit_overrides = -- constantEqualText' "2" [text| -- let -- -- __overrides = { a = 2; }; -- -- in (rec { -- inherit __overrides; -- x = a; -- a = 1; -- }.__overrides.a) -- |] case_unsafegetattrpos = traverse_ (uncurry constantEqualText) [ ( "[ 5 14 ]" , [text| let e = 1; f = 1; t = {}; s = { inherit t e f; a = 1; "b" = 2; c.d = 3; }; p = builtins.unsafeGetAttrPos "e" s; in [ p.line p.column ] |] ) , ( "[ 5 14 ]" , [text| let e = 1; f = 1; t = {}; s = { inherit t e f; a = 1; "b" = 2; c.d = 3; }; p = builtins.unsafeGetAttrPos "f" s; in [ p.line p.column ] |] ) , ( "[ 6 7 ]" , [text| let e = 1; f = 1; t = {}; s = { inherit t e f; a = 1; "b" = 2; c.d = 3; }; p = builtins.unsafeGetAttrPos "a" s; in [ p.line p.column ] |] ) , ( "[ 7 7 ]" , [text| let e = 1; f = 1; t = {}; s = { inherit t e f; a = 1; "b" = 2; c.d = 3; }; p = builtins.unsafeGetAttrPos "b" s; in [ p.line p.column ] |] ) ] -- jww (2018-05-09): These two are failing but they shouldn't be -- -- , ( "[ 7 13 ]" -- , [text| -- let e = 1; -- f = 1; -- t = {}; -- s = { -- inherit t e f; -- a = 1; -- "b" = 2; -- c.d = 3; -- }; -- p = builtins.unsafeGetAttrPos "c.d" s; in -- [ p.line p.column ] -- |] -- ) -- , ( "[ 7 13 ]" -- , [text| -- let e = 1; -- f = 1; -- t = {}; -- s = { -- inherit t e f; -- a = 1; -- "b" = 2; -- c.d = 3; -- }; -- p = builtins.unsafeGetAttrPos "d" s; in -- [ p.line p.column ] -- |] -- ) case_fixed_points = constantEqualText [text| [ { foobar = "foobar"; foo = "foo"; bar = "bar"; } { foobar = "foo + bar"; foo = "foo + "; bar = "bar"; } ] |] [text| let fix = f: let x = f x; in x; extends = f: rattrs: self: let super = rattrs self; in super // f self super; f = self: { foo = "foo"; bar = "bar"; foobar = self.foo + self.bar; }; g = self: super: { foo = super.foo + " + "; }; in [ (fix f) (fix (extends g f)) ] |] case_fixed_points_and_fold = constantEqualText [text| [ {} {} ] |] [text| let extends = f: rattrs: self: let super = rattrs self; in super // f self super; flip = f: a: b: f b a; toFixFold = builtins.foldl' (flip extends) (self: {}) ([(self: super: {})]); toFix = extends (self: super: {}) (self: {}); fix = f: let x = f x; in x; in [ (fix toFixFold) (fix toFix) ] |] case_fixed_points_attrsets = constantEqualText "{ x = { y = { z = 100; }; z = { y = 100; }; }; }" [text| let fix = f: let x = f x; in x; f = self: { x.z.y = 100; x.y.z = self.x.z.y; }; in fix f |] case_function_equals = traverse_ (uncurry constantEqualText) [ -- ( "true" -- , "{f = x: x;} == {f = x: x;}" -- ) -- ( "true" -- , "[(x: x)] == [(x: x)]" -- ) ( "false" , "(let a = (x: x); in a == a)" ) , ( "true" , "(let a = {f = x: x;}; in a == a)" ) , ( "true" , "(let a = [(x: x)]; in a == a)" ) , ( "false" , "builtins.pathExists \"/var/empty/invalid-directory\"" ) ] case_directory_pathexists = constantEqualText "false" "builtins.pathExists \"/var/empty/invalid-directory\"" -- jww (2018-05-02): This constantly changes! case_placeholder = constantEqualText "\"/1rz4g4znpzjwh1xymhjpm42vipw92pr73vdgl6xs1hycac8kf2n9\"" "builtins.placeholder \"out\"" case_rec_path_attr = constantEqualText "10" "let src = 10; x = rec { passthru.src = src; }; in x.passthru.src" case_mapattrs_builtin = constantEqualText' "{ a = \"afoo\"; b = \"bbar\"; }" [text| (builtins.mapAttrs (x: y: x + y) { a = "foo"; b = "bar"; }) |] -- Regression test for #373 case_regression_373 :: Assertion case_regression_373 = traverse_ (uncurry sameFreeVars) [ ( "{ inherit a; }" , one "a" ) , ( "rec {inherit a; }" , one "a" ) , ( "let inherit a; in { }" , one "a" ) ] case_bound_vars :: Assertion case_bound_vars = traverse_ noFreeVars [ "a: a" , "{b}: b" , "let c = 5; d = c; in d" , "rec { e = 5; f = e; }" ] where noFreeVars = flip sameFreeVars mempty case_expression_split = constantEqualText "[ \"\" [ \"a\" ] \"c\" ]" "(x: builtins.deepSeq x x) (builtins.split \"(a)b\" \"abc\")" case_empty_string_equal_null_is_false = constantEqualText "false" "\"\" == null" case_null_equal_empty_string_is_false = constantEqualText "false" "null == \"\"" case_empty_string_not_equal_null_is_true = constantEqualText "true" "\"\" != null" case_null_equal_not_empty_string_is_true = constantEqualText "true" "null != \"\"" case_list_nested_bottom_diverges = assertNixEvalThrows "let nested = [(let x = x; in x)]; in nested == nested" case_attrset_nested_bottom_diverges = assertNixEvalThrows "let nested = { y = (let x = x; in x); }; in nested == nested" case_list_list_nested_bottom_equal = constantEqualText "true" "let nested = [[(let x = x; in x)]]; in nested == nested" case_list_attrset_nested_bottom_equal = constantEqualText "true" "let nested = [{ y = (let x = x; in x); }]; in nested == nested" case_list_function_nested_bottom_equal = constantEqualText "true" "let nested = [(_: let x = x; in x)]; in nested == nested" case_attrset_list_nested_bottom_equal = constantEqualText "true" "let nested = { y = [(let x = x; in x)];}; in nested == nested" case_attrset_attrset_nested_bottom_equal = constantEqualText "true" "let nested = { y = { y = (let x = x; in x); }; }; in nested == nested" case_attrset_function_nested_bottom_equal = constantEqualText "true" "let nested = { y = _: (let x = x; in x); }; in nested == nested" case_if_follow_by_with = constantEqualText "1" "let x = { a = true; b = 2; }; in if with x; a then 1 else 2" -- Regression test for #527 case_add_string_thunk_left = constantEqualText [text| "cygwin" |] [text| builtins.head ["cyg"] + "win" |] case_add_string_thunk_right = constantEqualText [text| "cygwin" |] [text| "cyg" + builtins.head ["win"] |] case_add_int_thunk_left = constantEqualText "3" "builtins.head [1] + 2" case_add_int_thunk_right = constantEqualText "3" "1 + builtins.head [2]" case_concat_thunk_left = constantEqualText "[1 2 3]" "builtins.tail [0 1 2] ++ [3]" case_concat_thunk_rigth = constantEqualText "[1 2 3]" "[1] ++ builtins.tail [1 2 3]" --------------------------------------------------------------------------------- tests :: TestTree tests = $testGroupGenerator genEvalCompareTests :: IO TestTree genEvalCompareTests = do files <- coerce D.listDirectory testDir let unmaskedFiles :: [Path] unmaskedFiles = filter ((== ".nix") . takeExtension) files testFiles :: [Path] testFiles = unmaskedFiles \\ maskedFiles pure $ testGroup "Eval comparison tests" $ fmap (mkTestCase testDir) testFiles where mkTestCase :: Path -> Path -> TestTree mkTestCase dir f = testCase (coerce f :: TestName) $ assertEvalFileMatchesNix $ dir f constantEqual :: NExprLoc -> NExprLoc -> Assertion constantEqual expected actual = do time <- getCurrentTime let opts = defaultOptions time -- putStrLn =<< lint (stripAnnotation a) (eq, expectedNF, actualNF) <- runWithBasicEffectsIO opts $ do expectedNF <- getNormForm expected actualNF <- getNormForm actual eq <- valueEqM expectedNF actualNF pure (eq, expectedNF, actualNF) let message = "Inequal normal forms:\n" <> "Expected: " <> printNix expectedNF <> "\n" <> "Actual: " <> printNix actualNF assertBool (toString message) eq where getNormForm = normalForm <=< nixEvalExprLoc mempty constantEqualText' :: Text -> Text -> Assertion constantEqualText' expected actual = do let (Right expected', Right actual') = both parseNixTextLoc (expected, actual) constantEqual expected' actual' constantEqualText :: Text -> Text -> Assertion constantEqualText expected actual = do constantEqualText' expected actual mres <- liftIO $ on (<|>) lookupEnv "ALL_TESTS" "MATCHING_TESTS" whenJust (const $ assertEvalTextMatchesNix actual) mres assertNixEvalThrows :: Text -> Assertion assertNixEvalThrows a = do time <- getCurrentTime let opts = defaultOptions time Right a' = parseNixTextLoc a errored <- catch ( False <$ runWithBasicEffectsIO opts (normalForm =<< nixEvalExprLoc mempty a') ) (\(_ :: NixException) -> pure True) when (not errored) $ assertFailure "Did not catch nix exception" sameFreeVars :: Text -> [VarName] -> Assertion sameFreeVars a xs = do let Right a' = parseNixText a free' = getFreeVars a' assertEqual mempty (S.fromList xs) free' maskedFiles :: [Path] maskedFiles = mempty testDir :: Path testDir = "tests/eval-compare" ================================================ FILE: tests/Main.hs ================================================ {-# LANGUAGE QuasiQuotes #-} module Main where import qualified Control.Exception as Exc import Data.Fix import Data.List (isSuffixOf, lookup) import Data.Time import qualified EvalTests import GHC.Err (errorWithoutStackTrace) import NeatInterpolation (text) import qualified Nix import Nix.Expr.Types import Nix.Options import Nix.Parser import Nix.Prelude import Nix.Standard import Nix.String import Nix.Value import qualified NixLanguageTests import qualified ParserTests import qualified PrettyParseTests import qualified PrettyTests import qualified ReduceExprTests import Relude (force) import Relude.Unsafe (read) import System.Directory import System.Environment (setEnv) import System.FilePath.Glob (compile, globDir1) import System.PosixCompat.Files import Test.Tasty import Test.Tasty.HUnit ensureLangTestsPresent :: Assertion ensureLangTestsPresent = do exist <- fileExist "data/nix/tests/lang/eval-okay-if.nix" when (not exist) $ errorWithoutStackTrace "Directory data/nix does not have any files." ensureNixpkgsCanParse :: Assertion ensureNixpkgsCanParse = consider "default.nix" (parseNixFile "default.nix") $ \case Fix (NAbs (ParamSet _ _ pset) _) -> do let rev = getString "rev" pset sha256 = getString "sha256" pset consider "fetchTarball expression" ( pure $ parseNixTextLoc [text| builtins.fetchTarball { url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz"; sha256 = "${sha256}"; }|] ) $ \expr -> do NVStr ns <- do time <- getCurrentTime runWithBasicEffectsIO (defaultOptions time) $ Nix.nixEvalExprLoc mempty expr let dir = toString $ ignoreContext ns exists <- fileExist dir when (not exists) $ errorWithoutStackTrace $ "Directory " <> show dir <> " does not exist" files <- globDir1 (compile "**/*.nix") dir handlePresence ( errorWithoutStackTrace $ "Directory " <> show dir <> " does not have any files" ) ( traverse_ ( \path -> let notEndsIn suffix = not $ isSuffixOf suffix path in when (on (&&) notEndsIn "azure-cli/default.nix" "os-specific/linux/udisks/2-default.nix") $ mempty <$ consider (coerce path) (parseNixFileLoc (coerce path)) -- Parse and deepseq the resulting expression tree, to ensure the -- parser is fully executed. $ Exc.evaluate . force ) ) files v -> fail $ "Unexpected parse from default.nix: " <> show v where getExpr k m = let Just r = join $ lookup k m in r getString k m = let Fix (NStr (DoubleQuoted [Plain str])) = getExpr k m in str consider path action k = either (\err -> errorWithoutStackTrace $ "Parsing " <> coerce @Path path <> " failed: " <> show err) k =<< action main :: IO () main = do nixLanguageTests <- NixLanguageTests.genTests evalComparisonTests <- EvalTests.genEvalCompareTests let allOrLookup var = lookupEnv "ALL_TESTS" <|> lookupEnv var nixpkgsTestsEnv <- allOrLookup "NIXPKGS_TESTS" prettyTestsEnv <- lookupEnv "PRETTY_TESTS" pwd <- getCurrentDirectory setEnv "NIX_REMOTE" $ pwd <> "/real-store" setEnv "NIX_DATA_DIR" $ pwd <> "/data" defaultMain $ testGroup "hnix" $ [ ParserTests.tests , EvalTests.tests , PrettyTests.tests , ReduceExprTests.tests , PrettyParseTests.tests $ fromIntegral $ read @Int $ fromMaybe "0" prettyTestsEnv , evalComparisonTests , testCase "Nix language tests present" ensureLangTestsPresent , nixLanguageTests ] <> [ testCase "Nixpkgs parses without errors" ensureNixpkgsCanParse | isJust nixpkgsTestsEnv ] ================================================ FILE: tests/NixLanguageTests.hs ================================================ module NixLanguageTests (genTests) where import Control.Exception import Control.Monad.ST import Data.List (delete) import Data.List.Split (splitOn) import qualified Data.Map as Map import qualified Data.Set as Set import qualified Data.String as String import qualified Data.Text as Text import Data.Time import GHC.Err (errorWithoutStackTrace) import GHC.Exts import Nix.Lint import Nix.Options import Nix.Options.Parser import Nix.Parser import Nix.Prelude import Nix.Pretty import Nix.String import Nix.XML import qualified Options.Applicative as Opts import System.Environment (setEnv) import System.FilePath.Glob ( compile, globDir1, ) import Test.Tasty import Test.Tasty.HUnit import TestCommon {- From (git://nix)/tests/lang.sh we see that lang/parse-fail-*.nix -> parsing should fail lang/parse-okay-*.nix -> parsing should succeed lang/eval-fail-*.nix -> eval should fail lang/eval-okay-*.{nix,xml} -> eval should succeed, xml dump should be the same as the .xml lang/eval-okay-*.{nix,exp} -> eval should succeed, plain text output should be the same as the .exp lang/eval-okay-*.{nix,exp,flags} -> eval should succeed, plain text output should be the same as the .exp, pass the extra flags to nix-instantiate NIX_PATH=lang/dir3:lang/dir4 should be in the environment of all eval-okay-*.nix evaluations TEST_VAR=foo should be in all the environments # for eval-okay-getenv.nix -} groupBy :: (Ord k) => (v -> k) -> [v] -> Map k [v] groupBy key = Map.fromListWith (<>) . fmap (key &&& pure) {- | New tests, which have never yet passed. Once any of these is passing, please remove it from this list. Do not add tests to this list if they have previously passed. -} newFailingTests :: Set String newFailingTests = Set.fromList [ "eval-okay-fromTOML" , "eval-okay-zipAttrsWith" , "eval-okay-tojson" , "eval-okay-search-path" , "eval-okay-sort" , "eval-okay-path-antiquotation" , "eval-okay-getattrpos-functionargs" , "eval-okay-attrs6" ] {- | Upstream tests that test cases that HNix disaded as a misfeature that is used so rarely that it more effective to fix it & lint it out of existance. -} deprecatedRareNixQuirkTests :: Set String deprecatedRareNixQuirkTests = Set.fromList [ -- A rare quirk of Nix that is proper to fix&enforce then to support (see git commit history) "eval-okay-strings-as-attrs-names" , -- Nix upstream removed this test altogether "eval-okay-hash" ] genTests :: IO TestTree genTests = do testFiles <- getTestFiles let testsGroupedByName :: Map Path [Path] testsGroupedByName = groupBy (takeFileName . dropExtensions) testFiles testsGroupedByTypeThenName :: Map [String] [(Path, [Path])] testsGroupedByTypeThenName = groupBy testType $ Map.toList testsGroupedByName testTree :: [TestTree] testTree = mkTestGroup <$> Map.toList testsGroupedByTypeThenName pure $ localOption (mkTimeout 2000000) $ testGroup "Nix (upstream) language tests" testTree where getTestFiles :: IO [Path] getTestFiles = sortTestFiles <$> collectTestFiles where collectTestFiles :: IO [Path] collectTestFiles = coerce (globDir1 (compile "*-*-*.*") nixTestDir) sortTestFiles :: [Path] -> [Path] sortTestFiles = sort -- Disabling the not yet done tests cases. . filter withoutDisabledTests . filter withoutXml where withoutDisabledTests :: Path -> Bool withoutDisabledTests = (`Set.notMember` (newFailingTests `Set.union` deprecatedRareNixQuirkTests)) . takeBaseName withoutXml :: Path -> Bool withoutXml = (/= ".xml") . takeExtension testType :: (Path, b) -> [String] testType (fullpath, _files) = coerce (take 2 . splitOn "-") $ takeFileName fullpath mkTestGroup :: ([String], [(Path, [Path])]) -> TestTree mkTestGroup (tType, tests) = testGroup (String.unwords tType) $ mkTestCase <$> tests where mkTestCase :: (Path, [Path]) -> TestTree mkTestCase (basename, files) = testCase (coerce $ takeFileName basename) $ do time <- liftIO getCurrentTime let opts = defaultOptions time case tType of ["parse", "okay"] -> assertParse opts $ the files ["parse", "fail"] -> assertParseFail opts $ the files ["eval", "okay"] -> assertEval opts files ["eval", "fail"] -> assertEvalFail $ the files _ -> fail $ "Unexpected: " <> show tType assertParse :: Options -> Path -> Assertion assertParse _opts file = either (\err -> assertFailure $ "Failed to parse " <> coerce file <> ":\n" <> show err) (const stub) -- pure $! runST $ void $ lint opts expr =<< parseNixFileLoc file assertParseFail :: Options -> Path -> Assertion assertParseFail opts file = (`catch` \(_ :: SomeException) -> stub) $ either (const stub) ( \expr -> do _ <- pure $! runST $ void $ lint opts expr assertFailure $ "Unexpected success parsing `" <> coerce file <> ":\nParsed value: " <> show expr ) =<< parseNixFileLoc file assertLangOk :: Options -> Path -> Assertion assertLangOk opts fileBaseName = do actual <- printNix <$> hnixEvalFile opts (addNixExt fileBaseName) expected <- read fileBaseName ".exp" assertEqual mempty expected (actual <> "\n") assertLangOkXml :: Options -> Path -> Assertion assertLangOkXml opts fileBaseName = do actual <- ignoreContext . toXML <$> hnixEvalFile opts (addNixExt fileBaseName) expected <- read fileBaseName ".exp.xml" assertEqual mempty expected actual assertEval :: Options -> [Path] -> Assertion assertEval _opts files = do time <- liftIO getCurrentTime let opts = defaultOptions time case delete ".nix" $ sort $ fromString @Text . takeExtensions <$> files of [] -> void $ hnixEvalFile opts $ addNixExt name [".exp"] -> assertLangOk opts name [".exp.xml"] -> assertLangOkXml opts name [".exp.disabled"] -> stub [".exp-disabled"] -> stub [".exp", ".flags"] -> do liftIO $ setEnv "NIX_PATH" "lang/dir4:lang/dir5" flags <- read name ".flags" let flags' :: Text flags' = bool id Text.init (Text.last flags == '\n') flags case runParserGetResult time flags' of Opts.Failure err -> errorWithoutStackTrace $ "Error parsing flags from " <> coerce name <> ".flags: " <> show err Opts.CompletionInvoked _ -> fail "unused" Opts.Success opts' -> assertLangOk opts' name _ -> assertFailure $ "Unknown test type " <> show files where runParserGetResult :: UTCTime -> Text -> Opts.ParserResult Options runParserGetResult time flags' = Opts.execParserPure Opts.defaultPrefs (nixOptionsInfo time) (fmap toString $ fixup $ Text.splitOn " " flags') name :: Path name = coerce nixTestDir <> the (takeFileName . dropExtensions <$> files) fixup :: [Text] -> [Text] fixup ("--arg" : x : y : rest) = "--arg" : (x <> "=" <> y) : fixup rest fixup ("--argstr" : x : y : rest) = "--argstr" : (x <> "=" <> y) : fixup rest fixup (x : rest) = x : fixup rest fixup [] = mempty assertEvalFail :: Path -> Assertion assertEvalFail file = (`catch` (\(_ :: SomeException) -> stub)) $ do time <- liftIO getCurrentTime evalResult <- printNix <$> hnixEvalFile (defaultOptions time) file evalResult `seq` assertFailure $ "File: ''" <> coerce file <> "'' should not evaluate.\nThe evaluation result was `" <> toString evalResult <> "`." nixTestDir :: FilePath nixTestDir = "data/nix/tests/lang/" addNixExt :: Path -> Path addNixExt path = addExtension path ".nix" read :: Path -> String -> IO Text read path ext = readFile $ addExtension path ext ================================================ FILE: tests/ParserTests.hs ================================================ {-# LANGUAGE ExtendedDefaultRules #-} {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -Wno-missing-signatures #-} {-# OPTIONS_GHC -Wno-type-defaults #-} {-# OPTIONS_GHC -fno-warn-name-shadowing #-} module ParserTests (tests) where import Data.Fix import NeatInterpolation (text) import Nix.Atoms import Nix.Expr import Nix.Parser import Nix.Prelude hiding (($<)) import Nix.Pretty import Prettyprinter import Prettyprinter.Render.String (renderString) import Prettyprinter.Render.Text import Prettyprinter.Util (reflow) import Test.Tasty import Test.Tasty.HUnit import Test.Tasty.TH default (NixLang) -- * Tests -- ** Literals case_constant_int = checks ( mkInt 234 , "234" ) case_constant_bool = checks ( mkBool True , "true" ) ( mkBool False , "false" ) case_constant_bool_respects_attributes = invariantVals "true-foo" "false-bar" case_constant_path_invariants = knownAs (staysInvariantUnder (mkRelPath . toString)) "./." "./+-_/cdef/09ad+-" "/abc" "../abc" "~/a" "~/a/b" "a/b" "4/2" "rec+def/cdef" case_constant_path = checks ( var "a'b" @@ mkRelPath "/c" , "a'b/c" ) ( mkRelPath "a/b" $// mkRelPath "c/def" $// mkEnvPath "g" $< mkRelPath "def/d" , "a/b//c/def// < def/d" ) ( mkEnvPath "abc" , "" ) ( mkEnvPath "../cdef" , "<../cdef>" ) ( var "a" $// var "b" , "a//b" ) case_constant_path_syntax_mistakes = mistakes "." ".." "/" "a/" "a/def/" "~" "~/" case_constant_uri = knownAs (staysInvariantUnder mkStr) "a:a" "http://foo.bar" "a+de+.adA+-:%%%ads%5asdk&/" "rec+def:c" "f.foo:bar" case_constant_uri_syntax_mistakes = mistakes "http://foo${\"bar\"}" ":bcdef" "a%20:asda" ".:adasd" "+:acdcd" -- *** Special chars in vals case_identifier_special_chars = invariantVals "_a" "a_b" "a'b" "a''b" "a-b" "a--b" "a12a" case_identifier_special_chars_syntax_mistakes = mistakes ".a" "'a" -- ** Sets -- *** Non-recursive sets case_simple_set = checks ( mkNonRecSet [ "a" $= mkInt 23 , "b" $= mkInt 4 ] , "{ a = 23; b = 4; }" ) case_simple_set_syntax_mistakes = mistakes "{ a = 23 }" case_set_complex_keynames = checks ( mkNonRecSet $ one (NamedVar (one (DynamicKey (Plain (DoubleQuoted mempty)))) mkNull nullPos) , "{ \"\" = null; }" ) ( mkNonRecSet [ NamedVar (StaticKey "a" :| one (StaticKey "b")) (mkInt 3) nullPos , NamedVar (StaticKey "a" :| one (StaticKey "c")) (mkInt 4) nullPos ] , "{ a.b = 3; a.c = 4; }" ) ( mkNonRecSet $ one (NamedVar (one (DynamicKey (Antiquoted letExpr))) (mkInt 4) nullPos) , "{ ${let a = \"b\"; in a} = 4; }" ) ( mkNonRecSet $ one (NamedVar (DynamicKey (Plain str) :| one (StaticKey "e")) (mkInt 4) nullPos) , "{ \"a${let a = \"b\"; in a}c\".e = 4; }" ) where letExpr = mkLets (one ("a" $= mkStr "b")) (var "a") str = DoubleQuoted [Plain "a", Antiquoted letExpr, Plain "c"] -- *** Recursivity in sets case_set_rec = checks ( mkRecSet [ "a" $= mkInt 3 , "b" $= var "a" ] , "rec { a = 3; b = a; }" ) -- *** Inheritance case_set_inherit = checks ( mkNonRecSet [ "e" $= mkInt 3 , inherit ["a", "b"] ] , "{ e = 3; inherit a b; }" ) ( mkNonRecSet $ one $ inherit mempty , "{ inherit; }" ) case_set_scoped_inherit = checks ( mkNonRecSet $ (\x -> [x, "e" $= mkInt 4, x]) $ inheritFrom (var "a") ["b", "c"] , "{ inherit (a) b c; e = 4; inherit(a)b c; }" ) case_set_inherit_direct = checks ( mkNonRecSet $ one (inheritFrom (mkNonRecSet $ one ("a" $= mkInt 3)) mempty) , "{ inherit ({a = 3;}); }" ) case_inherit_selector_syntax_mistakes = mistakes "{ inherit a.x; }" -- A rare quirk of Nix that is proper to fix then to support (see git commit history) -- (old parser test result was): -- mkNonRecSet [inherit [DynamicKey (Plain (DoubleQuoted [Plain "a"]))]], "{ inherit \"a\"; }" -- ** Lists case_int_list = checks ( mkList $ mkInt <$> [1, 2, 3] , "[1 2 3]" ) case_int_null_list = checks ( mkList (mkConst <$> [NInt 1, NInt 2, NInt 3, NNull, NInt 4]) , "[1 2 3 null 4]" ) case_mixed_list = checks ( mkList [ mkNonRecSet (one $ "a" $= mkInt 3) @. "a" , mkIf (mkBool True) mkNull (mkBool False) , mkNull , mkBool False , mkInt 4 , emptyList , (@.<|>) (var "c") "d" mkNull ] , "[{a = 3;}.a (if true then null else false) null false 4 [] c.d or null]" ) case_mixed_list_syntax_mistakes = mistakes "[if true then null else null]" "[a ? b]" "[a : a]" "[${\"test\")]" -- ** Lambdas case_simple_lambda = checks ( mkFunction (Param "a") (var "a") , "a: a" ) case_lambda_or_uri = checks ( mkFunction (Param "a") $ var "b" , "a :b" ) ( var "a" @@ mkStr "c:def" , "a c:def" ) ( mkStr "c:def:" @@ var "c" , "c:def: c" ) ( mkFunction (Param "a") emptySet , "a:{}" ) ( mkFunction (Param "a") $ mkList $ one $ var "a" , "a:[a]" ) case_lambda_or_uri_syntax_mistakes = mistakes "def:" case_lambda_pattern = checks ( mkFunction (mkParamSet args) $ var "b" , "{b, c ? 1}: b" -- Fix (NAbs (ParamSet [("b",Nothing),("c",Just (Fix (NConstant (NInt 1))))] False Nothing) (Fix (NSym "b"))) ) ( mkFunction (mkParamSet args2) $ var "b" , "{ b ? x: x }: b" ) ( mkFunction (mkNamedParamSet "a" args) $ var "b" , "a@{b,c ? 1}: b" ) ( mkFunction (mkNamedParamSet "a" args) $ var "c" , "{b,c?1}@a: c" ) ( mkFunction (mkNamedVariadicParamSet "a" vargs) $ var "c" , "{b,c?1,...}@a: c" ) ( mkFunction (mkVariadicParamSet mempty) $ mkInt 1 , "{...}: 1" ) where args = [("b", Nothing), ("c", pure $ mkInt 1)] vargs = [("b", Nothing), ("c", pure $ mkInt 1)] args2 = one ("b", pure lam) lam = mkFunction (Param "x") $ var "x" case_lambda_pattern_syntax_mistakes = mistakes "a@b: a" "{a}@{b}: a" case_lambda_app_int = checks ( mkFunction (Param "a") (var "a") @@ mkInt 3 , "(a: a) 3" ) -- ** Let case_simple_let = checks ( mkLets (one $ "a" $= mkInt 4) $ var "a" , "let a = 4; in a" ) case_simple_let_syntax_mistakes = mistakes "let a = 4 in a" case_let_body = checks ( mkRecSet (one $ "body" $= mkInt 1) @. "body" , "let { body = 1; }" ) case_nested_let = checks ( mkLets (one $ "a" $= mkInt 4) $ mkLets (one $ "b" $= mkInt 5) $ var "a" , "let a = 4; in let b = 5; in a" ) case_nested_let_syntax_mistakes = mistakes "let a = 4; let b = 3; in b" case_let_scoped_inherit = checks ( mkLets [ "a" $= mkNull , inheritFrom (var "b") $ one "c" ] $ var "c" , "let a = null; inherit (b) c; in c" ) case_let_scoped_inherit_syntax_mistakes = mistakes "let inherit (b) c in c" -- ** If case_if = checks ( mkIf (mkBool True) (mkBool True) (mkBool False) , "if true then true else false" ) case_if_syntax_mistakes = mistakes "if true then false" "else" "if true then false else" "if true then false else false else" "1 + 2 then" -- ** If follow by with case_if_follow_by_with = checks ( mkLets (one $ "x" $= mkNonRecSet ["a" $= mkBool True, "b" $= mkInt 2]) $ mkIf (mkWith (mkSym "x") (mkSym "a")) (mkInt 1) (mkInt 2) , "let x = { a = true; b = 2; }; in if with x; a then 1 else 2" ) -- ** Literal expressions in vals case_identifier_keyword_prefix_invariants = invariantVals "true-name" "trueName" "null-name" "nullName" case_identifier_keyword_prefix = checks ( mkList $ one $ var "null-name" , "[ null-name ]" ) -- ** Strings invariantString str = checks ( mkStr str , "\"" <> str <> "\"" ) case_simple_string = knownAs invariantString "abcdef" "a" "A" " a a " "" case_string_dollar = knownAs invariantString "a$b" "a$$b" "$cdef" "gh$i" case_string_escape = checks ( mkStr "$\n\t\r\\" , "\"\\$\\n\\t\\r\\\\\"" ) ( mkStr " \" ' " , "\" \\\" \\' \"" ) case_string_antiquote = checks ( Fix $ NStr $ DoubleQuoted [ Plain "abc" , Antiquoted $ mkIf (mkBool True) (mkStr "def") (mkStr "abc") , Plain " g" ] , "\"abc${ if true then \"def\" else \"abc\" } g\"" ) ( mkStr "${a}" , "\"\\${a}\"" ) case_string_antiquote_syntax_mistakes = mistakes "\"a" "${true}" "\"${true\"" -- *** Indented string case_indented_string = checks ( mkIndentedStr 0 "a" , "''a''" ) ( mkIndentedStr 2 "foo\nbar" , "''\n foo\n bar''" ) ( mkIndentedStr 0 mempty , "'' ''" ) ( mkIndentedStr 0 "''" , "'''''''" ) ( Fix $ NStr $ Indented 3 [ Antiquoted mkNull , Plain "\na" , Antiquoted mkNull ] , "'' ${null}\n a${null}''" ) case_indented_string_syntax_mistakes = mistakes "'''''" "'' '" case_indented_string_escape = checks ( mkIndentedStr 1 "\n \t \\ ${ \\ \\n ' '' " , "'' ''\\n ''\\t ''\\\\ ''${ \\ \\n ' ''' ''" ) -- ** Selection case_select = checks ( Fix $ NSelect Nothing (var "a") (StaticKey "e" :| [StaticKey "di", StaticKey "f"]) , "a . e .di. f" ) ( Fix $ NSelect (pure mkNull) (var "a") (StaticKey "e" :| one (StaticKey "d")) , "a.e . d or null" ) ( Fix $ NSelect (pure mkNull) emptySet (one $ DynamicKey (Plain $ DoubleQuoted mempty)) , "{}.\"\"or null" ) ( Fix $ NBinary NConcat ( (@.<|>) ( mkNonRecSet $ one $ NamedVar (mkSelector "a") (mkList $ one $ mkInt 1) nullPos ) "a" (mkList $ one $ mkInt 2) ) (mkList $ one $ mkInt 3) , "{ a = [1]; }.a or [2] ++ [3]" ) case_select_path = checks ( var "f" @@ mkRelPath "./." , "f ./." ) ( var "f" @. "b" @@ mkRelPath "../a" , "f.b ../a" ) ( emptySet @@ mkRelPath "./def" , "{}./def" ) ( Fix (NSelect Nothing emptySet $ one $ DynamicKey $ Plain $ DoubleQuoted mempty) @@ mkRelPath "./def" , "{}.\"\"./def" ) case_select_keyword = checks ( mkNonRecSet $ one $ "false" $= mkStr "foo" , "{ false = \"foo\"; }" ) case_select_or_precedence = assertParsePrint [text| let matchDef = def: matcher: v: let case = builtins.head (builtins.attrNames v); in (matcher.case or def case) (v.case); in null |] [text| let matchDef = def: matcher: v: let case = builtins.head (builtins.attrNames v); in (matcher.case or def) case (v.case); in null |] case_select_or_precedence2 = assertParsePrint [text| let matchDef = def: matcher: v: let case = builtins.head (builtins.attrNames v); in (matcher.case or null.foo) (v.case); in null |] [text| let matchDef = def: matcher: v: let case = builtins.head (builtins.attrNames v); in (matcher.case or null).foo (v.case); in null |] -- ** Function application case_fun_app = checks ( var "f" @@ var "a" @@ var "b" , "f a b" ) ( var "f" @@ (@.<|>) (var "a") "x" mkNull , "f a.x or null" ) case_fun_app_syntax_mistakes = mistakes "f if true then null else null" -- ** Operators case_operator_fun_app = checks ( var "a" $++ var "b" , "a ++ b" ) ( var "a" $++ var "f" @@ var "b" , "a ++ f b" ) case_operators = checks ( mkInt 1 $+ mkInt 2 $- mkInt 3 , "1 + 2 - 3" ) ( mkInt 1 $+ mkIf (mkBool True) (mkInt 2) (mkInt 3) , "1 + (if true then 2 else 3)" ) ( mkNonRecSet (one $ "a" $= mkInt 3) $// mkRecSet (one $ "b" $= mkInt 4) , "{ a = 3; } // rec { b = 4; }" ) ( mkNeg $ mkNeg $ var "a" , "--a" ) ( var "a" $- var "b" $- var "c" , "a - b - c" ) ( var "foo" $< var "bar" , "foo") (coerce . mkPos) mkSpan = on SrcSpan (uncurry mkSPos) in assertParseTextLoc [text|let foo = bar baz "qux"; in foo |] ( NLetAnn (mkSpan (1, 1) (4, 7)) ( one $ NamedVar (one $ StaticKey "foo") ( NAppAnn (mkSpan (2, 7) (3, 15)) ( NAppAnn (mkSpan (2, 7) (3, 9)) (NSymAnn (mkSpan (2, 7) (2, 10)) "bar") (NSymAnn (mkSpan (3, 6) (3, 9)) "baz") ) (NStrAnn (mkSpan (3, 10) (3, 15)) $ DoubleQuoted $ one $ Plain "qux") ) (mkSPos 2 1) ) (NSymAnn (mkSpan (4, 4) (4, 7)) "foo") ) tests :: TestTree tests = $testGroupGenerator --------------------------------------------------------------------------------- -- * Helpers var = mkSym invariantVal = staysInvariantUnder var staysInvariantUnder :: (NixLang -> ExpectedHask) -> NixLang -> Assertion staysInvariantUnder f v = (<=>) (f v) v type NixLang = Text type ExpectedHask = NExpr (<=>) :: ExpectedHask -> NixLang -> Assertion (<=>) = assertParseText throwParseError :: forall ann. Text -> Text -> Doc ann -> Assertion throwParseError entity expr err = assertFailure $ renderString $ layoutSmart Prettyprinter.defaultLayoutOptions $ nest 2 $ vsep [ mempty , "Unexpected fail parsing " <> reflow entity <> ":" , nest 2 $ vsep [ "Expression:" , reflow expr , "Error: " <> nest 2 err ] ] assertParseText :: ExpectedHask -> NixLang -> Assertion assertParseText expected str = either (throwParseError "expression" str) ( assertEqual ("When parsing " <> toString str) (stripPositionInfo expected) . stripPositionInfo ) (parseNixText str) assertParseTextLoc :: NixLang -> NExprLoc -> Assertion assertParseTextLoc str expected = either (throwParseError "expression" str) ( assertEqual ("When parsing " <> toString str) expected ) (parseNixTextLoc str) assertParseFile :: Path -> NExpr -> Assertion assertParseFile file expected = do res <- parseNixFile $ "data/" <> file either (throwParseError "data file" $ coerce fromString file) ( assertEqual ("Parsing data file " <> coerce file) (stripPositionInfo expected) . stripPositionInfo ) res assertParseFail :: NixLang -> Assertion assertParseFail str = either (const stub) ( \r -> assertFailure $ toString $ "\nUnexpected success parsing string ''" <> str <> "'':\n''Parsed value: ''" <> show r <> "''." ) (parseNixText str) -- assertRoundTrip :: Text -> Assertion -- assertRoundTrip src = assertParsePrint src src assertParsePrint :: Text -> Text -> Assertion assertParsePrint src expect = let Right expr = parseNixTextLoc src result = renderStrict . layoutPretty defaultLayoutOptions . prettyNix . stripAnnotation $ expr in assertEqual mempty expect result ----- {- | This class constructs functions that accept variacic number of argumets. Every argument is an assertion. So now the new assertions can be added just by adding it to a block of according assertions. -} class VariadicAssertions t where checkListPairs' :: ((ExpectedHask, NixLang) -> Assertion) -> [(ExpectedHask, NixLang)] -> t instance VariadicAssertions (IO a) where checkListPairs' f acc = do traverse_ f acc pure $ error "never would be reached, cuz `I'm lazy`." instance (VariadicAssertions a) => VariadicAssertions ((ExpectedHask, NixLang) -> a) where checkListPairs' f acc x = checkListPairs' f (acc <> one x) checks :: (VariadicAssertions a) => a checks = checkListPairs' (uncurry assertParseText) mempty class VariadicArgs t where checkList' :: (NixLang -> Assertion) -> [NixLang] -> t instance VariadicArgs (IO a) where checkList' f acc = do traverse_ f acc pure $ error "never would be reached, cuz `I'm lazy`." instance (VariadicArgs a) => VariadicArgs (NixLang -> a) where checkList' f acc x = checkList' f (acc <> one x) knownAs :: (VariadicArgs a) => (NixLang -> Assertion) -> a knownAs f = checkList' f mempty mistakes :: (VariadicArgs a) => a mistakes = knownAs assertParseFail invariantVals :: (VariadicArgs a) => a invariantVals = knownAs invariantVal ================================================ FILE: tests/PrettyParseTests.hs ================================================ {-# LANGUAGE DataKinds #-} {-# LANGUAGE MonoLocalBinds #-} {-# LANGUAGE NoMonomorphismRestriction #-} module PrettyParseTests where import Data.Algorithm.Diff import Data.Algorithm.DiffOutput import Data.Char import Data.Fix import qualified Data.String as String import Hedgehog import qualified Hedgehog.Gen as Gen import qualified Hedgehog.Range as Range import Nix.Atoms import Nix.Expr import Nix.Parser import Nix.Prelude import Nix.Pretty import Prettyprinter import Test.Tasty import Test.Tasty.Hedgehog import qualified Text.Show.Pretty as PS asciiString :: (MonadGen m) => m String asciiString = Gen.list (Range.linear 1 15) Gen.lower asciiText :: Gen Text asciiText = fromString <$> asciiString asciiVarName :: Gen VarName asciiVarName = coerce <$> asciiText -- Might want to replace this instance with a constant value genNPos :: Gen NPos genNPos = fmap coerce $ mkPos <$> Gen.int (Range.linear 1 256) genNSourcePos :: Gen NSourcePos genNSourcePos = join ( liftA3 NSourcePos (fmap coerce asciiString) ) genNPos genKeyName :: Gen (NKeyName NExpr) genKeyName = Gen.choice [DynamicKey <$> genAntiquoted genString, StaticKey <$> asciiVarName] genAntiquoted :: Gen a -> Gen (Antiquoted a NExpr) genAntiquoted gen = Gen.choice [Plain <$> gen, pure EscapedNewline, Antiquoted <$> genExpr] genBinding :: Gen (Binding NExpr) genBinding = Gen.choice [ liftA3 NamedVar genAttrPath genExpr genNSourcePos , liftA3 Inherit (Gen.maybe genExpr) (Gen.list (Range.linear 0 5) asciiVarName) genNSourcePos ] genString :: Gen (NString NExpr) genString = Gen.choice [ DoubleQuoted <$> genLines , liftA2 Indented (Gen.int $ Range.linear 0 10) genLines ] where genLines = Gen.list (Range.linear 0 5) (genAntiquoted asciiText) genAttrPath :: Gen (NAttrPath NExpr) genAttrPath = liftA2 (:|) genKeyName $ Gen.list (Range.linear 0 4) genKeyName genParams :: Gen (Params NExpr) genParams = Gen.choice [ Param <$> asciiVarName , liftA3 (mkGeneralParamSet . pure) (Gen.choice [stub, asciiText]) ( Gen.list (Range.linear 0 10) $ liftA2 (,) asciiText (Gen.maybe genExpr) ) Gen.bool ] genAtom :: Gen NAtom genAtom = Gen.choice [ NInt <$> Gen.integral (Range.linear 0 1000) , NFloat <$> Gen.float (Range.linearFrac 0.0 1000.0) , NBool <$> Gen.bool , pure NNull ] -- This is written by hand so we can use `fairList` rather than the normal -- list Arbitrary instance which makes the generator terminate. The -- distribution is not scientifically chosen. genExpr :: Gen NExpr genExpr = Gen.sized genCurbed where genCurbed (coerce -> n) = Fix <$> bool small big (n >= 2) where genConstant = NConstant <$> genAtom genStr = NStr <$> genString genSym = NSym <$> asciiVarName genLiteralPath = NLiteralPath . ("./" <>) . coerce <$> asciiString genEnvPath = NEnvPath . coerce <$> asciiString small = Gen.choice [genConstant, genStr, genSym, genLiteralPath, genEnvPath] big = let sizeDivBy i = Size $ n `div` i resizeDivBy i = Gen.resize (sizeDivBy i) in Gen.frequency [ (1, genConstant) , (1, genSym) , (2, genUnary) , (5, genList) , (20, genSet) , (10, genRecSet) , (1, resizeDivBy 2 genAssert) , (4, resizeDivBy 3 genIf) , (2, resizeDivBy 3 genBinary) , (3, resizeDivBy 3 genSelect) , (20, resizeDivBy 2 genAbs) , (2, resizeDivBy 2 genHasAttr) , (10, resizeDivBy 2 genLet) , (10, resizeDivBy 2 genWith) ] where genList = NList <$> fairList genExpr genSet = NSet mempty <$> fairList genBinding genRecSet = NSet Recursive <$> fairList genBinding genUnary = liftA2 NUnary Gen.enumBounded genExpr genBinary = join (liftA3 NBinary Gen.enumBounded) genExpr genSelect = liftA3 NSelect (Gen.maybe genExpr) genExpr genAttrPath genHasAttr = liftA2 NHasAttr genExpr genAttrPath genAbs = liftA2 NAbs genParams genExpr genLet = liftA2 NLet (fairList genBinding) genExpr genIf = join (liftA3 NIf genExpr) genExpr genWith = join (liftA2 NWith) genExpr genAssert = join (liftA2 NAssert) genExpr {- | Useful when there are recursive positions at each element of the list as it divides the size by the length of the generated list. -} fairList :: Gen a -> Gen [a] fairList g = Gen.sized $ \s -> do k <- Gen.int $ Range.linear 0 $ unSize s -- Use max here to avoid dividing by zero when there is the empty list Gen.resize (Size (unSize s `div` max 1 k)) $ Gen.list (Range.singleton k) g equivUpToNormalization :: NExpr -> NExpr -> Bool equivUpToNormalization x y = normalize x == normalize y normalize :: NExpr -> NExpr normalize = foldFix $ \case NConstant (NInt n) | n < 0 -> mkNeg $ mkInt $ negate n NConstant (NFloat n) | n < 0 -> mkNeg $ mkFloat $ negate n NSet recur binds -> mkSet recur $ normBinding <$> binds NLet binds r -> mkLets (normBinding <$> binds) r NAbs params r -> mkFunction (normParams params) r r -> Fix r where normBinding (NamedVar path r pos) = NamedVar (normKey <$> path) r pos normBinding (Inherit mr names pos) = Inherit mr names pos normKey (DynamicKey quoted) = DynamicKey (normAntiquotedString quoted) normKey (StaticKey name) = StaticKey name normAntiquotedString :: Antiquoted (NString NExpr) NExpr -> Antiquoted (NString NExpr) NExpr normAntiquotedString (Plain (DoubleQuoted [EscapedNewline])) = EscapedNewline normAntiquotedString (Plain (DoubleQuoted strs)) = bool normAntiquotedString id (strs == strs') (Plain $ DoubleQuoted strs') where strs' = normAntiquotedText <$> strs normAntiquotedString r = r normAntiquotedText :: Antiquoted Text NExpr -> Antiquoted Text NExpr normAntiquotedText (Plain "\n") = EscapedNewline normAntiquotedText (Plain "''\n") = EscapedNewline normAntiquotedText r = r normParams (ParamSet (Just "") variadic pset) = ParamSet Nothing variadic pset normParams r = r -- | Test that parse . pretty == id up to attribute position information. prop_prettyparse :: (Monad m) => NExpr -> PropertyT m () prop_prettyparse p = either ( \s -> do footnote $ show $ vsep -- Remove :: Text type annotation after String -> Text migration. [fillSep ["Parse failed:", pretty (show s :: Text)], indent 2 $ prettyNix p] discard ) ( \v -> bool ( do let pp = normalise prog pv = normalise $ show $ prettyNix v footnote $ show $ vsep [ "----------------------------------------" , vsep ["Expr before:", indent 2 $ pretty $ PS.ppShow p] , "----------------------------------------" , vsep ["Expr after:", indent 2 $ pretty $ PS.ppShow v] , "----------------------------------------" , vsep ["Pretty before:", indent 2 $ pretty prog] , "----------------------------------------" , vsep ["Pretty after:", indent 2 $ prettyNix v] , "----------------------------------------" , vsep ["Normalised before:", indent 2 $ pretty pp] , "----------------------------------------" , vsep ["Normalised after:", indent 2 $ pretty pv] , "========================================" , vsep ["Normalised diff:", pretty $ ppDiff $ ldiff pp pv] , "========================================" ] assert (pp == pv) ) success (equivUpToNormalization p v) ) (parse $ fromString prog) where prog = show $ prettyNix p parse = parseNixText normalise s = String.unlines $ reverse . dropWhile isSpace . reverse <$> String.lines s ldiff :: String -> String -> [Diff [String]] ldiff s1 s2 = getDiff (one <$> String.lines s1) (one <$> String.lines s2) tests :: TestLimit -> TestTree tests n = testProperty "Pretty/Parse Property" $ withTests n $ property $ prop_prettyparse =<< forAll genExpr ================================================ FILE: tests/PrettyTests.hs ================================================ {-# LANGUAGE TemplateHaskell #-} module PrettyTests (tests) where import Nix.Prelude import Test.Tasty import Test.Tasty.HUnit import Test.Tasty.TH import Nix.Expr import Nix.Pretty case_indented_antiquotation :: Assertion case_indented_antiquotation = do assertPretty (mkIndentedStr 0 "echo $foo") "''echo $foo''" assertPretty (mkIndentedStr 0 "echo ${foo}") "''echo ''${foo}''" case_string_antiquotation :: Assertion case_string_antiquotation = do assertPretty (mkStr "echo $foo") "\"echo $foo\"" assertPretty (mkStr "echo ${foo}") "\"echo \\${foo}\"" case_function_params :: Assertion case_function_params = assertPretty (mkFunction (mkVariadicParamSet mempty) (mkInt 3)) "{ ... }:\n 3" case_paths :: Assertion case_paths = do assertPretty (mkPath False "~/test.nix") "~/test.nix" assertPretty (mkPath False "/test.nix") "/test.nix" assertPretty (mkPath False "./test.nix") "./test.nix" tests :: TestTree tests = $testGroupGenerator --------------------------------------------------------------------------------- assertPretty :: NExpr -> Text -> Assertion assertPretty e s = assertEqual ("When pretty-printing " <> show e) s . show $ prettyNix e ================================================ FILE: tests/ReduceExprTests.hs ================================================ {-# OPTIONS_GHC -fno-warn-name-shadowing #-} module ReduceExprTests (tests) where import Nix.Prelude import Test.Tasty import Test.Tasty.HUnit import Nix.Expr.Shorthands import Nix.Expr.Types import Nix.Expr.Types.Annotated import Nix.Parser import Nix.Reduce (reduceExpr) tests :: TestTree tests = testGroup "Expr Reductions" [ testCase "Non nested NSelect on set should be reduced" $ cmpReduceResult selectBasic selectBasicExpect , testCase "Nested NSelect on set should be reduced" $ cmpReduceResult selectNested selectNestedExpect , testCase "Non nested NSelect with incorrect attrpath shouldn't be reduced" $ shouldntReduce selectIncorrectAttrPath , testCase "Nested NSelect with incorrect attrpath shouldn't be reduced" $ shouldntReduce selectNestedIncorrectAttrPath ] assertSucc :: Result a -> IO a assertSucc = either (assertFailure . show) pure cmpReduceResult :: Result NExprLoc -> NExpr -> Assertion cmpReduceResult r e = do r <- assertSucc r r <- stripAnnotation <$> reduceExpr mempty r r @?= e shouldntReduce :: Result NExprLoc -> Assertion shouldntReduce r = do r <- assertSucc r rReduced <- reduceExpr mempty r r @?= rReduced selectBasic :: Result NExprLoc selectBasic = parseNixTextLoc "{b=2;a=42;}.a" selectBasicExpect :: NExpr selectBasicExpect = mkInt 42 selectNested :: Result NExprLoc selectNested = parseNixTextLoc "{a={b=2;a=42;};b={a=2;};}.a.a" selectNestedExpect :: NExpr selectNestedExpect = mkInt 42 selectIncorrectAttrPath :: Result NExprLoc selectIncorrectAttrPath = parseNixTextLoc "{a=42;}.b" selectNestedIncorrectAttrPath :: Result NExprLoc selectNestedIncorrectAttrPath = parseNixTextLoc "{a={a=42;};}.a.b" ================================================ FILE: tests/TestCommon.hs ================================================ module TestCommon where import Control.Monad.Catch import Data.Text.IO as Text import Data.Time import GHC.Err (errorWithoutStackTrace) import Nix import Nix.Prelude import Nix.Standard import System.Environment import System.IO import System.PosixCompat.Files import System.PosixCompat.Temp import System.Process import Test.Tasty.HUnit hnixEvalFile :: Options -> Path -> IO StdVal hnixEvalFile opts file = do parseResult <- parseNixFileLoc file either (\err -> fail $ "Parsing failed for file `" <> coerce file <> "`.\n" <> show err) ( \expr -> do setEnv "TEST_VAR" "foo" runWithBasicEffects opts $ evaluateExpression (pure $ coerce file) nixEvalExprLoc normalForm expr `catch` \case NixException frames -> errorWithoutStackTrace . show =<< renderFrames @StdVal @StdThun frames ) parseResult nixEvalFile :: Path -> IO Text nixEvalFile (coerce -> fp) = fromString <$> readProcess "nix-instantiate" ["--eval", "--strict", fp] mempty hnixEvalText :: Options -> Text -> IO StdVal hnixEvalText opts src = either (\err -> fail $ toString $ "Parsing failed for expression `" <> src <> "`.\n" <> show err) (runWithBasicEffects opts . (normalForm <=< nixEvalExpr mempty)) $ parseNixText src nixEvalText :: Text -> IO Text nixEvalText expr = do (fp, h) <- mkstemp "nix-test-eval" Text.hPutStr h expr hClose h res <- nixEvalFile $ coerce fp removeLink fp pure res assertEvalMatchesNix :: ( Options -> Text -> IO (NValue t (StdCited StandardIO) StandardIO) ) -> (Text -> IO Text) -> Text -> IO () assertEvalMatchesNix evalHNix evalNix fp = do time <- liftIO getCurrentTime hnixVal <- (<> "\n") . printNix <$> evalHNix (defaultOptions time) fp nixVal <- evalNix fp assertEqual (toString fp) nixVal hnixVal -- | Compares @HNix@ & @Nix@ return results. assertEvalFileMatchesNix :: Path -> Assertion assertEvalFileMatchesNix fp = assertEvalMatchesNix (\o -> hnixEvalFile o . coerce . toString) (nixEvalFile . coerce . toString) $ fromString $ coerce fp assertEvalTextMatchesNix :: Text -> Assertion assertEvalTextMatchesNix = assertEvalMatchesNix hnixEvalText nixEvalText ================================================ FILE: tests/eval-compare/builtins.appendContext.nix ================================================ let drv = derivation { name = "fail"; builder = "/bin/false"; system = "x86_64-linux"; outputs = [ "out" "foo" ]; }; path = "${./builtins.appendContext.nix}"; desired-context = { "${builtins.unsafeDiscardStringContext path}" = { path = true; }; "${builtins.unsafeDiscardStringContext drv.drvPath}" = { outputs = [ "foo" "out" ]; allOutputs = true; }; }; # TODO: Remove builtins.attrValues here once store hash is correct. legit-context = builtins.attrValues (builtins.getContext "${path}${drv.outPath}${drv.foo.outPath}${drv.drvPath}"); constructed-context = builtins.attrValues (builtins.getContext (builtins.appendContext "" desired-context)); # jww (2019-03-17): This is not working just yet # in [ (builtins.appendContext "foo" {}) # (legit-context == constructed-context) # constructed-context # ] in true ================================================ FILE: tests/eval-compare/builtins.eq-bottom-00.nix ================================================ let plain = (let x = x; in x); nested_list = [(let x = x; in x)]; nested_attrset = { y = (let x = x; in x); }; nested_list_list = [[(let x = x; in x)]]; nested_list_attrset = [{ y = (let x = x; in x); }]; nested_list_function = [(_: let x = x; in x)]; nested_attrset_list = { y = [(let x = x; in x)]; }; nested_attrset_attrset = { y = { y = (let x = x; in x); }; }; nested_attrset_function = { y = (_: let x = x; in x); }; tests = [ # (plain == plain) # Diverges # (nested_list == nested_list) # Diverges # (nested_attrset == nested_attrset) # Diverges (nested_list_list == nested_list_list) (nested_list_attrset == nested_list_attrset) (nested_list_function == nested_list_function) (nested_attrset_attrset == nested_attrset_attrset) (nested_attrset_list == nested_attrset_list) (nested_attrset_function == nested_attrset_function) ]; in tests ================================================ FILE: tests/eval-compare/builtins.fetchurl-01.nix ================================================ with builtins; let a = fetchurl "https://haskell.org"; in [ a (hasContext a) ] ================================================ FILE: tests/eval-compare/builtins.fromJSON-01.nix ================================================ with builtins; let simpleJSON = "{\"foo\": \"39\", \"bar\": 472}"; screwyJSON = "{\"4275\": \"Please do not fail.\"}"; crazyJSON = " { \"response\": { \"success\": 1, \"current_time\": 1362339098, \"prices\": { \"35\": { \"11\": { \"0\": { \"current\": { \"currency\": \"keys\", \"value\": 39, \"value_high\": 41, \"date\": 1357515306 }, \"previous\": { \"currency\": \"keys\", \"value\": 37, \"value_high\": 39 } } }, \"3\": { \"0\": { \"current\": { \"currency\": \"metal\", \"value\": 0.33, \"value_high\": 0.66 } } } }, \"5002\": { \"6\": { \"0\": { \"current\": { \"currency\": \"usd\", \"value\": 0.39, \"value_high\": 0.42, \"date\": 1358090106 } } } }, \"5022\": { \"6\": { \"1\": { \"current\": { \"currency\": \"metal\", \"value\": 1.33, \"value_high\": 1.55, \"date\": 1357515175 } } } } } } }"; in [(fromJSON simpleJSON) (fromJSON screwyJSON) (fromJSON crazyJSON)] ================================================ FILE: tests/eval-compare/builtins.getContext.nix ================================================ with builtins; [ (getContext "foo") (attrValues (getContext (toFile "foo" "foo contents"))) # TODO: Re-enable this once output hash is correct. # (getContext (toFile "foo" "foo contents")) ] ================================================ FILE: tests/eval-compare/builtins.lessThan-01.nix ================================================ with builtins; let numTestPrecisionA = 4.000000000000000000001; numTestPrecisionB = 4; numTest3 = -4.1; numTest4 = -4; numTestZeroA = 0; numTestZeroB = -0; numTestMaxBoundA = 999999999999999999; numTestMaxBoundB = 999999999999999998; numTestMinBoundA = -999999999999999999; numTestMinBoundB = -999999999999999998; stringTest1 = "abcd"; stringTest2 = "abce"; stringTestBase1 = "foo" + "/" + stringTest1; stringTestBase2 = "foo" + "/" + stringTest2; stringTestJSONA = toJSON stringTest1; stringTestJSONB = toJSON stringTest2; stringTestToFileA = toFile "stringTest1" stringTest1; stringTestToFileB = toFile "stringTest2" stringTest2; in [(lessThan numTestPrecisionA numTestPrecisionB) (lessThan numTestPrecisionB numTestPrecisionA) (lessThan numTest3 numTest4) (lessThan numTest4 numTest3) (lessThan numTestZeroA numTestZeroB) (lessThan numTestZeroB numTestZeroA) (lessThan numTestMaxBoundA numTestMaxBoundB) (lessThan numTestMaxBoundB numTestMaxBoundA) (lessThan numTestMinBoundA numTestMinBoundB) (lessThan numTestMinBoundB numTestMinBoundA) (lessThan stringTest1 stringTest2) (lessThan stringTest2 stringTest1) (lessThan stringTestJSONA stringTestJSONB) (lessThan stringTestJSONB stringTestJSONA) (lessThan stringTest1 stringTestJSONB) (lessThan stringTestJSONB stringTest1) (lessThan stringTest2 stringTestJSONA) (lessThan stringTestJSONA stringTest2) (lessThan stringTest1 stringTestToFileB) (lessThan stringTestToFileB stringTest1) (lessThan stringTestToFileA stringTest2) (lessThan stringTest1 (baseNameOf stringTestBase1)) (lessThan stringTest2 (baseNameOf stringTestBase2)) ] ================================================ FILE: tests/eval-compare/builtins.mapAttrs-01.nix ================================================ with builtins; let fooset = { foo = 123; bar = 456; }; lolset = { "foo/bar" = "lol"; "bar/baz" = "wat";}; emptyset = {}; in [ (all (x: hasContext(x)) (attrValues (mapAttrs (key: value: key) fooset))) (all (x: hasContext(x)) (attrValues (mapAttrs (key: value: key) lolset))) (all (x: hasContext(x)) (attrValues (mapAttrs (key: value: key) emptyset))) (all (x: hasContext(x)) (attrValues (mapAttrs (key: value: key + toString value) fooset))) (all (x: hasContext(x)) (attrValues (mapAttrs (key: value: key + toString value) lolset))) (all (x: hasContext(x)) (attrValues (mapAttrs (key: value: key + toString value) emptyset))) (all (x: hasContext(x)) (attrValues (mapAttrs (key: value: key + toJSON value) fooset))) (all (x: hasContext(x)) (attrValues (mapAttrs (key: value: key + toJSON value) lolset))) (all (x: hasContext(x)) (attrValues (mapAttrs (key: value: key + toJSON value) emptyset))) (all (x: hasContext(x)) (attrValues (mapAttrs (key: value: key + toJSON (toString value)) fooset))) (all (x: hasContext(x)) (attrValues (mapAttrs (key: value: key + toJSON (toString value)) lolset))) (all (x: hasContext(x)) (attrValues (mapAttrs (key: value: key + toJSON (toString value)) emptyset))) (all (x: hasContext(x)) (attrValues (mapAttrs (key: value: key + value) lolset))) (all (x: hasContext(x)) (attrValues (mapAttrs (key: value: key + value) emptyset))) ] ================================================ FILE: tests/eval-compare/builtins.pathExists.nix ================================================ builtins.pathExists "/var/empty/invalid-directory" ================================================ FILE: tests/eval-compare/builtins.replaceStrings-01.nix ================================================ with builtins; let a1 = toFile "foo" "foo contents"; # /nix/store/pqwdc5m06lxl8gmzcd26ifwsdhq9fj7k-foo a2 = toFile "bar" "bar contents"; # /nix/store/4q6kxj1ym13yfp1bcdrzrwa1la6dqgp5-bar b = dirOf a1; c = substring 3 1 b; d = replaceStrings ["b"] [c] "abc"; e = replaceStrings ["k"] [c] "abc"; f = replaceStrings ["y"] [c] (dirOf a2); g = replaceStrings ["s"] [c] (dirOf a2); h = replaceStrings ["y"] ["z"] "abc"; in [ b c d e f g h # TODO Add a1 here when we have correct store hashing working (hasContext d) (hasContext e) (hasContext f) (hasContext g) (hasContext h) ] ================================================ FILE: tests/eval-compare/builtins.split-01.nix ================================================ builtins.split "(a)b" "abc" ================================================ FILE: tests/eval-compare/builtins.split-02.nix ================================================ builtins.split "([ac])" "abc" ================================================ FILE: tests/eval-compare/builtins.split-03.nix ================================================ builtins.split "(a)|(c)" "abc" ================================================ FILE: tests/eval-compare/builtins.split-04.nix ================================================ builtins.split "([[:upper:]]+)" " FOO " ================================================ FILE: tests/eval-compare/builtins.string.store.nix ================================================ "${builtins.storeDir}" ================================================ FILE: tests/eval-compare/builtins.toJSON.nix ================================================ with builtins; let f = toFile "foo" "foo contents"; # /nix/store/pqwdc5m06lxl8gmzcd26ifwsdhq9fj7k-foo objA = { a = 15; b = substring 1 3 (dirOf f); }; objB = { a = 42; b = "hello"; }; in [ (hasContext (toJSON objA)) (hasContext (toJSON objB)) ] ================================================ FILE: tests/eval-compare/current-system.nix ================================================ builtins.hasContext builtins.currentSystem ================================================ FILE: tests/eval-compare/ellipsis.nix ================================================ let x = 1; f = { ... }: x; in f { x = 2; } ================================================ FILE: tests/eval-compare/ind-string-01.nix ================================================ let s1 = '' This is an indented multi-line string literal. An amount of whitespace at the start of each line matching the minimum indentation of all lines in the string literal together will be removed. Thus, in this case four spaces will be stripped from each line, even though THIS LINE is indented six spaces. Also, empty lines don't count in the determination of the indentation level (the previous empty line has indentation 0, but it doesn't matter). ''; in s1 ================================================ FILE: tests/eval-compare/ind-string-02.nix ================================================ let s2 = '' If the string starts with whitespace followed by a newline, it's stripped, but that's not the case here. Two spaces are stripped because of the " " at the start. ''; in s2 ================================================ FILE: tests/eval-compare/ind-string-03.nix ================================================ let s3 = '' This line is indented a bit further. ''; # indentation of last line doesn't count if it's empty in s3 ================================================ FILE: tests/eval-compare/ind-string-04.nix ================================================ let s4 = '' Anti-quotations, like ${if true then "so" else "not so"}, are also allowed. ''; in s4 ================================================ FILE: tests/eval-compare/ind-string-05.nix ================================================ let s5 = '' The \ is not special here. ' can be followed by any character except another ', e.g. 'x'. Likewise for $, e.g. $$ or $varName. But ' followed by ' is special, as is $ followed by {. If you want them, use anti-quotations: ${"''"}, ${"\${"}. ''; in s5 ================================================ FILE: tests/eval-compare/ind-string-06.nix ================================================ let s6 = '' Tabs are not interpreted as whitespace (since we can't guess what tab settings are intended), so don't use them. This line starts with a space and a tab, so only one space will be stripped from each line. ''; in s6 ================================================ FILE: tests/eval-compare/ind-string-07.nix ================================================ let s7 = '' Also note that if the last line (just before the closing ' ') consists only of whitespace, it's ignored. But here there is some non-whitespace stuff, so the line isn't removed. ''; in s7 ================================================ FILE: tests/eval-compare/ind-string-08.nix ================================================ let s8 = '' ${""} This shows a hacky way to preserve an empty line after the start. But there's no reason to do so: you could just repeat the empty line. ''; in s8 ================================================ FILE: tests/eval-compare/ind-string-09.nix ================================================ let s9 = '' ${""} Similarly you can force an indentation level, in this case to 2 spaces. This works because the anti-quote is significant (not whitespace). ''; in s9 ================================================ FILE: tests/eval-compare/ind-string-10.nix ================================================ let s10 = '' ''; in s10 ================================================ FILE: tests/eval-compare/ind-string-11.nix ================================================ let s11 = ''''; in s11 ================================================ FILE: tests/eval-compare/ind-string-12.nix ================================================ let s12 = '' ''; in s12 ================================================ FILE: tests/eval-compare/ind-string-13.nix ================================================ let s13 = '' start on network-interfaces start script rm -f /var/run/opengl-driver ${if true then "ln -sf 123 /var/run/opengl-driver" else if true then "ln -sf 456 /var/run/opengl-driver" else "" } rm -f /var/log/slim.log end script env SLIM_CFGFILE=${"abc"} env SLIM_THEMESDIR=${"def"} env FONTCONFIG_FILE=/etc/fonts/fonts.conf # !!! cleanup env XKB_BINDIR=${"foo"}/bin # Needed for the Xkb extension. env LD_LIBRARY_PATH=${"libX11"}/lib:${"libXext"}/lib:/usr/lib/ # related to xorg-sys-opengl - needed to load libglx for (AI)GLX support (for compiz) ${if true then "env XORG_DRI_DRIVER_PATH=${"nvidiaDrivers"}/X11R6/lib/modules/drivers/" else if true then "env XORG_DRI_DRIVER_PATH=${"mesa"}/lib/modules/dri" else "" } exec ${"slim"}/bin/slim ''; in s13 ================================================ FILE: tests/eval-compare/ind-string-14.nix ================================================ let s14 = '' Escaping of ' followed by ': ''' Escaping of $ followed by {: ''${ And finally to interpret \n etc. as in a string: ''\n, ''\r, ''\t. ''; in s14 ================================================ FILE: tests/eval-compare/ind-string-15.nix ================================================ let # Regression test: antiquotation in '${x}' should work, but didn't. s15 = let x = "bla"; in '' foo '${x}' bar ''; in s15 ================================================ FILE: tests/eval-compare/ind-string-16.nix ================================================ let # Regression test: accept $'. s16 = '' cut -d $'\t' -f 1 ''; in s16 ================================================ FILE: tests/eval-compare/ind-string-17.nix ================================================ let # Accept dollars at end of strings s17 = ''ending dollar $'' + ''$'' + "\n"; in s17 ================================================ FILE: tests/eval-compare/ind-string-18.nix ================================================ # to observe the upstream nix behavior for dollar sign excape in doublequote string "\${foo \$ $foo" ================================================ FILE: tests/eval-compare/ind-string-19.nix ================================================ # to observe the upstream nix behavior for dollar excape in Indented string '' ''$ $ ''${ '' ================================================ FILE: tests/eval-compare/paths-01.nix ================================================ baseNameOf foo/bar ================================================ FILE: tests/eval-compare/placeholder.nix ================================================ builtins.placeholder "foo" ================================================ FILE: tests/files/attrs.nix ================================================ rec { y = 2; z = { w = 4; }; v = rec { u = 6; t = [ u z.w s.q ]; }; s = { r = import ./goodbye.nix; q = 10; }; p = import ./hello.nix; } ================================================ FILE: tests/files/callLibs.nix ================================================ let callLibs = file: import file { lib = self; }; trivial = callLibs ./trivial.nix; in trivial ================================================ FILE: tests/files/eighty.nix ================================================ 80 ================================================ FILE: tests/files/file.nix ================================================ ({ x ? 1, y ? x * 3 }: import ./file2.nix { a = y; }) {} ================================================ FILE: tests/files/file2.nix ================================================ { a }: a + 100 ================================================ FILE: tests/files/findFile.nix ================================================ ================================================ FILE: tests/files/force.nix ================================================ let f = { a = 1; b = import ./hello.nix; }; in f.a ================================================ FILE: tests/files/goodbye.nix ================================================ "Goodbye, world!" ================================================ FILE: tests/files/hello.nix ================================================ "Hello, world!" ================================================ FILE: tests/files/hello2.nix ================================================ let x = { z = x: import ./eighty.nix + 20 + x; w = 123; }; allPackages = self: super: let res = import ./eighty.nix { inherit lib nixpkgsFun noSysDirs config; } null self; in res; y = "Hello"; z = "Goodbye"; f = x: if x == 0 then x * 2 else x + 2; w = x.z 5 + f 3 - 15; in assert w == 1; if x.z 2 == 100 then y else 3 ================================================ FILE: tests/files/if-then.nix ================================================ # [ ({ a = 1; b = 2; } // { c = 1; d = 2; }) # ([1 2 3] ++ [4.0 5.0 6.0]) # (x: y: x + y) # ] ({ x, y ? x + 1 }: x + x) ================================================ FILE: tests/files/lint.nix ================================================ { x, y }: let z = x + y; in [ z (y + 2) ] ================================================ FILE: tests/files/loop.nix ================================================ (with builtins; { localSystem ? builtins.intersectAttrs { system = null; platform = null; } args , system ? null , platform ? null , crossSystem ? null , config ? {} , overlays ? [] , ... }@args: ({ localSystem , crossSystem ? null , config ? null , overlays ? null , stdenvStages ? { lib, localSystem, crossSystem, config, overlays }@args: let inherit ( rec { stageFun = step: last: { shell ? "/bin/bash" , overrides ? (self: super: {}) , allowedRequisites ? null }: let name = "bootstrap-stage${toString step}"; thisStdenv = (let fix' = f: let x = f x // { __unfix__ = null; }; in x; makeExtensible = rattrs: fix' rattrs // { extend = null; }; lib = makeExtensible (self: let callLibs = file: import file { lib = self; }; in with self; { customisation = callLibs ; trivial = callLibs ; inherit (customisation) makeOverridable; inherit (trivial) functionArgs setFunctionArgs; }); in lib.makeOverridable ({ name ? null , preHook ? null , initialPath , shell , allowedRequisites ? null , overrides ? (self: super: {}) , config , buildPlatform , hostPlatform , targetPlatform }: let defaultBuildInputs = []; stdenv = derivation ({ allowedRequisites = allowedRequisites ++ defaultBuildInputs; } // { inherit name; inherit (buildPlatform) system; builder = shell; }) // { inherit overrides; }; in stdenv)) { name = "${name}-stdenv-darwin"; inherit config shell; allowedRequisites = if allowedRequisites == null then null else allowedRequisites ++ []; buildPlatform = localSystem; hostPlatform = localSystem; targetPlatform = localSystem; initialPath = []; overrides = self: super: (overrides self super) // { fetchurl = null; }; }; in { inherit config overlays; stdenv = thisStdenv; }; stage0 = stageFun 0 null { overrides = self: super: super; }; stage1 = prevStage: with prevStage; stageFun 1 prevStage { allowedRequisites = [ (pkgs.darwin.Libsystem) # THUNK FORCE STARTS HERE ]; overrides = sefl: super: {}; }; stagesDarwin = [ ({ }: stage0) stage1 ]; }) stagesDarwin; in stagesDarwin }@args: let lib = let fix' = f: let x = f x // { __unfix__ = null; }; in x; makeExtensible = rattrs: fix' rattrs // { extend = null; }; in makeExtensible (self: let callLibs = file: import file { lib = self; }; in with self; { fixedPoints = callLibs ; lists = callLibs ; inherit (fixedPoints) fix extends; inherit (lists) foldl' imap1; }); allPackages = newArgs: ({ lib , nixpkgsFun , stdenv , allowCustomOverrides , noSysDirs ? null , config , overlays }: let allPackages = pkgs: super: { pkgs = pkgs; darwin = pkgs.darwin; # THUNK FORCE LOOPS: self-reference }; in lib.fix (lib.foldl' (x: y: lib.extends y x) (self: {}) ([ (self: super: { inherit stdenv; }) allPackages (self: super: super.stdenv.overrides null super) ]))) ({ inherit lib nixpkgsFun; } // newArgs); withAllowCustomOverrides = lib.lists.imap1 (index: stageFun: prevStage: { allowCustomOverrides = index == 1; } // stageFun prevStage) (lib.lists.reverseList (stdenvStages { inherit lib localSystem crossSystem config overlays; })); go = n: if n == builtins.length withAllowCustomOverrides then {} else let succ = go (n + 1); in allPackages (builtins.elemAt withAllowCustomOverrides n succ); in go 0) (args // { inherit config overlays crossSystem; localSystem = { system = builtins.currentSystem; }; })) {} ================================================ FILE: tests/files/test.nix ================================================ let x = rec { y = 2; z = { w = 4; }; v = rec { u = 6; t = [ u z.w s.q ]; }; s = { r = import ./goodbye.nix; q = 10; }; p = import ./hello.nix; }; o = 100; in [ x.v.t x.z.w x.p x.p ] ================================================ FILE: tests/files/with.nix ================================================ with { x = 1; }; with { x = 2; }; y