Automate palette.nix generation

This commit is contained in:
alejandro-angulo 2025-12-20 09:01:06 -08:00
parent 4e42cc7957
commit 397e0a08b1
3 changed files with 2779 additions and 2686 deletions

View file

@ -1,9 +1,49 @@
{
description = "Catppuccin Color Palette";
outputs = { self, ... }: {
lib = {
palette = import ./palette.nix;
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default";
palette.url = "github:catppuccin/palette";
palette.flake = false;
};
outputs =
{
nixpkgs,
systems,
palette,
...
}:
let
forEachSystem = nixpkgs.lib.genAttrs (import systems);
in
{
lib = {
palette = import ./palette.nix;
};
apps = forEachSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
rawPalette = builtins.fromJSON (builtins.readFile "${palette}/palette.json");
paletteNix = nixpkgs.lib.generators.toPretty { } rawPalette;
in
{
generate-palette = {
type = "app";
program = toString (
pkgs.writeShellScript "generate-palette" ''
echo 'Updating palette.nix ...'
cat > palette.nix << EOF
${paletteNix}
EOF
''
);
};
}
);
};
}