diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000000..f8cfdb82745 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,36 @@ +FROM ubuntu:24.04 + +RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get update && \ + apt-get install -y \ + adwaita-qt \ + alsa-utils \ + build-essential \ + clangd \ + gdb \ + git \ + libadwaitaqt1 \ + pipewire \ + pipewire-alsa \ + pulseaudio-utils \ + python3-pip \ + qt6-wayland \ + sudo \ + udev \ + vim && \ + pip3 install pre-commit --break-system-packages + +COPY tools/debian_buildenv.sh /tmp/ + +RUN /tmp/debian_buildenv.sh setup + +RUN userdel -f -r ubuntu && \ + mkdir /home/developer && echo "developer ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/developer && \ + mkdir -p \ + /home/developer/.cache/pre-commit \ + /home/developer/.devcontainer \ + /home/developer/.mixxx \ + /tmp/ccache && \ + touch /home/developer/.devcontainer/.bash_history && \ + chown -R 1000:1000 /home/developer/ /tmp/ccache && \ + echo ".cache\n.vscode\n.node_modules" >> /home/developer/.gitignore && \ + echo ". /etc/bash_completion\nexport PROMPT_COMMAND='history -a'\nexport HISTFILE='/home/developer/.devcontainer/.bash_history'" >> /home/developer/.bashrc diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000000..903e45397f0 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,62 @@ +{ + "name": "mixxx", + "build": { + "dockerfile": "Dockerfile", + "context": ".." + }, + "runArgs": [ + "--network=host" // This is needed for native X.org support + ], + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": "false", + "username": "developer", + "userUid": "1000", + "userGid": "1000", + "upgradePackages": "false" + } + }, + "initializeCommand": "touch ${localEnv:HOME}${localEnv:USERPROFILE}/.gitignore", + "customizations": { + "vscode": { + "extensions": [ + "llvm-vs-code-extensions.vscode-clangd", + "twxs.cmake", + "ms-vscode.cmake-tools", + "streetsidesoftware.code-spell-checker", + "vadimcn.vscode-lldb", + "GitHub.vscode-pull-request-github", + "eamodio.gitlens" + ] + } + }, + "remoteEnv": { + "SSH_AUTH_SOCK": "${localEnv:SSH_AUTH_SOCK}", + "PATH": "/usr/lib/qt6/bin/:${containerEnv:PATH}", + "DISPLAY": "${localEnv:DISPLAY::0}", + "XDG_SESSION_DESKTOP": "${localEnv:XDG_SESSION_DESKTOP:gnome}", + "XDG_SESSION_TYPE": "${localEnv:XDG_SESSION_TYPE:wayland}", + "XAUTHORITY": "${localEnv:XAUTHORITY}", + "WAYLAND_DISPLAY": "${localEnv:WAYLAND_DISPLAY:wayland-0}", + "XDG_SESSION_CLASS": "${localEnv:XDG_SESSION_CLASS:user}", + "XDG_RUNTIME_DIR": "${localEnv:XDG_RUNTIME_DIR:/run/user/1000}", + "QT_QPA_PLATFORM": "${localEnv:QT_QPA_PLATFORM:wayland}" // Default to Wayland session, can also use 'xcb' to use X.org instead + }, + "remoteUser": "developer", + "postCreateCommand": "git config --global core.excludesFile '/home/developer/.gitignore' && git config --global --add safe.directory ${containerWorkspaceFolder} && pre-commit install --overwrite --install-hooks", + "mounts": [ + "type=bind,source=${localEnv:HOME},target=${localEnv:HOME},rslave", + "type=bind,source=${localEnv:XDG_RUNTIME_DIR},target=${localEnv:XDG_RUNTIME_DIR}", + "type=bind,source=/var/run/dbus/system_bus_socket,target=/var/run/dbus/system_bus_socket", + "type=bind,source=/dev,target=/dev,rslave", + "type=bind,source=/media,target=/media,rslave", + "type=bind,source=/mnt,target=/mnt,rslave", + "type=bind,source=/run/media,target=/run/media,rslave", + // Dev volumes used for persistence between containers + "type=volume,source=mixxx-bashistory,target=/home/developer/.devcontainer", + "type=volume,source=mixxx-precommit,target=/home/developer/.cache/pre-commit", + "type=volume,source=mixxx-config,target=/home/developer/.mixxx", + "type=volume,source=mixxx-ccache,target=/tmp/ccache", + "type=volume,source=mixxx-build,target=/workspaces/mixxx/build" + ] +} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cbc896f2c40..2c6e05c4b2b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -38,6 +38,7 @@ repos: exclude: ^.*(\.cbproj|\.groupproj|\.props|\.sln|\.vcxproj|\.vcxproj.filters|UTF-8-BOM.txt)$ - id: check-case-conflict - id: check-json + exclude: ^(.devcontainer/devcontainer.json)$ # Contains JSON comment, which isn't supported by the hook - id: check-merge-conflict - id: check-xml - id: check-yaml diff --git a/README.md b/README.md index 09a41fb37a2..e0be16fbbcf 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,29 @@ To build Mixxx, run There should now be a `mixxx` executable in the current directory that you can run. Alternatively, can generate a package using `cpack`. +### Using Dev Container + +> [!NOTE] +> Dev container has recently been introduced and it is likely incomplete! Currently, it's been tested with `devpod` on Zed and Codium exclusively + +We provide a DevContainer definition for Mixxx. The container base uses Ubuntu 24.04 to ensure a close similarity with the CI. +Similar to Fedora Toolbox's, the default configuration provide a comprehensive definition of mounts which will allow use to use Mixxx seamlessly in the container. (UI, audio, ...) +If you are not comfortable with this, you may want to remove some or all of the binding before starting the container. + +You can build and run Mixxx using the following command: + +```bash +mkdir build +cd build +cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON # Needed for clangd +cmake --build . -j $(nproc) +./mixxx +``` + +#### Using your device in DevContainer + +Devices be supported by default, thanks to the provided binds. Note that if you are encountering permission issue, check that you are not using SELinux, as this is currently not well supported in DevContainer + ## Documentation For help using Mixxx, there are a variety of options: