This commit is contained in:
Jan Bulthuis 2024-07-19 21:54:41 +02:00
parent 16de891fc7
commit 5a3aa36fd0
13 changed files with 120 additions and 26 deletions

View File

@ -16,6 +16,7 @@
# Enabled modules # Enabled modules
modules = { modules = {
base.enable = true; base.enable = true;
power-saving.enable = false;
pipewire.enable = true; pipewire.enable = true;
wpa_supplicant.enable = true; wpa_supplicant.enable = true;
}; };

View File

@ -36,14 +36,6 @@ in
# TODO: Remove everything below, it is here out of convenience and should be elsewhere # TODO: Remove everything below, it is here out of convenience and should be elsewhere
programs.dconf.enable = true; programs.dconf.enable = true;
xdg.portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-gtk
xdg-desktop-portal-wlr
];
};
services.libinput.enable = true; services.libinput.enable = true;
modules.unfree.enable = true; modules.unfree.enable = true;
modules.unfree.allowedPackages = [ modules.unfree.allowedPackages = [

View File

@ -20,6 +20,7 @@ with lib;
./greeter/greetd/tuigreet.nix ./greeter/greetd/tuigreet.nix
./locale/default.nix ./locale/default.nix
./neovim/default.nix ./neovim/default.nix
./power-saving/default.nix
./sound/pipewire.nix ./sound/pipewire.nix
./users/default.nix ./users/default.nix
./unfree/default.nix ./unfree/default.nix

View File

@ -0,0 +1,37 @@
{
lib,
config,
pkgs,
...
}:
with lib;
let
cfg = config.modules.power-saving;
in
{
options.modules.power-saving = {
enable = mkEnableOption "power-saving";
};
config = mkIf cfg.enable {
powerManagement.enable = true;
services.thermald.enable = true;
services.tlp = {
enable = true;
settings = {
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
CPU_MIN_PERF_ON_AC = 0;
CPU_MAX_PERF_ON_AC = 100;
CPU_MIN_PERF_ON_BAT = 0;
CPU_MAX_PERF_ON_BAT = 20;
};
};
};
}

View File

@ -110,7 +110,7 @@ in
background-color: #${colors.bg}; background-color: #${colors.bg};
border-style: none none solid none; border-style: none none solid none;
border-width: ${toString theme.layout.borderSize}px; border-width: ${toString theme.layout.borderSize}px;
border-color: #${colors.unfocused}; border-color: #${colors.border-unfocused};
font-size: 12px; font-size: 12px;
font-family: "${theme.fonts.monospace.name}"; font-family: "${theme.fonts.monospace.name}";
} }

View File

@ -27,6 +27,9 @@ in
}; };
config = { config = {
# Ensure desktop related systemd services (xdg) have access to session variables.
systemd.user.sessionVariables = config.home.sessionVariables;
home.packages = optionals cfg.wayland ( home.packages = optionals cfg.wayland (
with pkgs; with pkgs;
[ [

View File

@ -29,7 +29,7 @@ in
# Update background after rebuild # Update background after rebuild
home.activation = { home.activation = {
river = lib.hm.dag.entryAfter [ "installPackages" ] '' river = lib.hm.dag.entryBetween [ "reloadSystemd" ] [ "installPackages" ] ''
# Close waybar # Close waybar
PATH="${pkgs.procps}/bin:$PATH" $DRY_RUN_CMD pkill waybar PATH="${pkgs.procps}/bin:$PATH" $DRY_RUN_CMD pkill waybar
@ -65,7 +65,7 @@ in
8 8
9 9
]; ];
waylockOptions = "-init-color 0x${colors.bg} -input-color 0x${colors.focused} -fail-color 0x${colors.bg}"; waylockOptions = "-init-color 0x${colors.bg} -input-color 0x${colors.border-focused} -fail-color 0x${colors.bg}";
colors = config.theming.colors; colors = config.theming.colors;
@ -90,7 +90,7 @@ in
border-width = toString config.theming.layout.borderSize; border-width = toString config.theming.layout.borderSize;
background-color = "0x${colors.bg}"; background-color = "0x${colors.bg}";
border-color-focused = "0x${colors.fg}"; border-color-focused = "0x${colors.fg}";
border-color-unfocused = "0x${colors.unfocused}"; # TODO: Change to use named color; border-color-unfocused = "0x${colors.border-unfocused}"; # TODO: Change to use named color;
border-color-urgent = "0x${colors.fg}"; border-color-urgent = "0x${colors.fg}";
spawn = [ spawn = [

View File

@ -5,6 +5,7 @@
... ...
}: }:
with lib;
let let
cfg = config.modules.firefox; cfg = config.modules.firefox;
in in
@ -25,9 +26,9 @@ in
policies = { policies = {
AppAutoUpdate = false; AppAutoUpdate = false;
BlockAboutAddons = true; # BlockAboutAddons = true;
BlockAboutConfig = true; # BlockAboutConfig = true;
BlockAboutProfiles = true; # BlockAboutProfiles = true;
DisableAppUpdate = true; DisableAppUpdate = true;
DisableFeedbackCommands = true; DisableFeedbackCommands = true;
DisableMasterPasswordCreation = true; DisableMasterPasswordCreation = true;
@ -50,11 +51,26 @@ in
profiles.nixos = { profiles.nixos = {
search.default = "DuckDuckGo"; search.default = "DuckDuckGo";
extensions = with pkgs.nur.repos.rycee.firefox-addons; [ ublock-origin ]; extensions = with pkgs.nur.repos.rycee.firefox-addons; [
# firefox-color
ublock-origin
];
# Theming
userChrome = readFile (
pkgs.substituteAll {
src = ./userChrome.css;
colors = config.theming.colorsCSS;
}
);
# userContent = builtins.readFile ./userContent.css;
settings = { settings = {
"browser.tabs.inTitlebar" = 0; "browser.tabs.inTitlebar" = 0;
"extensions.autoDisableScopes" = 0; "extensions.autoDisableScopes" = 0;
"devtools.chrome.enabled" = true;
"devtools.debugger.remote-enabled" = true;
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
}; };
# Force overwriting configuration file # Force overwriting configuration file

View File

@ -0,0 +1 @@
@colors@

View File

@ -34,7 +34,7 @@ in
border = mkLiteral "${toString theme.layout.borderSize}px"; border = mkLiteral "${toString theme.layout.borderSize}px";
}; };
element-text = { element-text = {
highlight = mkLiteral "#${colors.accent}"; highlight = mkLiteral "#${colors.fg-search}";
}; };
inputbar = { inputbar = {
children = mkLiteral "[textbox-search, entry]"; children = mkLiteral "[textbox-search, entry]";
@ -53,7 +53,7 @@ in
padding = mkLiteral "0px 2px"; padding = mkLiteral "0px 2px";
}; };
"element selected" = { "element selected" = {
background-color = mkLiteral "#${colors.unfocused}"; background-color = mkLiteral "#${colors.border-unfocused}";
}; };
}; };
}; };

View File

@ -144,22 +144,49 @@ in
type = types.str; type = types.str;
default = colors.base05; default = colors.base05;
}; };
accent = mkOption { bg-status = mkOption {
type = types.str; type = types.str;
default = colors.base09; default = colors.base01;
}; };
focused = mkOption { fg-status = mkOption {
type = types.str; type = types.str;
default = cfg.colors.fg; default = colors.base04;
}; };
unfocused = mkOption { bg-selection = mkOption {
type = types.str; type = types.str;
default = colors.base02; default = colors.base02;
}; };
alert = mkOption { bg-highlight = mkOption {
type = types.str; type = types.str;
default = "ffffff"; # TODO: Derive color from theme default = colors.base03;
}; };
fg-search = mkOption {
type = types.str;
default = colors.base0A;
};
accent = mkOption {
type = types.str;
default = colors.base0D;
};
border-focused = mkOption {
type = types.str;
default = cfg.colors.fg;
};
border-unfocused = mkOption {
type = types.str;
default = cfg.colors.bg-selection;
};
};
colorsCSS = mkOption {
type = types.lines;
default =
":root {\n"
+ concatStrings (
map (color: " --nix-color-${color.name}: #${color.value};\n") (attrsToList cfg.colors)
)
+ "}\n\n";
description = "Colors as css variables";
}; };
layout = { layout = {

View File

@ -1,6 +1,6 @@
# How Jan likes his linux to be configured # How Jan likes his linux to be configured
{ config, ... }: { config, pkgs, ... }:
{ {
config = { config = {
@ -29,6 +29,7 @@
discord.enable = true; discord.enable = true;
qutebrowser.enable = true; qutebrowser.enable = true;
neovim.enable = true; neovim.enable = true;
rofi-rbw.enable = true;
# Programming languages # Programming languages
nix.enable = true; nix.enable = true;
@ -57,5 +58,20 @@
flavor = "frappe"; flavor = "frappe";
}; };
}; };
# TODO: Remove everything below, it is here out of convenience and should be elsewhere
xdg.portal = {
enable = true;
config.common.default = [
"wlr"
"gtk"
];
extraPortals = with pkgs; [
xdg-desktop-portal-gtk
xdg-desktop-portal-wlr
];
};
}; };
} }