{"id":21517571,"url":"https://github.com/tek/thax","last_synced_at":"2025-04-09T21:42:21.523Z","repository":{"id":147944996,"uuid":"259418376","full_name":"tek/thax","owner":"tek","description":"ctags generation for haskell projects with nix dependency management","archived":false,"fork":false,"pushed_at":"2024-05-17T16:48:04.000Z","size":37,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-23T23:34:33.811Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tek.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-27T18:31:00.000Z","updated_at":"2024-05-17T16:48:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"6b870227-f6f6-4b6c-98af-de7e763e5aa0","html_url":"https://github.com/tek/thax","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tek%2Fthax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tek%2Fthax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tek%2Fthax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tek%2Fthax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tek","download_url":"https://codeload.github.com/tek/thax/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248118846,"owners_count":21050746,"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":[],"created_at":"2024-11-24T00:43:01.144Z","updated_at":"2025-04-09T21:42:21.480Z","avatar_url":"https://github.com/tek.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"# thax – create haskell tags from nix dependencies\n\nThis nix expression provides a few functions for the creation of [hasktags]\nfrom a dependency tree of haskell derivations as produced by [cabal2nix].\n\n# Usage\n\nAll functions take a list of haskell derivations.\nThe functions in `individual` produce lists of derivations, each of which\ncontain the tags file for a package, while those in `combined` produce\na derivation for a merged tag file.\n\nThere are three functions in each of those two sets:\n\n* `deps` generates tags for only the dependencies\n* `packages` generates tags for only the targets\n* `all` combines the above\n\n## Ad-hoc from the shell\n\n```sh\nnix-build -A combined.packages --arg targets '[(import \u003cnixpkgs\u003e {}).haskellPackages.aeson]'\n```\n\nBuilds only the tags for `aeson` without dependencies, while `combined.all`\nwould build its dependencies as well and merge everything into the file `tags`\nin the output store path.\n\n## In your project config\n\n```nix\nlet\n  pkgs = import \u003cnixpkgs\u003e {};\n  tags = import (fetchTarball \"https://github.com/tek/thax/tarball/master\") { inherit pkgs; };\n  packages = [(pkgs.haskellPackages.callCabal2nix \"spaceship\" ./. {})]; # however your project is set up\nin {\n  projectTags = tags.combined.all { targets = packages; };\n}\n```\n\nFor example, in an [obelisk] project:\n\n```nix\nlet\n  pkgs = import \u003cnixpkgs\u003e {};\n  obelisk = (import ./.obelisk/impl {}).project ./. ({ ... }: {});\n  targets = [obelisk.ghc.frontend obelisk.ghc.backend obelisk.ghc.common];\n  tags = import (fetchTarball \"https://github.com/tek/thax/tarball/master\") { inherit pkgs; };\nin\n  obelisk // {\n    projectTags = tags.combined.all { inherit targets; };\n  }\n```\n\nNow you can generate all project dependencies' tags with:\n\n```sh\ncp $(nix-build --no-link -A projectTags)/tags .tags\n```\n\n# Relative paths\n\nThe tags of the packages you are developing in your project should not be\npointing to the store, but `nix` will copy them over before running the\nderivation builder.\n\nTherefore all packages passed into the API functions will be tagged with\nrelative paths by default, while all dependencies will have absolute paths.\n\nYou can override this behaviour by passing `relative = false;` to the\nfunctions, as in:\n\n```nix\ntags.combined.all { inherit targets; relative = false; }\n```\n\nor more granularly by setting the `relative` attribute on a package, like:\n\n```nix\ntags.combined.all { targets = [mypackage // { relative = false; }]; }\n```\n\n## Directory prefixes\n\nIf the relative path isn't enough, because your local packages are located in\nsubdirectories, you can set the package's attribute `tagsPrefix` like so:\n\n```nix\ntags.combined.all { targets = [mypackage // { tagsPrefix = \"packages/mypack\"; }]; }\n```\n\n## GHC\n\nSince `base` et al. aren't regular dependencies, the `all` function will\ninclude the GHC sources.\nIf that is not desired, you can deactivate it:\n\n```nix\ntags.combined.all { inherit targets; base = false; }\n```\n\n[hasktags]: https://hackage.haskell.org/package/hasktags\n[cabal2nix]: https://hackage.haskell.org/package/cabal2nix\n[obelisk]: https://github.com/obsidiansystems/obelisk\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftek%2Fthax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftek%2Fthax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftek%2Fthax/lists"}