defaults: cleanup

This commit is contained in:
Elec3137 2026-03-23 20:53:59 -07:00
commit d8071797fd
7 changed files with 73 additions and 67 deletions

42
defaults/browsers.nix Normal file
View file

@ -0,0 +1,42 @@
{
lib,
config,
...
}:
let
name = "browsers";
cfg = config.nixowos.defaults.${name};
in
{
options.nixowos.defaults.${name} = {
enable = lib.mkEnableOption name;
};
config = lib.mkIf cfg.enable {
programs.firefox = lib.mkDefault {
policies = {
ExtensionSettings = {
"uBlock0@raymondhill.net" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
};
};
Preferences = {
"browser.newtabpage.activity-stream.feeds.wallpaperfeed".Value = false;
"browser.newtabpage.activity-stream.feeds.weatherfeed".Value = false;
# from https://discourse.nixos.org/t/declare-firefox-extensions-and-settings/36265
"browser.newtabpage.activity-stream.feeds.section.topstories".Value = false;
"browser.newtabpage.activity-stream.feeds.snippets".Value = false;
"browser.newtabpage.activity-stream.section.highlights.includePocket".Value = false;
"browser.newtabpage.activity-stream.section.highlights.includeBookmarks".Value = false;
"browser.newtabpage.activity-stream.section.highlights.includeDownloads".Value = false;
"browser.newtabpage.activity-stream.section.highlights.includeVisited".Value = false;
"browser.newtabpage.activity-stream.showSponsored".Value = false;
"browser.newtabpage.activity-stream.system.showSponsored".Value = false;
"browser.newtabpage.activity-stream.showSponsoredTopSites".Value = false;
};
};
};
};
}

View file

@ -5,17 +5,17 @@
}:
let
name = "graphical";
name = "defaults";
cfg = config.nixowos.${name};
in
{
imports = [
./plasma.nix
./nvidia.nix
./games
./jp.nix
./mpv.nix
./virt.nix
./plasma.nix
./tmux.nix
./git.nix
./shell.nix
./browsers.nix
];
options.nixowos.${name} = {
@ -24,33 +24,12 @@ in
config = lib.mkIf cfg.enable {
nixowos.${name} = lib.mkDefault {
jp.enable = true;
plasma.enable = config.services.desktopManager.plasma6.enable;
mpv.enable = true;
};
programs.firefox = lib.mkDefault {
policies = {
ExtensionSettings = {
"uBlock0@raymondhill.net" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
};
};
Preferences = {
"browser.newtabpage.activity-stream.feeds.wallpaperfeed".Value = false;
"browser.newtabpage.activity-stream.feeds.weatherfeed".Value = false;
# from https://discourse.nixos.org/t/declare-firefox-extensions-and-settings/36265
"browser.newtabpage.activity-stream.feeds.section.topstories".Value = false;
"browser.newtabpage.activity-stream.feeds.snippets".Value = false;
"browser.newtabpage.activity-stream.section.highlights.includePocket".Value = false;
"browser.newtabpage.activity-stream.section.highlights.includeBookmarks".Value = false;
"browser.newtabpage.activity-stream.section.highlights.includeDownloads".Value = false;
"browser.newtabpage.activity-stream.section.highlights.includeVisited".Value = false;
"browser.newtabpage.activity-stream.showSponsored".Value = false;
"browser.newtabpage.activity-stream.system.showSponsored".Value = false;
"browser.newtabpage.activity-stream.showSponsoredTopSites".Value = false;
};
};
tmux.enable = true;
git.enable = true;
shell.enable = true;
browers.enable = true;
};
};
}

View file

@ -7,13 +7,14 @@
let
name = "git";
cfg = config.nixowos.cli.${name};
cfg = config.nixowos.defaults.${name};
superCfg = config.programs.${name};
in
{
options.nixowos.cli.${name} = {
enable = lib.mkEnableOption name;
options = {
nixowos.defaults.${name}.enable = lib.mkEnableOption name;
delta.enable = lib.mkEnableOption "delta within git" // {
programs.${name}.delta.enable = lib.mkEnableOption "delta within git" // {
default = true;
};
};
@ -21,7 +22,6 @@ in
config = lib.mkIf cfg.enable {
programs.git = {
enable = true;
config = lib.mkMerge [
{
@ -34,7 +34,7 @@ in
merge.conflictStyle = "zdiff3";
commit.verbose = true; # show diffs in commit editor
}
(lib.mkIf cfg.delta.enable {
(lib.mkIf superCfg.delta.enable {
core.pager = "${pkgs.delta}/bin/delta";
interactive.diffFilter = "${pkgs.delta}/bin/delta --color-only";
delta.navigate = true; # use n and N to move between diff sections

View file

@ -7,23 +7,18 @@
let
name = "jp";
cfg = config.nixowos.graphical.${name};
cfg = config.nixowos.defaults.${name};
in
{
options.nixowos.graphical.${name} = {
enable = lib.mkEnableOption "cjk fonts and fcitx5-mozc for ${name} input";
options.nixowos.defaults.${name} = {
enable = lib.mkEnableOption name;
};
config = lib.mkIf cfg.enable {
# enable default fonts (helps with emojis, etc)
fonts.enableDefaultPackages = lib.mkDefault true;
# for higher quality asian fonts
# without this, chromium might not render asian text at all
fonts.packages = [ pkgs.noto-fonts-cjk-sans ];
# for typing in japanese
i18n.inputMethod = {
enable = true;
i18n.inputMethod = lib.mkDefault {
# set this for the defaults to be realized!
# enable = true;
type = "fcitx5";
fcitx5 = {
waylandFrontend = true;

View file

@ -7,12 +7,13 @@
let
name = "plasma";
cfg = config.nixowos.graphical.${name};
cfg = config.nixowos.defaults.${name};
in
{
options.nixowos.graphical.${name} = {
options.nixowos.defaults.${name} = {
enable = lib.mkEnableOption name;
# TODO: move
startOnFirstTTY = lib.mkEnableOption "starting plasma from tty1" // {
description = ''
Whether to start ${name} automatically from tty1.

View file

@ -7,16 +7,10 @@
let
name = "shell";
cfg = config.nixowos.cli.${name};
# use a more verbose output style for nix than default
# only lix supports log-format = multiline-with-logs
logFormat = if config.nixowos.system.lix.enable then "multiline-with-logs" else "bar-with-logs";
cfg = config.nixowos.defaults.${name};
in
{
options.nixowos.cli.${name} = {
enable = lib.mkEnableOption name;
};
options.nixowos.defaults.${name}.enable = lib.mkEnableOption name;
config = lib.mkIf cfg.enable {
# use Fish, the nicest shell :)
@ -30,9 +24,7 @@ in
# make nix-shell preserve the user's $SHELL
nix-shell = /* sh */ ''nix-shell --command "export SHELL=$SHELL; $SHELL"'';
nixos-rebuild = /* sh */ "nixos-rebuild --ask-sudo-password --log-format ${logFormat}";
nix = /* sh */ "nix --log-format ${logFormat}";
nixos-rebuild = /* sh */ "nixos-rebuild --ask-sudo-password";
};
};
}

View file

@ -6,16 +6,13 @@
let
name = "tmux";
cfg = config.nixowos.cli.${name};
cfg = config.nixowos.defaults.${name};
in
{
options.nixowos.cli.${name} = {
enable = lib.mkEnableOption name;
};
options.nixowos.defaults.${name}.enable = lib.mkEnableOption name;
config = lib.mkIf cfg.enable {
programs.tmux = lib.mkDefault {
enable = true;
# this is a sin committed for ergonomics
# since "1" and "0" are quite far apart on most keyboards