Update hardcoded xdg paths

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2024-07-31 20:14:13 +00:00
parent f6d1a13d76
commit d5fa60df4c
6 changed files with 41 additions and 18 deletions

View File

@@ -7,6 +7,9 @@
pkgs, pkgs,
... ...
}: }:
let
hmConfig = config.home-manager.users.${username};
in
{ {
virtualisation.docker.rootless = { virtualisation.docker.rootless = {
enable = true; enable = true;
@@ -26,7 +29,9 @@
}; };
}; };
environment.persistence."/persist".users.${username}.directories = [ ".local/share/docker" ]; environment.persistence."/persist".users.${username}.directories = [
"${hmConfig.xdg.relativeDataHome}/docker"
];
home-manager.users.${username}.home.packages = with pkgs; [ docker-compose ]; home-manager.users.${username}.home.packages = with pkgs; [ docker-compose ];
} }

View File

@@ -9,7 +9,8 @@
}: }:
let let
userConfig = config.users.users.${username}; userConfig = config.users.users.${username};
sopsKeyPath = ".config/sops-nix/key.txt"; hmConfig = config.home-manager.users.${username};
sopsKeyPath = "${hmConfig.xdg.relativeConfigHome}/sops-nix/key.txt";
in in
{ {
environment.persistence."/persist".users.${username}.files = [ sopsKeyPath ]; environment.persistence."/persist".users.${username}.files = [ sopsKeyPath ];

View File

@@ -9,24 +9,28 @@ in
{ {
relativeCacheHome = mkOption { relativeCacheHome = mkOption {
type = str; type = str;
readOnly = true;
default = ".cache"; default = ".cache";
description = "Relative path to directory holding application caches."; description = "Relative path to directory holding application caches.";
}; };
relativeConfigHome = mkOption { relativeConfigHome = mkOption {
type = str; type = str;
readOnly = true;
default = ".config"; default = ".config";
description = "Relative path to directory holding application configurations."; description = "Relative path to directory holding application configurations.";
}; };
relativeDataHome = mkOption { relativeDataHome = mkOption {
type = str; type = str;
readOnly = true;
default = ".local/share"; default = ".local/share";
description = "Relative path to directory holding application data."; description = "Relative path to directory holding application data.";
}; };
relativeStateHome = mkOption { relativeStateHome = mkOption {
type = str; type = str;
readOnly = true;
default = ".local/state"; default = ".local/state";
description = "Relative path to directory holding application states."; description = "Relative path to directory holding application states.";
}; };
@@ -34,42 +38,49 @@ in
userDirs = { userDirs = {
relativeDesktop = mkOption { relativeDesktop = mkOption {
type = str; type = str;
readOnly = true;
default = "Desktop"; default = "Desktop";
description = "Relative path to the Desktop directory."; description = "Relative path to the Desktop directory.";
}; };
relativeDocuments = mkOption { relativeDocuments = mkOption {
type = str; type = str;
readOnly = true;
default = "Documents"; default = "Documents";
description = "Relative path to the Documents directory."; description = "Relative path to the Documents directory.";
}; };
relativeDownload = mkOption { relativeDownload = mkOption {
type = str; type = str;
readOnly = true;
default = "Downloads"; default = "Downloads";
description = "Relative path to the Downloads directory."; description = "Relative path to the Downloads directory.";
}; };
relativeMusic = mkOption { relativeMusic = mkOption {
type = str; type = str;
readOnly = true;
default = "Music"; default = "Music";
description = "Relative path to the Music directory."; description = "Relative path to the Music directory.";
}; };
relativePictures = mkOption { relativePictures = mkOption {
type = str; type = str;
readOnly = true;
default = "Pictures"; default = "Pictures";
description = "Relative path to the Pictures directory."; description = "Relative path to the Pictures directory.";
}; };
relativeTemplates = mkOption { relativeTemplates = mkOption {
type = str; type = str;
readOnly = true;
default = "Templates"; default = "Templates";
description = "Relative path to the Templates directory."; description = "Relative path to the Templates directory.";
}; };
relativeVideos = mkOption { relativeVideos = mkOption {
type = str; type = str;
readOnly = true;
default = "Videos"; default = "Videos";
description = "Relative path to the Videos directory."; description = "Relative path to the Videos directory.";
}; };

View File

@@ -1,7 +1,10 @@
{ {
username ? throw "username argument is required", username ? throw "username argument is required",
}: }:
{ ... }: { config, ... }:
let
hmConfig = config.home-manager.users.${username};
in
{ {
programs.chromium = { programs.chromium = {
enable = true; enable = true;
@@ -19,8 +22,8 @@
}; };
environment.persistence = { environment.persistence = {
"/persist".users.${username}.directories = [ ".config/chromium" ]; "/persist".users.${username}.directories = [ "${hmConfig.xdg.relativeConfigHome}/chromium" ];
"/cache".users.${username}.directories = [ ".cache/chromium" ]; "/cache".users.${username}.directories = [ "${hmConfig.xdg.relativeCacheHome}/chromium" ];
}; };
home-manager.users.${username} = { home-manager.users.${username} = {

View File

@@ -7,10 +7,13 @@
pkgs, pkgs,
... ...
}: }:
let
hmConfig = config.home-manager.users.${username};
in
{ {
environment.persistence = { environment.persistence = {
"/persist".users.${username}.directories = [ ".mozilla" ]; "/persist".users.${username}.directories = [ ".mozilla" ];
"/cache".users.${username}.directories = [ ".cache/mozilla" ]; "/cache".users.${username}.directories = [ "${hmConfig.xdg.relativeCacheHome}/mozilla" ];
}; };
home-manager.users.${username} = { home-manager.users.${username} = {

View File

@@ -12,20 +12,20 @@ let
in in
{ {
environment.persistence = { environment.persistence = {
"/persist".users.${username}.directories = [ ".config/Code" ]; "/persist".users.${username}.directories = [ "${hmConfig.xdg.relativeConfigHome}/Code" ];
# Bastard: https://github.com/microsoft/vscode/issues/3884 # Bastard: https://github.com/microsoft/vscode/issues/3884
"/cache".users.${username}.directories = [ "/cache".users.${username}.directories = [
".config/Code/Cache" "${hmConfig.xdg.relativeConfigHome}/Code/Cache"
".config/Code/CachedConfigurations" "${hmConfig.xdg.relativeConfigHome}/Code/CachedConfigurations"
".config/Code/CachedData" "${hmConfig.xdg.relativeConfigHome}/Code/CachedData"
".config/Code/CachedExtensionVSIXs" "${hmConfig.xdg.relativeConfigHome}/Code/CachedExtensionVSIXs"
".config/Code/CachedExtensions" "${hmConfig.xdg.relativeConfigHome}/Code/CachedExtensions"
".config/Code/CachedProfilesData" "${hmConfig.xdg.relativeConfigHome}/Code/CachedProfilesData"
".config/Code/Code Cache" "${hmConfig.xdg.relativeConfigHome}/Code/Code Cache"
".config/Code/DawnCache" "${hmConfig.xdg.relativeConfigHome}/Code/DawnCache"
".config/Code/GPUCache" "${hmConfig.xdg.relativeConfigHome}/Code/GPUCache"
".config/Code/Service Worker/CacheStorage" "${hmConfig.xdg.relativeConfigHome}/Code/Service Worker/CacheStorage"
".config/Code/Service Worker/ScriptCache" "${hmConfig.xdg.relativeConfigHome}/Code/Service Worker/ScriptCache"
]; ];
}; };