{"id":13837875,"url":"https://github.com/typelevel/typelevel-nix","last_synced_at":"2025-08-08T05:11:00.864Z","repository":{"id":36974984,"uuid":"445337200","full_name":"typelevel/typelevel-nix","owner":"typelevel","description":"Development tools for Typelevel projects","archived":false,"fork":false,"pushed_at":"2025-08-04T17:42:02.000Z","size":285,"stargazers_count":122,"open_issues_count":5,"forks_count":10,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-08-04T20:54:25.887Z","etag":null,"topics":["devshell","flakes","nix","scala","scalajs"],"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/typelevel.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-01-06T23:15:02.000Z","updated_at":"2025-08-04T17:42:06.000Z","dependencies_parsed_at":"2023-11-09T12:29:25.486Z","dependency_job_id":"d233b1de-cd5a-4ce0-8b1b-0c79a677d66d","html_url":"https://github.com/typelevel/typelevel-nix","commit_stats":{"total_commits":189,"total_committers":10,"mean_commits":18.9,"dds":0.4391534391534392,"last_synced_commit":"27e4d214408297726c01b89423880f3363890506"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/typelevel/typelevel-nix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typelevel%2Ftypelevel-nix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typelevel%2Ftypelevel-nix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typelevel%2Ftypelevel-nix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typelevel%2Ftypelevel-nix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/typelevel","download_url":"https://codeload.github.com/typelevel/typelevel-nix/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typelevel%2Ftypelevel-nix/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269366853,"owners_count":24405250,"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-08-08T02:00:09.200Z","response_time":72,"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":["devshell","flakes","nix","scala","scalajs"],"created_at":"2024-08-04T15:01:28.940Z","updated_at":"2025-08-08T05:11:00.795Z","avatar_url":"https://github.com/typelevel.png","language":"Nix","funding_links":[],"categories":["Nix"],"sub_categories":[],"readme":"# typelevel-nix\n\nIn antiquity, installing [sbt] was sufficient to compile, test, and run most Scala projects.  sbt would fetch all your JVM dependencies, and you didn't have other dependencies.  There was a [Scala CLR] target, but it was abandoned.\n\nYears passed, and [Scala.js] was born, and we were back to crossing platforms.  We suddenly needed a [Node] installation to run our tests.  More libraries are supporting [Scala Native].  Static site generators outside our JVM bubble have come and gone.\n\n\"Faugh,\" you say.  \"The JVM is good enough for me\".  Fine, but your libraries target Java 8 for broad appeal and your applications target Java 17 because it's 9 bigger, and you have to juggle multiple JVMs.\n\nWouldn't it be nice to have one-stop shopping for your development environment again?\n\n## `nix develop` to the rescue\n\nEnter the [Nix] package manager.  We can use [nix develop] to get a full, build enviroment for modern, cross-platform Scala.\n\nFor now, you'll need at least Nix 2.4 and to enable the [Nix command].\n\n### The baseline\n\n```console\n$ java -version\nbash: java: command not found\n$ sbt -version\nbash: sbt: command not found\n$ node --version\nbash: node: command not found\n```\n\nAll my apes gone.\n\n### Library shell\n\nThe one-liner `nix develop github:typelevel/typelevel-nix#library` gets us a full environment:\n\n```console\n$ nix develop github:typelevel/typelevel-nix#library\n🔨 Welcome to typelevel-lib-shell\n\n[general commands]\n\n  menu      - prints this menu\n  sbt       - A build tool for Scala, Java and more\n  scala-cli - Command-line tool to interact with the Scala language\n\n[versions]\n\n  Java - 8.0.292\n  Node - 16.13.1\n\n$ sbt -version\nsbt version in this project: 1.6.1\nsbt script version: 1.6.1\n$ exit\n```\n\n### Application shell\n\nAlternatively, `nix develop github:typelevel/typelevel-nix#application` gives us the same, with a more contemporary JDK:\n\n```console\n$ nix develop github:typelevel/typelevel-nix#application\n🔨 Welcome to typelevel-app-shell\n\n[general commands]\n\n  menu      - prints this menu\n  sbt       - A build tool for Scala, Java and more\n  scala-cli - Command-line tool to interact with the Scala language\n\n[versions]\n\n  Java - 17.0.1\n\n$ sbt -version\nsbt version in this project: 1.6.1\nsbt script version: 1.6.1\n$ exit\n```\n\n### Embed in your project\n\nThe `typelevelShell` module can be imported into your `devshell.mkShell` configuration:\n\n```nix\n{\n  inputs = {\n    typelevel-nix.url = \"github:typelevel/typelevel-nix\";\n    nixpkgs.follows = \"typelevel-nix/nixpkgs\";\n    flake-utils.follows = \"typelevel-nix/flake-utils\";\n  };\n\n  outputs = { self, nixpkgs, flake-utils, typelevel-nix }:\n    flake-utils.lib.eachDefaultSystem (system:\n      let\n        pkgs = import nixpkgs {\n          inherit system;\n          overlays = [ typelevel-nix.overlays.default ];\n        };\n      in\n      {\n        devShell = pkgs.devshell.mkShell {\n          imports = [ typelevel-nix.typelevelShell ];\n          name = \"my-project-shell\";\n          typelevelShell = {\n            jdk.package = pkgs.jdk8;\n            sbtMicrosites = {\n              enable = true;\n              siteDir = ./site;\n            };\n          };\n        };\n      }\n    );\n}\n```\n\nif you don't currently have a `flake.nix` you can create one quickly with the following command.\n\n```nix\n# For a library (defaults to jdk8)\nnix flake init -t github:typelevel/typelevel-nix#library\n# For an application service (defaults to jdk23)\nnix flake init -t github:typelevel/typelevel-nix#application\n```\n\nDon't forget to tweak the `devShell.name` property and customize to taste.\n\nExtra configuration in `typelevelShell`:\n\n* `typelevelShell.jdk.package`: the JDK package to use for `sbt` and the `$JAVA_HOME` environment.  Defaults to `pkgs.jdk17`.  If you're writing a library, you probably want `pkgs.jdk8`.\n* `typelevelShell.native.enable`: provide a clang environment for scala-native.  Defaults to `true` in the library shell, and `false` elsewhere.\n* `typelevelShell.native.libraries`: a list of split-output libraries to include (dev output) and link (lib output).  Defaults to `[ pkgs.zlib ]`.\n* `typelevelShell.nodejs.enable`: provide NodeJS.  Defaults to `true` in the library shell, and `false` elsewhere.\n* `typelevelShell.nodejs.package`: the package to use for NodeJS.  Defaults to `pkgs.nodejs`.\n* `typelevelShell.sbtMicrosites.enable`: enables Jekyll support for sbt-microsites.  Defaults to `false`.\n* `typelevelShell.sbtMicrosites.siteDir`: directory with your `Gemfile`, `Gemfile.lock`, and `gemset.nix`.  Run [bundix] to create a gemset.nix, and every time you upgrade Jekyll.\n\n## Infrequently asked questions\n\n### Is this stable?\n\nNot yet, but flake.lock makes it reproducible.\n\n### Can I use it with trusty old `nix-shell`?\n\nAbsolutely! The `shell.nix` provides a flakes-compatible shell that works with `nix-shell`. It selects the `application` shell by default, but you can be specific about it. E.g.\n\n```\n$ nix-shell --argstr shell library\n```\n\nTo use it remotely, copy the content of the `shell.nix` in your project and point `src` to this repository instead. E.g.\n\n```nix\n{\n  src = fetchTarball {\n    url = \"https://github.com/typelevel/typelevel-nix/archive/main.tar.gz\";\n    sha256 = \"0000000000000000000000000000000000000000000000000000\"; # replace hash\n  };\n};\n```\n\n### Can I embed this in a project to share with my colleagues and collaborators?\n\nYes.  You should be able to put a `flake.nix` so you can share with your colleagues or open source collaborators, and even provide a [direnv] so your `$SHELL` and `$EDITOR` do the right thing.  Examples forthcoming.\n\n### Can I read `.java-version` from jEnv to get an appropriate JDK?\n\n```nix\ntypelevelShell = {\n  jdk.package = builtins.getAttr \"jdk${pkgs.lib.fileContents ./.java-version}\" pkgs;\n}\n```\n\n[sbt]: https://www.scala-sbt.org/\n[Scala CLR]: https://www.scala-lang.org/old/sites/default/files/pdfs/PreviewScalaNET.pdf\n[Scala.js]: https://www.scala-js.org/\n[Node]: https://nodejs.org/\n[Scala Native]: https://scala-native.readthedocs.io/\n[Nix]: https://nixos.org/\n[nix develop]: https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-develop.html\n[Nix command]: https://nixos.wiki/wiki/Nix_command\n[direnv]: https://direnv.net/\n[Laika]: https://planet42.github.io/Laika/\n[bundix]: https://github.com/nix-community/bundix\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypelevel%2Ftypelevel-nix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftypelevel%2Ftypelevel-nix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypelevel%2Ftypelevel-nix/lists"}