For information about NFS, where to place your projects. see this README.
TL;DR: Your home directory is a NFS share, which is backed up. Do not place VM images/projects/... there.
Use /scratch/$USER
if you need fast, local disk access. This directory is not backed up.
- Where to look for packages: https://search.nixos.org
- Find packages by filename:
nix-locate someheader.h
(nix-locate
is installed on our servers). - Temporary vs. Global: If you temporarily need a package, use
nix-shell -p package
. If you need permanently installed packages for your user, consider home-manager.
Flakes or Nix Shells: Choose either format to define your project dependencies.
If you're inside a git project, git add flake.nix
, as nix cannot find it otherwise.
For templates, see ../templates/README.md.
- Enter the dev shell: Run
nix develop
or use direnv (see later section). - Check-in the lockfile: Commit the
flake.lock
generated bynix develop
to guarantee reproducibility.
Legacy option, still suitable for certain uses. Example:
with import <nixpkgs> { };
pkgs.llvmPackages_latest.stdenv.mkDerivation {
name = "llvm-debug-env";
nativeBuildInputs = [
pkgs.clang
];
MY_VAR = "Hello";
}
Enter the dev shell: Run nix-shell shell.nix
or use direnv (see later section).
Automatic Setup: Add use flakes
or use nix
to your .envrc
.
This will automatically load/unload your development environment when you enter the directory containing it.
Add .direnv
to your .gitignore
.
nix-shell '<home-manager>' -A install
Installing home manager should create a .config/home-manager/home.nix
. Alternatively, you can also check ../templates/README.md.
- Apply Changes: Run
home-manager switch
to update your configuration.