From b56d3893907f98a6b43ff85b8275903f0f0f9eed Mon Sep 17 00:00:00 2001 From: LordMZTE Date: Thu, 25 Apr 2024 00:31:45 +0200 Subject: [PATCH] nix changes --- flake.nix | 11 ----------- nix/default.nix | 2 +- nix/mzte-nix.nix | 18 ++++++++++++++++++ nix/userstyles.nix | 38 -------------------------------------- 4 files changed, 19 insertions(+), 50 deletions(-) create mode 100644 nix/mzte-nix.nix delete mode 100644 nix/userstyles.nix diff --git a/flake.nix b/flake.nix index 4512e64..a1f1786 100644 --- a/flake.nix +++ b/flake.nix @@ -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; diff --git a/nix/default.nix b/nix/default.nix index 65f799a..d527bd1 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -3,6 +3,6 @@ imports = [ ./cgnix ./mcdev.nix - ./userstyles.nix + ./mzte-nix.nix ]; } diff --git a/nix/mzte-nix.nix b/nix/mzte-nix.nix new file mode 100644 index 0000000..62d6950 --- /dev/null +++ b/nix/mzte-nix.nix @@ -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; + }; +} diff --git a/nix/userstyles.nix b/nix/userstyles.nix deleted file mode 100644 index 81c2f88..0000000 --- a/nix/userstyles.nix +++ /dev/null @@ -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)); - '') - ]; - }; -}