Created
April 17, 2025 22:02
-
-
Save r14c/56d15155a6e2d4e1adcc3040acd00089 to your computer and use it in GitHub Desktop.
hypergiant demo nix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
stdenv, | |
chicken, | |
chickenPackages, | |
makeWrapper, | |
... | |
}: | |
stdenv.mkDerivation { | |
name = "hypergiant-demo"; | |
src = ./.; | |
propagatedBuildInputs = with chickenPackages.chickenEggs; [ | |
hypergiant | |
]; | |
nativeBuildInputs = [ chicken makeWrapper ]; | |
buildPhase = '' | |
csc demo.scm | |
''; | |
installPhase = '' | |
runHook preInstall | |
install -Dt $out/bin demo | |
wrapProgram $out/bin/demo \ | |
--prefix CHICKEN_REPOSITORY_PATH : "$out/lib/chicken/${toString chicken.binaryVersion}:$CHICKEN_REPOSITORY_PATH" \ | |
--prefix CHICKEN_INCLUDE_PATH : "$CHICKEN_INCLUDE_PATH:$out/share" \ | |
--prefix PATH : "$out/bin:${chicken}/bin:$CHICKEN_REPOSITORY_PATH" | |
runHook postInstall | |
''; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import scheme (chicken base) hypergiant) | |
; from https://wiki.call-cc.org/eggref/5/hypergiant#examples | |
(define scene (make-parameter #f)) | |
(define camera (make-parameter #f)) | |
(define square (rectangle-mesh 1 1 color: (lambda (i) | |
(list-ref '((1 0 0) | |
(0 1 0) | |
(0 0 1) | |
(1 0 1)) | |
i)))) | |
(define (init) | |
(scene (make-scene)) | |
(camera (make-camera #:perspective #:orbit (scene))) | |
(add-node (scene) color-pipeline-render-pipeline | |
mesh: square)) | |
(start 400 400 "Simple" init: init resizable: #f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment