stylix/palette-generator/default.nix
Daniel Thwaites ba5565d698
Refactor palette generator ♻️
Simplified a lot of code which was unnecessarily generic.

Now using monads to manage the state of the random number generator
rather than passing it around by hand.

Also made some performance improvements, then increased the population
size so more combinations are tried in a similar length of time.
2023-07-08 14:28:15 +01:00

39 lines
800 B
Nix

{ haskellPackages, stdenvNoCC }:
let
ghc = haskellPackages.ghcWithPackages (ps: with ps; [
JuicyPixels
json
random
vector-algorithms
]);
# `nix build .#palette-generator.passthru.docs` and open in a web browser
docs = stdenvNoCC.mkDerivation {
name = "palette-generator-haddock";
src = ./.;
buildInputs = [ ghc ];
buildPhase = ''
haddock $src/**/*.hs --html --ignore-all-exports --odir $out
'';
dontInstall = true;
dontFixup = true;
};
in stdenvNoCC.mkDerivation {
name = "palette-generator";
src = ./.;
buildInputs = [ ghc ];
buildPhase = ''
ghc -O -threaded -Wall -Wno-type-defaults Stylix/Main.hs
'';
installPhase = ''
install -D Stylix/Main $out/bin/palette-generator
'';
passthru = { inherit docs; };
}