Adding programs to PATH: Difference between revisions

Axka (talk | contribs)
m Add example of running hello in an ad-hoc flake-based devshell
Tags: Mobile edit Mobile web edit Visual edit
Axka (talk | contribs)
m Add shell session example to declarative Nix flake devshell
Tags: Mobile edit Mobile web edit Visual edit
Line 85: Line 85:
     devShells.x86_64-linux.default = pkgs.mkShellNoCC {
     devShells.x86_64-linux.default = pkgs.mkShellNoCC {
       packages = [ pkgs.hello ];
       packages = [ pkgs.hello ];
     }
     };
   };
   };
}|name=flake.nix|lang=nix}}
}|name=flake.nix|lang=nix}}Here is an example of a it working:<syntaxhighlight lang="shell-session">
[username@hostname:/tmp/example]$ hello
-bash: hello: command not found
 
[username@hostname:/tmp/example]$ nix develop
warning: creating lock file "/tmp/example/flake.lock":
• Added input 'nixpkgs':
    'github:NixOS/nixpkgs/00c21e4c93d963c50d4c0c89bfa84ed6e0694df2?narHash=sha256-AYqlWrX09%2BHvGs8zM6ebZ1pwUqjkfpnv8mewYwAo%2BiM%3D' (2026-02-04)
[username@hostname:/tmp/example]$ hello
Hello, world!
 
[username@hostname:/tmp/example]$
</syntaxhighlight>