keycloak-theme/flake.nix

63 lines
2.0 KiB
Nix

{
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.nixpkgs.follows = "nixpkgs";
};
outputs = { self, flake-utils, devshell, nixpkgs }:
let
pkgs = import nixpkgs {
overlays = [
devshell.overlay
(import ./overlay.nix)
];
};
in
flake-utils.lib.simpleFlake {
inherit self nixpkgs;
name = "keycloak-theme-pub-solar";
overlay = ./overlay.nix;
preOverlays = [ devshell.overlays.default ];
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
];
};
};
}