diff --git a/hydro.nix b/hydro.nix deleted file mode 100644 index 90bd0f8e..00000000 --- a/hydro.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ pkgs ? import { system = "x86_64-linux"; } }: - -pkgs.dockerTools.buildImage { - name = "hydrooj/web"; - tag = "latest"; - - contents = [ - pkgs.mongodb-4_2 - pkgs.minio - pkgs.nodejs - pkgs.yarn - ]; - runAsRoot = '' - #!${pkgs.runtimeShell} - mkdir -p /data/db - yarn global add pm2 hydrooj @hydrooj/ui-default @hydrooj/hydrojudge - hydrooj addon add @hydrooj/hydrojudge - hydrooj addon add @hydrooj/ui-default - ''; - - config = { - WorkingDir = "/data"; - Volumes = { "/data" = { }; }; - ExposedPorts = { - "8888" = { }; - }; - Entrypoint = [ "/entrypoint.sh" ]; - }; -} diff --git a/install/nix/default.nix b/install/nix/default.nix new file mode 100644 index 00000000..5f5bd2dd --- /dev/null +++ b/install/nix/default.nix @@ -0,0 +1,24 @@ +{ pkgs ? import { system = "x86_64-linux"; } }: + +let + mongo = pkgs.callPackage ./mongo.nix {}; +in pkgs.dockerTools.buildImage { + name = "hydrooj/web-base"; + tag = "latest"; + + contents = [ + mongo + pkgs.minio + pkgs.nodejs + pkgs.yarn + ]; + + config = { + WorkingDir = "/data"; + Volumes = { "/data" = { }; }; + ExposedPorts = { + "8888" = { }; + }; + Cmd = [ "hydrooj" ]; + }; +} \ No newline at end of file diff --git a/install/nix/hydro.nix b/install/nix/hydro.nix new file mode 100644 index 00000000..a10fb7ae --- /dev/null +++ b/install/nix/hydro.nix @@ -0,0 +1,16 @@ +{ pkgs ? import {} }: + +pkgs.stdenv.mkDerivation { + name = "hydro-0.0.0"; + system = "x86_64-linux"; + #TODO install from cache + src = ../../.yarn/cache; + unpackPhase = "ls $src"; + + meta = { + description = "Hydro"; + homepage = https://hydro.js.org/; + maintainers = [ "undefined " ]; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/install/nix/mongo.nix b/install/nix/mongo.nix new file mode 100644 index 00000000..39b27ea5 --- /dev/null +++ b/install/nix/mongo.nix @@ -0,0 +1,35 @@ +{ stdenv, fetchurl, dpkg, glibc, xz, curl, openssl, gcc-unwrapped, autoPatchelfHook }: + +let in stdenv.mkDerivation { + name = "mongodb-5.0.6"; + system = "x86_64-linux"; + src = fetchurl { + url = "https://repo.mongodb.org/apt/ubuntu/dists/focal/mongodb-org/5.0/multiverse/binary-amd64/mongodb-org-server_5.0.6_amd64.deb"; + hash = "sha256-Rk43PNQN8p2/3XDDjWOzJmzBjs39CR06kLrTtr+5ngo="; + }; + nativeBuildInputs = [ + autoPatchelfHook + dpkg + ]; + buildInputs = [ + glibc + openssl # libcrypto.so.1.1 libssl.so.1.1 + xz # liblzma.so.5 + curl # libcurl.so.4 + gcc-unwrapped + ]; + unpackPhase = "true"; + installPhase = '' + mkdir -p $out + dpkg -x $src $out + mkdir $out/bin + mv $out/usr/bin/mongod $out/bin/mongod + ''; + + meta = { + description = "MongoDB"; + homepage = https://www.mongodb.com/; + maintainers = [ "undefined " ]; + platforms = [ "x86_64-linux" ]; + }; +} \ No newline at end of file