Hey Smell This: In the spirit of my Shell Grymoire, here are some useful Nix invocations/patterns/commands.
Adding a flake check to run pytest
{
checks.pytest = pkgs.stdenvNoCC.mkDerivation name = "pytest";
src =./.;
dontBuild = true;
doCheck = true;
nativeBuildInputs = [
pkgs.python3.pkgs.pytest./default.nix {};
pkgs.callPackage ];
checkPhase = "pytest test";
installPhase = "mkdir $out";
};
Disable remote builds in a derivation
Add NIX_CONFIG = "builders =";
to the derivation (and
thus process environment)
Calculate a Nix hash from Nix Version Pins
(or you can just invoke the Magic contained in the Version Pins document)
nix-build --expr '(import <nixpkgs> {}).fetchFromGitHub (import /home/rrix/arroyo-nix/versions.nix {}).org-fc' | xargs -n1 nix hash path