nix changes

This commit is contained in:
LordMZTE 2024-04-25 00:31:45 +02:00
parent 3e159a31d1
commit b56d389390
Signed by: LordMZTE
GPG Key ID: B64802DC33A64FF6
4 changed files with 19 additions and 50 deletions

View File

@ -14,7 +14,6 @@
let
pkgs = import nixpkgs { inherit system; };
common = pkgs.callPackage ./lib/common-nix { };
flakePkg = ref: (builtins.getFlake ref).packages.${system}.default;
root-mod = {
options.packages = nixpkgs.lib.mkOption { };
@ -26,16 +25,6 @@
inherit (pkgs) lib stdenv stdenvNoCC;
};
# Local user nix env
config.packages.mzte-nix = pkgs.symlinkJoin {
name = "mzte-nix";
paths = [
pkgs.nix-output-monitor
pkgs.nix-du
(flakePkg "github:nix-community/zon2nix")
];
};
# devshell for the dotfiles
config.dev-shells.default = nixpkgs.legacyPackages.${system}.mkShell {
buildInputs = with pkgs;

View File

@ -3,6 +3,6 @@
imports = [
./cgnix
./mcdev.nix
./userstyles.nix
./mzte-nix.nix
];
}

18
nix/mzte-nix.nix Normal file
View File

@ -0,0 +1,18 @@
{ lib, pkgs, config, ... }:
let
flakePkg = ref: (builtins.getFlake ref).packages.${pkgs.system}.default;
in
{
options.mzte-nix-packages = lib.mkOption { };
config.mzte-nix-packages = [
pkgs.nix-output-monitor
pkgs.nix-du
(flakePkg "github:nix-community/zon2nix")
];
config.packages.mzte-nix = pkgs.symlinkJoin {
name = "mzte-nix";
paths = config.mzte-nix-packages;
};
}

View File

@ -1,38 +0,0 @@
# 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));
'')
];
};
}