47 lines
		
	
	
	
		
			2.4 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
	
		
			2.4 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
# Credit to github:misterio77/nix-colors
 | 
						|
{
 | 
						|
  pkgs,
 | 
						|
  config,
 | 
						|
  hozen,
 | 
						|
}: let
 | 
						|
  inherit (config.ooknet.hardware) monitors;
 | 
						|
  inherit (hozen) color;
 | 
						|
  largest = f: xs: builtins.head (builtins.sort (a: b: a > b) (map f xs));
 | 
						|
  largestWidth = largest (x: x.width) monitors;
 | 
						|
  largestHeight = largest (x: x.height) monitors;
 | 
						|
in
 | 
						|
  {
 | 
						|
    width ? largestWidth,
 | 
						|
    height ? largestHeight,
 | 
						|
    logoScale ? 4,
 | 
						|
    backgroundColor ? color.layout.body,
 | 
						|
    logoColor1 ? color.green.base,
 | 
						|
    logoColor2 ? color.yellow.base,
 | 
						|
  }:
 | 
						|
    pkgs.stdenv.mkDerivation {
 | 
						|
      name = "generated-nix-wallpaper-${color.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 = [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";
 | 
						|
    }
 |