Created
April 15, 2024 22:37
-
-
Save ninioArtillero/ac5aa10125135e10809098ba0b079dc4 to your computer and use it in GitHub Desktop.
A simple reproducible script for launching a ghci session with Euterpea and HSoM libraries loaded using Nix
This file contains 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
#! /usr/bin/env nix-shell | |
#! nix-shell --pure -i ghci | |
#! nix-shell -p "haskellPackages.ghcWithPackages (pkgs: [ pkgs.Euterpea pkgs.HSoM ])" | |
#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/380be19fbd2d9079f677978361792cb25e8a3635.tar.gz | |
{- | |
This script loads an interactive environment for music eDSL Euterpea, | |
with all modules from the Haskell Scholl of Music (HSoM) library exposed. | |
IMPORTANT: Only first call will take a long time to load | |
as long as the nix store is not garbage collected, as when using | |
`nix-collect-garbage` or `nix-store --gc`. | |
### References ### | |
Reproducible scripts: | |
https://nix.dev/tutorials/first-steps/reproducible-scripts.html | |
nixpkgs pin: | |
https://releases.nixos.org/nixos/22.05/nixos-22.05.4694.380be19fbd2d | |
nixos-22.05 release nixos-22.05.4694.380be19fbd2d | |
Released on 2023-08-01 15:05:53 | |
from Git commit 380be19fbd2d9079f677978361792cb25e8a3635 via Hydra evaluation 1798090. | |
-} | |
import Euterpea | |
import HSoM | |
help :: IO () | |
help = putStrLn $ unlines [ | |
"\nEuterpea and its book companion library, HSoM, are loaded in this ghci session inside a custom nix-shell.", | |
"Note that HSoM funcions are called using their full qualified name, as in", | |
"\n> play $ HSoM.Examples.Interlude.childSong6\n", | |
"IMPORTANT: Only first call will take a long time to load", | |
"as long as the nix store is not garbage collected, like when using", | |
"`nix-collect-garbage` or `nix-store --gc`.", | |
"\nTo exit, quit ghci as usual using\n", | |
"> :q" | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment