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

55
flake.lock generated
View file

@ -1,6 +1,59 @@
{ {
"nodes": { "nodes": {
"root": {} "nixpkgs": {
"locked": {
"lastModified": 1766070988,
"narHash": "sha256-G/WVghka6c4bAzMhTwT2vjLccg/awmHkdKSd2JrycLc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c6245e83d836d0433170a16eb185cefe0572f8b8",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"palette": {
"flake": false,
"locked": {
"lastModified": 1742245182,
"narHash": "sha256-R52Q1FVAclvBk7xNgj/Jl+GPCIbORNf6YbJ1nxH3Gzs=",
"owner": "catppuccin",
"repo": "palette",
"rev": "0df7db6fe201b437d91e7288fa22807bb0e44701",
"type": "github"
},
"original": {
"owner": "catppuccin",
"repo": "palette",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"palette": "palette",
"systems": "systems"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
}, },
"root": "root", "root": "root",
"version": 7 "version": 7

View file

@ -1,9 +1,49 @@
{ {
description = "Catppuccin Color Palette"; description = "Catppuccin Color Palette";
outputs = { self, ... }: { 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 = { lib = {
palette = import ./palette.nix; 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
''
);
};
}
);
}; };
} }

File diff suppressed because it is too large Load diff