{"id":21070397,"url":"https://github.com/stencila/environs","last_synced_at":"2025-10-08T07:51:13.520Z","repository":{"id":140743930,"uuid":"97081169","full_name":"stencila/environs","owner":"stencila","description":"📦 Stencila in reproducible computing environments","archived":false,"fork":false,"pushed_at":"2019-01-07T05:47:17.000Z","size":268,"stargazers_count":5,"open_issues_count":4,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-16T05:37:21.091Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stencila.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":"2017-07-13T04:51:12.000Z","updated_at":"2019-01-20T09:29:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"a2319f38-fa2b-4815-a3a5-7383e91c814a","html_url":"https://github.com/stencila/environs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stencila/environs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stencila%2Fenvirons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stencila%2Fenvirons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stencila%2Fenvirons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stencila%2Fenvirons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stencila","download_url":"https://codeload.github.com/stencila/environs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stencila%2Fenvirons/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278909711,"owners_count":26066887,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-19T18:46:48.280Z","updated_at":"2025-10-08T07:51:13.501Z","avatar_url":"https://github.com/stencila.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"## `stencila/environs` : Stencila within reproducible execution environments\n\n[![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges)\n[![Build status](https://travis-ci.org/stencila/environs.svg?branch=master)](https://travis-ci.org/stencila/environs)\n[![Community](https://img.shields.io/badge/join-community-green.svg)](https://community.stenci.la)\n[![Chat](https://badges.gitter.im/stencila/stencila.svg)](https://gitter.im/stencila/stencila)\n\nThis repository provides environs and tools for using Stencila within containers. Use cases include:\n\n- using Stencila packages for R, Python and Node.js without having to install them individually\n\n- collaborating on a Stencila document using an identical computing environment\n\n- publishing a Stencila document as a self-contained, reproducible, computational bundle\n\n### Images\n\nThe minimal base images have just the bare essentials necessary for running a Stencila Host (the thing that provides execution contexts and other resources for each language). The \"comprehensive\" images have a large number of packages installed and are intended to be sufficient for most data analysis tasks without having to install more packages. \n\nImage                        | Summary\n:----------------------------| :-----------------------------------------------------------------\n[base](base)                 | A base image with Stencila packages for Python, R and/or Node.js\n[core](core)                 | An image with commonly used packages for data analysis in each language\n[mega](mega)                 | Comprehensive images with _a lot_ of packages for each language\n\nTo use these images simply run them with the container's port 2000 bound to a port on the host. Use a value in the range 2010-2100 so that it will be automatically be detected by the Stencila client (e.g. Stencila Desktop) without clashing:\n\n```bash\ndocker run -it --rm -p 2100:2000 stencila/core\n```\n\n### Tools\n\nSome of these images are large (i.e. ~1GB compressed). The [shrink-docker.sh](.shrink/shrink-docker.sh) script provides a way to shrink an image down to the minimum size necessary to reproduce your document.\n\n\n### Develop\n\n### Updating Node.js packages\n\nNode.js environments, such as `nix/core/node`, are built using [`node2nix`](https://github.com/svanderburg/node2nix). You can install `node2nix` using:\n\n```bash\nnix-env -f '\u003cnixpkgs\u003e' -iA nodePackages.node2nix\n```\n\n`node2nix` generates the files `node2nix/default.nix`, `node2nix/node-packages.nix` and `node2nix/node-env.nix` from `packages.json`. If you update a `packages.json` then re-generate these files using `node2nix` directly:\n\n```bash\ncd nix/core/node/node2nix\nnode2nix -6 -i ../packages.json\n```\n\nor using the `Makefile` recipe:\n\n```bash\nmake nix/core/node/node2nix\n```\n\n### Adding package fetched from git\n\nUse `nix-prefetch-git` to get the `sha256` when specifying a package using `nixpkgs.fetchgit` e.g.\n\n```bash\nnix-prefetch-git https://github.com/stencila/r 4ebd3a8106294060316574eb340c7108542f722a\n```\n\n## Run Stencila in a Nix shell\n\nOn NixOS or other linux with Nix installed run:\n\n```\nnix-shell core\n```\n\nTo \n\n```\nnix-shell core/r\n```\n\nWithin the Nix shell, three Stencila scripts are available\n\n- `stencila-manifest`: display a JSON manifest of the Stencila hosts and the packages installed within each\n- `stencila-register`: register the Stencila hosts so that they can discover each another within the environment\n- `stencila-run`: run the primary Stencila host in the environment\n\n\n## Run Stencila in a Docker Container\n\nOn NixOS, or Linux with Nix installed, run:\n\n```bash\nnix-build core/r\n````\n\nThis will create a tar archived Docker container in your Nix store e.g. `/nix/store/ci3k7fwnza75r9hg3wv0ab9c8544hmj8-docker-image-core-r.tar.gz` and a symlink to that file in the current directory called `result`.\n\nLoad that tar archive as a Docker image using:\n\n```bash\ndocker load -i result\n```\n\nThen run the image:\n\n```bash\ndocker run -it --rm -p 2100:2000 stencila/core/r\n```\n\nTo recover space you can clean up the Docker tar archive with:\n\n```bash\nnix-store --delete /nix/store/*-docker-image-stencila-*.tar.gz\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstencila%2Fenvirons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstencila%2Fenvirons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstencila%2Fenvirons/lists"}