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 = {
desktop = {
browser.enable = true;
enable = true;
gnome.enable = true;
};
devel = {

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,14 @@
{ 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; [
bc # Arbitrary-precision arithmetic language.
fzf # Command-line fuzzy finder for Unix-like operating systems.
@ -36,4 +43,5 @@
"application/x-extension-xht" = [ "google-chrome.desktop" ];
"application/pdf" = [ "google-chrome.desktop" ]; };
};
};
}

View File

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

View File

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

View File

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