Adding programs to PATH: Difference between revisions
m Clarify udev paragraph Tags: Mobile edit Mobile web edit Visual edit |
m Clarify flake devshell section Tags: Mobile edit Mobile web edit Visual edit |
||
| Line 65: | Line 65: | ||
=== Declarative shell using <code>flake.nix</code> and <code>nix develop</code> (Flakes) === | === Declarative shell using <code>flake.nix</code> and <code>nix develop</code> (Flakes) === | ||
{{Main|Flakes}} | {{Main|Flakes}} | ||
Below is a minimal example using flakes | Below is a minimal example using flakes. Write the file below and run the command <code>nix develop</code>.{{File|3={ | ||
description = "Minimal development shell using flakes"; | description = "Minimal development shell using flakes"; | ||
# Define Nixpkgs as a flake input | |||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
outputs = { nixpkgs, ... }: let | outputs = { nixpkgs, ... }: let | ||
# Get the Nixpkgs package set for the system x86_64-linux | |||
pkgs = nixpkgs.legacyPackages.x86_64-linux; | pkgs = nixpkgs.legacyPackages.x86_64-linux; | ||
in { | in { | ||
# Define a development shell for the system x86_64-linux | |||
devShells.x86_64-linux.default = pkgs.mkShellNoCC { | devShells.x86_64-linux.default = pkgs.mkShellNoCC { | ||
packages = [ pkgs.hello ]; | packages = [ pkgs.hello ]; | ||