refactor(modules): rewrite some modules; add dconf

This commit is contained in:
Artur Manuel 2025-01-21 15:45:42 +00:00
commit 7938019d55
15 changed files with 131 additions and 59 deletions

View file

@ -1,5 +1,5 @@
{pkgs, ...}: {
alqueva.fonts = {
alqueva.system.fonts = {
enable = true;
names = {
sansSerif = ["Liberation Sans"];

View file

@ -18,16 +18,18 @@
};
alqueva = {
xonsh = {
programs = {
libvirt.enable = true;
direnv.enable = true;
git.enable = true;
openssh.enable = true;
};
shells.xonsh = {
enable = true;
package = pkgs.amadaluzian-xonsh;
};
libvirt.enable = true;
direnv.enable = true;
git.enable = true;
pipewire.enable = true;
openssh.enable = true;
river.enable = true;
system.pipewire.enable = true;
wms.river.enable = true;
};
xdg.mime = {

View file

@ -1,5 +1,5 @@
{pkgs, ...}: {
alqueva.fonts = {
alqueva.system.fonts = {
names = {
sansSerif = ["Fira Sans"];
monospace = ["Fira Mono"];

View file

@ -1,8 +1,4 @@
{
pkgs,
lib,
...
}: let
{pkgs, ...}: let
themes = {
gtk-theme = pkgs.nightfox-gtk-theme.override {
colorVariants = ["dark"];
@ -14,21 +10,15 @@
cursor-theme = pkgs.simp1e-cursors;
};
in {
programs.dconf = {
alqueva.system.dconf = {
enable = true;
profiles.user.databases = [
{
settings = {
"org/gnome/desktop/interface" = {
color-scheme = "prefer-dark";
cursor-size = lib.gvariant.mkUint32 24;
cursor-theme = "Simp1e-Adw-Dark";
icon-theme = "Colloid-Dark";
gtk-theme = "Nightfox-Purple-Dark-Compact-Carbon";
};
};
}
];
luminosity = "dark";
theme = "Nightfox-Purple-Dark-Compact-Carbon";
icon.theme = "Colloid-Dark";
cursor = {
size = 24;
theme = "Simp1e-Adw-Dark";
};
};
qt = {

View file

@ -1,10 +1,20 @@
{pkgs, ...}: let
{
pkgs,
config,
lib,
...
}: let
ezaOptions = "--colour=always --icons=never --group-directories-first --octal-permissions";
cfg = config.alqueva.shells.aliases;
in {
config = {
options.alqueva.shells.aliases = {
enable = (lib.mkEnableOption "default aliases") // {default = true;};
};
config = lib.mkIf cfg.enable {
environment = {
shellAliases = builtins.mapAttrs (_: v: "${v} ${ezaOptions}") {
l = "eza -alh";
la = "eza -ah";
ls = "eza";
ll = "eza -l";
};

71
hosts/shared/dconf.nix Normal file
View file

@ -0,0 +1,71 @@
{
config,
lib,
...
}: let
cfg = config.alqueva.system.dconf;
inherit (lib) types;
in {
options.alqueva.system.dconf = {
enable = lib.mkEnableOption "configuration with DConf";
luminosity = lib.mkOption {
type = types.enum ["dark" "light"];
default = "dark";
description = "The luminosity you want to use for GTK.";
apply = lum: "prefer-${lum}";
};
theme = lib.mkOption {
type = types.str;
description = "The theme you want to use for GTK.";
default = "";
};
icon.theme = lib.mkOption {
type = types.str;
description = "The icon theme you want to use for GTK.";
default = "";
};
cursor = {
theme = lib.mkOption {
type = types.str;
description = "The cursor theme you want to use for GTK.";
default = "";
};
size = lib.mkOption {
type = types.ints.u32;
default = 24;
description = "The cursor size you want to use for GTK.";
apply = size: lib.gvariant.mkUint32 size;
};
};
extraDconfPackages = lib.mkOption {
type = types.listOf types.package;
description = "Extra packages to install for DConf.";
default = [];
};
extraDconfSettings = lib.mkOption {
type = types.attrsOf types.anything;
description = "Extra settings you want to apply to DConf.";
default = {};
};
};
config = lib.mkIf cfg.enable {
programs.dconf = {
profiles.user.databases = [
{
settings =
{
"org/gnome/desktop/interface" = {
color-scheme = cfg.luminosity;
cursor-size = cfg.cursor.size;
cursor-theme = cfg.cursor.theme;
icon-theme = cfg.icon.theme;
gtk-theme = cfg.theme;
};
}
// cfg.extraDconfSettings;
}
];
packages = cfg.extraDconfPackages;
};
};
}

View file

@ -11,5 +11,6 @@
./support.nix
./users.nix
./xonsh.nix
./dconf.nix
];
}

View file

@ -3,9 +3,9 @@
lib,
...
}: let
cfg = config.alqueva.direnv;
cfg = config.alqueva.programs.direnv;
in {
options.alqueva.direnv = {
options.alqueva.programs.direnv = {
enable = lib.mkEnableOption "direnv";
};

View file

@ -4,7 +4,7 @@
lib,
...
}: let
cfg = config.alqueva.fonts;
cfg = config.alqueva.system.fonts;
inherit (lib) types mkOption;
mkStringsOption = default: letterform:
mkOption {
@ -19,7 +19,7 @@
description = "The packages you want to use for your ${letterform} fonts.";
};
in {
options.alqueva.fonts = {
options.alqueva.system.fonts = {
enable = lib.mkEnableOption "" // {description = "Whether you want to use this fonts module.";};
packages =
{

View file

@ -3,9 +3,9 @@
lib,
...
}: let
cfg = config.alqueva.git;
cfg = config.alqueva.programs.git;
in {
options.alqueva.git = {
options.alqueva.programs.git = {
enable = lib.mkEnableOption "git";
};

View file

@ -4,9 +4,9 @@
pkgs,
...
}: let
cfg = config.alqueva.libvirt;
cfg = config.alqueva.programs.libvirt;
in {
options.alqueva.libvirt = {
options.alqueva.programs.libvirt = {
enable = lib.mkEnableOption "libvirt";
};

View file

@ -4,9 +4,9 @@
lib,
...
}: let
cfg = config.alqueva.pipewire;
cfg = config.alqueva.system.pipewire;
in {
options.alqueva.pipewire = {
options.alqueva.system.pipewire = {
enable = lib.mkEnableOption "PipeWire";
};

View file

@ -4,9 +4,9 @@
pkgs,
...
}: let
cfg = config.alqueva.river;
cfg = config.alqueva.wms.river;
in {
options.alqueva.river = {
options.alqueva.wms.river = {
enable = lib.mkEnableOption "River";
};

View file

@ -3,9 +3,9 @@
lib,
...
}: let
cfg = config.alqueva.openssh;
cfg = config.alqueva.programs.openssh;
in {
options.alqueva.openssh = {
options.alqueva.programs.openssh = {
enable = lib.mkEnableOption "OpenSSH";
};

View file

@ -4,15 +4,12 @@
lib,
...
}: let
cfg = config.alqueva.xonsh;
attrsToPyDict = attrs: (lib.pipe attrs [
(builtins.mapAttrs (n: v: "aliases['${n}'] = '${v}'"))
builtins.attrValues
(lib.concatStringsSep "\n")
(s: s + "\n")
]);
cfg = config.alqueva.shells.xonsh;
aliasesToPyDict = aliases:
lib.concatStringsSep "\n"
(lib.mapAttrsToList (k: v: "aliases['${k}'] = '${v}'") aliases);
in {
options.alqueva.xonsh = {
options.alqueva.shells.xonsh = {
enable = lib.mkEnableOption "xonsh";
package = lib.mkPackageOption pkgs "xonsh" {};
};
@ -20,13 +17,14 @@ in {
config = lib.mkIf cfg.enable {
programs = {
xonsh = {
config =
"from xonsh.xontribs import get_xontribs\n"
+ attrsToPyDict config.environment.shellAliases
+ ''
for xontrib in get_xontribs():
xontrib load @(xontrib)
'';
config = ''
from xonsh.xontribs import get_xontribs
${aliasesToPyDict config.environment.shellAliases}
for xontrib in get_xontribs():
xontrib load @(xontrib)
'';
inherit (cfg) package;
enable = true;
};