162 lines
5.7 KiB
Nix
162 lines
5.7 KiB
Nix
{ pkgs ? import <nixpkgs> { }
|
|
, pkgsLinux ? import <nixpkgs> { system = "x86_64-linux"; }
|
|
}:
|
|
|
|
let
|
|
|
|
# -- swap the above pkgs with the pkgs definition below for 100% reproducability
|
|
# -- WARNING: requires quite some diskspace
|
|
|
|
#{ } :
|
|
#
|
|
#let
|
|
# pkgs = import ( builtins.fetchTarball {
|
|
# # https://github.com/NixOS/nixpkgs/archive/refs/heads/nixos-25.05.zip
|
|
# name = "nixos-25.05";
|
|
# url = "https://github.com/NixOS/nixpkgs/archive/nixos-25.05.tar.gz";
|
|
# sha256 = "sha256:10cqhkqkifcgyibj9nwxrnq424crfl40kwr3daky83m2fisb4f6p";
|
|
# }) {};
|
|
|
|
vars = import ./vars.nix;
|
|
|
|
# generate the reproducable blob below via:
|
|
# $ nix-shell -p nix-prefetch-docker --run 'nix-prefetch-docker ghcr.io/manyfold3d/manyfold-solo 0.120.0'
|
|
|
|
#manyfoldImage = pkgs.dockerTools.pullImage {
|
|
# imageName = "ghcr.io/manyfold3d/manyfold-solo";
|
|
# imageDigest = "sha256:6250e562a05bf9476ddcfdc897a7b03cbf2090c727d9fe051afde486579b54a6";
|
|
# sha256 = "sha256-V5y1N0l4JQjVDQbboGYX15MQaImXtP/HpNwPjDtxeJQ=";
|
|
# finalImageName = "ghcr.io/manyfold3d/manyfold-solo";
|
|
# finalImageTag = "0.121.0";
|
|
#};
|
|
|
|
manyfoldImage = pkgs.dockerTools.pullImage {
|
|
imageName = "ghcr.io/manyfold3d/manyfold-solo";
|
|
imageDigest = "sha256:465399a2d296034ef84dba18a13744b567694c652387bd17fe97d51c672d1fa9";
|
|
hash = "sha256-j7YSUGRFUDh6FJ1CrIQEzGU/0B8uPO8y1kd9lYLad4w=";
|
|
finalImageName = "ghcr.io/manyfold3d/manyfold-solo";
|
|
finalImageTag = "latest";
|
|
};
|
|
|
|
#### JANUSXR Stack
|
|
|
|
janusweb = builtins.fetchTarball {
|
|
url = "https://github.com/coderofsalvation/janusweb/releases/download/1.5.56-xrf/janusweb-1.5.56.tar.gz";
|
|
# Get the SHA256 hash by running: nix-prefetch-url --unpack <URL>
|
|
sha256 = "0zkmfv07zxdf1nkhgr4g959fj86p2yp9f7n1ll1zyhlm186sfh31";
|
|
};
|
|
|
|
# Fetch the source from the GitHub tag
|
|
corsanywhere = pkgs.fetchzip {
|
|
url = "https://github.com/Rob--W/cors-anywhere/archive/0.4.4.tar.gz";
|
|
# You need to calculate the correct SHA256 hash for version 0.4.4
|
|
# You can get this by running 'nix-prefetch-url --unpack https://github.com/Rob--W/cors-anywhere/archive/0.4.4.tar.gz'
|
|
sha256 = "0zb3xzlpbc400rvibm66qb27y0lla8sml1ns41ksxcc0l0kp0bwz";
|
|
};
|
|
|
|
janusServer = pkgs.fetchurl {
|
|
url = "https://github.com/janusvr/janus-server/releases/download/v0.2.1/janus_server-linux";
|
|
# You can calculate the hash using: nix-prefetch-url https://...
|
|
sha256 = "1rrmabvqn4lm7c2k1q2crqwyk7lvpmfihc3hx3qx2hzsjyp5v3ja";
|
|
name = "janus_server-linux";
|
|
};
|
|
|
|
## 2. Create a minimal derivation to make the file executable
|
|
#janusServerBin = pkgs.stdenv.mkDerivation {
|
|
# pname = "janus-server";
|
|
# version = "1.0";
|
|
# src = janusServer;
|
|
# dontUnpack = true;
|
|
# dontBuild = true;
|
|
# installPhase = ''
|
|
# mkdir -p $out/bin
|
|
# cp $src $out/bin/janus_server-linux
|
|
# chmod +x $out/bin/janus_server-linux
|
|
# '';
|
|
#};
|
|
|
|
janus = pkgs.runCommand "janusweb-content" {} ''
|
|
mkdir -p $out/mnt/janusweb $out/root/corsanywhere $out/root
|
|
cp -rT ${janusweb} $out/mnt/janusweb
|
|
cp -rT ${corsanywhere} $out/root/corsanywhere/.
|
|
cp -rT ${janusServer} $out/root/janus_server-linux
|
|
'';
|
|
|
|
#### XR FRAGMENTS
|
|
|
|
## $ nix-shell -p nix-prefetch-git --command 'nix-prefetch-git https://codeberg.org/coderofsalvation/xrfragment.git <commit>'
|
|
xrfragmentsRepo = pkgs.fetchFromGitea {
|
|
"domain" = "codeberg.org";
|
|
"owner" = "coderofsalvation";
|
|
"repo" = "xrfragment";
|
|
"rev" = "823736a74dbdabd46924ebbc3dc58a076c3c900b";
|
|
"hash" = "sha256-P/RVwoDu0EYfwc0n2h1f4j0JZshtE4AtQsTU9iEkAcA=";
|
|
};
|
|
|
|
xrfragments = pkgs.runCommand "xrfragments-content" {} ''
|
|
mkdir -p $out/mnt/asset/xrfragments $out/mnt/templates/xrfragments
|
|
cp -r ${xrfragmentsRepo}/assets/library $out/mnt/asset/xrfragments/\#1
|
|
find ${xrfragmentsRepo}//assets/template -maxdepth 1 -mindepth 1 -type d | awk '{ system("cp -r "$0" '$out'/mnt/templates/xrfragments/#"(NR+1)) }'
|
|
'';
|
|
|
|
|
|
## generate the reproducable blob below via:
|
|
## $ nix-shell -p nix-prefetch-github --command 'nix-prefetch-github assimp assimp --rev e778c84cd62bc8b38d8e491ad3d2c27cb8ed37d5'
|
|
#assimpSrc = pkgs.fetchFromGitHub {
|
|
# "owner" = "assimp";
|
|
# "repo" = "assimp";
|
|
# "rev" = "e778c84cd62bc8b38d8e491ad3d2c27cb8ed37d5";
|
|
# "hash" = "sha256-ja5pFwpnzLT2MDIR8ISwC6+eA5UXyqRZW2CMCCrF1Q0=";
|
|
#};
|
|
#myAssimp = pkgs.pkgsStatic.assimp.overrideAttrs (oldAttrs: {
|
|
# inherit assimpSrc; # Set the source to the fetched commit
|
|
# src = assimpSrc;
|
|
#});
|
|
|
|
|
|
in
|
|
rec
|
|
{
|
|
|
|
xrforgeImage = pkgs.dockerTools.buildImage {
|
|
|
|
name = "xrforge";
|
|
tag = "latest";
|
|
created = "now";
|
|
fromImage = manyfoldImage;
|
|
|
|
# add nix pkgs + local files
|
|
copyToRoot = pkgs.buildEnv {
|
|
name = "image-root";
|
|
pathsToLink = ["/manyfold" "/bin" "/mnt" "/root"];
|
|
paths = [
|
|
#pkgs.pkgsStatic.rsync
|
|
pkgs.rsync
|
|
pkgs.sqlite
|
|
pkgs.rclone
|
|
pkgs.fuse3
|
|
pkgs.janus-gateway # webrtc voip for JanusXR
|
|
pkgs.nodejs_20 # for corsanywhere
|
|
#pkgs.acl # getfacl e.g.
|
|
#pkgs.inotify-tools # inotifywait e.g.
|
|
pkgs.zip # inotifywait e.g.
|
|
pkgs.assimp
|
|
##pkgs.ts # job management
|
|
#myAssimp # updated build of assimp
|
|
janus
|
|
xrfragments
|
|
../.
|
|
];
|
|
};
|
|
|
|
config = {
|
|
Cmd = ["/init"];
|
|
# We substitute the /init entrypoing with our own wrapper
|
|
EntryPoint = ["/manyfold/cli/manyfold.sh" "boot"];
|
|
Env = [
|
|
"LD_PRELOAD=" # unset LD_PRELOAD (some package is setting it a nonexisting lib)
|
|
];
|
|
};
|
|
};
|
|
|
|
}
|