forked from rvarun11/codespaces-ihp
-
Notifications
You must be signed in to change notification settings - Fork 5
/
install-nix.sh
executable file
·32 lines (18 loc) · 1.76 KB
/
install-nix.sh
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
sh <(curl -L https://nixos.org/nix/install)
. /home/vscode/.nix-profile/etc/profile.d/nix.sh
sudo apt update
sudo apt install direnv
nix-env -iA devenv -f https://github.com/NixOS/nixpkgs/tarball/nixpkgs-unstable
nix-env -iA cachix -f https://cachix.org/api/v1/install
mkdir -p ~/.config/direnv; touch ~/.config/direnv/direnv.toml; echo -e "[whitelist]\nprefix = ['/workspaces/']" >> ~/.config/direnv/direnv.toml
mkdir -p ~/.config/nix/; touch ~/.config/nix/nix.conf; echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
echo "trusted-users = root vscode" | sudo tee -a /etc/nix/nix.conf && sudo pkill nix-daemon; cachix use cachix; cachix use digitallyinduced;
sh ./usr/local/share/nix-entrypoint.sh; ( if [ ! -e "Main.hs" ]; then rm -rf /tmp/ihp-boilerplate; git clone https://github.com/digitallyinduced/ihp-boilerplate.git /tmp/ihp-boilerplate; rm -rf /tmp/ihp-boilerplate/.git; cp -r /tmp/ihp-boilerplate/. .; fi) && git add . && nix develop --accept-flake-config --impure --command make -s all;
if [ ! -d "Web" ]; then (nix develop --accept-flake-config --impure --command new-application Web) fi
echo -e "\n. ~/.nix-profile/etc/profile.d/nix.sh" >> ~/.bashrc
sudo apt install direnv; echo -e '\neval "$(direnv hook bash)"' >> ~/.bashrc
echo 'export IHP_BASEURL=$(if [ -n "${CODESPACE_NAME}" ]; then echo "https://${CODESPACE_NAME}-8000.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}"; else echo "http://localhost:8000"; fi)' >> ~/.bashrc
echo 'export IHP_IDE_BASEURL=$(if [ -n "${CODESPACE_NAME}" ]; then echo "https://${CODESPACE_NAME}-8001.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}"; else echo "http://localhost:8001"; fi)' >> ~/.bashrc
sudo apt install acl; sudo setfacl -k /tmp
nix develop --accept-flake-config --impure --command make -s all
direnv allow