-
Notifications
You must be signed in to change notification settings - Fork 3
/
shell.nix
95 lines (80 loc) · 2.38 KB
/
shell.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-24.05";
pkgs = import nixpkgs { config = {}; overlays = []; };
in
pkgs.mkShellNoCC {
packages = with pkgs; [
# Dependencies
nodejs
(pkgs.php.buildEnv {
extensions = ({ enabled, all } : enabled ++ (with all; [
curl
xdebug
pdo
pdo_pgsql
]));
extraConfig = ''
xdebug.mode=debug
'';
})
php83Packages.composer
# Editor and tools
helix
neovim
zellij
gitui
bat
];
NODE_BIN = "${pkgs.nodejs}/bin/node";
shellHook = ''
# Function to startup everything with zellij
function meetballs_editor() {
# Setup the editor
setup_meetballs_editor $1
# Ensure npm dependencies are installed
if [ ! -d node_modules ]; then
echo "Installing npm dependencies"
npm install
fi
# Ensure composer dependencies are installed
if [ ! -d vendor ]; then
echo "Installing composer dependencies"
composer install
fi
# Check which compositor is running to ensure zellij has the right
# clipboard support
if [ -n "$XDG_SESSION_TYPE" ]; then
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
export WAYLAND_DISPLAY=wayland-0
fi
fi
# Start zellij
zellij --session meetballs-editor \
--layout ./editor/layout.kdl \
options --copy-on-select false
}
function setup_meetballs_editor() {
# Set editor
CHOSEN_EDITOR=$EDITOR
# Get from args
if [ -n "$1" ]; then
CHOSEN_EDITOR=$1
fi
# If no editor is set, use neovim
if [ -z "$CHOSEN_EDITOR" ]; then
CHOSEN_EDITOR="nvim"
fi
export CHOSEN_EDITOR
}
bat <<EOF
Welcome to Meetballs!
I've included a few tools to get you started and dependencies for the
project. You can use the pre-configured editor by running:
$ meetballs_editor
This will also install npm and composer dependencies if they are not
already installed. If that command doesn't work, you can also run:
$ zellij --session meetballs-editor --layout ./editor/layout.kdl options --copy-on-select false
Which will launch the editor with the same layout.
EOF
'';
}