From ec2fd24e8ec5dbfe6ca62369e93fc8852199702c Mon Sep 17 00:00:00 2001 From: Ivy Pierlot Date: Mon, 8 Sep 2025 10:31:11 +1000 Subject: [PATCH 1/3] stylix/darwin: add module adds a module for wallpaper and colours for darwin --- modules/darwin/desktoppr.nix | 37 ++++++++++++++++++++++++++ modules/darwin/hm.nix | 50 ++++++++++++++++++++++++++++++++++++ modules/darwin/meta.nix | 5 ++++ 3 files changed, 92 insertions(+) create mode 100644 modules/darwin/desktoppr.nix create mode 100644 modules/darwin/hm.nix create mode 100644 modules/darwin/meta.nix diff --git a/modules/darwin/desktoppr.nix b/modules/darwin/desktoppr.nix new file mode 100644 index 000000000..977567f7a --- /dev/null +++ b/modules/darwin/desktoppr.nix @@ -0,0 +1,37 @@ +{ + stdenv, + fetchurl, + lib, + unzip, +}: +stdenv.mkDerivation { + name = "hln"; + version = "0.5-218"; + pname = "hln"; + src = fetchurl { + url = "https://github.com/scriptingosx/desktoppr/releases/download/v0.5/desktoppr-0.5-218.zip"; + hash = "sha256-Oa9gAQjOaJHYyT5JBUiFCxL1sQP1dqlFBm+GdmLHNNM="; + }; + + buildInputs = [ + unzip + ]; + + unpackPhase = '' + runHook preUnpack + + unzip $src + + runHook postUnpack + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out/bin + cp -r desktoppr $out/bin + + runHook postInstall + ''; + +} diff --git a/modules/darwin/hm.nix b/modules/darwin/hm.nix new file mode 100644 index 000000000..1ba947cb6 --- /dev/null +++ b/modules/darwin/hm.nix @@ -0,0 +1,50 @@ +{ mkTarget }: + +mkTarget { + name = "darwin"; + humanName = "Darwin"; + extraOptions = + { + image, + pkgs, + }: + { + home.activation = { + stylixBackground = '' + run ${pkgs.callPackage ./desktoppr.nix { }}/bin/desktoppr all ${image} + + ''; + }; + }; + + configElements = [ + + ( + { + colors, + lib, + pkgs, + }: + let + value = pkgs.runCommand "color" { } '' + + full=$((16#${colors.base00})) + red=$((($full >> 16) & 0xff)) + red=$(echo "scale=10; $red.0 / 255.0 " | bc |awk '{printf "%f", $0}') + green=$((($full >> 8) & 0xff)) + green=$(echo "scale=10; $green.0 / 255.0 " | bc | awk '{printf "%f", $0}') + blue=$(($full & 0xff)) + blue=$(echo "scale=10; $blue.0 / 255.0 " | bc | awk '{printf "%f", $0}') + echo "$red $green $blue 1.0" > $out + + ''; + + in + { + + targets.darwin.defaults."Apple Global Domain".AppleIconAppearanceCustomTintColor = value; + } + ) + ]; + +} diff --git a/modules/darwin/meta.nix b/modules/darwin/meta.nix new file mode 100644 index 000000000..1e3957621 --- /dev/null +++ b/modules/darwin/meta.nix @@ -0,0 +1,5 @@ +{ + name = "Darwin"; + homepage = "https://github.com/nix-darwin/nix-darwin"; + maintainers = [ ]; +} From c4242dba40afc6fdaab432cdb3f8312a9fda185c Mon Sep 17 00:00:00 2001 From: Ivy Pierlot Date: Mon, 8 Sep 2025 10:45:54 +1000 Subject: [PATCH 2/3] fixup! stylix/darwin: add module --- modules/darwin/hm.nix | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/darwin/hm.nix b/modules/darwin/hm.nix index 1ba947cb6..025713119 100644 --- a/modules/darwin/hm.nix +++ b/modules/darwin/hm.nix @@ -1,4 +1,10 @@ -{ mkTarget }: +{ + mkTarget, + config, + lib, + pkgs, + ... +}: mkTarget { name = "darwin"; @@ -6,7 +12,6 @@ mkTarget { extraOptions = { image, - pkgs, }: { home.activation = { @@ -22,8 +27,6 @@ mkTarget { ( { colors, - lib, - pkgs, }: let value = pkgs.runCommand "color" { } '' From 38a9ecbe1ae042668335baff4655779af766dda1 Mon Sep 17 00:00:00 2001 From: Ivy Pierlot Date: Wed, 10 Sep 2025 17:00:39 +1000 Subject: [PATCH 3/3] fixup! fixup! stylix/darwin: add module --- modules/darwin/hm.nix | 56 ++++++++++++------------ {modules => stylix}/darwin/desktoppr.nix | 4 +- 2 files changed, 30 insertions(+), 30 deletions(-) rename {modules => stylix}/darwin/desktoppr.nix (92%) diff --git a/modules/darwin/hm.nix b/modules/darwin/hm.nix index 025713119..243e83f66 100644 --- a/modules/darwin/hm.nix +++ b/modules/darwin/hm.nix @@ -9,43 +9,43 @@ mkTarget { name = "darwin"; humanName = "Darwin"; - extraOptions = - { - image, - }: - { - home.activation = { - stylixBackground = '' - run ${pkgs.callPackage ./desktoppr.nix { }}/bin/desktoppr all ${image} - - ''; - }; - }; configElements = [ - + ( + { + image, + pkgs, + }: + { + home.activation = { + stylixBackground = '' + run ${pkgs.callPackage ../../stylix/darwin/desktoppr.nix { }}/bin/desktoppr all ${image} + ''; + }; + } + ) ( { colors, }: - let - value = pkgs.runCommand "color" { } '' - - full=$((16#${colors.base00})) - red=$((($full >> 16) & 0xff)) - red=$(echo "scale=10; $red.0 / 255.0 " | bc |awk '{printf "%f", $0}') - green=$((($full >> 8) & 0xff)) - green=$(echo "scale=10; $green.0 / 255.0 " | bc | awk '{printf "%f", $0}') - blue=$(($full & 0xff)) - blue=$(echo "scale=10; $blue.0 / 255.0 " | bc | awk '{printf "%f", $0}') - echo "$red $green $blue 1.0" > $out - - ''; - in { - targets.darwin.defaults."Apple Global Domain".AppleIconAppearanceCustomTintColor = value; + targets.darwin.defaults."Apple Global Domain" = { + AppleIconAppearanceCustomTintColor = builtins.readFile "${ + pkgs.runCommand "color" { } '' + full=$((16#${colors.base00})) + red=$((($full >> 16) & 0xff)) + red=$(echo "scale=10; $red.0 / 255.0 " | bc |awk '{printf "%f", $0}') + green=$((($full >> 8) & 0xff)) + green=$(echo "scale=10; $green.0 / 255.0 " | bc | awk '{printf "%f", $0}') + blue=$(($full & 0xff)) + blue=$(echo "scale=10; $blue.0 / 255.0 " | bc | awk '{printf "%f", $0}') + echo "$red $green $blue 1.0" > $out + '' + + }"; + }; } ) ]; diff --git a/modules/darwin/desktoppr.nix b/stylix/darwin/desktoppr.nix similarity index 92% rename from modules/darwin/desktoppr.nix rename to stylix/darwin/desktoppr.nix index 977567f7a..8319a5c4b 100644 --- a/modules/darwin/desktoppr.nix +++ b/stylix/darwin/desktoppr.nix @@ -5,9 +5,9 @@ unzip, }: stdenv.mkDerivation { - name = "hln"; + name = "desktoppr"; version = "0.5-218"; - pname = "hln"; + pname = "desktoppr"; src = fetchurl { url = "https://github.com/scriptingosx/desktoppr/releases/download/v0.5/desktoppr-0.5-218.zip"; hash = "sha256-Oa9gAQjOaJHYyT5JBUiFCxL1sQP1dqlFBm+GdmLHNNM=";