diff --git a/lib/generators.nix b/lib/generators.nix new file mode 100644 index 00000000..1d1dc70f --- /dev/null +++ b/lib/generators.nix @@ -0,0 +1,30 @@ +{ lib, pkgs, ... }: + +with builtins; +with lib; +{ + toCSSFile = file: + let fileName = baseNameOf file; + compiledStyles = + pkgs.runCommand "compileScssFile" + { buildInputs = [ sass ]; } '' + mkdir "$out" + scss --sourcekkmap=none \ + --no-cache \ + --style compressed \ + --default-encoding utf-8 \ + "${file}" \ + >>"$out/${fileName}.css" + ''; + in "${compiledStyles}/${fileName}"; + + toFilteredImage = imageFile: options: + let result = "result.png"; + filteredImage = + pkgs.runCommand "filterWallpaper" + { buildInputs = [ pkgs.imagemagick ]; } '' + mkdir "$out" + convert ${options} ${imageFile} $out/${result} + ''; + in "${filteredImage}/${result}"; +}