feat(desktop/firefox): add synced profile support and move desktop config
This commit is contained in:
parent
7e256c954d
commit
02c356494a
6 changed files with 82 additions and 47 deletions
|
@ -1,12 +1,30 @@
|
||||||
{ osConfig, lib, ... }:
|
{ osConfig, lib, ... }:
|
||||||
|
let
|
||||||
|
inherit (builtins) map listToAttrs;
|
||||||
|
inherit (lib.lists) findFirstIndex;
|
||||||
|
cfg = osConfig.desktop.browser.firefox;
|
||||||
|
profileCfg = id: {
|
||||||
|
inherit id;
|
||||||
|
};
|
||||||
|
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 = lib.mkIf (osConfig.desktop.browser == "firefox") {
|
config = lib.mkIf cfg.enable {
|
||||||
home.persistence."/persist/home/rafiq".directories = [ ".mozilla/firefox" ];
|
home.persistence."/persist/home/rafiq".directories = [ ".mozilla/firefox" ];
|
||||||
home.sessionVariables.BROWSER = "firefox";
|
home.sessionVariables.BROWSER = "firefox";
|
||||||
programs.firefox = {
|
programs.firefox = {
|
||||||
enable = true;
|
enable = true;
|
||||||
profiles.rafiq.id = 0;
|
inherit profiles;
|
||||||
profiles.test.id = 1;
|
};
|
||||||
|
stylix.targets.firefox = {
|
||||||
|
profileNames = cfg.syncedProfiles;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
25
modules/nixos/desktop/browser/default.nix
Normal file
25
modules/nixos/desktop/browser/default.nix
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{ 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.";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
|
@ -18,7 +18,6 @@
|
||||||
};
|
};
|
||||||
windowManager = lib.pantheon.mkStrOption;
|
windowManager = lib.pantheon.mkStrOption;
|
||||||
lockscreen = lib.pantheon.mkStrOption;
|
lockscreen = lib.pantheon.mkStrOption;
|
||||||
browser = lib.pantheon.mkStrOption;
|
|
||||||
terminal = lib.pantheon.mkStrOption;
|
terminal = lib.pantheon.mkStrOption;
|
||||||
notification-daemon = lib.pantheon.mkStrOption;
|
notification-daemon = lib.pantheon.mkStrOption;
|
||||||
launcher = lib.pantheon.mkStrOption;
|
launcher = lib.pantheon.mkStrOption;
|
||||||
|
|
28
systems/x86_64-linux/desktop.nix
Normal file
28
systems/x86_64-linux/desktop.nix
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
{
|
||||||
|
desktop = {
|
||||||
|
browser.firefox = {
|
||||||
|
enable = true;
|
||||||
|
syncedProfiles = [
|
||||||
|
"rafiq"
|
||||||
|
"test"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
windowManager = "hyprland";
|
||||||
|
terminal = "ghostty";
|
||||||
|
lockscreen = "hyprlock";
|
||||||
|
notification-daemon = "mako";
|
||||||
|
launcher = "fuzzel";
|
||||||
|
status-bar = "waybar";
|
||||||
|
media-player = "vlc";
|
||||||
|
mainMonitor = {
|
||||||
|
id = "desc:OOO AN-270W04K";
|
||||||
|
scale = "2";
|
||||||
|
resolution = "3840x2160";
|
||||||
|
refresh-rate = "60";
|
||||||
|
};
|
||||||
|
enableSpotifyd = true;
|
||||||
|
enableSteam = true;
|
||||||
|
enableVR = true;
|
||||||
|
enableSunshine = true;
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,5 +1,8 @@
|
||||||
{ lib, ... }:
|
|
||||||
{
|
{
|
||||||
|
imports = [
|
||||||
|
../common.nix
|
||||||
|
../desktop.nix
|
||||||
|
];
|
||||||
|
|
||||||
system = {
|
system = {
|
||||||
hostname = "mellinoe";
|
hostname = "mellinoe";
|
||||||
|
@ -14,20 +17,4 @@
|
||||||
};
|
};
|
||||||
platform = "intel";
|
platform = "intel";
|
||||||
};
|
};
|
||||||
|
|
||||||
desktop = {
|
|
||||||
windowManager = "hyprland";
|
|
||||||
browser = "firefox";
|
|
||||||
terminal = "ghostty";
|
|
||||||
lockscreen = "hyprlock";
|
|
||||||
notification-daemon = "mako";
|
|
||||||
launcher = "fuzzel";
|
|
||||||
status-bar = "waybar";
|
|
||||||
mainMonitor = {
|
|
||||||
id = "BOE 0x088B";
|
|
||||||
scale = "2";
|
|
||||||
resolution = "1920x1280";
|
|
||||||
refresh-rate = "60";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
{
|
{
|
||||||
lib,
|
imports = [
|
||||||
...
|
../common.nix
|
||||||
}:
|
../desktop.nix
|
||||||
{
|
];
|
||||||
imports = lib.singleton ../common.nix;
|
|
||||||
|
|
||||||
system = {
|
system = {
|
||||||
hostname = "nemesis";
|
hostname = "nemesis";
|
||||||
|
@ -20,27 +19,6 @@
|
||||||
gpu = "nvidia";
|
gpu = "nvidia";
|
||||||
};
|
};
|
||||||
|
|
||||||
desktop = {
|
|
||||||
windowManager = "hyprland";
|
|
||||||
browser = "firefox";
|
|
||||||
terminal = "ghostty";
|
|
||||||
lockscreen = "hyprlock";
|
|
||||||
notification-daemon = "mako";
|
|
||||||
launcher = "fuzzel";
|
|
||||||
status-bar = "waybar";
|
|
||||||
media-player = "vlc";
|
|
||||||
mainMonitor = {
|
|
||||||
id = "desc:OOO AN-270W04K";
|
|
||||||
scale = "2";
|
|
||||||
resolution = "3840x2160";
|
|
||||||
refresh-rate = "60";
|
|
||||||
};
|
|
||||||
enableSpotifyd = true;
|
|
||||||
enableSteam = true;
|
|
||||||
enableVR = true;
|
|
||||||
enableSunshine = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
tor = {
|
tor = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue