Update browsers

This commit is contained in:
DashieTM 2024-09-29 12:48:39 +02:00
parent 10adafe703
commit b72d409a5a
15 changed files with 262 additions and 67 deletions

View file

@ -14,7 +14,7 @@ let
summaryAppend = name: ''
echo "- [${name}](${name}.md)" >> src/SUMMARY.md
'';
system = (build_systems ../example/.)."example".options;
system = (build_systems { root = ../example/.; })."example".options;
makeOptionsDocPrograms = name: pkgs.nixosOptionsDoc { options = system.mods.${name}; };
conf = makeOptionsDoc system.conf;
paths = builtins.readDir ../modules/programs;

View file

@ -24,7 +24,7 @@
outputs =
{ ... }@inputs:
{
nixosConfigurations = inputs.dashNix.dashNixLib.build_systems ./.;
nixosConfigurations = inputs.dashNix.dashNixLib.build_systems { root = ./.; };
};
nixConfig = {

37
flake.lock generated
View file

@ -1337,6 +1337,22 @@
"type": "github"
}
},
"nixpkgs_22": {
"locked": {
"lastModified": 1726937504,
"narHash": "sha256-bvGoiQBvponpZh8ClUcmJ6QnsNKw0EMrCQJARK3bI1c=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "9357f4f23713673f310988025d9dc261c20e70c6",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1716330097,
@ -1670,7 +1686,8 @@
"reset-plugins": "reset-plugins",
"sops-nix": "sops-nix",
"stable": "stable",
"stylix": "stylix"
"stylix": "stylix",
"zen-browser": "zen-browser"
}
},
"rust-overlay": {
@ -2064,6 +2081,24 @@
"repo": "xdg-desktop-portal-hyprland",
"type": "github"
}
},
"zen-browser": {
"inputs": {
"nixpkgs": "nixpkgs_22"
},
"locked": {
"lastModified": 1727287465,
"narHash": "sha256-XQAf5M593WmxgaXagtkci/H9DA3jSVx1TJk6F3X5VQo=",
"owner": "MarceColl",
"repo": "zen-browser-flake",
"rev": "96f1b5d80bf7360cb77c9b521f388324f18383a0",
"type": "github"
},
"original": {
"owner": "MarceColl",
"repo": "zen-browser-flake",
"type": "github"
}
}
},
"root": "root",

View file

@ -28,6 +28,8 @@
url = "github:JakeStanger/ironbar?ref=3a1c60442382f970cdb7669814b6ef3594d9f048";
};
zen-browser.url = "github:MarceColl/zen-browser-flake";
stylix.url = "github:danth/stylix";
base16.url = "github:SenchoPens/base16.nix";

View file

@ -7,6 +7,7 @@
additionalHomeConfig,
homeMods,
additionalHomeMods,
additionalInputs,
root,
...
}:
@ -22,7 +23,7 @@
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
inherit inputs root;
inherit inputs root additionalInputs;
};
users.${config.conf.username} = {

View file

@ -3,35 +3,6 @@
pkgs,
self,
lib,
additionalMods ? {
nixos = [ ];
home = [ ];
},
mods ? {
nixos = [
inputs.home-manager.nixosModules.home-manager
inputs.stylix.nixosModules.stylix
../base
../home
../modules
];
home = [
inputs.anyrun.homeManagerModules.default
inputs.ironbar.homeManagerModules.default
inputs.oxicalc.homeManagerModules.default
inputs.oxishut.homeManagerModules.default
inputs.oxinoti.homeManagerModules.default
inputs.oxidash.homeManagerModules.default
inputs.oxipaste.homeManagerModules.default
inputs.hyprdock.homeManagerModules.default
inputs.hyprland.homeManagerModules.default
inputs.reset.homeManagerModules.default
inputs.nix-flatpak.homeManagerModules.nix-flatpak
inputs.sops-nix.homeManagerModules.sops
inputs.dashvim.homeManagerModules.dashvim
../modules
];
},
...
}:
{
@ -52,8 +23,7 @@
# Example usage
:::{.example}
```nix
nixosConfigurations =
(build_systems [ "nixos" ] ./.);
nixosConfigurations = build_systems { root = ./.; };
```
:::
*/
@ -65,7 +35,40 @@
# in
build_systems =
root:
{
root,
additionalMods ? {
nixos = [ ];
home = [ ];
},
mods ? {
nixos = [
inputs.home-manager.nixosModules.home-manager
inputs.stylix.nixosModules.stylix
../base
../home
../modules
];
home = [
inputs.anyrun.homeManagerModules.default
inputs.ironbar.homeManagerModules.default
inputs.oxicalc.homeManagerModules.default
inputs.oxishut.homeManagerModules.default
inputs.oxinoti.homeManagerModules.default
inputs.oxidash.homeManagerModules.default
inputs.oxipaste.homeManagerModules.default
inputs.hyprdock.homeManagerModules.default
inputs.hyprland.homeManagerModules.default
inputs.reset.homeManagerModules.default
inputs.nix-flatpak.homeManagerModules.nix-flatpak
inputs.sops-nix.homeManagerModules.sops
inputs.dashvim.homeManagerModules.dashvim
../modules
];
},
additionalInputs ? { },
...
}:
builtins.listToAttrs (
map
(name: {
@ -89,6 +92,7 @@
hostName = name;
homeMods = mods.home;
additionalHomeMods = additionalMods.home;
additionalInputs = additionalInputs;
};
modules =
[ mod ]

View file

@ -0,0 +1,23 @@
{
lib,
config,
options,
pkgs,
...
}:
{
options.mods.browser.brave = {
enable = lib.mkOption {
default = false;
example = true;
type = lib.types.bool;
description = "Enables brave";
};
# TODO configure brave
};
config = lib.mkIf config.mods.browser.brave.enable (
lib.optionalAttrs (options ? home.packages) {
home.packages = with pkgs; [ brave ];
}
);
}

View file

@ -0,0 +1,23 @@
{
lib,
config,
options,
pkgs,
...
}:
{
options.mods.browser.chromium = {
enable = lib.mkOption {
default = false;
example = true;
type = lib.types.bool;
description = "Enables chromium";
};
# TODO configure chromium
};
config = lib.mkIf config.mods.browser.chromium.enable (
lib.optionalAttrs (options ? home.packages) {
home.packages = with pkgs; [ chromium ];
}
);
}

View file

@ -0,0 +1,8 @@
{
imports = [
./firefox.nix
./zen.nix
./chromium.nix
./brave.nix
];
}

View file

@ -6,10 +6,10 @@
...
}:
{
options.mods.firefox = {
options.mods.browser.firefox = {
enable = lib.mkOption {
default = true;
example = false;
default = false;
example = true;
type = lib.types.bool;
description = "Enables firefox";
};
@ -62,22 +62,45 @@
type = with lib.types; listOf package;
description = "Firefox extensions (from nur)";
};
profiles = lib.mkOption {
default = [
{
name = "${config.conf.username}";
value = {
isDefault = true;
id = 0;
extensions = config.mods.browser.firefox.extensions;
};
}
{
name = "special";
value = {
isDefault = false;
id = 1;
extensions = config.mods.browser.firefox.extensions;
};
}
];
example = [
{
name = "custom";
value = {
isDefault = true;
id = 0;
extensions = config.mods.browser.firefox.extensions;
};
}
];
type = with lib.types; listOf (attrsOf anything);
description = "Firefox extensions (from nur)";
};
};
config = lib.mkIf config.mods.firefox.enable (
config = lib.mkIf config.mods.browser.firefox.enable (
lib.optionalAttrs (options ? programs.firefox.profiles) {
programs.firefox = {
enable = true;
policies = config.mods.firefox.configuration;
profiles.${config.conf.username} = {
isDefault = true;
id = 0;
extensions = config.mods.firefox.extensions;
};
profiles."special" = {
isDefault = false;
id = 1;
extensions = config.mods.firefox.extensions;
};
policies = config.mods.browser.firefox.configuration;
profiles = builtins.listToAttrs config.mods.browser.firefox.profiles;
};
}
);

View file

@ -0,0 +1,35 @@
{
lib,
config,
options,
system,
inputs,
...
}:
{
options.mods.browser.zen = {
enable = lib.mkOption {
default = false;
example = true;
type = lib.types.bool;
description = "Enables the zen browser";
};
optimization = lib.mkOption {
default = "specific";
example = "generic";
type =
with lib.types;
(enum [
"specific"
"generic"
]);
description = "Enables the zen browser";
};
# TODO configure zen
};
config = lib.mkIf config.mods.browser.zen.enable (
lib.optionalAttrs (options ? home.packages) {
home.packages = [ inputs.zen-browser.packages."${system}".${config.mods.browser.zen.optimization} ];
}
);
}

View file

@ -3,9 +3,9 @@
./acpid.nix
./basePackages.nix
./bluetooth.nix
./browser
./coding.nix
./drives.nix
./firefox.nix
./fish.nix
./flatpak.nix
./gaming.nix

View file

@ -3,6 +3,7 @@
options,
config,
pkgs,
inputs,
...
}:
{
@ -68,11 +69,17 @@
type = with lib.types; nullOr package;
description = "The email client";
};
additionalBrowser = lib.mkOption {
default = pkgs.brave;
example = null;
type = with lib.types; nullOr package;
description = "Additional browser -> second to firefox, the only installed browser if firefox is disabled";
browser = lib.mkOption {
default = inputs.zen-browser.packages.${pkgs.system}.specific;
example = "firefox";
type =
with lib.types;
nullOr (
either (enum [
"firefox"
]) package
);
description = "The browser (the enum variants have preconfigured modules)";
};
};
config = lib.optionalAttrs (options ? home.packages) {
@ -87,8 +94,9 @@
(lib.mkIf (!isNull config.mods.homePackages.matrixClient) config.mods.homePackages.matrixClient)
(lib.mkIf (!isNull config.mods.homePackages.mailClient) config.mods.homePackages.mailClient)
(lib.mkIf (
!isNull config.mods.homePackages.additionalBrowser
) config.mods.homePackages.additionalBrowser)
# NOTE: This should be package, but nix doesn't have that....
builtins.isAttrs config.mods.homePackages.browser && !isNull config.mods.homePackages.browser
) config.mods.homePackages.browser)
adw-gtk3
bat
brightnessctl
@ -129,10 +137,19 @@
};
};
programs =
if config.mods.homePackages.useDefaultPackages then
config.mods.homePackages.specialPrograms
else
config.mods.homePackages.specialPrograms;
config.mods.homePackages.specialPrograms
// (
if config.mods.homePackages.browser == "firefox" then
{
firefox = {
enable = true;
policies = config.mods.browser.firefox.configuration;
profiles = builtins.listToAttrs config.mods.browser.firefox.profiles;
};
}
else
{ }
);
services =
if config.mods.homePackages.useDefaultPackages then
config.mods.homePackages.specialServices

View file

@ -5,6 +5,17 @@
pkgs,
...
}:
let
browserName =
if (builtins.isString config.mods.homePackages.browser) then
config.mods.homePackages.browser
else if
config.mods.homePackages.browser ? meta && config.mods.homePackages.browser.meta ? mainProgram
then
config.mods.homePackages.browser.meta.mainProgram
else
config.mods.homePackages.browser.pname;
in
{
options.mods = {
hyprland = {
@ -106,7 +117,7 @@
bindm = [
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
"$mod, mouse:273, resizeactive"
];
bind = [
@ -116,8 +127,10 @@
''$mod SUPERSHIFTALT,S,exec,grim -c -g "2560,0 3440x1440" - | wl-copy''
# regular programs
"$mod SUPER,F,exec,firefox"
"$mod SUPERSHIFT,F,exec,firefox -p special"
"$mod SUPER,F,exec,${browserName}"
(lib.mkIf (
browserName == "firefox" || browserName == "zen"
) "$mod SUPERSHIFT,F,exec,${browserName} -p special")
"$mod SUPER,T,exec,kitty -1"
"$mod SUPER,E,exec,nautilus -w"
"$mod SUPER,N,exec,neovide"

View file

@ -6,6 +6,17 @@
options,
...
}:
let
browserName =
if (builtins.isString config.mods.homePackages.browser) then
config.mods.homePackages.browser
else if
config.mods.homePackages.browser ? meta && config.mods.homePackages.browser.meta ? mainProgram
then
config.mods.homePackages.browser.meta.mainProgram
else
config.mods.homePackages.browser.pname;
in
{
options.mods.mime = {
enable = lib.mkOption {
@ -72,7 +83,7 @@
description = "Browser X mime handlers";
};
browserApplications = lib.mkOption {
default = [ "firefox" ];
default = [ "${browserName}" ];
example = [ ];
type = with lib.types; listOf str;
description = "Applications used for handling browser mime types";