feat(nixos:appearance): move appearance options to nixos
This commit is contained in:
parent
cedeb52103
commit
ceb66c03cf
51 changed files with 393 additions and 377 deletions
|
|
@ -5,5 +5,6 @@
|
|||
./host
|
||||
./programs
|
||||
./services
|
||||
./theme
|
||||
];
|
||||
}
|
||||
|
|
|
|||
5
nixos/modules/theme/default.nix
Normal file
5
nixos/modules/theme/default.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
imports = [
|
||||
./minimal.nix
|
||||
];
|
||||
}
|
||||
49
nixos/modules/theme/generatedWallpaper.nix
Normal file
49
nixos/modules/theme/generatedWallpaper.nix
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
}: let
|
||||
inherit (config.ooknet.host.hardware) monitors;
|
||||
inherit (config.ooknet.appearance) colorscheme;
|
||||
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 ? colorscheme.palette.mantle,
|
||||
logoColor1 ? colorscheme.palette.yellow,
|
||||
logoColor2 ? colorscheme.palette.green,
|
||||
}:
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "generated-nix-wallpaper-${colorscheme.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";
|
||||
}
|
||||
41
nixos/modules/theme/minimal.nix
Normal file
41
nixos/modules/theme/minimal.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf;
|
||||
inherit (config.ooknet.appearance) theme;
|
||||
|
||||
generatedWallpaper = import ./generatedWallpaper.nix {inherit config pkgs;} {};
|
||||
in {
|
||||
config = mkIf (theme == "minimal") {
|
||||
ooknet.appearance = {
|
||||
fonts = {
|
||||
monospace = {
|
||||
family = "JetBrainsMono Nerd Font";
|
||||
package = pkgs.nerdfonts.override {fonts = ["JetBrainsMono"];};
|
||||
};
|
||||
regular = {
|
||||
family = "Fira Sans";
|
||||
package = pkgs.fira;
|
||||
};
|
||||
};
|
||||
|
||||
cursor = {
|
||||
name = "Bibata-Modern-Ice";
|
||||
package = pkgs.bibata-cursors;
|
||||
size = 22;
|
||||
};
|
||||
|
||||
wallpaper = {
|
||||
path = "${generatedWallpaper}";
|
||||
};
|
||||
|
||||
colorscheme = {
|
||||
name = "hozen";
|
||||
variant = "dark";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
30
nixos/options/appearance/colors.nix
Normal file
30
nixos/options/appearance/colors.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkOption;
|
||||
inherit (lib.types) str enum attrsOf;
|
||||
|
||||
cfg = config.ooknet.colorscheme;
|
||||
in {
|
||||
# simple colorscheme module bases on misterio77/nix-colors
|
||||
options.ooknet.colorscheme = {
|
||||
name = mkOption {
|
||||
type = enum ["hozen"];
|
||||
default = "hozen";
|
||||
};
|
||||
variant = mkOption {
|
||||
type = enum ["dark" "light"];
|
||||
default = "dark";
|
||||
};
|
||||
slug = mkOption {
|
||||
type = str;
|
||||
default = "${toString cfg.name-cfg.variant}";
|
||||
};
|
||||
palette = {
|
||||
type = attrsOf str;
|
||||
default = (import ./palettes/${cfg.slug}.nix).colorscheme.palette;
|
||||
};
|
||||
};
|
||||
}
|
||||
77
nixos/options/appearance/default.nix
Normal file
77
nixos/options/appearance/default.nix
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) isString hasPrefix removePrefix mkOption mkOptionType;
|
||||
inherit (lib.types) enum str nullOr package path int attrsOf coercedTo;
|
||||
hexColorType = mkOptionType {
|
||||
name = "hex-color";
|
||||
descriptionClass = "noun";
|
||||
description = "RGB color in hex format";
|
||||
check = x: isString x && !(hasPrefix "#" x);
|
||||
};
|
||||
|
||||
mkFontOption = {
|
||||
family = mkOption {
|
||||
type = str;
|
||||
default = "";
|
||||
};
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
|
||||
cfg = config.ooknet.appearance;
|
||||
in {
|
||||
imports = [./palettes];
|
||||
options.ooknet.appearance = {
|
||||
theme = mkOption {
|
||||
type = nullOr (enum ["minimal" "phone"]);
|
||||
default = null;
|
||||
};
|
||||
fonts = {
|
||||
monospace = mkFontOption;
|
||||
regular = mkFontOption;
|
||||
};
|
||||
wallpaper = {
|
||||
path = mkOption {
|
||||
type = path;
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
cursor = {
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = null;
|
||||
};
|
||||
name = mkOption {
|
||||
type = str;
|
||||
default = "";
|
||||
};
|
||||
size = mkOption {
|
||||
type = int;
|
||||
default = 22;
|
||||
};
|
||||
};
|
||||
colorscheme = {
|
||||
name = mkOption {
|
||||
type = enum ["hozen"];
|
||||
default = "hozen";
|
||||
};
|
||||
variant = mkOption {
|
||||
type = enum ["dark" "light"];
|
||||
default = "dark";
|
||||
};
|
||||
slug = mkOption {
|
||||
type = str;
|
||||
default = "${toString cfg.colorscheme.name}-${toString cfg.colorscheme.variant}";
|
||||
};
|
||||
palette = mkOption {
|
||||
type = attrsOf (coercedTo str (removePrefix "#") hexColorType);
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
3
nixos/options/appearance/palettes/default.nix
Normal file
3
nixos/options/appearance/palettes/default.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
imports = [./hozen-dark.nix];
|
||||
}
|
||||
57
nixos/options/appearance/palettes/hozen-dark.nix
Normal file
57
nixos/options/appearance/palettes/hozen-dark.nix
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
cfg = config.ooknet.appearance.colorscheme;
|
||||
inherit (lib) mkIf;
|
||||
in {
|
||||
ooknet.appearance.colorscheme = mkIf (cfg.name == "hozen" && cfg.variant == "dark") {
|
||||
palette = {
|
||||
crust = "2b2927";
|
||||
mantle = "33312e";
|
||||
base = "3f3b37";
|
||||
surface-0 = "48423c";
|
||||
surface-1 = "534d46";
|
||||
surface-2 = "655c53";
|
||||
overlay-0 = "766b60";
|
||||
overlay-1 = "9c8c7c";
|
||||
overlay-2 = "ac9a86";
|
||||
subtext-0 = "bfaa92";
|
||||
subtext-1 = "c9b39c";
|
||||
text = "d2bda7";
|
||||
red = "cc6666";
|
||||
dull-red = "b87a7a";
|
||||
orange = "cc8566";
|
||||
dull-orange = "b88d7a";
|
||||
yellow = "ccad66";
|
||||
dull-yellow = "ada185";
|
||||
green = "a0cc66";
|
||||
dull-green = "9db87a";
|
||||
cyan = "85ad98";
|
||||
dull-cyan = "92a099";
|
||||
blue = "7A9EBB";
|
||||
dull-blue = "8a94a8";
|
||||
purple = "8166cc";
|
||||
dull-purple = "998aa8";
|
||||
|
||||
base00 = "2b2927";
|
||||
base01 = "33312e";
|
||||
base02 = "48423c";
|
||||
base03 = "534d46";
|
||||
base04 = "655c53";
|
||||
base05 = "c9B39C";
|
||||
base06 = "deccba";
|
||||
base07 = "e7d9cb";
|
||||
|
||||
base08 = "CC6666"; #red
|
||||
base09 = "C28970"; #orange
|
||||
base0A = "C2A970"; #yellow
|
||||
base0B = "ACC270"; #green
|
||||
base0C = "70C296"; #cyan
|
||||
base0D = "7A9EB8"; #blue
|
||||
base0E = "C982B0"; #purple
|
||||
base0F = "B88D7A"; #dim-orange
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./appearance
|
||||
./gaming.nix
|
||||
./host.nix
|
||||
./programs.nix
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
in {
|
||||
config = mkIf (host.type == "desktop" && host.role == "workstation") {
|
||||
ooknet = {
|
||||
appearance.theme = "minimal";
|
||||
services = {
|
||||
gnomeServices.enable = true;
|
||||
gvfs.enable = true;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
in {
|
||||
config = mkIf (host.type == "laptop" && host.role == "workstation") {
|
||||
ooknet = {
|
||||
appearance.theme = "minimal";
|
||||
services = {
|
||||
gnomeServices.enable = true;
|
||||
gvfs.enable = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue