Convert home-manager modules to options

This commit is contained in:
NullBite 2024-02-09 07:56:12 +01:00
parent 1044a3f92f
commit 787b5855b1
Signed by: nullbite
GPG Key ID: 6C4D545385D4925A
5 changed files with 255 additions and 210 deletions

View File

@ -1,10 +1,20 @@
{ lib, pkgs, config, inputs, ... } @args:
let
cfg = config.nixfiles.programs.comma;
in
{
imports = [
inputs.nix-index-database.hmModules.nix-index
];
home.packages = with pkgs; [
options.nixfiles.programs.comma = {
enable = lib.mkEnableOption "comma";
};
config = {
programs.nix-index.symlinkToCacheHome = lib.mkDefault cfg.enable;
home.packages = with pkgs; lib.optionals cfg.enable [
comma
];
};
}

View File

@ -1,12 +1,22 @@
{ lib, pkgs, osConfig, ... }:
{ lib, pkgs, config, osConfig, ... }:
let
cfg = config.nixfiles.profile.base;
in
{
imports = [
./comma.nix
];
# imports = [
# ./comma.nix
# ];
# home.username = "nullbite";
# home.homeDirectory = "/home/nullbite";
options.nixfiles.profile.base = {
enable = lib.mkEnableOption "base profile";
};
config = lib.mkIf cfg.enable {
nixfiles.programs.comma.enable = true;
home.packages = with pkgs; [
btop
];
};
}

View File

@ -5,6 +5,11 @@ let
in
{
imports = [
./common
./package-sets
./profile
./programs
./sessions
];
config = {};
options.nixfiles = {

View File

@ -1,5 +1,6 @@
{ lib, pkgs, osConfig, outputs, ... }@args:
{ lib, pkgs, config, osConfig ? {}, outputs, ... }@args:
let
cfg = config.nixfiles.sessions.hyprland;
mkd = lib.mkDefault;
terminal = "${pkgs.kitty}/bin/kitty";
files = "${pkgs.dolphin}/bin/dolphin";
@ -24,9 +25,21 @@ in
{
# FIXME this is temporary just to get it working, need to make wm-common an
# option first
imports = [
./wm-common.nix
];
# imports = [
# ./wm-common.nix
# ];
options.nixfiles.sessions.hyprland = {
enable = lib.mkOption {
type = lib.types.bool;
default = if (builtins.hasAttr "home-manager" osConfig) then osConfig.nixfiles.sessions.hyprland.enable else false;
example = true;
description = "Whether to enable hyprland.";
};
};
config = lib.mkIf cfg.enable {
nixfiles.common.wm.enable = true;
home.packages = with pkgs; [
kitty
dolphin
@ -240,4 +253,5 @@ in
];
};
};
};
}

View File

@ -1,8 +1,13 @@
{ pkgs, lib, config, osConfig, options, ...}:
let
cfg = config.nixfiles.common.wm;
inherit (lib) mkDefault;
in
{
options.nixfiles.common.wm = {
enable = lib.mkEnableOption "common window manager config";
};
config = lib.mkIf cfg.enable {
# Common options for standalone window managers; many of these (or
# alternatives thereof) are pulled in by desktop environments.
services = {
@ -11,4 +16,5 @@ in
automount = mkDefault false;
};
};
};
}