about summary refs log tree commit diff
path: root/pkgs.nix
blob: c1f6f06ca12c2cc666e4952d053d57e11a8625d9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{ pkgs }:

rec {
  # likely-music haskellPackage
  likely-music-lib = likely-music-backend;
  likely-music-backend = pkgs.haskellPackages.callPackage ./likely-music-backend.nix { };

  likely-music-frontend = pkgs.callPackage ./web { };

  # executable wrapper around everything with correct paths
  likely-music = pkgs.runCommand "likely-music" { } ''
    mkdir -p $out/bin
    source "${pkgs.dieHook}/nix-support/setup-hook"
    source "${pkgs.makeWrapper}/nix-support/setup-hook"
    makeWrapper "${likely-music-backend}/bin/likely-music-backend" "$out/bin/likely-music" \
      --argv0 likely-music \
      --set LIKELY_MUSIC_FRONTEND "${likely-music-frontend}/share/likely-music-frontend" \
      --set LIKELY_MUSIC_SYNTH "${fluidsynth-wrapper}/bin/fluidsynth-wrapper"
    '';

  fluidsynth-wrapper = pkgs.writeTextFile {
    name = "fluidsynth-wrapper";
    executable = true;
    destination = "/bin/fluidsynth-wrapper";
    text = ''
      #!${pkgs.bash}/bin/bash
      # fluidsynth-wrapper IN.mid OUT.wav
      if [ -z "$1" -o -z "$2" ]; then
        echo "$0: missing file parameter(s)" >&2
        exit 1
      fi
      ${pkgs.fluidsynth}/bin/fluidsynth -a file -i ${pkgs.soundfont-fluid}/share/soundfonts/FluidR3_GM2-2.sf2 -F "$2" "$1"
    '';
  };
}