Automate palette.nix generation
This commit is contained in:
parent
4e42cc7957
commit
397e0a08b1
3 changed files with 2779 additions and 2686 deletions
50
flake.nix
50
flake.nix
|
|
@ -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
|
||||
''
|
||||
);
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue