structural-rework #1
4 changed files with 108 additions and 1 deletions
|
@ -2,5 +2,7 @@
|
|||
# These should be stuff you would like to share with others, not your personal configurations.
|
||||
{
|
||||
# List your module files here
|
||||
# my-module = import ./my-module.nix;
|
||||
fonts = import ./fonts.nix;
|
||||
monitors = import ./monitors.nix;
|
||||
wallpaper = import ./wallpaper.nix;
|
||||
}
|
||||
|
|
32
modules/home-manager/fonts.nix
Normal file
32
modules/home-manager/fonts.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
modules/home-manager/monitors.nix
Normal file
62
modules/home-manager/monitors.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;
|
||||
};
|
||||
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.";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
11
modules/home-manager/wallpaper.nix
Normal file
11
modules/home-manager/wallpaper.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib) types mkOption;
|
||||
in {
|
||||
options.wallpaper = mkOption {
|
||||
type = types.path;
|
||||
default = "";
|
||||
description = ''
|
||||
Wallpaper path
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue