diff --git a/machines/kcnhub/packages.nix b/machines/kcnhub/packages.nix index 9acfd3d..7f809de 100644 --- a/machines/kcnhub/packages.nix +++ b/machines/kcnhub/packages.nix @@ -4,6 +4,6 @@ ./packages/terminal.nix ./packages/matlab.nix ./packages/containers.nix - ./packages/conda.nix + ./packages/deeplabcut.nix ]; } diff --git a/machines/kcnhub/packages/deeplabcut.nix b/machines/kcnhub/packages/deeplabcut.nix new file mode 100644 index 0000000..7f96d6a --- /dev/null +++ b/machines/kcnhub/packages/deeplabcut.nix @@ -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 + ]; +} diff --git a/machines/kcnhub/packages/deeplabcut.patch b/machines/kcnhub/packages/deeplabcut.patch new file mode 100644 index 0000000..3125bd3 --- /dev/null +++ b/machines/kcnhub/packages/deeplabcut.patch @@ -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