diff --git a/modules/darwin/hm.nix b/modules/darwin/hm.nix new file mode 100644 index 000000000..243e83f66 --- /dev/null +++ b/modules/darwin/hm.nix @@ -0,0 +1,53 @@ +{ + mkTarget, + config, + lib, + pkgs, + ... +}: + +mkTarget { + name = "darwin"; + humanName = "Darwin"; + + configElements = [ + ( + { + image, + pkgs, + }: + { + home.activation = { + stylixBackground = '' + run ${pkgs.callPackage ../../stylix/darwin/desktoppr.nix { }}/bin/desktoppr all ${image} + ''; + }; + } + ) + ( + { + colors, + }: + + { + + 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/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 = [ ]; +} diff --git a/stylix/darwin/desktoppr.nix b/stylix/darwin/desktoppr.nix new file mode 100644 index 000000000..8319a5c4b --- /dev/null +++ b/stylix/darwin/desktoppr.nix @@ -0,0 +1,37 @@ +{ + stdenv, + fetchurl, + lib, + unzip, +}: +stdenv.mkDerivation { + name = "desktoppr"; + version = "0.5-218"; + pname = "desktoppr"; + 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 + ''; + +}