Last active
September 22, 2025 00:41
-
-
Save xfthhxk/0d72b290f8c6ab23b26791fae6252e34 to your computer and use it in GitHub Desktop.
example using nix with clojure and other dev tools
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { use_zsh ? "true" }: | |
| let | |
| # nixos-25.05 stable as of 4 Aug 2025. See: https://status.nixos.org | |
| nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/archive/ce01daebf8489ba97bd1609d185ea276efdeb121.tar.gz"; | |
| pkgs = import nixpkgs { config = {}; overlays = []; }; | |
| in | |
| pkgs.mkShell { | |
| packages = [ | |
| pkgs.clojure | |
| pkgs.babashka | |
| pkgs.clj-kondo | |
| pkgs.cljfmt | |
| pkgs.temurin-bin | |
| pkgs.nodejs | |
| pkgs.google-cloud-sdk | |
| pkgs.docker | |
| pkgs.docker-buildx | |
| pkgs.docker-compose | |
| pkgs.pulumi | |
| pkgs.pulumiPackages.pulumi-nodejs | |
| pkgs.postgresql | |
| pkgs.mkcert | |
| pkgs.nss.tools # provides certutil for mkcert | |
| pkgs.openssl | |
| pkgs.libgcc.lib # provides libgomp which is needed for datalevin | |
| pkgs.zsh | |
| ]; | |
| shellHook = '' | |
| export LD_LIBRARY_PATH="${pkgs.libgcc.lib}/lib:$LD_LIBRARY_PATH" # needed by datalevin | |
| export CLOUD_PYTHON=`which python` # force gcloud to use the installed python | |
| if [[ ${use_zsh} = true ]] | |
| then | |
| exec zsh | |
| fi | |
| ''; | |
| } | |
| #------------------------------------------------------------ | |
| # Uncomment and put the following in .zshrc | |
| # to show nix shell is activated | |
| #------------------------------------------------------------ | |
| # if [[ $IN_NIX_SHELL ]] | |
| # then | |
| # PROJECT=`basename $PWD` | |
| # PROMPT='%(?:%{%}%1{➜%} :%{%}%1{➜%} ) %F{yellow}[nix:$PROJECT]%f %{%}%c%{%} $(git_prompt_info)' | |
| # fi |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Running
sudocan get tricky inside of nix-shells becausesudowon't be able to find programs that exist only inside of nix.This seems to work however.
You can add other env vars on the cli to
sudofor example$HOMEto preserve the current user's$HOMEenv varlue