-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell-example.nix
58 lines (51 loc) · 1.61 KB
/
shell-example.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#=========================================================================#
# shell.nix
#
# To create shell environment and install packages run in project directory
# where this file is located:
#
# $ echo "use nix" > .envrc && direnv allow
#
# $ nix-shell
# $ nix-shell --show-trace
#
#=========================================================================#
#
# See also:
#
# - https://nix.dev/tutorials/first-steps/declarative-shell.html#a-basic-shell-nix-file
# - https://nix.dev/guides/recipes/direnv#automatic-direnv
#
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-24.05";
pkgs = import nixpkgs {
config = {};
overlays = [];
};
# `mkShellNoCC`
# - function produces a temporary environment without a compiler toolchain.
# - it is a wrapper around `mkDerivation`
in
pkgs.mkShellNoCC {
packages = with pkgs; [
# using luajit2.1
#dependency
love
#dev_dependency
luajitPackages.busted # Elegant Lua unit testing. see https://lunarmodules.github.io/busted/
luajitPackages.luaunit # A unit testing framework for Lua. see http://github.com/bluebird75/luaunit
#misc
pkg-config
cowsay
lolcat
];
# Environment variables
GREETING = "Hello from shell.nix!";
# - note: use `shellHook` attribute to override protected environment variables.
shellHook = ''
echo $GREETING | cowsay | lolcat
'';
# Instead of manually activating the environment for each project, you can
# reload a declarative shell every time you enter the project's directory
# or chage the `shell.nix` inside it.
}