add nix derivation to build catppuccin userstyles
This commit is contained in:
parent
a541d203bd
commit
7413815278
|
@ -2,11 +2,11 @@
|
|||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1712791164,
|
||||
"narHash": "sha256-3sbWO1mbpWsLepZGbWaMovSO7ndZeFqDSdX0hZ9nVyw=",
|
||||
"lastModified": 1713537308,
|
||||
"narHash": "sha256-XtTSSIB2DA6tOv+l0FhvfDMiyCmhoRbNB+0SeInZkbk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "1042fd8b148a9105f3c0aca3a6177fd1d9360ba5",
|
||||
"rev": "5c24cf2f0a12ad855f444c30b2421d044120c66f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
config._module.args = {
|
||||
inherit inputs;
|
||||
inherit pkgs system;
|
||||
inherit (pkgs) lib stdenv;
|
||||
inherit (pkgs) lib stdenv stdenvNoCC;
|
||||
};
|
||||
|
||||
# Local user nix env
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
imports = [
|
||||
./cgnix
|
||||
./mcdev.nix
|
||||
./userstyles.nix
|
||||
];
|
||||
}
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
# Module that provides an output for a stylus import file with catppuccin themes.
|
||||
{ pkgs, stdenvNoCC, ... }:
|
||||
let
|
||||
flavor = "mocha";
|
||||
accent-color = "red";
|
||||
in
|
||||
{
|
||||
packages.userstyles = stdenvNoCC.mkDerivation {
|
||||
name = "userstyles.json";
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://github.com/catppuccin/userstyles/releases/download/all-userstyles-export/import.json";
|
||||
hash = "sha256-eYU9Y95au9mI3muS4+1QJt31W7s2zVmurdKbQ1dU+pk=";
|
||||
};
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
# TODO: use better language
|
||||
realBuilder = "${pkgs.deno}/bin/deno";
|
||||
args = [
|
||||
"run"
|
||||
"-A"
|
||||
(pkgs.writeText "build.js" ''
|
||||
const json = await import(Deno.env.get("src"), { with: { type: "json" } });
|
||||
const processed = json.default.map(theme => {
|
||||
if (theme.usercssData?.vars?.accentColor?.default)
|
||||
theme.usercssData.vars.accentColor.default = "${accent-color}";
|
||||
|
||||
if (theme.usercssData?.vars?.darkFlavor?.default)
|
||||
theme.usercssData.vars.darkFlavor.default = "${flavor}";
|
||||
|
||||
return theme;
|
||||
});
|
||||
|
||||
Deno.writeTextFileSync(Deno.env.get("out"), JSON.stringify(processed));
|
||||
'')
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue