keycloak-theme/flake.nix

64 lines
2 KiB
Nix
Raw Normal View History

2022-11-27 01:17:33 +00:00
{
description = "Keycloak pub.solar theme";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
devshell.url = "github:numtide/devshell";
devshell.inputs.flake-utils.follows = "flake-utils";
devshell.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, flake-utils, devshell, nixpkgs }:
2022-11-27 04:16:39 +00:00
let
pkgs = import nixpkgs {
overlays = [
devshell.overlay
(import ./overlay.nix)
];
};
in
2022-11-27 01:17:33 +00:00
flake-utils.lib.simpleFlake {
inherit self nixpkgs;
name = "keycloak-theme-pub-solar";
2022-11-27 04:16:39 +00:00
overlay = ./overlay.nix;
2022-11-27 01:17:33 +00:00
preOverlays = [ devshell.overlay ];
shell = { pkgs }:
let
google-font-downloader = with pkgs; writeShellScriptBin "google-font-downloader" ''
echo "Attempting to fetch $1"
${nodejs}/bin/npx google-font-downloader -- $1
rm ./common/resources/scss/typography.scss
echo "/* To regenerate this file, run $ google-font-downloader '$1' */" >> ./common/resources/scss/typography.scss
echo "" >> ./common/resources/scss/typography.scss
cat ./google-fonts-*.css >> ./common/resources/scss/typography.scss
rm ./google-fonts-*.css
mv fonts ./common/resources/fonts
'';
compile-sass = with pkgs; writeShellScriptBin "compile-sass" ''
${sassc}/bin/sassc "./common/resources/scss/index.scss" > "./common/resources/css/index.css"
'';
watch-sass = with pkgs; writeShellScriptBin "watch-sass" ''
while true; do
${inotify-tools}/bin/inotifywait -e close_write ./common/resources/scss && ${compile-sass}/bin/compile-sass
done
'';
in
pkgs.devshell.mkShell {
imports = [ ];
# Add additional packages you'd like to be available in your devshell
# PATH here
devshell.packages = with pkgs; [
google-font-downloader
compile-sass
watch-sass
];
};
};
}