refactor browser to program

This commit is contained in:
Tyler Starr 2024-10-24 20:36:57 -07:00
parent 2585388001
commit 9399b584f8
11 changed files with 70 additions and 50 deletions

View File

@ -18,7 +18,7 @@
# Modules # Modules
modules = { modules = {
desktop = { desktop = {
browser.enable = true; enable = true;
gnome.enable = true; gnome.enable = true;
}; };
devel = { devel = {

View File

@ -34,7 +34,7 @@
# Modules # Modules
modules = { modules = {
desktop = { desktop = {
browser.enable = true; enable = true;
gnome.enable = true; gnome.enable = true;
}; };
devel = { devel = {

View File

@ -31,7 +31,7 @@
# Modules # Modules
modules = { modules = {
desktop = { desktop = {
browser.enable = true; enable = true;
gnome.enable = true; gnome.enable = true;
}; };
devel = { devel = {

View File

@ -21,7 +21,7 @@
# Modules # Modules
modules = { modules = {
desktop = { desktop = {
browser.enable = true; enable = true;
gnome.enable = true; gnome.enable = true;
}; };
devel = { devel = {

View File

@ -1,4 +0,0 @@
{ ... }:
{
imports = [ ./chrome.nix ./firefox.nix ];
}

View File

@ -1,7 +1,14 @@
{ config, lib, pkgs, user, inputs, ... }: { config, lib, pkgs, user, inputs, ... }:
{
imports = [ ./browser ./keyd.nix ./gnome.nix ];
let cfg = config.modules.desktop;
in {
imports = [
./keyd.nix
./gnome.nix
];
options.modules.desktop.enable = lib.mkEnableOption "desktop";
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
bc # Arbitrary-precision arithmetic language. bc # Arbitrary-precision arithmetic language.
fzf # Command-line fuzzy finder for Unix-like operating systems. fzf # Command-line fuzzy finder for Unix-like operating systems.
@ -36,4 +43,5 @@
"application/x-extension-xht" = [ "google-chrome.desktop" ]; "application/x-extension-xht" = [ "google-chrome.desktop" ];
"application/pdf" = [ "google-chrome.desktop" ]; }; "application/pdf" = [ "google-chrome.desktop" ]; };
}; };
};
} }

View File

@ -1,9 +1,16 @@
{ config, lib, pkgs, user, ... }: { config, lib, pkgs, user, ... }:
let cfg = config.modules.desktop.browser; let cfg1 = config.modules.desktop;
cfg2 = config.modules.programs.chrome;
in { in {
# Enable option declared in firefox.nix options.modules.programs.chrome = with lib; {
config = lib.mkIf cfg.enable { enable = lib.mkOption {
type = types.bool;
default = true;
};
};
config = lib.mkIf (cfg1.enable && cfg2.enable) {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
google-chrome # Web browser developed by Google. google-chrome # Web browser developed by Google.
]; ];
@ -46,7 +53,7 @@ in {
# Setup bookmarks # Setup bookmarks
"BookmarkBarEnabled" = true; "BookmarkBarEnabled" = true;
"ShowAppsShortcutInBookmarkBar" = false; "ShowAppsShortcutInBookmarkBar" = false;
"ManagedBookmarks" = import ./bookmarks/chrome.nix; "ManagedBookmarks" = import ./bookmarks.nix;
}; };
}; };

View File

@ -1,6 +1,8 @@
{ ... }: { ... }:
{ {
imports = [ imports = [
./chrome
./firefox
./git.nix ./git.nix
./chezmoi.nix ./chezmoi.nix
./kitty.nix ./kitty.nix

View File

@ -1,10 +1,17 @@
{ config, lib, pkgs, user, ... }: { config, lib, pkgs, user, ... }:
let cfg = config.modules.desktop.browser; let cfg1 = config.modules.desktop;
cfg2 = config.modules.programs.firefox;
in { in {
options.modules.desktop.browser.enable = lib.mkEnableOption "browser"; options.modules.programs.firefox = with lib; {
config = lib.mkIf cfg.enable { enable = lib.mkOption {
# Install applications for CAC type = types.bool;
default = true;
};
};
config = lib.mkIf (cfg1.enable && cfg2.enable) {
# Applications for CAC usage
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
opensc opensc
pcsc-tools pcsc-tools
@ -15,7 +22,7 @@ in {
programs.firefox = { programs.firefox = {
enable = true; enable = true;
profiles.default = { profiles.default = {
bookmarks = import ./bookmarks/firefox.nix; bookmarks = import ./bookmarks.nix;
isDefault = true; isDefault = true;
name = "default"; name = "default";
settings = { settings = {