feat(desktop): move firefox config to homes and use home-manager modules
This commit is contained in:
parent
844e6b263e
commit
6897ad63c9
8 changed files with 95 additions and 90 deletions
|
@ -3,6 +3,7 @@
|
||||||
inputs,
|
inputs,
|
||||||
osConfig,
|
osConfig,
|
||||||
lib,
|
lib,
|
||||||
|
system,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
@ -26,6 +27,7 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
config = mkMerge [
|
config = mkMerge [
|
||||||
|
(mkIf osConfig.desktop.enable (import ./desktop { inherit lib inputs system; }))
|
||||||
(mkIf osConfig.desktop.enable {
|
(mkIf osConfig.desktop.enable {
|
||||||
home.persistence."/persist/home/rafiq".directories = [
|
home.persistence."/persist/home/rafiq".directories = [
|
||||||
"docs"
|
"docs"
|
||||||
|
|
39
homes/x86_64-linux/rafiq/desktop/browser.nix
Normal file
39
homes/x86_64-linux/rafiq/desktop/browser.nix
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
inputs,
|
||||||
|
system,
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (builtins) map listToAttrs;
|
||||||
|
inherit (lib.lists) findFirstIndex;
|
||||||
|
inherit (inputs.nur.legacyPackages.${system}.repos.rycee) firefox-addons;
|
||||||
|
profiles = listToAttrs (
|
||||||
|
map (name: {
|
||||||
|
inherit name;
|
||||||
|
# If there are duplicate profile names, findFirstIndex will cause issues.
|
||||||
|
value = profileCfg (findFirstIndex (x: x == name) null syncedProfiles);
|
||||||
|
}) syncedProfiles
|
||||||
|
);
|
||||||
|
syncedProfiles = [
|
||||||
|
"rafiq"
|
||||||
|
"test"
|
||||||
|
];
|
||||||
|
profileCfg = id: {
|
||||||
|
inherit id;
|
||||||
|
settings."extensions.autoDisableScopes" = 0; # Auto enable extensions
|
||||||
|
extensions = {
|
||||||
|
force = true;
|
||||||
|
packages = with firefox-addons; [
|
||||||
|
darkreader
|
||||||
|
gesturefy
|
||||||
|
sponsorblock
|
||||||
|
ublock-origin
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
home.sessionVariables.BROWSER = "firefox";
|
||||||
|
programs.firefox = { inherit profiles; };
|
||||||
|
stylix.targets.firefox.profileNames = syncedProfiles;
|
||||||
|
}
|
12
homes/x86_64-linux/rafiq/desktop/default.nix
Normal file
12
homes/x86_64-linux/rafiq/desktop/default.nix
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
inputs,
|
||||||
|
system,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (lib) mkMerge;
|
||||||
|
in
|
||||||
|
mkMerge [
|
||||||
|
(import ./browser.nix { inherit lib inputs system; })
|
||||||
|
]
|
|
@ -1,52 +0,0 @@
|
||||||
{
|
|
||||||
osConfig,
|
|
||||||
lib,
|
|
||||||
inputs,
|
|
||||||
system,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
inherit (builtins) map listToAttrs;
|
|
||||||
inherit (lib) mkIf;
|
|
||||||
inherit (lib.lists) findFirstIndex;
|
|
||||||
inherit (inputs.nur.legacyPackages.${system}.repos.rycee) firefox-addons;
|
|
||||||
cfg = osConfig.desktop.browser.firefox;
|
|
||||||
profileCfg = id: {
|
|
||||||
inherit id;
|
|
||||||
#TODO: move this into an option?
|
|
||||||
settings = {
|
|
||||||
"extensions.autoDisableScopes" = 0; # Auto enable extensions
|
|
||||||
};
|
|
||||||
extensions = {
|
|
||||||
force = true;
|
|
||||||
packages = with firefox-addons; [
|
|
||||||
darkreader
|
|
||||||
gesturefy
|
|
||||||
sponsorblock
|
|
||||||
ublock-origin
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
profiles = listToAttrs (
|
|
||||||
map (name: {
|
|
||||||
inherit name;
|
|
||||||
# If there are duplicate profile names, findFirstIndex will cause issues.
|
|
||||||
# We sanitize the input in nixosModules.desktop to avoid this.
|
|
||||||
value = profileCfg (findFirstIndex (x: x == name) null cfg.syncedProfiles);
|
|
||||||
}) cfg.syncedProfiles
|
|
||||||
);
|
|
||||||
in
|
|
||||||
{
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
home.persistence."/persist/home/rafiq".directories = [ ".mozilla/firefox" ];
|
|
||||||
home.sessionVariables.BROWSER = "firefox";
|
|
||||||
programs.firefox = {
|
|
||||||
enable = true;
|
|
||||||
inherit profiles;
|
|
||||||
};
|
|
||||||
stylix.targets.firefox = {
|
|
||||||
profileNames = cfg.syncedProfiles;
|
|
||||||
colorTheme.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,12 +1,27 @@
|
||||||
{ config, ... }:
|
{ config, lib, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib) mkOption;
|
||||||
|
inherit (lib.types) listOf str;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
|
options = {
|
||||||
|
persistDirs = mkOption {
|
||||||
|
type = listOf str;
|
||||||
|
default = [ ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
home.persistence."/persist/home/${config.snowfallorg.user.name}" = {
|
home.persistence."/persist/home/${config.snowfallorg.user.name}" = {
|
||||||
directories = [
|
directories = config.persistDirs;
|
||||||
".ssh"
|
|
||||||
".config/sops/age"
|
|
||||||
];
|
|
||||||
allowOther = true;
|
allowOther = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
persistDirs = [
|
||||||
|
".ssh"
|
||||||
|
".config/sops/age"
|
||||||
|
];
|
||||||
|
|
||||||
home.stateVersion = "24.11";
|
home.stateVersion = "24.11";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
{ lib, config, ... }:
|
|
||||||
let
|
|
||||||
inherit (lib) mkEnableOption mkOption;
|
|
||||||
inherit (lib.types) listOf str;
|
|
||||||
inherit (lib.lists) allUnique;
|
|
||||||
cfg = config.desktop.browser;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.desktop.browser = {
|
|
||||||
firefox = {
|
|
||||||
enable = mkEnableOption "";
|
|
||||||
syncedProfiles = mkOption {
|
|
||||||
type = listOf str;
|
|
||||||
default = [ ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config.assertions = [
|
|
||||||
{
|
|
||||||
assertion = allUnique cfg.firefox.syncedProfiles;
|
|
||||||
message = "desktop.browser.firefox.syncedProfiles has duplicate elements.";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
20
modules/nixos/desktop/browser/firefox/default.nix
Normal file
20
modules/nixos/desktop/browser/firefox/default.nix
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{ lib, config, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
mkEnableOption
|
||||||
|
mkIf
|
||||||
|
singleton
|
||||||
|
;
|
||||||
|
cfg = config.desktop.browser.firefox;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.desktop.browser.firefox.enable = mkEnableOption "";
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
home-manager.sharedModules = singleton {
|
||||||
|
persistDirs = singleton ".mozilla/firefox";
|
||||||
|
programs.firefox.enable = true;
|
||||||
|
stylix.targets.firefox.colorTheme.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,13 +1,7 @@
|
||||||
{
|
{
|
||||||
desktop = {
|
desktop = {
|
||||||
enable = true;
|
enable = true;
|
||||||
browser.firefox = {
|
browser.firefox.enable = true;
|
||||||
enable = true;
|
|
||||||
syncedProfiles = [
|
|
||||||
"rafiq"
|
|
||||||
"test"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
lockscreen.hyprlock.enable = true;
|
lockscreen.hyprlock.enable = true;
|
||||||
windowManager = "hyprland";
|
windowManager = "hyprland";
|
||||||
terminal = "ghostty";
|
terminal = "ghostty";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue