1.0 KiB
1.0 KiB
Table of contents
- [
nix flake
](###nix flake
command) - [
nix develop
](###nix develop
command) - [
nix build
](###nix build
command)
nix flake
command
Command to do stuff with nix flakes (flake.nix
)
nix develop
nix build
command
Command to build nix packages, either locally sourced or from third parties (like nixpkgs)
Example
Local
Set something to build inside your Nix flake (flake.nix
) then run nix build
.
Here's an example you can put in Nix flake:
packages.default = pkgs.rustPlatform.buildRustPackage {
name = "zero-to-nix-rust";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
};
Then run:
nix build
to build your home brewed package!
Third party/Remote
You can either grab something from GitHub (using the github:user/repo*#optional_pkg
) or a URL (using the https://scm.wyattjmiller.com/wymiller/cool-repo*#pkg
).
Example from GitHub:
nix build "github:"
Example from a URL:
nix build "https://flakehub.com/f/NixOS/nixpkgs/*#bat"