{"id":28239505,"url":"https://github.com/codedownio/julia2nix","last_synced_at":"2025-06-11T07:31:20.109Z","repository":{"id":53488277,"uuid":"313034243","full_name":"codedownio/julia2nix","owner":"codedownio","description":"Generate Nix expressions for building a Julia depot with a set of packages","archived":false,"fork":false,"pushed_at":"2022-12-02T07:12:29.000Z","size":136,"stargazers_count":57,"open_issues_count":2,"forks_count":6,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-06-02T16:22:07.699Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codedownio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-15T13:11:58.000Z","updated_at":"2025-04-17T10:09:27.000Z","dependencies_parsed_at":"2023-01-22T12:15:25.588Z","dependency_job_id":null,"html_url":"https://github.com/codedownio/julia2nix","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codedownio%2Fjulia2nix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codedownio%2Fjulia2nix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codedownio%2Fjulia2nix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codedownio%2Fjulia2nix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codedownio","download_url":"https://codeload.github.com/codedownio/julia2nix/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codedownio%2Fjulia2nix/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259221916,"owners_count":22823983,"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":"2025-05-19T02:12:31.914Z","updated_at":"2025-06-11T07:31:20.096Z","avatar_url":"https://github.com/codedownio.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# julia2nix\n\nPackage a Julia environment using the [Nix package manager](https://nixos.org/)!\n\n\u003e Recommended: Julia 1.3+ (so we can get package dependencies from `Artifacts.toml`)\n\n## Quick start\n\n### Step 1: create `Project.toml` and `Manifest.toml`\n\nGo to a folder and create a Julia `Project.toml` and `Manifest.toml` containing the desired packages, using the normal `Pkg` interface.\n\n\u003e Important: make sure you use the same Julia version you're going to be specifying in Nix!\n\u003e If you use different versions, the package set you create may not be compatible.\n\u003e It's best to just launch the Nix-provided Julia directly, i.e.\n\u003e `$(nix-build '\u003cnixpkgs\u003e' -A julia-lts-bin)/bin/julia`\n\n```bash\nmkdir depot\ncd depot\n$(nix-build '\u003cnixpkgs\u003e' -A julia-lts-bin)/bin/julia\n\njulia\u003e # Press \"]\" to enter package mode\npkg\u003e activate .\npkg\u003e add SomePackage\npkg\u003e add SomeOtherPackage\npkg\u003e [Ctrl+D to exit]\n```\n### Step 2: run `julia2nix` to generate the Nix files\n\nFor better reproducibility, `julia2nix` is now powered by [Nix flakes](https://nixos.wiki/wiki/Flakes#Enable_flakes).\n\n```bash\n# Still in the \"depot\" folder from before:\nnix run github:codedownio/julia2nix/v1.0.0\n```\n\nThis will create a few files:\n\n* `packages.nix`: Nix expressions for the packages and artifacts.\n* `common.nix`: common code for building your environment. Please don't edit this by hand.\n* `default.nix`: the main entry point. You can edit some settings in here.\n\n\u003e You should make sure the `baseJulia` in `default.nix` matches the Julia version you used in Step 1.\n\n### Step 3: build!\n\nThe following command should build your Julia environment and drop you into a Julia session where your packages are available:\n\n``` bash\n# Make sure you have a writable depot in JULIA_DEPOT_PATH.\n# Our wrapped Julia will add the one we just built to the end.\nexport JULIA_DEPOT_PATH=${HOME}/.julia\n$(nix-build . --no-out-link)/bin/julia\n```\n\n## Updating packages\n\nTo change the package set and regenerate the Nix expressions, simply repeat steps 1 and 2 in the same folder. `julia2nix` will overwrite `packages.nix` and possibly `common.nix`/`fetchgit`, but will not replace `default.nix`.\n\n## How does it work?\n\nJulia's package manager learns about available packages from a \"registry\" repository, primarily the [General](https://github.com/JuliaRegistries/General) registry. When you type `Pkg.install(\"SomePackage\")`, it looks up the package's URL and other metadata such as the Git hash in the registry.\n\n`julia2nix` looks at your `Manifest.toml` to find all the packages that `Pkg3` will need to download and constructs Nix derivations to get the necessary versions of each. Then, it constructs a special version of the registry where those package URLs are replaced with Nix store paths. With this special registry, plus rewriting any URL paths in `Manifest.toml` itself, we can run `Pkg.instantiate()` and be sure that all clone requests will be read from Nix store paths on disk.\n\nAfter the packages are cloned, some will need to obtain extra artifacts such as platform-specific library binaries. If the packages use the new `Pkg.Artifacts` system to specify their artifacts, then `julia2nix` will likewise generate derivations for these by processing the `Artifacts.toml` file in each package and computing an overall [`Overrides.toml`](https://julialang.github.io/Pkg.jl/v1/artifacts/#Overriding-artifact-locations) with Nix path versions of everything.\n\nAt the end of the day, you get a declarative and reproducible Julia depot built with Nix!\n\n## Advanced notes\n\nThere are a few options you can configure in `default.nix` (also documented there):\n\n* Set whether `Pkg.precompile()` is called at the end to precompile all packages (defaults to true).\n* Configure `makeWrapper` arguments to Julia, for example to configure environment variables. The default version sets the `PYTHON` environment variable to a Nix-provided Python, so that Julia packages won't try to use Conda to obtain their own.\n\nIf you only want the Julia depot to use in your own derivations, it is exposed from `default.nix` as the `depot` attribute.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodedownio%2Fjulia2nix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodedownio%2Fjulia2nix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodedownio%2Fjulia2nix/lists"}