feat(dev): Setup devcontainer
This commit is contained in:
parent
0d621743cd
commit
90e6ae6f67
5 changed files with 61 additions and 6 deletions
1
.devcontainer/Dockerfile
Normal file
1
.devcontainer/Dockerfile
Normal file
|
@ -0,0 +1 @@
|
||||||
|
FROM ghcr.io/xtruder/nix-devcontainer:v1
|
51
.devcontainer/devcontainer.json
Normal file
51
.devcontainer/devcontainer.json
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or the definition README at
|
||||||
|
// https://github.com/microsoft/vscode-dev-containers/tree/master/containers/docker-existing-dockerfile
|
||||||
|
{
|
||||||
|
"name": "devcontainer-project",
|
||||||
|
"dockerFile": "Dockerfile",
|
||||||
|
"context": "${localWorkspaceFolder}",
|
||||||
|
"build": {
|
||||||
|
"args": {
|
||||||
|
"USER_UID": "${localEnv:USER_UID}",
|
||||||
|
"USER_GID": "${localEnv:USER_GID}"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
// run arguments passed to docker
|
||||||
|
"runArgs": [
|
||||||
|
"--security-opt", "label=disable"
|
||||||
|
],
|
||||||
|
|
||||||
|
"containerEnv": {
|
||||||
|
// extensions to preload before other extensions
|
||||||
|
"PRELOAD_EXTENSIONS": "arrterian.nix-env-selector"
|
||||||
|
},
|
||||||
|
|
||||||
|
// disable command overriding and updating remote user ID
|
||||||
|
"overrideCommand": false,
|
||||||
|
"userEnvProbe": "loginShell",
|
||||||
|
"updateRemoteUserUID": false,
|
||||||
|
|
||||||
|
// build development environment on creation, make sure you already have shell.nix
|
||||||
|
"onCreateCommand": "nix develop",
|
||||||
|
|
||||||
|
// Add the IDs of extensions you want installed when the container is created.
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
"extensions": [
|
||||||
|
// select nix environment
|
||||||
|
"arrterian.nix-env-selector",
|
||||||
|
|
||||||
|
// extra extensions
|
||||||
|
//"fsevenm.run-it-on",
|
||||||
|
"jnoortheen.nix-ide"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
|
"forwardPorts": []
|
||||||
|
|
||||||
|
// Use 'postCreateCommand' to run commands after the container is created.
|
||||||
|
// "postCreateCommand": "go version",
|
||||||
|
}
|
|
@ -52,9 +52,8 @@
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
# Base dev shell
|
|
||||||
devenv.shells.default = {
|
devenv.shells.default = {
|
||||||
imports = [ "${self}/shells/base.nix" ];
|
imports = [ "${self}/shells/nix.nix" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
formatter = pkgs.nixfmt-rfc-style;
|
formatter = pkgs.nixfmt-rfc-style;
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
{ ... }:
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
8
shells/nix.nix
Normal file
8
shells/nix.nix
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
languages.nix.enable = true;
|
||||||
|
|
||||||
|
packages = [
|
||||||
|
nixfmt-rfc-style
|
||||||
|
];
|
||||||
|
}
|
Loading…
Reference in a new issue