Skip to content
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

stylix: adding option for other wallpapers and improvements (DRAFT) #508

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion stylix/darwin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let
autoload = import ../autoload.nix { inherit lib; } "darwin";
in {
imports = [
../pixel.nix
../nix-wallpaper.nix
../target.nix
../opacity.nix
./fonts.nix
Expand Down
41 changes: 41 additions & 0 deletions stylix/flake-wallpaper.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{ pkgs, config, ... }:
{ width
, height
, logoScale
, backgroundColor ? config.lib.stylix.colors.withHashtag.base01
, logoColor1 ? config.lib.stylix.colors.withHashtag.base0C
, logoColor2 ? config.lib.stylix.colors.withHashtag.base0D
}:
pkgs.stdenv.mkDerivation {
name = "generated-nix-wallpaper-${config.lib.stylix.colors.slug}.png";
src = pkgs.writeTextFile {
name = "template.svg";
text = ''
<svg width="${toString width}" height="${
toString height
}" version="1.1" xmlns="http://www.w3.org/2000/svg">
<rect width="${toString width}" height="${
toString height
}" fill="${backgroundColor}"/>
<svg x="${toString (width / 2 - (logoScale * 50))}" y="${
toString (height / 2 - (logoScale * 50))
}" version="1.1" xmlns="http://www.w3.org/2000/svg">
<g transform="scale(${toString logoScale})">
<g transform="matrix(.19936 0 0 .19936 80.161 27.828)">
<path d="m-53.275 105.84-122.2-211.68 56.157-0.5268 32.624 56.869 32.856-56.565 27.902 0.011 14.291 24.69-46.81 80.49 33.229 57.826zm-142.26 92.748 244.42 0.012-27.622 48.897-65.562-0.1813 32.559 56.737-13.961 24.158-28.528 0.031-46.301-80.784-66.693-0.1359zm-9.3752-169.2-122.22 211.67-28.535-48.37 32.938-56.688-65.415-0.1717-13.942-24.169 14.237-24.721 93.111 0.2937 33.464-57.69z" fill="${logoColor1}"/>
<path d="m-97.659 193.01 122.22-211.67 28.535 48.37-32.938 56.688 65.415 0.1716 13.941 24.169-14.237 24.721-93.111-0.2937-33.464 57.69zm-9.5985-169.65-244.42-0.012 27.622-48.897 65.562 0.1813-32.559-56.737 13.961-24.158 28.528-0.031 46.301 80.784 66.693 0.1359zm-141.76 93.224 122.2 211.68-56.157 0.5268-32.624-56.869-32.856 56.565-27.902-0.011-14.291-24.69 46.81-80.49-33.229-57.826z" fill="${logoColor2}" style="isolation:auto;mix-blend-mode:normal"/>
</g>
</g>
</svg>
</svg>
'';
};
buildInputs = with pkgs; [ inkscape ];
unpackPhase = "true";
buildPhase = ''
inkscape --export-type="png" $src -w ${toString width} -h ${
toString height
} -o wallpaper.png
'';
installPhase = "install -Dm0644 wallpaper.png $out";
}
2 changes: 1 addition & 1 deletion stylix/hm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let
autoload = import ../autoload.nix { inherit lib; } "hm";
in {
imports = [
../pixel.nix
../nix-wallpaper.nix
../target.nix
../opacity.nix
./cursor.nix
Expand Down
14 changes: 14 additions & 0 deletions stylix/nix-wallpaper.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{ pkgs ? import <nixpkgs> { } }:
rec {
# Takes a scheme, resulting wallpaper height and width, plus logo scale, and ouputs the generated wallpaper path
# Example:
# wallpaper = nixWallpaperFromScheme {
# width = 2560;
# height = 1440;
# logoScale = 5.0;
# };
config.lib.stylix.flake = import ./flake-wallpaper.nix { inherit pkgs; };

config.lib.stylix.pixel = import ./pixel-wallpaper.nix { inherit pkgs; };

}
2 changes: 1 addition & 1 deletion stylix/nixos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let
autoload = import ../autoload.nix { inherit lib; } "nixos";
in {
imports = [
../pixel.nix
../nix-wallpaper.nix
../target.nix
../opacity.nix
./cursor.nix
Expand Down
2 changes: 1 addition & 1 deletion stylix/pixel.nix → stylix/pixel-wallpaper.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{ pkgs, config, ... }:

Check warning on line 1 in stylix/pixel-wallpaper.nix

View workflow job for this annotation

GitHub Actions / Lint

unexpected TOKEN_COLON at 83..139, wanted any of [TOKEN_ASSIGN]

Check warning on line 1 in stylix/pixel-wallpaper.nix

View workflow job for this annotation

GitHub Actions / Lint

unexpected token at 249..252

{
# Generate a PNG image containing a named color
config.lib.stylix.pixel = color:
color:

Check warning on line 5 in stylix/pixel-wallpaper.nix

View workflow job for this annotation

GitHub Actions / Lint

Unexpected TOKEN_COLON at 83..139, wanted any of [TOKEN_ASSIGN]
pkgs.runCommand "${color}-pixel.png" {
color = config.lib.stylix.colors.withHashtag.${color};
} "${pkgs.imagemagick}/bin/convert xc:$color png32:$out";

Check warning on line 8 in stylix/pixel-wallpaper.nix

View workflow job for this annotation

GitHub Actions / Lint

Unexpected token at 249..252
}
Loading