Skip to content

Commit c68a508

Browse files
authored
Merge pull request #123 from samueldr/feature/build-logos
logo: Provide an easy path to optimized SVGs and exported PNGs
2 parents c1ab3b0 + 6757528 commit c68a508

File tree

4 files changed

+51
-0
lines changed

4 files changed

+51
-0
lines changed

default.nix

+1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@
2828
makeFlags = [ "prefix=$(out)" ];
2929
}
3030
) {};
31+
logo = pkgs.callPackage ./logo/package.nix {};
3132
}

logo/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@ white, keeping the spacing exact.
5656
This variant is monochrome, with the shadow gradients baked-in as opacity
5757
changes.
5858

59+
### Optimized version
60+
61+
The SVG files in this directory are the authoring files.
62+
63+
In other words, they are busy with inkscape-specific properties, used when
64+
editing the files.
65+
66+
If what is needed is a file optimized for size, and for using as an asset,
67+
the Nix expression in this directory can be used to produce optimized SVGs.
68+
69+
5970
License
6071
-------
6172

logo/default.nix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(import ../. {}).logo

logo/package.nix

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{ runCommand
2+
, lib
3+
, inkscape
4+
, nodePackages
5+
}:
6+
7+
runCommand "nixos-artwork-logos" {
8+
logos = [
9+
# The snowflake-only variants
10+
"nix-snowflake-colours"
11+
"nix-snowflake-white"
12+
13+
# The horizontal variants
14+
"nixos"
15+
"nixos-white"
16+
17+
# The vertical variant
18+
"nixos-text-below"
19+
];
20+
src = lib.cleanSource ./.;
21+
nativeBuildInputs = [
22+
inkscape
23+
nodePackages.svgo
24+
];
25+
} ''
26+
PS4=" $ "
27+
for f in $logos; do
28+
mkdir -p $out
29+
printf ":: ⇒ %s\n" "$f"
30+
(set -x
31+
inkscape --export-background-opacity=0 --export-plain-svg --export-filename=$out/$f.svg "$src/$f.svg"
32+
inkscape --export-background-opacity=0 --export-filename=$out/$f.png "$src/$f.svg"
33+
)
34+
done
35+
(set -x
36+
svgo --pretty --multipass --folder "$out"
37+
)
38+
''

0 commit comments

Comments
 (0)