Using VSCode Flatpak to launch DevContainers Using Podman with Support for Nvidia CUDA and VSCode's "Container Features" In SilverBlue.
Note: This Setup Works for Machine Learning and GPU Acceleration in Containers
| image: | |
| file: prebuild-devcontainer/Dockerfile | |
| tasks: | |
| - init: | | |
| direnv allow | |
| vscode: | |
| extensions: | |
| - jetpack-io.devbox | |
| - ms-python.python |
| #!/bin/bash | |
| # Get a list of all volumes | |
| volumes=$(podman volume ls -q) | |
| #get timestamp for unique filename | |
| timestamp=$(date +"%Y%m%d%H%M%S") | |
| # Pause all running containers | |
| echo "Pausing containers for backup" | |
| podman pause $(podman ps -q) |
| { | |
| pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/refs/tags/22.11-beta.tar.gz") {}, | |
| } : | |
| with pkgs; | |
| let | |
| init = pkgs.writeScript "init.sh" '' | |
| #!${pkgs.runtimeShell} | |
| /activate | |
| exec /run/current-system/systemd/lib/systemd/systemd $* |
| # to add to your ~/.bashrc or your ~/.zshrc file. Usage: $ go switch 1.18.1 | |
| function go() { | |
| case $* in | |
| switch* ) | |
| shift 1 | |
| gobindir=$(go env GOBIN) | |
| # adapt to a valid directory at the beginning of your $PATH if you're not on systemd | |
| homebindir=$(systemd-path user-binaries) | |
| go install golang.org/dl/go"$@"@latest | |
| $gobindir/go"$@" download |
| # Edit this configuration file to define what should be installed on | |
| # your system. Help is available in the configuration.nix(5) man page | |
| # and in the NixOS manual (accessible by running ‘nixos-help’). | |
| { config, pkgs, ... }: | |
| { | |
| imports = | |
| [ # Include the results of the hardware scan. | |
| ./hardware-configuration.nix |
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| # Always use the by-id aliases for devices, otherwise ZFS can choke on imports. | |
| DISK=${DISK:-/dev/disk/by-id/nvme-Samsung_SSD_970_EVO_Plus_500GB_S4EVNF0M531397T} | |
| EFI=${EFI:-true} | |
| function Usage() { | |
| echo "usage: $0 install|revert" >&2 |
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <!-- Required meta tags --> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
| <!-- Bootstrap CSS --> | |
| <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> |
| include karax / prelude | |
| import strutils | |
| type | |
| Model = object | |
| counter*: int | |
| Dispatch = proc(model: Model): void | |
| proc init(): Model = | |
| result = Model(counter: 0) |