Dmitriy Kholkin 2c65c0500c
init version
2022-10-27 21:43:05 +03:00

35 lines
1.3 KiB
Nix

{
inputs = {
flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs, flake-utils-plus, ... }@inputs:
let
pkgs-unstable = self.channels.unstable;
in flake-utils-plus.lib.mkFlake {
inherit self inputs;
channels.unstable.input = nixpkgs;
outputsBuilder = channels: let
pkgs = channels.unstable;
image-tag = "ataraxiadev/rocm-pytorch:latest";
cmd-line-options = "/shared/init.sh --theme dark --listen --port 7860 --deepdanbooru --medvram --opt-split-attention";
in rec {
packages = {
image-build = pkgs.writeShellScriptBin "image-build" ''
docker build --force-rm --tag ${image-tag} "$@" .
'';
image-run = pkgs.writeShellScriptBin "image-run" ''
docker run -it --rm --name stable-diffusion --device=/dev/kfd --device=/dev/dri --group-add=video --ipc=host --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -p 80:7860 -v $(pwd)/shared:/shared ${image-tag} ${cmd-line-options} "$@"
'';
};
defaultPackage = packages.image-run;
devShell = pkgs.mkShell {
name = "pytorch-terminal";
packages = with packages; [ image-build image-run ];
};
};
};
}