Skip to content

Commit bf565cf

Browse files
committed
Create devcontainer.json [skip ci]
Instantiates a development environment with the Nix flake supplied from the repo
1 parent 4c97bdc commit bf565cf

3 files changed

Lines changed: 58 additions & 0 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# https://github.com/xtruder/nix-devcontainer-python-jupyter/blob/main/.devcontainer/Dockerfile
2+
FROM ghcr.io/xtruder/nix-devcontainer:v1
3+
4+
# cache /nix
5+
VOLUME /nix

.devcontainer/devcontainer.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Adapted from https://github.com/xtruder/nix-devcontainer-python-jupyter/blob/main/.devcontainer/devcontainer.json
2+
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or the definition README at
3+
// https://github.com/microsoft/vscode-dev-containers/tree/master/containers/docker-existing-dockerfile
4+
{
5+
"name": "nix-devcontainer-homotopy-rs",
6+
"dockerFile": "Dockerfile",
7+
"context": "${localWorkspaceFolder}",
8+
"build": {
9+
"args": {
10+
"USER_UID": "${localEnv:USER_UID}",
11+
"USER_GID": "${localEnv:USER_GID}"
12+
},
13+
},
14+
15+
"runArgs": [
16+
"--security-opt", "label=disable"
17+
],
18+
19+
"mounts": [
20+
"source=nix-devcontainer-homotopy-rs_nix,target=/nix,type=volume"
21+
],
22+
23+
"userEnvProbe": "loginShell",
24+
"overrideCommand": false,
25+
"updateRemoteUserUID": false,
26+
27+
// build development environment on creation
28+
"onCreateCommand": "nix profile install nixpkgs#nix-direnv && ln -s $HOME/.nix-profile/share/nix-direnv/direnvrc $HOME/.direnvrc",
29+
30+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
31+
"forwardPorts": [8080],
32+
33+
// Use 'postCreateCommand' to run commands after the container is created.
34+
// "postCreateCommand": "rustc --version",
35+
}

.github/workflows/nix.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,21 @@ jobs:
2727
env:
2828
PR_URL: ${{github.event.pull_request.html_url}}
2929
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
30+
devshell:
31+
name: Build and cache devShell
32+
runs-on: ubuntu-latest
33+
needs: lockfile
34+
steps:
35+
- name: Install Nix
36+
uses: cachix/install-nix-action@v18
37+
with:
38+
extra_nix_config: |
39+
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
40+
- name: Setup cachix
41+
uses: cachix/cachix-action@v12
42+
with:
43+
name: homotopy-io
44+
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
45+
- name: Build devShell
46+
run: |
47+
nix develop --build github:homotopy-io/homotopy-rs/update_flake_lock_action

0 commit comments

Comments
 (0)