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 dev 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    # atproto
29    pkgs.atproto-goat
30  ];
31
32  # https://devenv.sh/languages/
33  # languages.rust.enable = true;
34
35  # https://devenv.sh/processes/
36  # processes.dev.exec = "${lib.getExe pkgs.watchexec} -n -- ls -la";
37
38  # https://devenv.sh/services/
39  # services.postgres.enable = true;
40
41
42  enterShell = ''
43    # Interactive shells only: `devenv shell -- <cmd>` has no line editing,
44    # and bind warns there.
45    if [[ $- == *i* ]]; then
46      # Configure bash with fish-like features
47      bind 'set completion-ignore-case on'  # Case-insensitive completion
48      bind 'set show-all-if-ambiguous on'   # Show all completions on first tab
49      bind 'set menu-complete-display-prefix on'
50      bind 'TAB:menu-complete'              # Tab cycles through completions
51      bind '"\e[A":history-search-backward' # Up arrow searches history
52      bind '"\e[B":history-search-forward'  # Down arrow searches history
53      bind 'set colored-completion-prefix on'  # Color the completion prefix
54      bind 'set colored-stats on'           # Color the completion stats
55
56      # Enable bash-completion if available
57      if [ -f ${pkgs.bash-completion}/etc/profile.d/bash_completion.sh ]; then
58        source ${pkgs.bash-completion}/etc/profile.d/bash_completion.sh
59      fi
60
61      # Better directory navigation
62      shopt -s autocd 2>/dev/null          # Type directory name to cd
63      shopt -s dirspell 2>/dev/null        # Correct spelling of dir names
64      shopt -s cdspell 2>/dev/null         # Correct spelling of cd args
65
66      # Enable ** globbing for recursive directory matching
67      shopt -s globstar 2>/dev/null
68    fi
69  '';
70  # https://devenv.sh/tasks/
71  # tasks = {
72  #   "myproj:setup".exec = "mytool build";
73  #   "devenv:enterShell".after = [ "myproj:setup" ];
74  # };
75
76  # https://devenv.sh/tests/
77  enterTest = ''
78  '';
79
80  # https://devenv.sh/git-hooks/
81  # git-hooks.hooks.shellcheck.enable = true;
82
83  # See full reference at https://devenv.sh/reference/options/
84}