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: { lib, pkgs, config, inputs, ... } @args:
let
cfg = config.nixfiles.programs.comma;
in
{ {
imports = [ imports = [
inputs.nix-index-database.hmModules.nix-index 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 comma
]; ];
};
} }

View File

@ -1,12 +1,22 @@
{ lib, pkgs, osConfig, ... }: { lib, pkgs, config, osConfig, ... }:
let
cfg = config.nixfiles.profile.base;
in
{ {
imports = [ # imports = [
./comma.nix # ./comma.nix
]; # ];
# home.username = "nullbite"; # home.username = "nullbite";
# home.homeDirectory = "/home/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; [ home.packages = with pkgs; [
btop btop
]; ];
};
} }

View File

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

View File

@ -1,5 +1,6 @@
{ lib, pkgs, osConfig, outputs, ... }@args: { lib, pkgs, config, osConfig ? {}, outputs, ... }@args:
let let
cfg = config.nixfiles.sessions.hyprland;
mkd = lib.mkDefault; mkd = lib.mkDefault;
terminal = "${pkgs.kitty}/bin/kitty"; terminal = "${pkgs.kitty}/bin/kitty";
files = "${pkgs.dolphin}/bin/dolphin"; 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 # FIXME this is temporary just to get it working, need to make wm-common an
# option first # option first
imports = [ # imports = [
./wm-common.nix # ./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; [ home.packages = with pkgs; [
kitty kitty
dolphin dolphin
@ -240,4 +253,5 @@ in
]; ];
}; };
}; };
};
} }

View File

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