2 description = "sounds";
4 nixpkgs.url = "flake:nixpkgs";
5 git-hooks.url = "github:cachix/git-hooks.nix";
6 git-hooks.inputs.nixpkgs.follows = "nixpkgs";
7 proteaaudio = { url = "github:csabahruska/proteaaudio"; flake = false; };
12 lib = inputs.nixpkgs.lib;
13 fileInputs = with lib.fileset; toSource {
20 (fileFilter (file: lib.any file.hasExt [ "hs" ]) ./exe)
23 perSystem = f: lib.genAttrs lib.systems.flakeExposed (system: f rec {
25 pkgs = inputs.nixpkgs.legacyPackages.${system};
26 haskellPackages = pkgs.haskellPackages.extend (with pkgs.haskell.lib.compose; finalHaskellPkgs: previousHaskellPkgs: {
27 ${pkg} = buildFromSdist (finalHaskellPkgs.callCabal2nix pkg fileInputs { });
28 lambdasound = (doJailbreak (unmarkBroken previousHaskellPkgs.lambdasound)).overrideAttrs (previousAttrs: {
29 # ExplanationNote: one of lambdasound's test tries to write in `$HOME`
30 # which defaults to the non-existent directory `/homeless-shelter`.
33 plots = doJailbreak (unmarkBroken previousHaskellPkgs.plots);
34 proteaaudio = lib.pipe
35 (finalHaskellPkgs.callCabal2nix "proteaaudio" "${inputs.proteaaudio}/proteaaudio" {
36 libpulse = pkgs.libpulseaudio;
37 libpulse-simple = pkgs.libpulseaudio.dev;
39 (overrideCabal (previousDrv: {
40 # ExplanationNote: because
41 # `proteaaudio/proteaaudio/Sound/ProteaAudio.chs`
42 # symlinks to `../../chs/Binding.chs`
43 # the sibling directory ${inputs.proteaaudio}/cbits
44 # must be available too.
45 src = inputs.proteaaudio;
46 postUnpack = "sourceRoot=$sourceRoot/proteaaudio";
54 packages = perSystem ({ haskellPackages, ... }: {
55 default = haskellPackages.${pkg};
57 # nix -L develop or direnv allow
58 devShells = perSystem ({ pkgs, haskellPackages, system, ... }: {
60 haskellPackages.shellFor {
65 haskellPackages.cabal-install
66 haskellPackages.cabal2nix
67 haskellPackages.haskell-language-server
74 inherit (checks.${system}.git-hooks-check) shellHook;
78 checks = perSystem (args: with args; {
79 git-hooks-check = inputs.git-hooks.lib.${system}.run {
82 cabal-fmt.enable = true;
83 fourmolu.enable = true;
85 nixpkgs-fmt.enable = true;
86 ormolu.settings.cabalDefaultExtensions = true;
90 entry = "${pkgs.reuse}/bin/reuse lint";
91 pass_filenames = false;