diff --git a/hosts/machine/kanade/home/default.nix b/hosts/machine/kanade/home/default.nix index c57cb0d..33360d7 100644 --- a/hosts/machine/kanade/home/default.nix +++ b/hosts/machine/kanade/home/default.nix @@ -21,6 +21,7 @@ "${inputs.self}/modules/home/devtool/neovim.nix" "${inputs.self}/modules/home/devtool/ghostty.nix" "${inputs.self}/modules/home/devtool/zed.nix" + "${inputs.self}/modules/home/firefox-devedition.nix" ./config/git.nix ./config/shell.nix ]; diff --git a/hosts/machine/kanade/modules/homebrew/casks.nix b/hosts/machine/kanade/modules/homebrew/casks.nix index 11d6a71..08ad7f2 100644 --- a/hosts/machine/kanade/modules/homebrew/casks.nix +++ b/hosts/machine/kanade/modules/homebrew/casks.nix @@ -11,6 +11,9 @@ "signal" "zoom" + # Browsers + "firefox@developer-edition" + # Productivity and design "camo-studio" "proton-drive" diff --git a/hosts/server/natsu/default.nix b/hosts/server/natsu/default.nix index 1b29d32..90ba444 100644 --- a/hosts/server/natsu/default.nix +++ b/hosts/server/natsu/default.nix @@ -12,7 +12,6 @@ nixpkgs.lib.nixosSystem { # ./services/attic.nix ./services/caddy.nix ./services/forgejo-runner.nix - ./services/limbo.nix ./services/stream.nix # ./services/harmonia.nix ./configuration.nix diff --git a/hosts/server/natsu/services/limbo.nix b/hosts/server/natsu/services/limbo.nix deleted file mode 100644 index 404c5dc..0000000 --- a/hosts/server/natsu/services/limbo.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ ... }: - -{ - systemd.services.limbo = { - description = "Minecraft Limbo Server"; - after = [ "network-online.target" ]; - wants = [ "network-online.target" ]; - wantedBy = [ "multi-user.target" ]; - - serviceConfig = { - Type = "simple"; - User = "imnyang"; - Group = "users"; - WorkingDirectory = "/home/imnyang/minecraft/limbo"; - ExecStart = "/home/imnyang/minecraft/limbo/pico_limbo --config /home/imnyang/minecraft/limbo/server.toml"; - Restart = "always"; - RestartSec = 5; - }; - }; -} diff --git a/modules/home/firefox-devedition.nix b/modules/home/firefox-devedition.nix index 9a5d18e..8ed8f1d 100644 --- a/modules/home/firefox-devedition.nix +++ b/modules/home/firefox-devedition.nix @@ -1,147 +1,258 @@ -{ pkgs, ... }: +{ pkgs, lib, ... }: let + inherit (pkgs.stdenv.hostPlatform) isDarwin isLinux; + extensionUrl = "https://git.mizuki.guru/imnyang/thisiswindowsfigma/releases/download/v1.0.0/d168a70cb6a24fe4a478-1.0.0.xpi"; extensionId = "figma-windows-ua-spoofer@imnyang.local"; -in -{ - programs.firefox = { - enable = true; - package = pkgs.firefox-devedition; - policies = { - DisableAppUpdate = true; - ExtensionSettings = { - ${extensionId} = { - installation_mode = "force_installed"; - install_url = extensionUrl; + profileName = "imnyang"; + darwinProfilePath = "Profiles/${profileName}"; + + firefoxSettings = { + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + "browser.uidensity" = 0; + "browser.theme.dark-private-windows" = false; + }; + + userChrome = '' + :root { + --mizuki-bg: #fcf8f9; + --mizuki-fg: #191017; + --mizuki-muted: #707d8a; + --mizuki-border: #f2e6ea; + --mizuki-surface: #fdf7f9; + --mizuki-hover: #8165700f; + --mizuki-active: #8165701a; + --mizuki-selection: #ecb7d5; + } + + @media (prefers-color-scheme: dark) { + :root { + --mizuki-bg: #191017; + --mizuki-fg: #fafafa; + --mizuki-muted: #a9a9b1; + --mizuki-border: #2c1f2d; + --mizuki-surface: #191017; + --mizuki-hover: #2c1f2d80; + --mizuki-active: #2c1f2d; + --mizuki-selection: #604562; + } + } + + #navigator-toolbox, + #TabsToolbar, + #nav-bar, + #PersonalToolbar, + #sidebar-box, + #sidebar-header { + background-color: var(--mizuki-bg) !important; + color: var(--mizuki-fg) !important; + } + + #navigator-toolbox { + border-bottom: 1px solid var(--mizuki-border) !important; + } + + #urlbar-background, + #searchbar { + background-color: var(--mizuki-surface) !important; + border-color: var(--mizuki-border) !important; + color: var(--mizuki-fg) !important; + } + + #urlbar[focused] > #urlbar-background, + #searchbar:focus-within { + border-color: var(--mizuki-selection) !important; + box-shadow: 0 0 0 1px var(--mizuki-selection) !important; + } + + .tab-background { + border-radius: 10px 10px 0 0 !important; + } + + .tab-background[selected] { + background-color: var(--mizuki-active) !important; + } + + .tabbrowser-tab:not([selected]):hover .tab-background, + toolbarbutton:hover, + #urlbar:hover > #urlbar-background { + background-color: var(--mizuki-hover) !important; + } + + toolbarbutton[open], + toolbarbutton[checked], + toolbarbutton:active { + background-color: var(--mizuki-active) !important; + } + + #TabsToolbar .tabbrowser-tab, + #urlbar-input, + #identity-icon-label, + toolbarbutton { + color: var(--mizuki-fg) !important; + } + + .tabbrowser-tab:not([selected]) .tab-label, + #sidebar-title { + color: var(--mizuki-muted) !important; + } + ''; + + userContent = '' + @-moz-document url("about:home"), url("about:newtab"), url("about:privatebrowsing") { + body, + .outer-wrapper, + .activity-stream { + background: #fcf8f9 !important; + color: #191017 !important; + } + + @media (prefers-color-scheme: dark) { + body, + .outer-wrapper, + .activity-stream { + background: #191017 !important; + color: #fafafa !important; + } + } + } + ''; + + userJs = lib.concatStringsSep "\n" ( + lib.mapAttrsToList (name: value: ''user_pref(${builtins.toJSON name}, ${builtins.toJSON value});'') firefoxSettings + ) + "\n"; +in +lib.mkMerge [ + (lib.mkIf isLinux { + programs.firefox = { + enable = true; + package = pkgs.firefox-devedition; + + policies = { + DisableAppUpdate = true; + ExtensionSettings = { + ${extensionId} = { + installation_mode = "force_installed"; + install_url = extensionUrl; + }; }; }; - }; - profiles.imnyang = { - id = 0; - name = "imnyang"; - isDefault = true; + profiles.${profileName} = { + id = 0; + name = profileName; + path = "${profileName}.default"; + isDefault = true; - settings = { - "toolkit.legacyUserProfileCustomizations.stylesheets" = true; - "browser.uidensity" = 0; - "browser.theme.dark-private-windows" = false; + settings = firefoxSettings; + inherit userChrome userContent; }; + }; - userChrome = '' - :root { - --mizuki-bg: #fcf8f9; - --mizuki-fg: #191017; - --mizuki-muted: #707d8a; - --mizuki-border: #f2e6ea; - --mizuki-surface: #fdf7f9; - --mizuki-hover: #8165700f; - --mizuki-active: #8165701a; - --mizuki-selection: #ecb7d5; - } + xdg.mimeApps.defaultApplications = { + "text/html" = [ "firefox-devedition.desktop" ]; + "x-scheme-handler/http" = [ "firefox-devedition.desktop" ]; + "x-scheme-handler/https" = [ "firefox-devedition.desktop" ]; + "x-scheme-handler/about" = [ "firefox-devedition.desktop" ]; + "x-scheme-handler/unknown" = [ "firefox-devedition.desktop" ]; + }; + }) - @media (prefers-color-scheme: dark) { - :root { - --mizuki-bg: #191017; - --mizuki-fg: #fafafa; - --mizuki-muted: #a9a9b1; - --mizuki-border: #2c1f2d; - --mizuki-surface: #191017; - --mizuki-hover: #2c1f2d80; - --mizuki-active: #2c1f2d; - --mizuki-selection: #604562; - } - } + (lib.mkIf isDarwin { + home.activation.configureFirefoxDeveloperEdition = lib.hm.dag.entryAfter [ "writeBoundary" ] '' + firefox_dir="$HOME/Library/Application Support/Firefox" + profiles_ini="$firefox_dir/profiles.ini" - #navigator-toolbox, - #TabsToolbar, - #nav-bar, - #PersonalToolbar, - #sidebar-box, - #sidebar-header { - background-color: var(--mizuki-bg) !important; - color: var(--mizuki-fg) !important; - } + mkdir -p "$firefox_dir/Profiles" - #navigator-toolbox { - border-bottom: 1px solid var(--mizuki-border) !important; - } - - #urlbar-background, - #searchbar { - background-color: var(--mizuki-surface) !important; - border-color: var(--mizuki-border) !important; - color: var(--mizuki-fg) !important; - } - - #urlbar[focused] > #urlbar-background, - #searchbar:focus-within { - border-color: var(--mizuki-selection) !important; - box-shadow: 0 0 0 1px var(--mizuki-selection) !important; - } - - .tab-background { - border-radius: 10px 10px 0 0 !important; - } - - .tab-background[selected] { - background-color: var(--mizuki-active) !important; - } - - .tabbrowser-tab:not([selected]):hover .tab-background, - toolbarbutton:hover, - #urlbar:hover > #urlbar-background { - background-color: var(--mizuki-hover) !important; - } - - toolbarbutton[open], - toolbarbutton[checked], - toolbarbutton:active { - background-color: var(--mizuki-active) !important; - } - - #TabsToolbar .tabbrowser-tab, - #urlbar-input, - #identity-icon-label, - toolbarbutton { - color: var(--mizuki-fg) !important; - } - - .tabbrowser-tab:not([selected]) .tab-label, - #sidebar-title { - color: var(--mizuki-muted) !important; - } - ''; - - userContent = '' - @-moz-document url("about:home"), url("about:newtab"), url("about:privatebrowsing") { - body, - .outer-wrapper, - .activity-stream { - background: #fcf8f9 !important; - color: #191017 !important; - } - - @media (prefers-color-scheme: dark) { - body, - .outer-wrapper, - .activity-stream { - background: #191017 !important; - color: #fafafa !important; + profile_info="" + if [ -f "$profiles_ini" ]; then + profile_info=$( + awk ' + function flush() { + if (in_profile && path != "") { + if (is_default == "1") { + print is_relative "|" path + found = 1 + exit + } + if (first == "") { + first = is_relative "|" path + } + } } - } - } + BEGIN { in_profile = 0; is_relative = "1" } + /^\\[Profile[0-9]+\\]$/ { flush(); in_profile = 1; path = ""; is_default = "0"; is_relative = "1"; next } + /^\\[/ { flush(); in_profile = 0; next } + in_profile && /^Path=/ { path = substr($0, 6); next } + in_profile && /^Default=1$/ { is_default = "1"; next } + in_profile && /^IsRelative=/ { is_relative = substr($0, 12); next } + END { + if (!found) { + flush() + } + if (!found && first != "") { + print first + } + } + ' "$profiles_ini" + ) + fi + + if [ -n "$profile_info" ]; then + is_relative="''${profile_info%%|*}" + profile_path="''${profile_info#*|}" + if [ "$is_relative" = "1" ]; then + profile_dir="$firefox_dir/$profile_path" + else + profile_dir="$profile_path" + fi + else + profile_dir="$firefox_dir/${darwinProfilePath}" + cat > "$profiles_ini" <<'EOF' +[Profile0] +Name=${profileName} +IsRelative=1 +Path=${darwinProfilePath} +Default=1 + +[General] +StartWithLastProfile=1 +Version=2 +EOF + fi + + mkdir -p "$profile_dir/chrome" + cp ${pkgs.writeText "firefox-devedition-user.js" userJs} "$profile_dir/user.js" + cp ${pkgs.writeText "firefox-devedition-userChrome.css" userChrome} "$profile_dir/chrome/userChrome.css" + cp ${pkgs.writeText "firefox-devedition-userContent.css" userContent} "$profile_dir/chrome/userContent.css" + ''; + + home.file = { + "Library/Preferences/org.mozilla.firefoxdeveloperedition.plist".text = '' + + + + + EnterprisePoliciesEnabled + + DisableAppUpdate + + ExtensionSettings + + ${extensionId} + + installation_mode + force_installed + install_url + ${extensionUrl} + + + + ''; }; - }; - - xdg.mimeApps.defaultApplications = { - "text/html" = [ "firefox-devedition.desktop" ]; - "x-scheme-handler/http" = [ "firefox-devedition.desktop" ]; - "x-scheme-handler/https" = [ "firefox-devedition.desktop" ]; - "x-scheme-handler/about" = [ "firefox-devedition.desktop" ]; - "x-scheme-handler/unknown" = [ "firefox-devedition.desktop" ]; - }; -} + }) +]