Skip to content

toraritte/shell.nixes

Repository files navigation

TODO: This repo is huge mess...

TODO: Make naming style consistent. (E.g., in _utils.nix functions and types have snake case, while other variables are CamelCased, and other Nix expressions are all over the place.)

  • _helpers: Some good notes in READMEs, but it was so long ago that not even sure what I was trying to achieve.
  • _utils: Helper functions for composing shellHooks; see shell.nix files in ./postgres and .baseline directories. (I think this was to goal of _helpers, but I had even less clue of what I was doing than now.)

NOTES:

  • builtins.fetchurl will cache results (see issue NixOS/nix#1223), and so far the only solution for me is to keep track of fetched files and to delete them with nix-store --delete <nix-store-path>

Each folder has their specific README, but the source files are heavily commented as well, in case it is missing. If you still have any questions, or have suggestions, please feel free to open an issue, PR, or track me down any other way.


Helpers (i.e., the _helpers directory)

Mostly Nix expressions (only one at the moment, to be precise) to promote code re-use.

Some nix-shell tricks learned along the way

  • invoke nix-shell with a URL of a shell.nix

    The discussion can be found here and using deno-shell.nix as an example:

      nix-shell -E 'import (builtins.fetchurl "https://raw.githubusercontent.com/toraritte/shell.nixes/main/deno-shell.nix")'
  • Definitely take a look at the comments in deno-shell.nix!

  • call nix-shell on a package that is not in the Nixpkgs repo

    That is, kind of like nix-shell -p but that can only be called on Nixpkgs packages (as far as I know).

    Traditional way

    nix-shell -p '(callPackage (fetchTarball https://github.com/DavHau/mach-nix/tarball/3.0.2) {}).mach-nix'

    Nix flakes

    That is, if

    1. flakes support is enabled (at least, at the time of writing this, flakes are not yet enabled by default), and

    2. the target repo also supports flakes (right?...),

    one can do:

    nix shell github:DavHau/mach-nix

    Quoting the rest verbatim because I have yet to understand it:

    I would just capture mach-nix in your shell.nix or devShell in your flake.nix. Then pair it with direnv to allow you to bring it into your shell when you need it for a particular project.

azure-new

Mentioning it here because it is not a simple subdirectory but a git submodule - it has its own extensive readme, but wnated to note it here as well.

azure-new is a collection of scripts to provision custom NixOS images and VMs on the Microsoft Azure cloud computing platform, originally created by @colemickens. I presume the main motivation was that the Azure backend has been removed from NixOps. The weird layout of the project comes from the fact that it has been ripped out from the Nixpkgs repo; see more details in the project readme on the how.)

Tip: To clone this repo with the azure-new submodule, please see the How to “git clone” including submodules? Stackoverflow thread.

git submodule reminders to self

Reminder on how to set up a git submodule that tracks a branch:

# add submodule to track master branch
git submodule add -b branch_name URL_to_Git_repo optional_directory_rename

# update your submodule
git submodule update --remote 

About

`shell.nix` files for projects of different scopes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published