-
-
Notifications
You must be signed in to change notification settings - Fork 264
stylix/darwin: add module #1892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
''; | ||
|
||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,53 @@ | ||||||||||||||
{ | ||||||||||||||
mkTarget, | ||||||||||||||
config, | ||||||||||||||
lib, | ||||||||||||||
pkgs, | ||||||||||||||
... | ||||||||||||||
}: | ||||||||||||||
|
||||||||||||||
mkTarget { | ||||||||||||||
name = "darwin"; | ||||||||||||||
humanName = "Darwin"; | ||||||||||||||
extraOptions = | ||||||||||||||
{ | ||||||||||||||
image, | ||||||||||||||
}: | ||||||||||||||
{ | ||||||||||||||
home.activation = { | ||||||||||||||
stylixBackground = '' | ||||||||||||||
run ${pkgs.callPackage ./desktoppr.nix { }}/bin/desktoppr all ${image} | ||||||||||||||
|
||||||||||||||
''; | ||||||||||||||
}; | ||||||||||||||
}; | ||||||||||||||
|
||||||||||||||
configElements = [ | ||||||||||||||
|
||||||||||||||
( | ||||||||||||||
{ | ||||||||||||||
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}') | ||||||||||||||
|
full=$((16#${colors.base00})) | |
red=$((($full >> 16) & 0xff)) | |
red=$(echo "scale=10; $red.0 / 255.0 " | bc |awk '{printf "%f", $0}') | |
full=$((16#${colors.base00})) | |
red=$((($full >> 16) & 0xff)) | |
red=$(echo "scale=10; $red.0 / 255.0 " | bc |awk '{printf "%f", $0}') |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why you would bind the color
package to value
in a let block, but then only use it once.
Why not just bind it directly here in the config definition? I.e. inline value
.
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 = [ ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lines 228 to 264 in 0ce0103
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extraOptions
is for declaring options. You haven't usedlib.mkOption
or any of its wrappers, so this looks a lot more like a config definition that should go inconfigElements
.The reason
pkgs.callPackage
doesn't exist when declaring options is to ensure it is not accidentally used in option docs (i.e. option examples, defaultText, etc). See #1212Could you clarify what you're trying to achieve here?
You may find Writing NixOS Modules helpful, in particular the distinction between declaring and defining options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm familiar with the distinction and have written many modules, i was just very unsure how this mkStylixModule system works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understandable. Too many layers of abstraction can make it difficult to understand what things actually do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you already take a look at
stylix/doc/src/modules.md
Lines 42 to 115 in 0ce0103
Yes, the
mkTarget
documentation is currently too technical and the implementation is too complex to quickly understand. Once themkTarget
behavior has further solidified after merging #1721, improving the documentation is planned. Note that the currently pending commit 300f48d ("stylix/mk-target: polish implementation and improve error reporting") from #1721 attempts to improve and drastically simplify the implementation.Aside from the
mkTarget
documentation, take a look at existingmkTarget
examples in/modules/<MODULE>/
.