diff options
author | Tim Keller <tjk@tjkeller.xyz> | 2024-10-02 22:07:10 -0500 |
---|---|---|
committer | Tim Keller <tjk@tjkeller.xyz> | 2024-10-02 22:07:10 -0500 |
commit | 4730b215fdc4095800fedfdf690c12fec994bb6b (patch) | |
tree | 3c746ece0089625a8093d4ae6bf1149ea903b7dc /modules/home | |
parent | 34b0bb8df42194a0ea433592e3cac27546f0af4e (diff) | |
download | nixos-4730b215fdc4095800fedfdf690c12fec994bb6b.tar.xz nixos-4730b215fdc4095800fedfdf690c12fec994bb6b.zip |
more reorganizing and modularizing
Diffstat (limited to 'modules/home')
-rw-r--r-- | modules/home/default.nix | 16 | ||||
-rw-r--r-- | modules/home/firefox.nix | 63 | ||||
-rw-r--r-- | modules/home/git.nix | 7 | ||||
-rw-r--r-- | modules/home/initial-home-setup.nix | 18 | ||||
-rw-r--r-- | modules/home/resources/activation-scripts/clone-repos.sh | 19 | ||||
-rw-r--r-- | modules/home/resources/firefox/uiCustomization.json | 1 | ||||
-rw-r--r-- | modules/home/resources/firefox/userChrome.css | 195 | ||||
-rw-r--r-- | modules/home/theme.nix | 46 |
8 files changed, 365 insertions, 0 deletions
diff --git a/modules/home/default.nix b/modules/home/default.nix new file mode 100644 index 0000000..bce93ba --- /dev/null +++ b/modules/home/default.nix @@ -0,0 +1,16 @@ +{ lib, ... }: { + home = { + username = "timmy"; + homeDirectory = "/home/timmy"; + stateVersion = "24.05"; + }; + + imports = [ + ./firefox.nix + ./git.nix + ./initial-home-setup.nix + ./theme.nix + ]; + + theme.mint.enable = lib.mkDefault true; +} diff --git a/modules/home/firefox.nix b/modules/home/firefox.nix new file mode 100644 index 0000000..3ae1278 --- /dev/null +++ b/modules/home/firefox.nix @@ -0,0 +1,63 @@ +{ + programs.firefox = { + # TODO see if there is way to login to moz account in profile + enable = true; + arkenfox = { + enable = true; + }; + profiles = let + search = { + engines = { + "Timmy Search" = { + urls = [{ template = "https://search.tjkeller.xyz/search?q={searchTerms}"; }]; # Don't know how to do w/ POST but I prefer GET anyways + iconURI = "https://search.tjkeller.xyz/static/themes/simple/img/favicon.svg"; # TODO doesn't seem to work + }; + }; + default = "Timmy Search"; + privateDefault = "Timmy Search"; + }; + userChrome = builtins.readFile ./resources/firefox/userChrome.css; + arkenfox = { + enable = true; + enableAllSections = true; + "0100"."0102"."browser.startup.page".value = 3; # 0=blank, 1=home, 2=last visited page, 3=resume previous session + "0100"."0103"."browser.startup.homepage".enable = false; + "0100"."0104"."browser.newtabpage.enabled".enable = false; + }; + settings = { + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + "browser.compactmode.show" = true; + "browser.uidensity" = 1; # Compact + "browser.download.dir" = /home/timmy/dls; # FF will create this dir if it doesn't exist + "browser.aboutConfig.showWarning" = false; # arkenfox does + "app.normandy.first_run" = false; + "browser.uiCustomization.state" = builtins.readFile ./resources/firefox/uiCustomization.json; # Toolbar etc. + "browser.newtabpage.activity-stream.feeds.section.topstories" = false; + "browser.newtabpage.activity-stream.feeds.topsites" = false; + "general.smoothScroll" = false; + "devtools.toolbox.host" = "window"; + #identity.fxaccounts.account.device.name = "timmy’s Firefox on nixos"; # HOSTNAME + }; + in { + Personal = { + id = 0; + isDefault = true; + inherit search; + inherit userChrome; + inherit arkenfox; + inherit settings; + }; + Work = { + id = 1; + inherit search; + }; + Test = { + id = 2; + inherit search; + inherit arkenfox; + inherit userChrome; + inherit settings; + }; + }; + }; +} diff --git a/modules/home/git.nix b/modules/home/git.nix new file mode 100644 index 0000000..e1a36c3 --- /dev/null +++ b/modules/home/git.nix @@ -0,0 +1,7 @@ +{ + programs.git = { + enable = true; + userName = "Tim Keller"; # TODO set to user description + userEmail = "tjk@tjkeller.xyz"; # TODO set to user email + }; +} diff --git a/modules/home/initial-home-setup.nix b/modules/home/initial-home-setup.nix new file mode 100644 index 0000000..a7119b9 --- /dev/null +++ b/modules/home/initial-home-setup.nix @@ -0,0 +1,18 @@ +{ config, lib, ... }: { + home.activation = { + cloneRepos = lib.hm.dag.entryAfter ["writeBoundary"] '' + export PATH="${config.home.path}/bin:$PATH" + ${builtins.readFile ./resources/activation-scripts/clone-repos.sh} + ''; + linkZshProfile = lib.hm.dag.entryAfter ["writeBoundary"] '' + run ln -sf $VERBOSE_ARG $HOME/.config/zsh/zprofile $HOME/.zprofile + ''; + cleanupHome = lib.hm.dag.entryAfter ["writeBoundary"] '' + run rm -f $VERBOSE_ARG $HOME/{.zcompdump,.zshrc,.zsh_history,.bash_history} + ''; + mimewiz = lib.hm.dag.entryAfter ["writeBoundary"] '' + export PATH="$HOME/.local/bin/misc:$PATH" + run mimewiz # already verbose + ''; + }; +} diff --git a/modules/home/resources/activation-scripts/clone-repos.sh b/modules/home/resources/activation-scripts/clone-repos.sh new file mode 100644 index 0000000..8ebdbe4 --- /dev/null +++ b/modules/home/resources/activation-scripts/clone-repos.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +server="https://git.tjkeller.xyz/" + +clonemissing() { + # clone to $2 + [ -d "$2"/.git ] && return + run mkdir -p $VERBOSE_ARG "$2" + run git clone $VERBOSE_ARG "$server$1" "$2" + + # link to $3 + [ -z "$3" ] && return + run mkdir -p $VERBOSE_ARG "$3" + run ln -sf $VERBOSE_ARG "$2"/.* "$2"/* "$3" +} + +# # repo # clone to # link to +clonemissing scripts.git $HOME/docs/src/scripts $HOME/.local/bin +clonemissing dotconfig.git $HOME/docs/src/config $HOME/.config diff --git a/modules/home/resources/firefox/uiCustomization.json b/modules/home/resources/firefox/uiCustomization.json new file mode 100644 index 0000000..339b716 --- /dev/null +++ b/modules/home/resources/firefox/uiCustomization.json @@ -0,0 +1 @@ +{"placements":{"widget-overflow-fixed-list":[],"unified-extensions-area":["ublock0_raymondhill_net-browser-action","sponsorblocker_ajay_app-browser-action","_e6e36c9a-8323-446c-b720-a176017e38ff_-browser-action","dearrow_ajay_app-browser-action","_446900e4-71c2-419f-a6a7-df9c091e268b_-browser-action","idcac-pub_guus_ninja-browser-action","addon_darkreader_org-browser-action","_74145f27-f039-47ce-a470-a662b129930a_-browser-action","_762f9885-5a13-4abd-9c77-433dcd38b8fd_-browser-action","jid1-bofifl9vbdl2zq_jetpack-browser-action","addon_fastforward_team-browser-action","jid1-tsgsxbhncspbwq_jetpack-browser-action","_aecec67f-0d10-4fa7-b7c7-609a2db280cf_-browser-action"],"nav-bar":["back-button","forward-button","stop-reload-button","home-button","urlbar-container","downloads-button","unified-extensions-button"],"toolbar-menubar":["menubar-items"],"TabsToolbar":["tabbrowser-tabs","new-tab-button","alltabs-button"],"PersonalToolbar":["personal-bookmarks"]},"seen":["save-to-pocket-button","developer-button","dearrow_ajay_app-browser-action","_446900e4-71c2-419f-a6a7-df9c091e268b_-browser-action","_e6e36c9a-8323-446c-b720-a176017e38ff_-browser-action","sponsorblocker_ajay_app-browser-action","ublock0_raymondhill_net-browser-action","idcac-pub_guus_ninja-browser-action","addon_darkreader_org-browser-action","_74145f27-f039-47ce-a470-a662b129930a_-browser-action","_762f9885-5a13-4abd-9c77-433dcd38b8fd_-browser-action","jid1-bofifl9vbdl2zq_jetpack-browser-action","addon_fastforward_team-browser-action","jid1-tsgsxbhncspbwq_jetpack-browser-action","_aecec67f-0d10-4fa7-b7c7-609a2db280cf_-browser-action"],"dirtyAreaCache":["nav-bar","PersonalToolbar","unified-extensions-area","toolbar-menubar","TabsToolbar"],"currentVersion":20,"newElementCount":5} diff --git a/modules/home/resources/firefox/userChrome.css b/modules/home/resources/firefox/userChrome.css new file mode 100644 index 0000000..af302c5 --- /dev/null +++ b/modules/home/resources/firefox/userChrome.css @@ -0,0 +1,195 @@ +/* TOP BAR */ +#navigator-toolbox { + --uc-navigationbar-width: 40vw; +} + +/* Remove overflow button */ +#nav-bar-overflow-button { display: none; } + +/* remove alltabs button */ +#alltabs-button { display: none; } + +/* Change background color of toolbar */ +#navigator-toolbox-background { + background: var(--toolbar-field-border-color) !important; +} + +/* Fix vertical spacing of tabs */ +#TabsToolbar { + margin-top: -1px; +} + +/* Move new tab to far right */ +#tabbrowser-arrowscrollbox-periphery { + margin-left: auto; +} + +/* Fix spacing around tabs by removing nav bar top border */ +#nav-bar { + border: none !important; +} + +/* Media queries for width of nav bar */ +@media screen and (max-width: 1000px) { + #navigator-toolbox { + --uc-navigationbar-width: 50vw; + } +} +@media screen and (max-width: 800px) { + #navigator-toolbox { + --uc-navigationbar-width: 60vw; + } +} + +/* Change look of tabs in smaller view */ +@media screen and (max-width: 800px) { + .tab-background { + margin-block: .2em !important; + } + #TabsToolbar { + margin-left: 5px; + } +} + + +/* COMBINE TOP BAR */ +/* Combine top bar into single line if width >= 800px */ +@media screen and (min-width: 800px) { + :root { + --uc-toolbar-height: 36px; /* Half height bar */ + } + + /* Modify these to change relative widths or default height */ + #navigator-toolbox { + margin-bottom: 0px; + } + + #titlebar { + margin-top: 2px; + } + + #TabsToolbar { + margin-left: calc(var(--uc-navigationbar-width) + 2px); /* Resize tab bar */ + margin-top: -4px; + margin-bottom: 2px; + } + + /* Tabs extend to bottom of bar */ + .tab-background { + margin-bottom: 0 !important; + margin-top: 2px !important; /* See above navbox rule */ + } + + /* Center tab buttons */ + #tabs-newtab-button, + #alltabs-button + { + margin-top: 4px !important; + } + + /* Integrate url / nav bar */ + #nav-bar { + margin-right:calc(100vw - var(--uc-navigationbar-width)); + margin-top: calc(0px - var(--uc-toolbar-height)); + border-radius: 0 var(--tab-border-radius) var(--tab-border-radius) 0; + border-right: 1px solid ThreeDShadow !important; + box-shadow: 0 0 4px rgba(0,0,0,.4) !important; + } + + /* 1px margin on touch density causes tabs to be too high */ + .tab-close-button { + margin-top: 0 !important + } + + /* Make opened urlbar overlay the toolbar */ + #urlbar[open]:focus-within { + min-width: 50vw !important; + } + + /* Remove min and max width of urlbar */ + #urlbar-container { + width: 0 !important; + } + + /* Fix customization view */ + #customization-panelWrapper .panel-arrowbox .panel-arrow { + margin-inline-end: initial !important; + } + + /* Shorten findbar */ + findbar { + width: 600px !important; + border-radius: 0 0 0 5px; + border-bottom: none !important; + box-shadow: 0 2px 4px rgba(0,0,0,.4); /* Move down 2px so it doesn't go over the tab bar */ + } +} + + +/* FINDBAR */ +findbar { + width: 100vw; + position: absolute; + top: 0; + right: 0; + padding: 0 !important; + padding-top: 1px !important; + background: -moz-headerbar Field !important; + border-top-width: 0px !important; + border-bottom: 1px solid ThreeDShadow; +} + +findbar .findbar-container { + padding-bottom: 5px !important; /* Move search bar closer to left edge */ + padding-top: 2px !important; /* Move search bar closer to left edge */ + height: max-content !important; + gap: 2px; + justify-content: space-between; + flex-wrap: wrap; +} + +/* Force textbox to fill up first line */ +findbar .findbar-textbox { + width: 100% !important; + background: Field !important; /* Set the background color to be consistent with found-matches label when unfocused */ +} + +/* Hide description showing wrap conditions etc. */ +findbar description { + display: none; +} + +/* Move found matches label (roughly) into the textbox */ +findbar label.found-matches, +findbar description { + position: absolute; + top: 6.5px; + right: 110px; + color: color-mix(in srgb, -moz-headerbartext, transparent 46%) !important; + /* So this text overrides the text below, TODO find a more elegant solution */ + padding-inline: 1ex; + background: Field; +} + +/* Show description when it says "Phrase Not Found" */ +findbar description[status=notfound] { + display: inline-block; +} + +/* Force checkboxes onto second line */ +findbar .findbar-container hbox { + width: 100%; +} + + +/* BOOKMARK BAR */ +@-moz-document url(chrome://browser/content/browser.xhtml) { + #PersonalToolbar { + background: -moz-headerbar Field !important; + border-top: 1px solid ThreeDShadow !important; + } + /* Space out bookmark items */ + .bookmark-item .toolbarbutton-text { + padding: 2.5px 4px; + } +} diff --git a/modules/home/theme.nix b/modules/home/theme.nix new file mode 100644 index 0000000..c49b8f5 --- /dev/null +++ b/modules/home/theme.nix @@ -0,0 +1,46 @@ +{ config, lib, pkgs, ... }: { + options = { + theme.mint = { + enable = lib.mkEnableOption "enables mint theme"; + theme.color = lib.mkOption { + type = lib.types.str; + default = "Dark-Aqua"; + description = "mint-y theme color eg. 'Dark-Aqua' or 'Red'"; + }; + icons.color = lib.mkOption { + type = lib.types.str; + default = "Aqua"; + description = "mint-y icons color eg. 'Aqua' or 'Red'"; + }; + }; + }; + + config = { + gtk = { + enable = true; + theme = lib.mkIf config.theme.mint.enable { + package = pkgs.cinnamon.mint-themes; + name = "Mint-Y-${config.theme.mint.theme.color}"; + }; + iconTheme = lib.mkIf config.theme.mint.enable { + package = pkgs.cinnamon.mint-y-icons; + name = "Mint-Y-${config.theme.mint.icons.color}"; + }; + cursorTheme = { + name = "Adwaita"; + }; + gtk3.bookmarks = [ + "file:///home/timmy/dls Downloads" + "file:///home/timmy/docs Documents" + "file:///home/timmy/docs/src/sites sites" + "file:///home/timmy/docs/src/scripts scripts" + "file:///home/timmy/docs/src/programs programs" + ]; + gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; + }; + qt = { + enable = true; + platformTheme.name = "gtk3"; + }; + }; +} |