Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions modules/darwin/hm.nix
Original file line number Diff line number Diff line change
@@ -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
''
Comment on lines +36 to +45
Copy link
Member

@trueNAHO trueNAHO Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to natively implement this in Nix. Also, take a look at existing Stylix modules, to find something similar as inspiration.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like in colors.nix module that was recently merged for mkHexOpacityColor and mkHexColor


}";
};
}
)
];

}
5 changes: 5 additions & 0 deletions modules/darwin/meta.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
name = "Darwin";
homepage = "https://github.com/nix-darwin/nix-darwin";
maintainers = [ ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stylix/doc/src/modules.md

Lines 228 to 264 in 0ce0103

### Maintainers
New modules must have at least one maintainer.
If you are not already listed in the Nixpkgs `/maintainers/maintainer-list.nix`
maintainer list, add yourself to `/stylix/maintainers.nix`.
Add yourself as a maintainer in one of the following ways, depending on the
number of maintainers:
- ```nix
{ lib, ... }:
{
maintainers = [ lib.maintainers.danth ];
}
```
- ```nix
{ lib, ... }:
{
maintainers = with lib.maintainers; [
awwpotato
danth
naho
];
}
```
The main responsibility of module maintainers is to update and fix their
modules.
> [!NOTE]
> If this is the first time you're adding yourself as a maintainer in Stylix,
> the `/generated/all-maintainers.nix` file will need to be updated by running
> `nix run .#all-maintainers`
> ([pre-commit](./development_environment.md#pre-commit) will also automatically
> regenerate it).

}
37 changes: 37 additions & 0 deletions stylix/darwin/desktoppr.nix
Original file line number Diff line number Diff line change
@@ -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
'';

}
Comment on lines +1 to +37
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pr might be worth mentioning NixOS/nixpkgs#397284

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pr might be worth mentioning NixOS/nixpkgs#397284

Thanks for pointing that out. I suggest using the Nixpkgs module (after updating our Nixpkgs input) once it has been merged.

Loading