refactor(home-manager modules): moved home-manager module: fonts, monitors, wallpapaer to home/modules/config

This commit is contained in:
ooks-io 2024-02-26 17:23:07 +13:00
parent 3337488840
commit 902f5b5f0f
8 changed files with 9 additions and 8 deletions

View file

@ -1,5 +0,0 @@
{
fonts = import ./fonts.nix;
monitors = import ./monitors.nix;
wallpaper = import ./wallpaper.nix;
}

View file

@ -1,32 +0,0 @@
{ lib, config, ... }:
let
mkFontOption = kind: {
family = lib.mkOption {
type = lib.types.str;
default = null;
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.fontProfiles;
in
{
options.fontProfiles = {
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 ];
};
}

View file

@ -1,62 +0,0 @@
{ lib, config, ... }:
let
inherit (lib) mkOption types;
cfg = config.monitors;
in
{
options.monitors = mkOption {
type = types.listOf (types.submodule {
options = {
name = mkOption {
type = types.str;
example = "DP-1";
};
primary = mkOption {
type = types.bool;
default = false;
};
width = mkOption {
type = types.int;
example = 1920;
};
height = mkOption {
type = types.int;
example = 1080;
};
refreshRate = mkOption {
type = types.int;
default = 60;
};
x = mkOption {
type = types.int;
default = 0;
};
y = mkOption {
type = types.int;
default = 0;
};
transform = mkOption {
type = types.int;
default = 0;
};
enabled = mkOption {
type = types.bool;
default = true;
};
workspace = mkOption {
type = types.nullOr types.str;
default = null;
};
};
});
default = [ ];
};
config = {
assertions = [{
assertion = ((lib.length config.monitors) != 0) ->
((lib.length (lib.filter (m: m.primary) config.monitors)) == 1);
message = "Exactly one monitor must be set to primary.";
}];
};
}

View file

@ -1,12 +0,0 @@
{ lib, ... }:
let inherit (lib) types mkOption;
in
{
options.wallpaper = mkOption {
type = types.path;
default = "";
description = ''
Wallpaper path
'';
};
}