Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 39 additions & 22 deletions nix/modules/home-manager.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
inputs: {config, lib, pkgs, ...}:
let
inputs: { config, lib, pkgs, ... }:
let
inherit (pkgs.stdenv.hostPlatform) system;
package = inputs.self.packages.${system}.default;
configDir =
if pkgs.stdenv.hostPlatform.isDarwin
then "Library/Application\ Support/Firefox/Profiles/"
else ".mozilla/firefox/";

configDirLibreWolf =
if pkgs.stdenv.hostPlatform.isDarwin
then "Library/Application\ Support/LibreWolf/Profiles/"
else ".librewolf/";

cfg = config.textfox;
in {

cfgFirefox = {
enable = true;
profiles."${cfg.profile}" = {
extraConfig = builtins.readFile "${package}/user.js";
extensions = [ config.nur.repos.rycee.firefox-addons.sidebery ];
containersForce = true;
userChrome = lib.mkBefore (builtins.readFile "${package}/chrome/userChrome.css");
};
};
in
{

imports = [
inputs.nur.hmModules.nur
Expand All @@ -21,29 +37,30 @@ in {
type = lib.types.str;
description = "The profile to apply the textfox configuration to";
};
librewolf = lib.mkEnableOption "Enable LibreWolf browser configuration";
};

config = lib.mkIf cfg.enable {
programs.firefox = {
enable = true;
profiles."${cfg.profile}" = {
extraConfig = builtins.readFile "${package}/user.js";
extensions = [ config.nur.repos.rycee.firefox-addons.sidebery ];
containersForce = true;
userChrome = lib.mkBefore (builtins.readFile "${package}/chrome/userChrome.css");
};
};
programs.firefox = cfgFirefox;
programs.librewolf = cfgFirefox // { enable = lib.mkDefault cfg.librewolf; };

home.file =
let
chrome = {
source = pkgs.lib.cleanSourceWith {
src = "${package}/chrome";
filter = path: type:
!(type == "regular" && baseNameOf path == "userChrome.css");
};
recursive = true;
};
in
{
"${configDir}${cfg.profile}/chrome" = chrome;
"${configDirLibreWolf}${cfg.profile}/chrome" = chrome;

home.file."${configDir}${cfg.profile}/chrome" = {
source = pkgs.lib.cleanSourceWith {
src = "${package}/chrome";
filter = path: type:
!(type == "regular" && baseNameOf path == "userChrome.css");
"${configDir}${cfg.profile}/chrome/config.css".text = cfg.configCss;
"${configDirLibreWolf}${cfg.profile}/chrome/config.css".text = cfg.configCss;
};
recursive = true;
};
home.file."${configDir}${cfg.profile}/chrome/config.css" = {
text = cfg.configCss;
};
};
}