|
144 | 144 | });
|
145 | 145 | };
|
146 | 146 |
|
| 147 | + apps = let ## TODO: Move these functions to the lib. |
| 148 | + ## Define a single entry for flake `apps` from the path in the Nix store |
| 149 | + ## for a Cabal package and executable defined in that package. |
| 150 | + cabalApp = package: executable: { |
| 151 | + program = "${inputs.self.packages.${system}."${defaultCompiler}_${package}"}/bin/${executable}"; |
| 152 | + type = "app"; |
| 153 | + }; |
| 154 | + |
| 155 | + ## Given a path in the Nix store for a Cabal package and a list of |
| 156 | + ## executables defined in the Cabal package, creates an AttrSet of apps, |
| 157 | + ## one per listed executable. |
| 158 | + ## |
| 159 | + ## TODO: Somehow extract this, if possible, from `callCabal2nix` result. |
| 160 | + cabalApps = package: executables: |
| 161 | + builtins.listToAttrs |
| 162 | + (map (exe: {name = exe; value = cabalApp package exe;}) executables); |
| 163 | + |
| 164 | + ## Given an AttrSet with the keys being paths in the Nix store for Cabal |
| 165 | + ## packages and the values being lists of executables defined in that |
| 166 | + ## Cabal package, creates an AttrSet of apps, one per listed executable. |
| 167 | + ## |
| 168 | + ## TODO: Somehow extract this, if possible, from `cabalProject2nix` |
| 169 | + ## result. |
| 170 | + cabalProjectApps = pkgs.lib.concatMapAttrs cabalApps; |
| 171 | + in cabalProjectApps { |
| 172 | + concat-graphics = ["graphics-examples" "graphics-trace"]; |
| 173 | + ## TODO: concat-hardware currently doesn’t build |
| 174 | + # concat-hardware = ["hardware-examples" "hardware-trace"]; |
| 175 | + concat-plugin = ["misc-examples" "misc-trace"]; |
| 176 | + }; |
| 177 | + |
147 | 178 | # Nix code formatter, https://github.com/kamadorueda/alejandra#readme
|
148 | 179 | formatter = pkgs.alejandra;
|
149 | 180 | });
|
|
0 commit comments