diff --git a/flake.nix b/flake.nix index 9b7b29a07..d95bf5594 100644 --- a/flake.nix +++ b/flake.nix @@ -38,6 +38,25 @@ packages = rec { default = dolos-cli; dolos-cli = pkgs.callPackage (import ./package.nix) {}; + dolos-docker-image = pkgs.dockerTools.buildImage { + name = "ghcr.io/dodona-edu/dolos-cli"; + tag = "latest"; + copyToRoot = pkgs.buildEnv { + name = "image-root"; + paths = [ dolos-cli ]; + pathsToLink = [ "/bin" ]; + }; + runAsRoot = '' + mkdir -p /dolos + ''; + config = { + Cmd = [ "/bin/dolos" ]; + WorkingDir = "/dolos"; + }; + }; + dolos-load-docker = pkgs.writeShellScriptBin "dolos-load-docker" '' + docker load < ${dolos-docker-image} + ''; }; overlays.default = final: prev: { dolos-cli = final.callPackage (import ./package.nix) {}; diff --git a/package.nix b/package.nix index 28aba8cbd..8ec1aa358 100644 --- a/package.nix +++ b/package.nix @@ -7,9 +7,25 @@ buildNpmPackage rec { pname = "dolos"; version = "2.7.1"; - src = ./.; + srcs = [ + ./package.json + ./package-lock.json + ./tsconfig.global.json + ./core + ./parsers + ./lib + ./web + ./cli + ]; - npmDepsHash = "sha256-qgAdXhohaIyQffkiIWxVXeE3c4JRTgbjxrNFI9dlaNs="; + unpackPhase = '' + for src in $srcs; do + cp -r $src ./$(stripHash $src) + chmod -R 700 ./$(stripHash $src) + done + ''; + + npmDepsHash = "sha256-XMATCZS/j5bcGjfUQnaFC2mPCv47+3tgIfruTYUQhN4="; npmWorkspace="cli";