diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 45aae31..2c04a15 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -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; } diff --git a/modules/home-manager/fonts.nix b/modules/home-manager/fonts.nix new file mode 100644 index 0000000..db9e088 --- /dev/null +++ b/modules/home-manager/fonts.nix @@ -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]; + }; +} diff --git a/modules/home-manager/monitors.nix b/modules/home-manager/monitors.nix new file mode 100644 index 0000000..96c1c85 --- /dev/null +++ b/modules/home-manager/monitors.nix @@ -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."; + } + ]; + }; +} diff --git a/modules/home-manager/wallpaper.nix b/modules/home-manager/wallpaper.nix new file mode 100644 index 0000000..6ca48e0 --- /dev/null +++ b/modules/home-manager/wallpaper.nix @@ -0,0 +1,11 @@ +{lib, ...}: let + inherit (lib) types mkOption; +in { + options.wallpaper = mkOption { + type = types.path; + default = ""; + description = '' + Wallpaper path + ''; + }; +}