From b3085369e2b6cecca68cac9cb9c3a69f10b61dfe Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Thu, 27 Oct 2022 23:13:00 +0200 Subject: [PATCH] flake: add Nix build --- .gitignore | 1 + flake.lock | 43 +++++++++++++++++++++++++++++++++++++++++++ flake.nix | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore index b7177da..8bd4c24 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.midi *.pdf +/result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ed7e51a --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1666703756, + "narHash": "sha256-GwpMJ1hT+z1fMAUkaGtvbvofJQwdVFDEGVhfE82+AUk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f994293d1eb8812f032e8919e10a594567cf6ef7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..17ef04a --- /dev/null +++ b/flake.nix @@ -0,0 +1,43 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + outputs = { + self, + nixpkgs, + flake-utils, + ... + }: + flake-utils.lib.eachDefaultSystem (system: let + pkgs = import nixpkgs {inherit system;}; + in { + packages = let + # just need an empty fonts.conf + fontConf = pkgs.makeFontsConf {fontDirectories = [];}; + makeSheetMusic = name: + pkgs.stdenvNoCC.mkDerivation { + inherit name; + + src = self; + + nativeBuildInputs = with pkgs; [ + lilypond-with-fonts + ]; + + buildPhase = '' + export FONTCONFIG_FILE=${fontConf} + lilypond ${name}.ly + ''; + + installPhase = '' + mkdir $out + cp ${name}.pdf $out/${name}.pdf + cp ${name}.midi $out/${name}.midi + ''; + }; + in { + indigo-night = makeSheetMusic "indigo-night"; + }; + }); +}