diff options
Diffstat (limited to 'home-manager')
25 files changed, 917 insertions, 0 deletions
diff --git a/home-manager/clone-repos.nix b/home-manager/clone-repos.nix new file mode 100644 index 0000000..fcf96f7 --- /dev/null +++ b/home-manager/clone-repos.nix @@ -0,0 +1,40 @@ +{ config, lib, pkgs, ... }: let + cfg = config.home._repos; + # TODO MAKE OPTIONS + server = "https://git.tjkeller.xyz/"; + src = "${config.xdg.userDirs.documents}/src"; + dotConfig = config.xdg.configHome; + bin = "$HOME/.local/bin"; + cloneMissing = repo: source: target: ''clonemissing "${repo}" "${source}" "${target}"''; +in { + options.home._repos = { + enable = lib.mkEnableOption "clone git repos"; + desktop = lib.mkEnableOption "clone repos that are for desktop use"; + }; + + config = lib.mkIf cfg.enable { + # TODO look into xdg.configFile.<name> + home.activation = { + cloneRepos = lib.hm.dag.entryAfter ["writeBoundary"] ('' + export PATH="${pkgs.git}/bin:$PATH" + ${builtins.readFile ./resources/activation-scripts/clone-repos.sh} + '' + lib.strings.concatStringsSep "\n" ([ + (cloneMissing "${server}dotconfig" "${src}/config" dotConfig) + (cloneMissing "${server}nixos" "${src}/nixos" "") + (cloneMissing "${server}nvim" "${dotConfig}/nvim" "") + (cloneMissing "${server}zsh" "${dotConfig}/zsh" "") + ] ++ lib.optionals cfg.desktop [ + (cloneMissing "${server}scripts" "${src}/scripts" bin) + (cloneMissing "${server}userscripts" "${src}/userscripts" "") + (cloneMissing "${server}awesome" "${dotConfig}/awesome" "") + ])); + linkZshProfile = lib.hm.dag.entryAfter ["writeBoundary"] '' + run ln -sf $VERBOSE_ARG ${dotConfig}/zsh/zprofile $HOME/.zprofile + ''; + }; + #home.file.Zprofile = { + # source = "${dotConfig}/zsh/zprofile"; + # target = ".zprofile"; + #}; + }; +} diff --git a/home-manager/default.nix b/home-manager/default.nix new file mode 100644 index 0000000..c1a105f --- /dev/null +++ b/home-manager/default.nix @@ -0,0 +1,19 @@ +{ + imports = [ + ./clone-repos.nix + ./firefox.nix + ./fontconfig.nix + ./home-cleanup.nix + ./htop.nix + ./mint-theme.nix + ./pcmanfm.nix + ./qt-gtk-theme.nix + ./redshift.nix + ./theme-st.nix + ./wallpapers.nix + ./xdg-mime.nix + ]; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; +} diff --git a/home-manager/firefox.nix b/home-manager/firefox.nix new file mode 100644 index 0000000..cca4a19 --- /dev/null +++ b/home-manager/firefox.nix @@ -0,0 +1,91 @@ +{ config, lib, pkgs, ... }: let + cfg = config.programs.firefox; + search = { + engines = { + "Timmy Search" = { + urls = [{ + template = "https://search.tjkeller.xyz/search"; + params = [ { name = "q"; value = "{searchTerms}"; } ]; + }]; + iconURI = "https://search.tjkeller.xyz/static/themes/simple/img/favicon.svg"; # TODO doesn't seem to work + }; + "Nix Packages" = { + urls = [{ + template = "https://search.nixos.org/packages"; + params = [ { name = "query"; value = "{searchTerms}"; } ]; + }]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "@np" ]; + }; + "NixOS Options" = { + urls = [{ + template = "https://search.nixos.org/options"; + params = [ { name = "query"; value = "{searchTerms}"; } ]; + }]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "@no" ]; + }; + }; + default = "Timmy Search"; + privateDefault = "Timmy Search"; + force = true; # Overwrite old + }; + 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; + #"2800"."2811"."privacy.clearOnShutdown.history".enable = false; + }; + settings = { + "browser.compactmode.show" = true; + "browser.uiCustomization.state" = builtins.readFile ./resources/firefox/uiCustomization.json; # Toolbar etc. + "browser.uidensity" = 1; # Compact + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; # userchrome + + "app.normandy.first_run" = false; + "browser.aboutConfig.showWarning" = false; # arkenfox does + #"browser.download.dir" = userDetails.userDirs.downloads; + "browser.newtabpage.activity-stream.feeds.section.topstories" = false; + "browser.newtabpage.activity-stream.feeds.topsites" = false; + "browser.urlbar.suggest.topsites" = false; + "devtools.toolbox.host" = "window"; + "dom.push.enabled" = false; # + "extensions.pocket.enabled" = false; + "general.smoothScroll" = false; + #"geo.provider.use_geoclue" = true; + }; + workSettings = settings // { + "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; # Use builtin dark theme instead of system theme + }; +in { + options.programs.firefox = { + _configure = lib.mkEnableOption "configure firefox profiles"; + }; + + config = lib.mkIf cfg._configure { + programs.firefox = { + enable = lib.mkDefault true; + arkenfox.enable = lib.mkDefault true; + profiles = { + Personal = { + id = 0; + isDefault = true; + inherit search; + inherit userChrome; + inherit arkenfox; + inherit settings; + }; + Work = { + id = 1; + inherit search; + inherit userChrome; + inherit arkenfox; + settings = workSettings; + }; + }; + }; + }; +} diff --git a/home-manager/fontconfig.nix b/home-manager/fontconfig.nix new file mode 100644 index 0000000..4473d1a --- /dev/null +++ b/home-manager/fontconfig.nix @@ -0,0 +1,83 @@ +{ config, lib, ... }: let + cfg = config.fonts.fontconfig; + fcConfd = "fontconfig/conf.d"; + fcResources = ./resources/fontconfig; + + extraConfigFile = lib.types.submodule ({ name, ... }: { + options = { + enable = lib.mkEnableOption "Whether this font config file should be generated."; + text = lib.mkOption { + type = lib.types.nullOr lib.types.lines; + default = null; + description = "Verbatim contents of the config file. If this option is null then the 'source' option must be set."; + }; + source = lib.mkOption { + type = lib.types.nullOr lib.types.path; + default = null; + description = "Config file to source. Alternatively, use the 'text' option instead."; + }; + label = lib.mkOption { + type = lib.types.str; + default = "name"; + description = "Label to use for the name of the config file."; + }; + priority = lib.mkOption { + type = lib.types.addCheck lib.types.int (x: x >= 0 && x <= 99); + default = 90; + description = '' + Determines the order in which configs are loaded. + Must be a value within the range of 0-99, where priority 0 is the highest priority and 99 is the lowest. + ''; + }; + }; + config = { + label = lib.mkDefault name; + }; + }); +in { + options.fonts.fontconfig = { + _extraConfigFiles = lib.mkOption { + type = lib.types.attrsOf extraConfigFile; + default = {}; + description = '' + Extra font config files that will be added to `~/.config/fontconfig/conf.d/`. + Files are added as `conf.d/{priority}-{label}.conf`. + ''; + example = '' + { + tamzen = { + enable = true; + label = "tamzen-disable-antialiasing"; + text = tamzenFontConfig; # Pretend this is defined elsewhere + priority = 90; + }; # => conf.d/90-tamzen-disable-antialiasing.conf + commit-mono-options = { + enable = true; + source = ./resources/fontconfig/commit-mono.conf; + priority = 80; + }; # => conf.d/80-commit-mono-options.conf + }; + ''; + }; + }; + + config = lib.mkIf cfg.enable { + fonts.fontconfig._extraConfigFiles = { + tamzen-disable-antialiasing = { + enable = true; + text = builtins.readFile ./resources/fontconfig/90-tamzen-disable-anti-aliasing.conf; + priority = 90; + }; + commit-mono-options = { + enable = true; + source = ./resources/fontconfig/90-commit-mono-options.conf; + priority = 90; + }; + }; + + xdg.configFile = lib.mapAttrs' (name: config: + lib.nameValuePair "${fcConfd}/${builtins.toString config.priority}-${config.label}.conf" + { inherit (config) text; source = lib.mkIf (config.source != null) config.source; } + ) cfg._extraConfigFiles; + }; +} diff --git a/home-manager/home-cleanup.nix b/home-manager/home-cleanup.nix new file mode 100644 index 0000000..0754d95 --- /dev/null +++ b/home-manager/home-cleanup.nix @@ -0,0 +1,21 @@ +{ config, lib, ... }: let + cacheHome = config.xdg.cacheHome; + configHome = config.xdg.configHome; + dataHome = config.xdg.dataHome; +in { + # Gtk 2 + # This file may be generated by home-manager, so this will need to be set + # so that it ends up in the correct location + gtk.gtk2.configLocation = "${configHome}/gtk-2.0/gtkrc"; + + # Npm + xdg.configFile.npmrc = { + enable = lib.mkDefault true; + text = '' + prefix=${dataHome}/npm + cache=${cacheHome}/npm + init-module=${dataHome}/npm/npm-init.js + ''; + target = "npm/npmrc"; + }; +} diff --git a/home-manager/htop.nix b/home-manager/htop.nix new file mode 100644 index 0000000..36ccbac --- /dev/null +++ b/home-manager/htop.nix @@ -0,0 +1,46 @@ +{ config, lib, ... }: let + cfg = config.programs.htop; +in { + options.programs.htop = { + _configure = lib.mkEnableOption "apply sensible defaults to htop"; + }; + + config = lib.mkIf cfg._configure { + programs.htop.enable = lib.mkDefault true; + programs.htop.settings = { + fields = with config.lib.htop.fields; [ + PID + USER + 124 # EXE + PERCENT_CPU + PERCENT_MEM + STARTTIME + ELAPSED # time elapsed since process start + IO_READ_RATE + RBYTES # num read bytes + IO_WRITE_RATE + WBYTES # num written bytes + TIME + STIME # sys time + CSTIME # child sys time + NICE + STATE + PRIORITY + 125 # CWD + ]; + } // (with config.lib.htop; leftMeters [ + (bar "AllCPUs2") + (bar "CPU") + (bar "Memory") + (bar "DiskIO") + (bar "NetworkIO") + ]) // (with config.lib.htop; rightMeters [ + (text "Hostname") + (text "Clock") + (text "Uptime") + (text "Battery") + (text "LoadAverage") + (text "Tasks") + ]); + }; +} diff --git a/home-manager/mint-theme.nix b/home-manager/mint-theme.nix new file mode 100644 index 0000000..a77be6a --- /dev/null +++ b/home-manager/mint-theme.nix @@ -0,0 +1,43 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.gtk._mintTheme; # gtk.theme type is null or submodule under the hood so gtk.theme._mint, etc. can't be used + transformColorValue = color: dark: + "Mint-Y" + lib.optionalString dark "-Dark" + + lib.optionalString (color != "Green") ("-" + color) + ; +in { + options.gtk._mintTheme = { + enable = lib.mkEnableOption "enables mint theme"; + color = lib.mkOption { + type = lib.types.enum [ + "Aqua" "Blue" "Green" "Grey" "Orange" + "Pink" "Purple" "Red" "Sand" "Teal" + ]; + default = "Green"; + description = "mint-y theme color"; + }; + dark = lib.mkEnableOption "whether to use dark variant of mint theme"; + icons.color = lib.mkOption { + type = lib.types.enum [ + "Aqua" "Blue" "Green" "Grey" "Orange" "Pink" "Purple" "Red" + "Sand" "Teal" + ]; + default = "Aqua"; + description = "mint-y icons color eg. 'Aqua' or 'Red'"; + }; + }; + + config = lib.mkIf cfg.enable { + gtk = { + enable = true; + theme = { + package = pkgs.mint-themes; + name = transformColorValue cfg.color cfg.dark; + }; + iconTheme = { + package = pkgs.mint-y-icons; + name = transformColorValue cfg.icons.color false; + }; + }; + }; +} diff --git a/home-manager/pcmanfm.nix b/home-manager/pcmanfm.nix new file mode 100644 index 0000000..a99fb15 --- /dev/null +++ b/home-manager/pcmanfm.nix @@ -0,0 +1,15 @@ +{ config, lib, ... }: let + cfg = config.programs._pcmanfm.openAsRootOption; +in { + options.programs._pcmanfm.openAsRootOption = { + enable = lib.mkEnableOption "enable 'open as root' option in pcmanfm right-click menu"; + }; + + config = lib.mkIf cfg.enable { + home.file.pcmanfm-root = { + target = ".local/share/file-manager/actions/root.desktop"; + # FIXME this action uses an absolute path pls fix + source = ./resources/pcmanfm/root.desktop; + }; + }; +} diff --git a/home-manager/qt-gtk-theme.nix b/home-manager/qt-gtk-theme.nix new file mode 100644 index 0000000..2e53ccc --- /dev/null +++ b/home-manager/qt-gtk-theme.nix @@ -0,0 +1,15 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.qt._gtkPlatformTheme; +in { + options.qt._gtkPlatformTheme = { + enable = lib.mkEnableOption "use gtk theme in qt"; + }; + + config = lib.mkIf cfg.enable { + qt = { + enable = lib.mkDefault true; + platformTheme.name = "gtk3"; + }; + }; +} diff --git a/home-manager/redshift.nix b/home-manager/redshift.nix new file mode 100644 index 0000000..4bae599 --- /dev/null +++ b/home-manager/redshift.nix @@ -0,0 +1,18 @@ +{ config, lib, ... }: let + cfg = config.services._redshift; +in { + options.services._redshift = { + enable = lib.mkEnableOption "configure redshift"; + }; + + config = lib.mkIf cfg.enable { + services.redshift = { + enable = true; + provider = lib.mkDefault "geoclue2"; + temperature = { + day = lib.mkDefault 6500; # Redshift default, the hm module defaults to 5500 + night = lib.mkDefault 3600; + }; + }; + }; +} diff --git a/home-manager/resources/activation-scripts/clone-repos.sh b/home-manager/resources/activation-scripts/clone-repos.sh new file mode 100644 index 0000000..adf8fd7 --- /dev/null +++ b/home-manager/resources/activation-scripts/clone-repos.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +clonemissing() { + # pull and return if already existing + if [ -d "$2"/.git ]; then + run cd $VERBOSE_ARG "$2" + run git pull $VERBOSE_ARG || echo "$2: failed to pull from remote" + return + fi + + # clone $1 to $2 + run mkdir -p $VERBOSE_ARG "$2" + run git clone $VERBOSE_ARG "$1" "$2" + + # link files to $3 + [ -z "$3" ] && return + run mkdir -p $VERBOSE_ARG "$3" + run ln -sf $VERBOSE_ARG "$2"/* "$3" +} diff --git a/home-manager/resources/firefox/uiCustomization.json b/home-manager/resources/firefox/uiCustomization.json new file mode 100644 index 0000000..339b716 --- /dev/null +++ b/home-manager/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/home-manager/resources/firefox/userChrome.css b/home-manager/resources/firefox/userChrome.css new file mode 100644 index 0000000..624ab26 --- /dev/null +++ b/home-manager/resources/firefox/userChrome.css @@ -0,0 +1,204 @@ +/* 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; +} + +/* Change background color of bookmarks toolbar */ +#PersonalToolbar { + background: var(--toolbox-bgcolor) !important; +} + +/* Adjust spacing of toolbar items */ +#PlacesToolbarItems { + gap: .35rem; + margin-block: .2rem; +} + +/* 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; + padding-top: 1px; /* Top bar is cut off otherwise */ + } + + #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: 3px !important; /* See above navigator-toolbox rule. Avoid cutting off top */ + } + + /* 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; + z-index: 1000; /* To not be affected by shadow from navbar */ + } + /* Space out bookmark items */ + .bookmark-item .toolbarbutton-text { + padding: 2.5px 4px; + } +} diff --git a/home-manager/resources/fontconfig/90-commit-mono-options.conf b/home-manager/resources/fontconfig/90-commit-mono-options.conf new file mode 100644 index 0000000..9c7373a --- /dev/null +++ b/home-manager/resources/fontconfig/90-commit-mono-options.conf @@ -0,0 +1,17 @@ +<?xml version="1.0"?> +<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> + +<fontconfig> + <description>Enable opentype features for CommitMono to make it match better with Inter as its monospace counterpart</description> + <match target="font"> + <test name="family" compare="eq" ignore-blanks="true"> + <string>CommitMono</string> + </test> + <edit name="fontfeatures" mode="append"> + <string>ss03 on</string> <!-- smart case --> + <string>ss04 on</string> <!-- symbol spacing --> + <string>cv02 on</string> <!-- alt g --> + <string>cv06 on</string> <!-- alt 6 & 9 --> + </edit> + </match> +</fontconfig> diff --git a/home-manager/resources/fontconfig/90-tamzen-disable-anti-aliasing.conf b/home-manager/resources/fontconfig/90-tamzen-disable-anti-aliasing.conf new file mode 100644 index 0000000..5bf94d7 --- /dev/null +++ b/home-manager/resources/fontconfig/90-tamzen-disable-anti-aliasing.conf @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> + +<fontconfig> + <description>Disable anti-aliasing for Tamzen since it is a bitmap font</description> + <match target="pattern"> + <test name="family" compare="eq" qual="any"> + <string>Tamzen</string> + </test> + <edit name="antialias" mode="assign"> + <bool>false</bool> + </edit> + </match> +</fontconfig> diff --git a/home-manager/resources/pcmanfm/root.desktop b/home-manager/resources/pcmanfm/root.desktop new file mode 100644 index 0000000..4b4d263 --- /dev/null +++ b/home-manager/resources/pcmanfm/root.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Type=Action +Tooltip=Open Directory As Root +Name=Open Directory As Root +Profiles=profile-zero; +Icon=gtk-dialog-authentication + +[X-Action-Profile profile-zero] +MimeTypes=inode/directory; +Exec=/home/timmy/.local/bin/x11/xsudo /usr/bin/pcmanfm %u +Name=Default profile diff --git a/home-manager/resources/xdg-mime/audio b/home-manager/resources/xdg-mime/audio new file mode 100644 index 0000000..fd00b26 --- /dev/null +++ b/home-manager/resources/xdg-mime/audio @@ -0,0 +1,65 @@ +application/x-cue +application/x-extension-m4a +application/x-ogm-audio +application/x-shorten +audio/3gpp +audio/3gpp2 +audio/AMR +audio/aac +audio/ac3 +audio/aiff +audio/amr-wb +audio/dv +audio/eac3 +audio/flac +audio/m3u +audio/m4a +audio/mp1 +audio/mp2 +audio/mp3 +audio/mp4 +audio/mpeg +audio/mpeg2 +audio/mpeg3 +audio/mpegurl +audio/mpg +audio/musepack +audio/ogg +audio/opus +audio/rn-mpeg +audio/scpls +audio/vnd.dolby.heaac.1 +audio/vnd.dolby.heaac.2 +audio/vnd.dts +audio/vnd.dts.hd +audio/vnd.rn-realaudio +audio/vorbis +audio/wav +audio/webm +audio/x-aac +audio/x-adpcm +audio/x-aiff +audio/x-ape +audio/x-m4a +audio/x-matroska +audio/x-mp1 +audio/x-mp2 +audio/x-mp3 +audio/x-mpegurl +audio/x-mpg +audio/x-ms-asf +audio/x-ms-wma +audio/x-musepack +audio/x-pls +audio/x-pn-au +audio/x-pn-realaudio +audio/x-pn-wav +audio/x-pn-windows-pcm +audio/x-realaudio +audio/x-scpls +audio/x-shorten +audio/x-tta +audio/x-vorbis +audio/x-vorbis+ogg +audio/x-wav +audio/x-wavpack diff --git a/home-manager/resources/xdg-mime/email b/home-manager/resources/xdg-mime/email new file mode 100644 index 0000000..db65256 --- /dev/null +++ b/home-manager/resources/xdg-mime/email @@ -0,0 +1,6 @@ +application/mbox +application/vnd.ms-outlook +message/rfc822 +text/calendar +x-scheme-handler/mailto +x-scheme-handler/mid diff --git a/home-manager/resources/xdg-mime/image b/home-manager/resources/xdg-mime/image new file mode 100644 index 0000000..4401ebb --- /dev/null +++ b/home-manager/resources/xdg-mime/image @@ -0,0 +1,14 @@ +image/bmp +image/gif +image/jpeg +image/jpg +image/png +image/tiff +image/x-bmp +image/x-portable-anymap +image/x-portable-bitmap +image/x-portable-graymap +image/x-tga +image/x-xpixmap +image/svg+xml +image/svg+xml-compressed diff --git a/home-manager/resources/xdg-mime/pdf b/home-manager/resources/xdg-mime/pdf new file mode 100644 index 0000000..73bd5d0 --- /dev/null +++ b/home-manager/resources/xdg-mime/pdf @@ -0,0 +1,4 @@ +application/epub+zip +application/oxps +application/pdf +application/x-fictionbook diff --git a/home-manager/resources/xdg-mime/text b/home-manager/resources/xdg-mime/text new file mode 100644 index 0000000..709cb57 --- /dev/null +++ b/home-manager/resources/xdg-mime/text @@ -0,0 +1,15 @@ +application/x-shellscript +text/english +text/plain +text/x-c +text/x-c++ +text/x-c++hdr +text/x-c++src +text/x-chdr +text/x-csrc +text/x-java +text/x-makefile +text/x-moc +text/x-pascal +text/x-tcl +text/x-tex diff --git a/home-manager/resources/xdg-mime/video b/home-manager/resources/xdg-mime/video new file mode 100644 index 0000000..6a0839e --- /dev/null +++ b/home-manager/resources/xdg-mime/video @@ -0,0 +1,55 @@ +application/mxf +application/ogg +application/sdp +application/smil +application/streamingmedia +application/vnd.apple.mpegurl +application/vnd.ms-asf +application/vnd.rn-realmedia +application/vnd.rn-realmedia-vbr +application/x-extension-mp4 +application/x-matroska +application/x-mpegurl +application/x-ogg +application/x-ogm +application/x-ogm-video +application/x-smil +application/x-streamingmedia +video/3gp +video/3gpp +video/3gpp2 +video/avi +video/divx +video/dv +video/fli +video/flv +video/mkv +video/mp2t +video/mp4 +video/mp4v-es +video/mpeg +video/msvideo +video/ogg +video/quicktime +video/vnd.divx +video/vnd.mpegurl +video/vnd.rn-realvideo +video/webm +video/x-avi +video/x-flc +video/x-flic +video/x-flv +video/x-m4v +video/x-matroska +video/x-mpeg2 +video/x-mpeg3 +video/x-ms-afs +video/x-ms-asf +video/x-ms-wmv +video/x-ms-wmx +video/x-ms-wvxvideo +video/x-msvideo +video/x-ogm +video/x-ogm+ogg +video/x-theora +video/x-theora+ogg diff --git a/home-manager/theme-st.nix b/home-manager/theme-st.nix new file mode 100644 index 0000000..110c9d6 --- /dev/null +++ b/home-manager/theme-st.nix @@ -0,0 +1,42 @@ +{ config, lib, pkgs, ... }: let + cfg = config.programs._st; + toString = x: if lib.isBool x then (if x then "true" else "false") else builtins.toString x; + generateXftFontString = name: attrs: + name + lib.optionalString (attrs != {}) ( + ":" + lib.concatStringsSep ":" ( + lib.mapAttrsToList (key: value: "${key}=${toString value}") attrs + ) + ) + ; + themed-st = pkgs.st.overrideAttrs (old: { + buildInputs = old.buildInputs or [] ++ [ pkgs.makeWrapper ]; + postInstall = old.postInstall or "" + '' + wrapProgram $out/bin/st \ + --add-flags '-f"${generateXftFontString cfg.font.name cfg.font.attrs}"' + ''; + }); +in { + options.programs._st = { + enable = lib.mkEnableOption "enables theming st with home manager"; + font = { + name = lib.mkOption { + type = lib.types.str; + example = "JetBrainsMonoNL Nerd Font Mono"; + default = "monospace"; + }; + attrs = lib.mkOption { + type = lib.types.attrs; + default = {}; + example = { + size = 12; + antialias = true; + autohint = true; + }; + }; + }; + }; + + config = lib.mkIf cfg.enable { + home.packages = [ themed-st ]; + }; +} diff --git a/home-manager/wallpapers.nix b/home-manager/wallpapers.nix new file mode 100644 index 0000000..de64d76 --- /dev/null +++ b/home-manager/wallpapers.nix @@ -0,0 +1,17 @@ +{ lib, config, pkgs, ... }: let + cfg = config.programs._seasonalwallpaper.wallpapers; +in { + options.programs._seasonalwallpaper.wallpapers = { + download = lib.mkEnableOption "enables all wallpapers"; + }; + + config = lib.mkIf cfg.download { + home.file.wallpapers = { + target = ".local/share/wallpaper"; + source = pkgs.fetchzip { + url = "https://tjkeller.xyz/permalinks/wallpapers.tar"; + hash = "sha256-lhj9wUMZfd0XOrUtWY9HB64oXrS/EjsvsaJHzu4ucFg="; + }; + }; + }; +} diff --git a/home-manager/xdg-mime.nix b/home-manager/xdg-mime.nix new file mode 100644 index 0000000..420510f --- /dev/null +++ b/home-manager/xdg-mime.nix @@ -0,0 +1,42 @@ +{ config, lib, pkgs, ... }: let + cfg = config.xdg.mimeApps._defaultCategoryApplications; + + # Mime-type category files are stored here + mimeResources = ./resources/xdg-mime; + + # Files present in mimeResources with newline separated mime-types + # Would be more fun to load these dynamically with builtins.readDir, but I will be disciplined + categories = [ "audio" "email" "image" "pdf" "text" "video" ]; + + # Dynamically generate categories + categoryApplications = (lib.genAttrs categories (category: lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ ]; + description = "set the default application used for ${category} files. omit '.desktop'"; + })); + + # Create list of mime-types from the category file + getCategoryMimeTypes = category: lib.filter (s: s != "") (lib.splitString "\n" (builtins.readFile "${mimeResources}/${category}")); + + # Structure default applications for a specified category how home-manager expects + assignMimeTypes = applications: category: lib.map (mimetype: + { "${mimetype}" = lib.mkIf (applications != []) (lib.map (app: "${app}.desktop") applications); } + ) (getCategoryMimeTypes category); + + # Combine all category applications + defaultApplications = lib.mkMerge (lib.flatten ( + lib.map (category: assignMimeTypes cfg.categoryApplications.${category} category) categories + )); +in { + options.xdg.mimeApps._defaultCategoryApplications = { + enable = lib.mkEnableOption "set default applications as defined in the resources dir"; + inherit categoryApplications; + }; + + config = lib.mkIf cfg.enable { + xdg.mimeApps = { + enable = lib.mkDefault true; + inherit defaultApplications; + }; + }; +} |