refactor: inputs/ --> {sys,home}/

This commit is contained in:
ooks-io 2024-05-26 14:57:35 +12:00
parent 8f22a24963
commit f77c627980
225 changed files with 77 additions and 88 deletions

View file

@ -0,0 +1,38 @@
{ lib, config, ... }:
let
cfg = config.homeModules.theme.cursor;
in
{
options.homeModules.theme.cursor = {
enable = lib.mkEnableOption "Enable cursor module";
package = lib.mkOption {
type = lib.types.package;
default = null;
description = "Package for cursor";
example = "pkgs.bibata-cursors";
};
name = lib.mkOption {
type = lib.types.str;
default = "";
description = "Name of cursor";
example = "Bibata-Modern-Ice";
};
size = lib.mkOption {
type = lib.types.int;
default = 22;
description = "Size of cursor";
example = "22";
};
};
config = lib.mkIf cfg.enable {
home.pointerCursor = {
package = cfg.package;
name = cfg.name;
size = cfg.size;
gtk.enable = true;
x11.enable = true;
};
};
}

View file

@ -0,0 +1,9 @@
{
imports = [
./fonts
./cursor
./gtk
./qt
./wallpaper
];
}

View file

@ -0,0 +1,40 @@
{ lib, config, pkgs, ... }:
let
mkFontOption = kind: {
family = lib.mkOption {
type = lib.types.str;
default = "";
description = "Family name for ${kind} font profile";
example = "Fira Code";
};
package = lib.mkOption {
type = lib.types.package;
default = null;
description = "Package for ${kind} font profile";
example = "pkgs.fira-code";
};
};
cfg = config.homeModules.theme.fonts;
in
{
options.homeModules.theme.fonts = {
enable = lib.mkEnableOption "Whether to enable font profiles";
monospace = mkFontOption "monospace";
regular = mkFontOption "regular";
};
config = lib.mkIf cfg.enable {
fonts.fontconfig.enable = true;
home.packages = [
cfg.monospace.package
cfg.regular.package
pkgs.noto-fonts
pkgs.noto-fonts-cjk
pkgs.noto-fonts-emoji
];
};
}

View file

@ -0,0 +1,39 @@
{ config, pkgs, inputs, lib, ... }:
let
inherit (inputs.nix-colors.lib-contrib { inherit pkgs; }) gtkThemeFromScheme;
cfg = config.homeModules.theme.gtk;
in
{
options.homeModules.theme.gtk = {
enable = lib.mkEnableOption "Enable gtk theme module";
# TODO: add theme option
};
config = lib.mkIf cfg.enable (rec {
gtk = {
enable = true;
font = {
name = config.homeModules.theme.fonts.regular.family;
size = 12;
};
theme = {
name = config.colorscheme.slug;
package = gtkThemeFromScheme { scheme = config.colorscheme; };
};
iconTheme = {
name = "Papirus-Dark";
package = pkgs.papirus-icon-theme;
};
};
services.xsettingsd = {
enable = true;
settings = {
"Net/ThemeName" = gtk.theme.name;
"Net/IconThemeName" = gtk.iconTheme.name;
};
};
});
}

View file

@ -0,0 +1,15 @@
{ config, lib, ... }:
let
cfg = config.homeModules.theme.qt;
in
{
options.homeModules.theme.qt.enable = lib.mkEnableOption "Enable qt module";
config = lib.mkIf cfg.enable {
qt = {
enable = true;
platformTheme.name = "gtk";
};
};
}

View file

@ -0,0 +1,34 @@
{ lib, config, inputs, pkgs, ... }:
let
inherit (inputs.nix-colors.lib-contrib { inherit pkgs; }) nixWallpaperFromScheme;
inherit (lib) types mkDefault mkIf mkOption mkEnableOption;
cfg = config.homeModules.theme.wallpaper;
in
{
options.homeModules.theme.wallpaper = {
enable = mkEnableOption "Enable wallpaper module";
path = mkOption {
type = types.path;
default = null;
description = "Wallpaper Path";
};
};
config = mkIf cfg.enable {
homeModules.theme.wallpaper.path =
let
largest = f: xs: builtins.head (builtins.sort (a: b: a > b) (map f xs));
largestWidth = largest (x: x.width) config.monitors;
largestHeight = largest (x: x.height) config.monitors;
in
mkDefault (nixWallpaperFromScheme
{
scheme = config.colorscheme;
width = largestWidth;
height = largestHeight;
logoScale = 4;
});
};
}