refactor(home-manager modules): moved home-manager module: fonts, monitors, wallpapaer to home/modules/config
This commit is contained in:
parent
3337488840
commit
902f5b5f0f
8 changed files with 9 additions and 8 deletions
7
home/modules/config/default.nix
Normal file
7
home/modules/config/default.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
imports = [
|
||||
./fonts
|
||||
./monitors
|
||||
./wallpaper
|
||||
];
|
||||
}
|
||||
32
home/modules/config/fonts/default.nix
Normal file
32
home/modules/config/fonts/default.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{ 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 ];
|
||||
};
|
||||
}
|
||||
62
home/modules/config/monitors/default.nix
Normal file
62
home/modules/config/monitors/default.nix
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
{ 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.";
|
||||
}];
|
||||
};
|
||||
}
|
||||
12
home/modules/config/wallpaper/default.nix
Normal file
12
home/modules/config/wallpaper/default.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{ lib, ... }:
|
||||
let inherit (lib) types mkOption;
|
||||
in
|
||||
{
|
||||
options.wallpaper = mkOption {
|
||||
type = types.path;
|
||||
default = "";
|
||||
description = ''
|
||||
Wallpaper path
|
||||
'';
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue