{"id":14968039,"url":"https://github.com/typeable/stackage2nix","last_synced_at":"2025-10-26T00:30:47.528Z","repository":{"id":56878948,"uuid":"91977623","full_name":"typeable/stackage2nix","owner":"typeable","description":"Generate Nix build instructions from a Stack file","archived":false,"fork":false,"pushed_at":"2021-02-18T14:04:22.000Z","size":245,"stargazers_count":49,"open_issues_count":14,"forks_count":18,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-31T12:51:19.959Z","etag":null,"topics":["haskell","nix","nixpkgs","stack","stack2nix","stackage"],"latest_commit_sha":null,"homepage":null,"language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/typeable.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-21T18:07:58.000Z","updated_at":"2024-03-06T11:51:52.000Z","dependencies_parsed_at":"2022-08-20T11:40:35.049Z","dependency_job_id":null,"html_url":"https://github.com/typeable/stackage2nix","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typeable%2Fstackage2nix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typeable%2Fstackage2nix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typeable%2Fstackage2nix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typeable%2Fstackage2nix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/typeable","download_url":"https://codeload.github.com/typeable/stackage2nix/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238229940,"owners_count":19437723,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["haskell","nix","nixpkgs","stack","stack2nix","stackage"],"created_at":"2024-09-24T13:39:09.003Z","updated_at":"2025-10-26T00:30:47.055Z","avatar_url":"https://github.com/typeable.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"# stackage2nix (DEPRECATED)\n\n[![Build Status](https://travis-ci.org/typeable/stackage2nix.svg?branch=master)](https://travis-ci.org/typeable/stackage2nix)\n\n`stackage2nix` converts a Stack file into a Nix Haskell packages set.\n\n# Create build derivation from stack.yaml\n\n## Generate targets from stack.yaml only\n\n```\nstack exec -- stackage2nix .\n```\n\nCommand creates file `default.nix` which overrides `haskell.packages.stackage`\npackages set. You should use\n[typeable/nixpkgs-stackage](https://github.com/typeable/nixpkgs-stackage) overlay that\nadds LTS Stackage packages to Nixpkgs.\n\nBuild package with overlay installed:\n\n```\nnix-build -A stackage2nix\n```\n\n## Generate Stackage packages for the build\n\nIf you don't want to use Stackage overlay, stackage2nix can generate required\npackages with `--with-stackage-closure` flag.\n\n``` bash\nstack exec -- stackage2nix \\\n  --all-cabal-hashes /path/to/commercialhaskell/all-cabal-hashes \\\n  --lts-haskell /path/to/fpco/lts-haskell \\\n  --with-stackage-closure \\\n  ./stack.yaml\n```\n\nTo generate Stackage packages, supply the `--all-cabal-hashes` flag\nwith the path to a local clone of\n[all-cabal-hashes](https://github.com/commercialhaskell/all-cabal-hashes)\nchecked out on the `hackage` branch and supply the `--lts-haskell` flag\nwith the path to a local clone of\n[lts-haskell](https://github.com/commercialhaskell/lts-haskell).\n\n### stackage2nix wrapper\n\nYou can use stackage2nix wrapper from `nix` directory that adds required flags:\n\n```\nnix-env -i -f ./nix/stackage2nix\nstackage2nix --with-stackage-closure ./stack.yaml\n```\n\nThis command will produce `packages.nix` and `configuration-packages.nix`\nStackage packages and its override in `default.nix`\n\n## Generate full Stackage\n\n`--with-stackage` parameter generates full Stackage LTS in addition to the\ntargets from `stack.yaml`\n\n```\nnix-env -i -f ./nix/stackage2nix\nstackage2nix --with-stackage ./stack.yaml\n```\n\n## Generate Stackage from LTS resolver\n\nYou can also generate only Stackage packages set from the resolver:\n\n```\nnix-env -i -f ./nix/stackage2nix\nstackage2nix --resolver lts-10.0\n```\n\nThis command will produce Stackage packages `packages.nix`, packages config\n`configuration-packages.nix` and a Haskell packages set `default.nix`.\n\n## Runtime dependencies\n\n- `nix-env` is required to be on PATH by the\n  [distribution-nixpkgs](https://hackage.haskell.org/package/distribution-nixpkgs)\n  dependency\n- `nix-prefetch-scripts` is required on PATH if you have git dependencies in\n  `stack.yaml`\n\n## Override result derivation\n\nComplex projects may require some extra customization.\nSnippet `override.nix` below shows a minimal example of how to apply additional\noverrides on top of Haskell packages set produced by `stackage2nix`.\n\n``` nix\nwith import \u003cnixpkgs\u003e {};\nwith haskell.lib;\nlet haskellPackages = import ./. {};\nin haskellPackages.override {\n  overrides = self: super: {\n    stackage2nix = disableSharedExecutables super.stackage2nix;\n  };\n}\n```\n\n```\nnix-build -A stackage2nix override.nix\n```\n\nFor more complex overrides and detailed information on how to work with Haskell packages in Nix, see Nixpkgs manual [User’s Guide to the Haskell Infrastructure](http://nixos.org/nixpkgs/manual/#users-guide-to-the-haskell-infrastructure)\n\n## Tests\n\nIntegration tests that build stackage2nix form different yaml configs:\n\n``` bash\nSTACKAGE_REPO=\u003cpath/to/stackage/repo\u003e \\\nALL_CABAL_HASHES=\u003cpath/to/all-cabal-hashes/repo\u003e \\\nSTACK_FILE=stack-ghc-7103.yaml \\\n./ci-stackage2nix\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypeable%2Fstackage2nix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftypeable%2Fstackage2nix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypeable%2Fstackage2nix/lists"}