Expand xdg config
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -5,30 +5,16 @@ let
|
||||
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
|
||||
{
|
||||
(user: cfg: ({
|
||||
xdg = {
|
||||
enable = true;
|
||||
mimeApps.enable = true;
|
||||
|
||||
inherit cacheHome;
|
||||
inherit configHome;
|
||||
inherit dataHome;
|
||||
inherit stateHome;
|
||||
|
||||
userDirs = {
|
||||
enable = true;
|
||||
extraConfig = {
|
||||
XDG_VM_DIR = xdgVmDir;
|
||||
XDG_GIT_DIR = xdgGitDir;
|
||||
XDG_VM_DIR = "${cfg.home}/VMs";
|
||||
XDG_GIT_DIR = "${cfg.home}/git";
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -41,10 +27,9 @@ in
|
||||
"Pictures" # userDirs.pictures
|
||||
"Templates" # userDirs.templates
|
||||
"Videos" # userDirs.videos
|
||||
"VMs" # xdgVmDir
|
||||
"git" # xdgGitDir
|
||||
"VMs"
|
||||
"git"
|
||||
];
|
||||
}
|
||||
))
|
||||
}))
|
||||
users;
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@
|
||||
useGlobalPkgs = true;
|
||||
sharedModules = [{
|
||||
imports = [
|
||||
./options/home-manager/xdg
|
||||
./options/home-manager/matugen
|
||||
./options/home-manager/theme
|
||||
];
|
||||
|
@@ -247,7 +247,6 @@ in
|
||||
fi
|
||||
|
||||
${cfg.extraConfig}
|
||||
$
|
||||
'';
|
||||
};
|
||||
in
|
||||
|
48
users/common/options/home-manager/xdg/default.nix
Normal file
48
users/common/options/home-manager/xdg/default.nix
Normal file
@@ -0,0 +1,48 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.xdg;
|
||||
in
|
||||
{
|
||||
options.xdg = with lib; with types; {
|
||||
relativeCacheHome = mkOption {
|
||||
type = str;
|
||||
default = ".cache";
|
||||
description = "Relative path to directory holding application caches.";
|
||||
};
|
||||
|
||||
cacheHome = mkOption {
|
||||
default = "${config.home.homeDirectory}/${cfg.relativeCacheHome}";
|
||||
};
|
||||
|
||||
relativeConfigHome = mkOption {
|
||||
type = str;
|
||||
default = ".config";
|
||||
description = "Relative path to directory holding application configurations.";
|
||||
};
|
||||
|
||||
configHome = mkOption {
|
||||
default = "${config.home.homeDirectory}/${cfg.relativeConfigHome}";
|
||||
};
|
||||
|
||||
relativeDataHome = mkOption {
|
||||
type = str;
|
||||
default = ".local/share";
|
||||
description = "Relative path to directory holding application data.";
|
||||
};
|
||||
|
||||
dataHome = mkOption {
|
||||
default = "${config.home.homeDirectory}/${cfg.relativeDataHome}";
|
||||
};
|
||||
|
||||
relativeStateHome = mkOption {
|
||||
type = str;
|
||||
default = ".local/state";
|
||||
description = "Relative path to directory holding application states.";
|
||||
};
|
||||
|
||||
stateHome = mkOption {
|
||||
default = "${config.home.homeDirectory}/${cfg.relativeStateHome}";
|
||||
};
|
||||
};
|
||||
}
|
@@ -50,7 +50,7 @@ in
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
};
|
||||
|
||||
tmpfiles.rules = [ "d ${hmConfig.xdg.dataHome}/gnupg 0700 ${user.name} users -" ];
|
||||
tmpfiles.rules = [ "d ${gpgPath} 0700 ${user.name} users -" ];
|
||||
};
|
||||
|
||||
sops.secrets = {
|
||||
|
@@ -1,5 +1,8 @@
|
||||
{ user ? throw "user argument is required" }: { ... }:
|
||||
{ user ? throw "user argument is required" }: { config, ... }:
|
||||
|
||||
let
|
||||
hmConfig = config.home-manager.users."${user.name}";
|
||||
in
|
||||
{
|
||||
home-manager.users."${user.name}" = {
|
||||
programs.kitty = {
|
||||
@@ -9,6 +12,6 @@
|
||||
'';
|
||||
};
|
||||
|
||||
home.persistence."/cache${user.home}".directories = [ ".cache/kitty" ];
|
||||
home.persistence."/cache${user.home}".directories = [ "${hmConfig.xdg.relativeCacheHome}/kitty" ];
|
||||
};
|
||||
}
|
||||
|
@@ -1,10 +1,13 @@
|
||||
{ user ? throw "user argument is required" }: { pkgs, ... }:
|
||||
{ user ? throw "user argument is required" }: { config, pkgs, ... }:
|
||||
|
||||
let
|
||||
hmConfig = config.home-manager.users."${user.name}";
|
||||
in
|
||||
{
|
||||
home-manager.users."${user.name}" = {
|
||||
home = {
|
||||
packages = with pkgs; [ rofi-wayland ];
|
||||
persistence."/cache${user.home}".directories = [ ".cache/rofi" ];
|
||||
persistence."/cache${user.home}".directories = [ "${hmConfig.xdg.relativeCacheHome}/rofi" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@ in
|
||||
home-manager.users."${user.name}" = {
|
||||
home = {
|
||||
packages = with pkgs; [ swww ];
|
||||
persistence."/cache${user.home}".directories = [ ".cache/swww" ];
|
||||
persistence."/cache${user.home}".directories = [ "${hmConfig.xdg.relativeCacheHome}/swww" ];
|
||||
};
|
||||
|
||||
theme.extraConfig = let name = "theme-swww"; in
|
||||
|
@@ -1,8 +1,11 @@
|
||||
{ user ? throw "user argument is required" }: { pkgs, ... }:
|
||||
{ user ? throw "user argument is required" }: { config, pkgs, ... }:
|
||||
|
||||
let
|
||||
hmConfig = config.home-manager.users."${user.name}";
|
||||
in
|
||||
{
|
||||
home-manager.users."${user.name}" = {
|
||||
theme.enable = true;
|
||||
home.persistence."/persist${user.home}".directories = [ ".config/theme" ];
|
||||
home.persistence."/persist${user.home}".directories = [ "${hmConfig.xdg.relativeConfigHome}/theme" ];
|
||||
};
|
||||
}
|
||||
|
@@ -62,8 +62,8 @@
|
||||
|
||||
home.persistence = {
|
||||
"/persist${user.home}".directories = [ ".config/Code" ];
|
||||
# Bastard: https://github.com/microsoft/vscode/issues/3884
|
||||
# Even bigger Bastards:
|
||||
# Bastard:
|
||||
# - https://github.com/microsoft/vscode/issues/3884
|
||||
# - https://github.com/nix-community/impermanence/issues/22
|
||||
# - https://github.com/nix-community/impermanence/pull/97
|
||||
# "/cache${user.home}".directories = [
|
||||
|
@@ -1,13 +1,16 @@
|
||||
{ user ? throw "user argument is required" }: { ... }:
|
||||
{ user ? throw "user argument is required" }: { config, ... }:
|
||||
|
||||
let
|
||||
hmConfig = config.home-manager.users."${user.name}";
|
||||
in
|
||||
{
|
||||
home-manager.users."${user.name}" = {
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
dotDir = ".config/zsh";
|
||||
dotDir = "${hmConfig.xdg.relativeConfigHome}/zsh";
|
||||
autocd = true;
|
||||
history = {
|
||||
path = "${user.home}/.local/share/zsh/history";
|
||||
path = "${hmConfig.xdg.dataHome}/zsh/history";
|
||||
expireDuplicatesFirst = true;
|
||||
};
|
||||
historySubstringSearch.enable = true;
|
||||
@@ -15,6 +18,6 @@
|
||||
syntaxHighlighting.enable = true;
|
||||
};
|
||||
|
||||
home.persistence."/persist${user.home}".directories = [ ".local/share/zsh" ];
|
||||
home.persistence."/persist${user.home}".directories = [ "${hmConfig.xdg.relativeDataHome}/zsh" ];
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user