helm/lib/generators.nix

31 lines
900 B
Nix
Raw Permalink Normal View History

2020-10-17 20:37:47 -07:00
{ lib, pkgs, ... }:
with builtins;
with lib;
{
toCSSFile = file:
let fileName = removeSuffix ".scss" (baseNameOf file);
2020-10-17 20:37:47 -07:00
compiledStyles =
pkgs.runCommand "compileScssFile"
2021-02-01 21:24:47 -08:00
{ buildInputs = [ pkgs.sass ]; } ''
2020-10-17 20:37:47 -07:00
mkdir "$out"
2021-02-01 21:24:47 -08:00
scss --sourcemap=none \
2020-10-17 20:37:47 -07:00
--no-cache \
--style compressed \
--default-encoding utf-8 \
"${file}" \
>>"$out/${fileName}.css"
'';
in "${compiledStyles}/${fileName}.css";
2020-10-17 20:37:47 -07:00
toFilteredImage = imageFile: options:
let result = "result.png";
filteredImage =
pkgs.runCommand "filterWallpaper"
{ buildInputs = [ pkgs.imagemagick ]; } ''
mkdir "$out"
convert ${options} ${imageFile} $out/${result}
'';
in "${filteredImage}/${result}";
}