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, ...}: { {pkgs, ...}: {
alqueva.fonts = { alqueva.system.fonts = {
enable = true; enable = true;
names = { names = {
sansSerif = ["Liberation Sans"]; sansSerif = ["Liberation Sans"];

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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