Skip to content

Commit

Permalink
Update devcontainer.json
Browse files Browse the repository at this point in the history
  • Loading branch information
CSchank authored Oct 1, 2024
1 parent ebc45ba commit a70e5be
Showing 1 changed file with 28 additions and 16 deletions.
44 changes: 28 additions & 16 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,40 @@
{
"image": "mcr.microsoft.com/devcontainers/base:alpine",
"image": "mcr.microsoft.com/devcontainers/base:jammy",
"features": {
"ghcr.io/devcontainers/features/nix:1": {
"multiUser": true,
"version": "latest",
// Needed for flakes & nix-direnv:
"extraNixConfig": "experimental-features = nix-command flakes,keep-outputs = true,keep-derivations = true"
}
"ghcr.io/devcontainers/features/nix:1": {
"multiUser": true,
"packages": ["cachix", "ihp-new"],
"extraNixConfig": "experimental-features = nix-command flakes,keep-outputs = true,keep-derivations = true"
}
},
"onCreateCommand": {
// Set up global gitignore for direnv.
"init-git": "mkdir -p ~/.config/git && printf '.direnv/\\n.envrc\\n' > ~/.config/git/ignore && git config --global core.excludesfile ~/.config/git/ignore",
// Install, set up and allow direnv in workspace.
"install-direnv": "nix profile install nixpkgs#direnv nixpkgs#nix-direnv && mkdir -p ~/.config/direnv && echo 'source $HOME/.nix-profile/share/nix-direnv/direnvrc' >> ~/.config/direnv/direnvrc && cp .envrc.recommended .envrc && direnv allow",
// Run `print-dev-env` to build `devShells.${system}.default`.
"build-dev-env": "nix print-dev-env > /dev/null"
"Setup cachix": "echo \"trusted-users = root vscode\" | sudo tee -a /etc/nix/nix.conf && sudo pkill nix-daemon; cachix use cachix; cachix use digitallyinduced;",
"Setup direnv": "sudo apt install direnv; echo 'eval \"$(direnv hook bash)\"' >> ~/.bashrc",
"Set IHP BASEURL": "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",
"Set IHP IDE BASEURL": "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",
"Fix nix Permissions": "sudo apt install acl; sudo setfacl -k /tmp",
"Allow direnv": "mkdir -p ~/.config/direnv; touch ~/.config/direnv/direnv.toml; echo \"[whitelist]\nprefix = ['/workspaces/']\" >> ~/.config/direnv/direnv.toml"
},
"containerEnv": {
"PROJECT_DIR": "${containerWorkspaceFolder}"
},
"remoteUser": "vscode",
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.profiles.linux": {
"bash": {
"path": "/bin/bash"
}
},
"terminal.integrated.defaultProfile.linux": "bash"
},
"extensions": [
// Inject direnv variables into VS Code terminals and tasks:
"bbenoist.nix",
"haskell.haskell",
"s0kil.vscode-hsx",
"mkhl.direnv",
// Support for `.nix` files:
"jnoortheen.nix-ide"
"vigoo.stylish-haskell"
]
}
}
Expand Down

0 comments on commit a70e5be

Please sign in to comment.