From cf71bd8eefa3e718cb81c83c7cdec713d9df4697 Mon Sep 17 00:00:00 2001 From: Himadri Bhattacharjee <107522312+lavafroth@users.noreply.github.com> Date: Sat, 19 Jul 2025 06:57:08 +0530 Subject: [PATCH] feat: add custom package `mustache2konsole` overlay --- flake.lock | 45 +++++++++++----- flake.nix | 7 +++ hosts/default/home/konsole-stylix.nix | 78 +-------------------------- 3 files changed, 41 insertions(+), 89 deletions(-) diff --git a/flake.lock b/flake.lock index f497102..e23340a 100644 --- a/flake.lock +++ b/flake.lock @@ -218,11 +218,11 @@ ] }, "locked": { - "lastModified": 1752603129, - "narHash": "sha256-S+wmHhwNQ5Ru689L2Gu8n1OD6s9eU9n9mD827JNR+kw=", + "lastModified": 1752814804, + "narHash": "sha256-irfg7lnfEpJY+3Cffkluzp2MTVw1Uq9QGxFp6qadcXI=", "owner": "nix-community", "repo": "home-manager", - "rev": "e8c19a3cec2814c754f031ab3ae7316b64da085b", + "rev": "d0300c8808e41da81d6edfc202f3d3833c157daf", "type": "github" }, "original": { @@ -278,6 +278,26 @@ "type": "github" } }, + "mustache2konsole": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1752990396, + "narHash": "sha256-P8ariIwu7x3Njm6KbTacFsNkxxU5t9B/M2lRGB1I+xo=", + "owner": "lavafroth", + "repo": "mustache2konsole", + "rev": "f63133635d68fde4fd0de3316122be82525718b5", + "type": "github" + }, + "original": { + "owner": "lavafroth", + "repo": "mustache2konsole", + "type": "github" + } + }, "nix-formatter-pack": { "inputs": { "nixpkgs": [ @@ -308,11 +328,11 @@ ] }, "locked": { - "lastModified": 1752441837, - "narHash": "sha256-FMH1OSSJp8Cx8MZHXz6KckxJGbCnVMotZNAH3v2WneU=", + "lastModified": 1752985182, + "narHash": "sha256-sX8Neff8lp3TCHai6QmgLr5AD8MdsQQX3b52C1DVXR8=", "owner": "nix-community", "repo": "nix-index-database", - "rev": "839e02dece5845be3a322e507a79712b73a96ba2", + "rev": "fafdcb505ba605157ff7a7eeea452bc6d6cbc23c", "type": "github" }, "original": { @@ -369,11 +389,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1752480373, - "narHash": "sha256-JHQbm+OcGp32wAsXTE/FLYGNpb+4GLi5oTvCxwSoBOA=", + "lastModified": 1752687322, + "narHash": "sha256-RKwfXA4OZROjBTQAl9WOZQFm7L8Bo93FQwSJpAiSRvo=", "owner": "nixos", "repo": "nixpkgs", - "rev": "62e0f05ede1da0d54515d4ea8ce9c733f12d9f08", + "rev": "6e987485eb2c77e5dcc5af4e3c70843711ef9251", "type": "github" }, "original": { @@ -541,6 +561,7 @@ "inputs": { "home-manager": "home-manager", "lanzaboote": "lanzaboote", + "mustache2konsole": "mustache2konsole", "nix-index-database": "nix-index-database", "nix-ld": "nix-ld", "nix-on-droid": "nix-on-droid", @@ -627,11 +648,11 @@ "tinted-zed": "tinted-zed" }, "locked": { - "lastModified": 1752684057, - "narHash": "sha256-QRuM25aYp3n2cf59gEJE0VcIoGRX2ps8gp2mzorKodw=", + "lastModified": 1752965417, + "narHash": "sha256-FDec+RoFgSrk3YPedcjNiBK+acaHO4Vt0YDTMdKdw1w=", "owner": "danth", "repo": "stylix", - "rev": "0ba0ffe94cbe20ae739c2aa8cae04cbf900bf56b", + "rev": "f826d3214b8a9be3f158d5cc7514c4130674324b", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 51572c2..2d59efd 100644 --- a/flake.nix +++ b/flake.nix @@ -28,12 +28,17 @@ url = "github:nix-community/nix-on-droid/release-23.11"; inputs.nixpkgs.follows = "nixpkgs"; }; + mustache2konsole = { + url = "github:lavafroth/mustache2konsole"; + inputs.nixpkgs.follows = "nixpkgs"; + }; nix-ld.url = "github:Mic92/nix-ld"; nix-ld.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = inputs@{ + self, nixpkgs, home-manager, lanzaboote, @@ -42,6 +47,7 @@ nix-index-database, stylix, nix-ld, + mustache2konsole, ... }: @@ -54,6 +60,7 @@ stylix.nixosModules.stylix nix-index-database.nixosModules.nix-index { programs.nix-index-database.comma.enable = true; } + { nixpkgs.overlays = [ mustache2konsole.overlays.default ]; } # uni requires us to use uv for python # RIP binary isolation lol diff --git a/hosts/default/home/konsole-stylix.nix b/hosts/default/home/konsole-stylix.nix index 72f611d..81559be 100644 --- a/hosts/default/home/konsole-stylix.nix +++ b/hosts/default/home/konsole-stylix.nix @@ -1,86 +1,10 @@ { - config, pkgs, lib, ... }: { home.activation.konsolerc = lib.hm.dag.entryAfter [ "stylixLookAndFeel" ] '' - PATH="${config.home.path}/bin:$PATH:${pkgs.jq}" - palette=$HOME/.config/stylix/palette.json - scheme=$HOME/.local/share/konsole/Stylix.colorscheme - profile=$HOME/.local/share/konsole/Stylix.profile - - if ! [ -f $palette ]; then - echo "Palette doesn't exist" - else - json=$( cat $palette ) - - hex_to_rgb() { - hex=$1 - r=$((16#''${hex:0:2})) - g=$((16#''${hex:2:2})) - b=$((16#''${hex:4:2})) - echo "$r,$g,$b" - } - - for base in base00 base01 base02 base03 base04 base05 base06 base07 base08 base09 base0A base0B base0C base0D base0E base0F; do - hex=$(echo "$json" | jq -r ".$base") - rgb=$(hex_to_rgb "$hex") - declare "''${base}_rgb=$rgb" - done - - echo " - [Background] - Color=$base00_rgb - [BackgroundIntense] - Color=$base03_rgb - [Color0] - Color=$base00_rgb - [Color0Intense] - Color=$base03_rgb - [Color1] - Color=$base08_rgb - [Color1Intense] - Color=$base08_rgb - [Color2] - Color=$base0B_rgb - [Color2Intense] - Color=$base0B_rgb - [Color3] - Color=$base0A_rgb - [Color3Intense] - Color=$base0A_rgb - [Color4] - Color=$base0D_rgb - [Color4Intense] - Color=$base0D_rgb - [Color5] - Color=$base0E_rgb - [Color5Intense] - Color=$base0E_rgb - [Color6] - Color=$base0C_rgb - [Color6Intense] - Color=$base0C_rgb - [Color7] - Color=$base05_rgb - [Color7Intense] - Color=$base07_rgb - [Foreground] - Color=$base05_rgb - [ForegroundIntense] - Color=$base07_rgb - [General] - Description=Stylix - Wallpaper= - " > $scheme - - echo " - [Appearance] - ColorScheme=Stylix - " > $profile - fi - + ${pkgs.mustache2konsole}/bin/mustache2konsole $HOME/.config/stylix/palette.json > $HOME/.local/share/konsole/Stylix.colorscheme ''; }