shithub: choc

Download patch

ref: 7ab81661f913653ac04755a8c4505ce82e9d96a3
parent: c5209ccbb0b1cdaff26f3b0a3903b68bd229d869
author: Filip Sufitchi <[email protected]>
date: Wed Feb 9 17:00:17 EST 2022

Clean up devcontainer dir structure

--- a/.devcontainer/.gitignore
+++ b/.devcontainer/.gitignore
@@ -1,2 +1,4 @@
 *.xauth
-wads/
\ No newline at end of file
+wads/
+prefs/
+share/
\ No newline at end of file
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -1,7 +1,7 @@
 // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
 // https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/docker-existing-dockerfile
 {
-	"name": "Existing Dockerfile",
+	"name": "Doom Dev Container",
 
 	// Sets the run context to one level up instead of the .devcontainer folder.
 	"context": "..",
@@ -15,6 +15,7 @@
 	// Add the IDs of extensions you want installed when the container is created.
 	"extensions": [
 		"ms-vscode.cpptools-extension-pack",
+		"npxms.hide-gitignored",
 	],
 
 	// Required to not bleed "root" permission files into the volume
@@ -22,17 +23,19 @@
 
 	// VSCode on Linux specific, for creating X11 and sound forwarding
 	// Comment out manually if working on non-Linux
-	"initializeCommand": "sh ${localWorkspaceFolder}/.devcontainer/xauth-configure.sh ${localWorkspaceFolder}/.devcontainer/devcontainer.xauth",
+	"initializeCommand": "${localWorkspaceFolder}/.devcontainer/initialize-linux.sh",
 	"mounts": [
 		"source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind",
+		"source=${localWorkspaceFolder}/.devcontainer/prefs,target=/home/chocodev/.local/share/chocolate-doom,type=bind",
 	],
 	"containerEnv": {
 		"DISPLAY": "${localEnv:DISPLAY}",
-		"XAUTHORITY": "${containerWorkspaceFolder}/.devcontainer/devcontainer.xauth",
+		"XAUTHORITY": "${containerWorkspaceFolder}/.devcontainer/share/devcontainer.xauth",
 	},
 	"runArgs": [
 		// "--gpus", "all",  // Uncomment for GPU support
-		"--device", "/dev/snd",  // TODO: pulseaudio? https://github.com/mviereck/x11docker/wiki/Container-sound:-ALSA-or-Pulseaudio
+		"--device", "/dev/snd",  
+		// TODO: pulseaudio? https://github.com/mviereck/x11docker/wiki/Container-sound:-ALSA-or-Pulseaudio
 	]
 
 	// TODO: X11/sound forwarding configs for MacOS (XQuartz) and Windows (Xming)
--- /dev/null
+++ b/.devcontainer/initialize-linux.sh
@@ -1,0 +1,9 @@
+#!/bin/bash
+HERE=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
+
+### Create the xauth file allowing the container to interact with a forwarded X11
+XAUTH="$HERE/share/devcontainer.xauth";
+touch "$XAUTH"
+xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
+
+### TODO: pulseaudio pasthrough
\ No newline at end of file
--- a/.devcontainer/xauth-configure.sh
+++ /dev/null
@@ -1,6 +1,0 @@
-#!/bin/sh
-
-# Specify arg of path to create the xauth at
-
-touch $1;
-xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $1 nmerge -