devenv.nix
1{
2 pkgs,
3 lib,
4 config,
5 inputs,
6 ...
7}:
8
9{
10 # https://devenv.sh/basics/
11 env.GREET = "devenv";
12
13 # https://devenv.sh/packages/
14 packages = [
15 pkgs.git
16 pkgs.bash
17 pkgs.bash-completion
18 pkgs.bashInteractive
19 pkgs.just
20 pkgs.curl
21 pkgs.jq
22
23 # custom tools
24 inputs.bug.packages.${pkgs.system}.bug
25 inputs.local-code-review.packages.${pkgs.system}.default
26 inputs.secrets.packages.${pkgs.system}.default
27 ];
28
29 # https://devenv.sh/languages/
30 languages.javascript.enable = true;
31 languages.javascript.corepack.enable = true;
32
33 # https://devenv.sh/processes/
34 # processes.dev.exec = "${lib.getExe pkgs.watchexec} -n -- ls -la";
35
36 # https://devenv.sh/services/
37 # services.postgres.enable = true;
38
39
40 enterShell = ''
41 # Configure bash with fish-like features
42 bind 'set completion-ignore-case on' # Case-insensitive completion
43 bind 'set show-all-if-ambiguous on' # Show all completions on first tab
44 bind 'set menu-complete-display-prefix on'
45 bind 'TAB:menu-complete' # Tab cycles through completions
46 bind '\e[A:history-search-backward' # Up arrow searches history
47 bind '\e[B:history-search-forward' # Down arrow searches history
48 bind 'set colored-completion-prefix on' # Color the completion prefix
49 bind 'set colored-stats on' # Color the completion stats
50
51 # Enable bash-completion if available
52 if [ -f ${pkgs.bash-completion}/etc/profile.d/bash_completion.sh ]; then
53 source ${pkgs.bash-completion}/etc/profile.d/bash_completion.sh
54 fi
55
56 # Better directory navigation
57 shopt -s autocd 2>/dev/null # Type directory name to cd
58 shopt -s dirspell 2>/dev/null # Correct spelling of dir names
59 shopt -s cdspell 2>/dev/null # Correct spelling of cd args
60
61 # Enable ** globbing for recursive directory matching
62 shopt -s globstar 2>/dev/null
63
64 # Use correct Cloudflare context
65 export CLOUDFLARE_ACCOUNT_ID=$(secrets decrypt cloudflare/account_id)
66 export CLOUDFLARE_API_TOKEN=$(secrets decrypt cloudflare/workers_api_key)
67 '';
68
69# https://devenv.sh/tasks/
70 # tasks = {
71 # "myproj:setup".exec = "mytool build";
72 # "devenv:enterShell".after = [ "myproj:setup" ];
73 # };
74
75 # https://devenv.sh/tests/
76 enterTest = ''
77 '';
78
79 # https://devenv.sh/git-hooks/
80 # git-hooks.hooks.shellcheck.enable = true;
81
82 # See full reference at https://devenv.sh/reference/options/
83}