Setup .envrc

Standard provides an extension to the stdlib via direnv_lib.sh.

The integrity hash below ensures it is downloaded only once and cached from there on.

#!/bin/sh # first time if [[ ! -d $(nix store add-path --name source --dry-run .) ]]; then nix store add-path --name source . (cd ./src/local && nix flake lock --update-input std) (cd ./src/tests && nix flake lock --update-input std) fi # shellcheck disable=SC1090 . "$(fetchurl "https://raw.githubusercontent.com/paisano-nix/direnv/main/lib" "sha256-IgQhKK7UHL1AfCUntJO2KCaIDJQotRnK2qC4Daxk+wI=")" use envreload //local/shells/default //local/configs

NOTE: In the above code use std cells //std/... refers to the folder where Cells are grown from. If your folder is e.g. nix, adapt to use std nix //... and so forth.

It is used to automatically set up file watches on files that could modify the current devshell, discoverable through these or similar logs during loading:

direnv: loading https://raw.githubusercontent.com/divnix/std/... direnv: using std cells //local/shells:default direnv: Watching: cells/local/shells.nix direnv: Watching: cells/local/shells (recursively)

For reference, the above example loads the default devshell from:

{ inputs, cell, }: let inherit (inputs) nixpkgs namaka; inherit (inputs.nixpkgs.lib) mapAttrs optionals; inherit (inputs.std) std; inherit (inputs.std.lib.dev) mkShell; inherit (cell) configs; in mapAttrs (_: mkShell) rec { default = {...}: { name = "Standard"; nixago = [ configs.conform configs.treefmt configs.editorconfig configs.githubsettings configs.lefthook configs.adrgen configs.cog ]; commands = [ { package = nixpkgs.reuse; category = "legal"; } { package = nixpkgs.delve; category = "cli-dev"; name = "dlv"; } { package = nixpkgs.go; category = "cli-dev"; } { package = nixpkgs.gotools; category = "cli-dev"; } { package = nixpkgs.gopls; category = "cli-dev"; } { package = namaka.packages.default; category = "nix-testing"; } ] ++ optionals nixpkgs.stdenv.isLinux [ { package = nixpkgs.golangci-lint; category = "cli-dev"; } ]; imports = [std.devshellProfiles.default book]; }; book = {...}: { nixago = [configs.mdbook]; }; }