flake: add Nix build

This commit is contained in:
Antoine Martin 2022-10-27 23:13:00 +02:00
parent 3061aff363
commit b3085369e2
3 changed files with 87 additions and 0 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
*.midi
*.pdf
/result

43
flake.lock Normal file
View file

@ -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
}

43
flake.nix Normal file
View file

@ -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";
};
});
}