{"id":17685978,"url":"https://github.com/lionello/dub2nix","last_synced_at":"2025-05-12T21:27:50.548Z","repository":{"id":39658271,"uuid":"182485565","full_name":"lionello/dub2nix","owner":"lionello","description":"CLI tool to create Nix expressions for D-lang Dub projects","archived":false,"fork":false,"pushed_at":"2023-09-11T16:28:29.000Z","size":57,"stargazers_count":14,"open_issues_count":8,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-20T18:39:03.960Z","etag":null,"topics":["dlang","dlang-utilities","dlanguage","dub","nix","nixos","nixpkgs"],"latest_commit_sha":null,"homepage":null,"language":"D","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lionello.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":"2019-04-21T03:32:58.000Z","updated_at":"2024-11-20T15:22:48.000Z","dependencies_parsed_at":"2024-10-24T16:13:39.820Z","dependency_job_id":null,"html_url":"https://github.com/lionello/dub2nix","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lionello%2Fdub2nix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lionello%2Fdub2nix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lionello%2Fdub2nix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lionello%2Fdub2nix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lionello","download_url":"https://codeload.github.com/lionello/dub2nix/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253824571,"owners_count":21970045,"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":["dlang","dlang-utilities","dlanguage","dub","nix","nixos","nixpkgs"],"created_at":"2024-10-24T10:29:36.799Z","updated_at":"2025-05-12T21:27:50.500Z","avatar_url":"https://github.com/lionello.png","language":"D","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dub2nix\nCLI tool to create Nix expressions for D-lang Dub projects.\n\n![CI](https://github.com/lionello/dub2nix/workflows/CI/badge.svg)\n\n## Installation\nInstall with `nix-env`:\n```sh\nnix-env -if https://github.com/lionello/dub2nix/archive/master.tar.gz\n```\nor add to your `shell.nix` and run `nix-shell`:\n```nix\nwith import \u003cnixpkgs\u003e {};\nlet\n  dub2nix-src = fetchTarball {\n    url = \"https://github.com/lionello/dub2nix/archive/master.tar.gz\";\n  };\n  dub2nix = (import dub2nix-src) { inherit pkgs; };\nin mkShell {\n  buildInputs = [\n    dub2nix # dub dmd dtools ldc etc..\n  ];\n}\n```\n\n## Development\nDo `git clone` and `nix-shell` to build with `dub`:\n```sh\nnix-shell\ndub\n```\nAlternatively, use [`direnv`](https://direnv.net):\n```sh\necho use nix \u003e\u003e .envrc\ndirenv allow\ndub\n```\n\n### Test\n\nTo run the tests, do:\n```\nnix-instantiate --eval \"test\"\n```\n\nThis should evaluate to `true`.\n\n## Usage\n```\nUsage: dub2nix [OPTIONS] COMMAND\n\nCreate Nix derivations for Dub package dependencies.\n\nCommands:\n  save         Write Nix files for Dub project\n\nOptions:\n-i     --input Path of selections JSON; defaults to ./dub.selections.json\n-o    --output Output Nix file for Dub project\n-r  --registry URL to Dub package registry; default http://code.dlang.org/packages/\n-d --deps-file Output Nix file with dependencies; defaults to ./dub.selections.nix\n-h      --help This help information.\n```\nFirst, use `dub build` to generate the `dub.selections.json` for your Dub project.\nThen, run `dub2nix save` to read the `dub.selections.json` in the current folder and write a new file `dub.selections.nix`.\n\nThis `dub.selections.nix` is used in `mkDubDerivation` (from `mkDub.nix`) to create a new derivation for your Dub project:\n```nix\n{pkgs}:\nwith (import ./mkDub.nix {\n    inherit pkgs;\n});\nmkDubDerivation {\n    version = \"0.1.0\"; # optional\n    src = ./.;\n}\n```\n\nWhen your project has no dependencies at all, this will fail because `dub.selections.nix` is missing. Set `deps` to override the dependencies:\n```nix\n{pkgs}:\nwith (import ./mkDub.nix {\n    inherit pkgs;\n});\nmkDubDerivation {\n    src = ./.;\n    deps = [];\n}\n```\n\nUse the `--output` option to write a `.nix` file with a skeleton derivation for your dub project. This will also create the `mkDub.nix` file for importing into the derivation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flionello%2Fdub2nix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flionello%2Fdub2nix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flionello%2Fdub2nix/lists"}