Add basic theme config
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
|
||||
let
|
||||
users = lib.attrsets.filterAttrs (name: config: config.isNormalUser) config.users.users;
|
||||
in {
|
||||
in
|
||||
{
|
||||
programs.fuse.userAllowOther = lib.mkIf (users != [ ]) true;
|
||||
|
||||
systemd.tmpfiles.rules = lib.mkIf (users != [ ]) (
|
||||
@@ -14,12 +15,14 @@ in {
|
||||
lib.attrsets.mapAttrsToList (user: config: "d /cache${config.home} 0700 ${user} users -") users
|
||||
);
|
||||
|
||||
home-manager.users = lib.attrsets.mapAttrs (user: config: ({
|
||||
imports = [ inputs.impermanence.nixosModules.home-manager.impermanence ];
|
||||
home-manager.users = lib.attrsets.mapAttrs
|
||||
(user: config: ({
|
||||
imports = [ inputs.impermanence.nixosModules.home-manager.impermanence ];
|
||||
|
||||
home.persistence = {
|
||||
"/persist${config.home}".allowOther = true;
|
||||
"/cache${config.home}".allowOther = true;
|
||||
};
|
||||
})) users;
|
||||
home.persistence = {
|
||||
"/persist${config.home}".allowOther = true;
|
||||
"/cache${config.home}".allowOther = true;
|
||||
};
|
||||
}))
|
||||
users;
|
||||
}
|
||||
|
@@ -3,15 +3,18 @@
|
||||
let
|
||||
users = lib.attrsets.filterAttrs (name: config: config.isNormalUser) config.users.users;
|
||||
sopsKeyPath = ".config/sops-nix/key.txt";
|
||||
in {
|
||||
home-manager.users = lib.attrsets.mapAttrs (user: config: ({
|
||||
imports = [ inputs.sops-nix.homeManagerModules.sops ];
|
||||
in
|
||||
{
|
||||
home-manager.users = lib.attrsets.mapAttrs
|
||||
(user: config: ({
|
||||
imports = [ inputs.sops-nix.homeManagerModules.sops ];
|
||||
|
||||
sops.age.keyFile = "/persist${config.home}/${sopsKeyPath}";
|
||||
sops.age.keyFile = "/persist${config.home}/${sopsKeyPath}";
|
||||
|
||||
home = {
|
||||
persistence."/persist${config.home}".files = [ sopsKeyPath ];
|
||||
sessionVariables.SOPS_AGE_KEY_FILE = "${config.home}/${sopsKeyPath}";
|
||||
};
|
||||
})) users;
|
||||
home = {
|
||||
persistence."/persist${config.home}".files = [ sopsKeyPath ];
|
||||
sessionVariables.SOPS_AGE_KEY_FILE = "${config.home}/${sopsKeyPath}";
|
||||
};
|
||||
}))
|
||||
users;
|
||||
}
|
||||
|
@@ -2,43 +2,49 @@
|
||||
|
||||
let
|
||||
users = lib.attrsets.filterAttrs (name: config: config.isNormalUser) config.users.users;
|
||||
in {
|
||||
home-manager.users = lib.attrsets.mapAttrs (user: cfg: (let
|
||||
cacheHome = "${cfg.home}/.cache";
|
||||
configHome = "${cfg.home}/.config";
|
||||
dataHome = "${cfg.home}/.local/share";
|
||||
stateHome = "${cfg.home}/.local/state";
|
||||
xdgVmDir = "${cfg.home}/VMs";
|
||||
xdgGitDir = "${cfg.home}/git";
|
||||
in {
|
||||
xdg = {
|
||||
enable = true;
|
||||
mimeApps.enable = true;
|
||||
in
|
||||
{
|
||||
home-manager.users = lib.attrsets.mapAttrs
|
||||
(user: cfg: (
|
||||
let
|
||||
cacheHome = "${cfg.home}/.cache";
|
||||
configHome = "${cfg.home}/.config";
|
||||
dataHome = "${cfg.home}/.local/share";
|
||||
stateHome = "${cfg.home}/.local/state";
|
||||
xdgVmDir = "${cfg.home}/VMs";
|
||||
xdgGitDir = "${cfg.home}/git";
|
||||
in
|
||||
{
|
||||
xdg = {
|
||||
enable = true;
|
||||
mimeApps.enable = true;
|
||||
|
||||
inherit cacheHome;
|
||||
inherit configHome;
|
||||
inherit dataHome;
|
||||
inherit stateHome;
|
||||
inherit cacheHome;
|
||||
inherit configHome;
|
||||
inherit dataHome;
|
||||
inherit stateHome;
|
||||
|
||||
userDirs = {
|
||||
enable = true;
|
||||
extraConfig = {
|
||||
XDG_VM_DIR = xdgVmDir;
|
||||
XDG_GIT_DIR = xdgGitDir;
|
||||
userDirs = {
|
||||
enable = true;
|
||||
extraConfig = {
|
||||
XDG_VM_DIR = xdgVmDir;
|
||||
XDG_GIT_DIR = xdgGitDir;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
home.persistence."/persist${cfg.home}".directories = [
|
||||
"Desktop" # userDirs.desktop
|
||||
"Documents" # userDirs.documents
|
||||
"Downloads" # userDirs.download
|
||||
"Music" # userDirs.music
|
||||
"Pictures" # userDirs.pictures
|
||||
"Templates" # userDirs.templates
|
||||
"Videos" # userDirs.videos
|
||||
"VMs" # xdgVmDir
|
||||
"git" # xdgGitDir
|
||||
];
|
||||
})) users;
|
||||
home.persistence."/persist${cfg.home}".directories = [
|
||||
"Desktop" # userDirs.desktop
|
||||
"Documents" # userDirs.documents
|
||||
"Downloads" # userDirs.download
|
||||
"Music" # userDirs.music
|
||||
"Pictures" # userDirs.pictures
|
||||
"Templates" # userDirs.templates
|
||||
"Videos" # userDirs.videos
|
||||
"VMs" # xdgVmDir
|
||||
"git" # xdgGitDir
|
||||
];
|
||||
}
|
||||
))
|
||||
users;
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
{
|
||||
imports = [
|
||||
inputs.home-manager.nixosModules.default
|
||||
./options.nix
|
||||
./options
|
||||
./configs/persist
|
||||
./configs/sops
|
||||
./configs/xdg
|
||||
@@ -14,6 +14,11 @@
|
||||
backupFileExtension = "bak";
|
||||
useGlobalPkgs = true;
|
||||
sharedModules = [{
|
||||
imports = [
|
||||
./options/home-manager/matugen
|
||||
./options/home-manager/theme
|
||||
];
|
||||
|
||||
home.stateVersion = "24.05";
|
||||
systemd.user.startServices = "sd-switch";
|
||||
nix.settings = config.nix.settings;
|
||||
|
@@ -11,18 +11,9 @@ let
|
||||
type = nullOr str;
|
||||
description = "Full name of the user.";
|
||||
};
|
||||
|
||||
options.wallpaper = mkOption {
|
||||
type = path;
|
||||
description = "Path to the user's wallpaper.";
|
||||
};
|
||||
|
||||
options.base16Scheme = mkOption {
|
||||
type = path;
|
||||
description = "Base16 scheme to use for the user's color palette.";
|
||||
};
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = with lib; with types; {
|
||||
users.users = mkOption {
|
||||
type = attrsOf (submodule userOptions);
|
23
users/common/options/home-manager/matugen/default.nix
Normal file
23
users/common/options/home-manager/matugen/default.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.programs.matugen;
|
||||
in
|
||||
{
|
||||
# https://github.com/Theaninova/matugen/blob/add-home-manager-module/hm-module.nix
|
||||
options.programs.matugen = with lib; with types; {
|
||||
enable = mkEnableOption "matugen";
|
||||
package = mkPackageOption pkgs "matugen" { };
|
||||
settings = mkOption {
|
||||
type = attrs;
|
||||
description = "Settings to write to config.toml.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
xdg.configFile."matugen/config.toml".source = lib.mkIf (cfg.settings != null) (
|
||||
(pkgs.formats.toml { }).generate "matugen" cfg.settings
|
||||
);
|
||||
};
|
||||
}
|
267
users/common/options/home-manager/theme/default.nix
Normal file
267
users/common/options/home-manager/theme/default.nix
Normal file
@@ -0,0 +1,267 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.theme;
|
||||
in
|
||||
{
|
||||
# https://github.com/Theaninova/TheaninovOS/blob/master/modules/home-manager/theme/md3-evo.nix
|
||||
options.theme = with lib; with types; {
|
||||
enable = mkEnableOption "theme";
|
||||
|
||||
configDir = mkOption {
|
||||
type = str;
|
||||
default = "${config.xdg.configHome}/theme";
|
||||
description = "The path to the theme config directory.";
|
||||
};
|
||||
|
||||
wallpaper = mkOption {
|
||||
type = path;
|
||||
description = "The path to the default wallpaper";
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = lines;
|
||||
default = "";
|
||||
description = "Extra configuration lines to add to the theme script.";
|
||||
};
|
||||
|
||||
flavour = mkOption {
|
||||
type = enum [
|
||||
"content"
|
||||
"expressive"
|
||||
"fidelity"
|
||||
"fruit-salad"
|
||||
"monochrome"
|
||||
"neutral"
|
||||
"rainbow"
|
||||
"tonal-spot"
|
||||
];
|
||||
default = "tonal-spot";
|
||||
description = "The flavour of the theme.";
|
||||
};
|
||||
|
||||
contrast = mkOption {
|
||||
type = numbers.between (-1) 1;
|
||||
default = 0;
|
||||
description = "Use a modified contrast.";
|
||||
};
|
||||
|
||||
opacity = mkOption {
|
||||
type = numbers.between 0 1;
|
||||
default = 1;
|
||||
description = "The opacity of apps.";
|
||||
};
|
||||
|
||||
radius = mkOption {
|
||||
type = ints.unsigned;
|
||||
default = 24;
|
||||
description = "The radius of corners.";
|
||||
};
|
||||
|
||||
padding = mkOption {
|
||||
type = ints.unsigned;
|
||||
default = 12;
|
||||
description = "The padding of windows.";
|
||||
};
|
||||
|
||||
blur = mkOption {
|
||||
type = ints.unsigned;
|
||||
default = 0;
|
||||
description = "The blur amount of windows.";
|
||||
};
|
||||
|
||||
color = {
|
||||
semantic = {
|
||||
blend = mkOption {
|
||||
type = bool;
|
||||
default = false;
|
||||
description = "Blend the colors.";
|
||||
};
|
||||
|
||||
danger = mkOption {
|
||||
type = str;
|
||||
default = "#ff0000";
|
||||
description = "The color of danger.";
|
||||
};
|
||||
|
||||
warning = mkOption {
|
||||
type = str;
|
||||
default = "#ffff00";
|
||||
description = "The color of warning.";
|
||||
};
|
||||
|
||||
success = mkOption {
|
||||
type = str;
|
||||
default = "#00ff00";
|
||||
description = "The color of success.";
|
||||
};
|
||||
|
||||
info = mkOption {
|
||||
type = str;
|
||||
default = "#0000ff";
|
||||
description = "The color of info.";
|
||||
};
|
||||
};
|
||||
|
||||
syntax = {
|
||||
blend = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Blend the colors.";
|
||||
};
|
||||
|
||||
keywords = mkOption {
|
||||
type = str;
|
||||
default = "#ff8000";
|
||||
description = "The color of keywords.";
|
||||
};
|
||||
|
||||
functions = mkOption {
|
||||
type = str;
|
||||
default = "#0000ff";
|
||||
description = "The color of functions.";
|
||||
};
|
||||
|
||||
properties = mkOption {
|
||||
type = str;
|
||||
default = "#ff00ff";
|
||||
description = "The color of properties.";
|
||||
};
|
||||
|
||||
constants = mkOption {
|
||||
type = str;
|
||||
default = "#ff00ff";
|
||||
description = "The color of constants.";
|
||||
};
|
||||
|
||||
strings = mkOption {
|
||||
type = str;
|
||||
default = "#00ff00";
|
||||
description = "The color of variables.";
|
||||
};
|
||||
|
||||
numbers = mkOption {
|
||||
type = str;
|
||||
default = "#00ffff";
|
||||
description = "The color of numbers.";
|
||||
};
|
||||
|
||||
structures = mkOption {
|
||||
type = str;
|
||||
default = "#ffff00";
|
||||
description = "The color of structures.";
|
||||
};
|
||||
|
||||
types = mkOption {
|
||||
type = str;
|
||||
default = "#00ffff";
|
||||
description = "The color of types.";
|
||||
};
|
||||
};
|
||||
|
||||
ansi = {
|
||||
blend = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Blend the colors.";
|
||||
};
|
||||
|
||||
red = mkOption {
|
||||
type = str;
|
||||
default = "#ff0000";
|
||||
description = "The color of red.";
|
||||
};
|
||||
|
||||
green = mkOption {
|
||||
type = str;
|
||||
default = "#00ff00";
|
||||
description = "The color of green.";
|
||||
};
|
||||
|
||||
yellow = mkOption {
|
||||
type = str;
|
||||
default = "#ffff00";
|
||||
description = "The color of yellow.";
|
||||
};
|
||||
|
||||
orange = mkOption {
|
||||
type = str;
|
||||
default = "#ff8000";
|
||||
description = "The color of orange.";
|
||||
};
|
||||
|
||||
blue = mkOption {
|
||||
type = str;
|
||||
default = "#0000ff";
|
||||
description = "The color of blue.";
|
||||
};
|
||||
|
||||
magenta = mkOption {
|
||||
type = str;
|
||||
default = "#ff00ff";
|
||||
description = "The color of magenta.";
|
||||
};
|
||||
|
||||
cyan = mkOption {
|
||||
type = str;
|
||||
default = "#00ffff";
|
||||
description = "The color of cyan.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
cursor = {
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = pkgs.gnome.adwaita-icon-theme;
|
||||
description = "The package providing the cursor theme.";
|
||||
};
|
||||
|
||||
name = mkOption {
|
||||
type = str;
|
||||
default = "Adwaita";
|
||||
description = "The cursor name within the package.";
|
||||
};
|
||||
|
||||
size = mkOption {
|
||||
type = ints.positive;
|
||||
default = 32;
|
||||
description = "The cursor size.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
name = "theme-init";
|
||||
init = pkgs.writeShellApplication {
|
||||
inherit name;
|
||||
runtimeInputs = with pkgs; [ coreutils-full ];
|
||||
text =
|
||||
let
|
||||
wallpaperPath = "${cfg.configDir}/wallpaper";
|
||||
in
|
||||
''
|
||||
if [ ! -L "${wallpaperPath}" ]; then
|
||||
ln -sf "${cfg.wallpaper}" "${wallpaperPath}"
|
||||
fi
|
||||
|
||||
${cfg.extraConfig}
|
||||
$
|
||||
'';
|
||||
};
|
||||
in
|
||||
lib.mkIf cfg.enable {
|
||||
home = {
|
||||
packages = [ init ];
|
||||
|
||||
pointerCursor = {
|
||||
inherit (cfg.cursor) package name size;
|
||||
gtk.enable = true;
|
||||
x11.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
wayland.windowManager.hyprland.settings.exec-once = "${init}/bin/${name}";
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user