refactor(treewide): clean-up, flatten, rework module system

This commit is contained in:
ooks-io 2024-06-05 22:56:07 +12:00
parent 4ddf9d2b35
commit 5590c8a951
58 changed files with 397 additions and 635 deletions

View file

@ -1,29 +1,7 @@
{ lib, ... }:
{
imports = [
./firefox
# ./schizofox
#./chrome -- still needs to be implemented
#./brave -- still needs tio be implemented
];
options.ooknet.desktop.browser = {
firefox = {
enable = lib.mkEnableOption "Enable firefox browser";
default = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Set Firefox as default browser";
};
};
schizofox = {
enable = lib.mkEnableOption "Enable schizofox browser";
default = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Set schizofox as default browser";
};
};
};
}

View file

@ -2,18 +2,17 @@
let
addons = inputs.firefox-addons.packages.${pkgs.system};
cfg = config.ooknet.desktop.browser.firefox;
cfg = config.ooknet.browser.firefox;
browser = config.ooknet.desktop.browser;
inherit (lib) mkIf;
in
{
config = {
nixpkgs.config.allowUnfree = true;
home.sessionVariables = mkIf cfg.default {
BROWSER = "firefox";
};
config = mkIf (cfg.enable || browser == "firefox") {
home.sessionVariables.BROWSER = mkIf (browser == "firefox") "firefox";
ooknet.binds.browser = mkIf (browser == "firefox") "firefox";
programs.firefox = mkIf cfg.enable {
programs.firefox = {
enable = true;
profiles.ooks = {
extensions = with addons; [

View file

@ -1,72 +0,0 @@
{ inputs, config, lib, ... }:
let
cfg = config.ooknet.desktop.browser.schizofox;
fonts = config.ooknet.theme.fonts;
inherit (config.colorscheme) palette;
in
{
imports = [inputs.schizofox.homeManagerModule];
config = lib.mkIf cfg.enable {
home.sessionVariables.BROWSER = lib.mkIf cfg.default "firefox";
programs.schizofox = {
enable = true;
theme = {
font = "${fonts.regular.family}";
colors = {
background-darker = "${palette.base00}";
background = "${palette.base01}";
foreground = "${palette.base07}";
};
};
security = {
sanitizeOnShutdown = false;
sandbox = true;
noSessionRestore = false;
userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:106.0) Gecko/20100101 Firefox/106.0";
};
misc = {
drmFix = true;
disableWebgl = false;
};
extensions = {
extraExtensions = let
mkUrl = name: "https://addons.mozilla.org/firefox/downloads/latest/${name}/latest.xpi";
extensions = [
{
id = "1018e4d6-728f-4b20-ad56-37578a4de76";
name = "flagfox";
}
{
id = "{c2c003ee-bd69-42a2-b0e9-6f34222cb046}";
name = "auto-tab-discard";
}
{
id = "{d634138d-c276-4fc8-924b-40a0ea21d284}";
name = "1password-x-password-manager";
}
{
id = "{a4c4eda4-fb84-4a84-b4a1-f7c1cbf2a1ad}";
name = "refined-github-";
}
{
id = "sponsorBlocker@ajay.app";
name = "sponsorblock";
}
{
id = "{tridactyl.vim@cmcaine.co.uk}";
name = "tridactyl-vim";
}
];
extraExtensions = builtins.foldl' (acc: ext: acc // {ext.id = {install_url = mkUrl ext.name;};}) {} extensions;
in
extraExtensions;
};
};
};
}