Add Deeplabcut (docker)

master
David Crompton 2023-08-02 11:33:59 -04:00
parent 1a3dc0b1c7
commit 98775778e4
3 changed files with 62 additions and 1 deletions

View File

@ -4,6 +4,6 @@
./packages/terminal.nix
./packages/matlab.nix
./packages/containers.nix
./packages/conda.nix
./packages/deeplabcut.nix
];
}

View File

@ -0,0 +1,30 @@
{ config, lib, pkgs, ...}: let
deeplabcut_script = let
version = "2.3.5";
in pkgs.stdenvNoCC.mkDerivation {
pname = "deeplabcut_docker";
inherit version;
src = (pkgs.fetchFromGitHub {
owner = "DeepLabCut";
repo = "DeepLabCut";
rev = "v${version}";
hash = "sha256-VYwpyP+NFouizoDG7h7b8MC3t1O6NKRcM83tUn2GsGo=";
}) + "/docker/deeplabcut_docker.sh";
unpackPhase = ''
cp $src ./
'';
installPhase = ''
mkdir -p $out/bin
cp * $out/bin
'';
isExecutable = true;
patches = [
./deeplabcut.patch
];
};
in {
environment.systemPackages = with pkgs; [
xorg.xhost
deeplabcut_script
];
}

View File

@ -0,0 +1,31 @@
diff --git a/deeplabcut_docker.sh b/deeplabcut_docker.sh
old mode 100644
new mode 100755
index c62087c..30b5e51
--- a/deeplabcut_docker.sh
+++ b/deeplabcut_docker.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
# Helper script for launching deeplabcut docker UI containers
# Usage:
@@ -144,8 +144,10 @@ gui() {
update gui || exit 1
build gui || exit 1
args="$(get_x11_args) $(get_mount_args) ${extra_args}"
+ xhost +local:dlc
$DOCKER run -it --rm ${args} $(get_local_container_name gui) \
|| err "Failed to launch the DLC GUI. Used args: \"${args}\""
+ xhost -local:dlc
}
# Launch a Jupyter Server in the current directory
@@ -182,7 +184,6 @@ custom() {
$DOCKER run -it $args ${image}-custom bash
}
-check_system
subcommand=${1:-gui}
shift 1
case "${subcommand}" in