diff options
-rw-r--r-- | modules/common/common/default.nix | 1 | ||||
-rw-r--r-- | modules/common/common/nix/default.nix | 2 | ||||
-rw-r--r-- | modules/common/common/xdg.nix | 53 | ||||
-rw-r--r-- | modules/common/git.nix | 11 | ||||
-rw-r--r-- | modules/darwin/common/default.nix | 1 | ||||
-rw-r--r-- | modules/darwin/common/xdg.nix | 25 | ||||
-rw-r--r-- | modules/nixos/common/xdg.nix | 38 | ||||
-rw-r--r-- | nixosConfigurations/eonwe/default.nix | 1 |
8 files changed, 97 insertions, 35 deletions
diff --git a/modules/common/common/default.nix b/modules/common/common/default.nix index 8849ad9..a516ef3 100644 --- a/modules/common/common/default.nix +++ b/modules/common/common/default.nix @@ -8,5 +8,6 @@ _: { ./secrets.nix ./shell ./users.nix + ./xdg.nix ]; } diff --git a/modules/common/common/nix/default.nix b/modules/common/common/nix/default.nix index e516500..29d6b2d 100644 --- a/modules/common/common/nix/default.nix +++ b/modules/common/common/nix/default.nix @@ -97,6 +97,8 @@ with lib; { patches = final.patches ++ [./patches/tdesktop-no-ads.patch]; }); + inherit (pkgsPr 246555 "sha256-GQJ0hFyQIKQXekdDX59v5y65AYxiU8W2y+dktXEsN/g=") qzdl; + inherit (pkgsPr 245433 "sha256-7duAw2pGwXrX4cgUioNSypmuiNR/hCUVywhKL6jW3qE=") openmw; } // (let diff --git a/modules/common/common/xdg.nix b/modules/common/common/xdg.nix new file mode 100644 index 0000000..04ca544 --- /dev/null +++ b/modules/common/common/xdg.nix @@ -0,0 +1,53 @@ +{ + config, + lib, + ... +}: +with lib; { + imports = let + withBase = a: ["nixfiles" "modules" "common" "xdg" a]; + in [ + (mkAliasOptionModule ["dirs" "cache"] (withBase "cacheHome")) + (mkAliasOptionModule ["dirs" "config"] (withBase "configHome")) + (mkAliasOptionModule ["dirs" "data"] (withBase "dataHome")) + (mkAliasOptionModule ["dirs" "state"] (withBase "stateHome")) + (mkAliasOptionModule ["userDirs"] (withBase "userDirs")) + ]; + + options.nixfiles.modules.common.xdg = { + cacheHome = mkOption { + type = types.str; + default = "${config.hm.home.homeDirectory}/.cache"; + }; + configHome = mkOption { + type = types.str; + default = "${config.hm.home.homeDirectory}/.config"; + }; + dataHome = mkOption { + type = types.str; + default = "${config.hm.home.homeDirectory}/.local/share"; + }; + stateHome = mkOption { + type = types.str; + default = "${config.hm.home.homeDirectory}/.local/state"; + }; + userDirs = mkOption { + type = types.attrs; + default = let + inherit (config.my) home; + tmp = home + "/tmp"; + in { + enable = true; + + desktop = tmp; + documents = "${home}/doc"; + download = tmp; + music = tmp; + pictures = tmp; + publicShare = "${home}/share"; + templates = tmp; + videos = tmp; + }; + }; + }; +} diff --git a/modules/common/git.nix b/modules/common/git.nix index 0bd7720..2e5c834 100644 --- a/modules/common/git.nix +++ b/modules/common/git.nix @@ -13,23 +13,20 @@ in { mkEnableOption "Git client"; config = mkIf cfg.client.enable { - secrets = let - # HACK MacOS doesn't support XDG specifications. - configHome = "${config.my.home}/.config"; - in { + secrets = { glab-cli-config = { file = "${inputs.self}/secrets/glab-cli-config"; - path = "${configHome}/glab-cli/config.yml"; + path = "${config.dirs.config}/glab-cli/config.yml"; owner = localUsername; }; gh-hosts = { file = "${inputs.self}/secrets/gh-hosts"; - path = "${configHome}/gh/hosts.yml"; + path = "${config.dirs.config}/gh/hosts.yml"; owner = localUsername; }; hut = { file = "${inputs.self}/secrets/hut"; - path = "${configHome}/hut/config"; + path = "${config.dirs.config}/hut/config"; owner = localUsername; }; }; diff --git a/modules/darwin/common/default.nix b/modules/darwin/common/default.nix index b03e431..4d4824f 100644 --- a/modules/darwin/common/default.nix +++ b/modules/darwin/common/default.nix @@ -7,5 +7,6 @@ _: { ./secrets.nix ./shell.nix ./users.nix + ./xdg.nix ]; } diff --git a/modules/darwin/common/xdg.nix b/modules/darwin/common/xdg.nix new file mode 100644 index 0000000..9e798ad --- /dev/null +++ b/modules/darwin/common/xdg.nix @@ -0,0 +1,25 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.nixfiles.modules.common.xdg; +in { + hm.home.sessionVariables = with cfg; + { + XDG_CACHE_HOME = cacheHome; + XDG_CONFIG_HOME = configHome; + XDG_DATA_HOME = dataHome; + XDG_STATE_HOME = stateHome; + } + // (with userDirs; { + XDG_DOCUMENTS_DIR = documents; + XDG_DOWNLOAD_DIR = download; + XDG_MUSIC_DIR = music; + XDG_PICTURES_DIR = pictures; + XDG_PUBLICSHARE_DIR = publicShare; + XDG_TEMPLATES_DIR = templates; + XDG_VIDEOS_DIR = videos; + }); +} diff --git a/modules/nixos/common/xdg.nix b/modules/nixos/common/xdg.nix index b02c0ae..b46c350 100644 --- a/modules/nixos/common/xdg.nix +++ b/modules/nixos/common/xdg.nix @@ -4,41 +4,23 @@ this, ... }: -with lib; { - imports = let - withBase = s: ["home-manager" "users" my.username "xdg" s]; - in [ - (mkAliasOptionModule ["dirs" "cache"] (withBase "cacheHome")) - (mkAliasOptionModule ["dirs" "config"] (withBase "configHome")) - (mkAliasOptionModule ["dirs" "data"] (withBase "dataHome")) - (mkAliasOptionModule ["dirs" "state"] (withBase "stateHome")) - (mkAliasOptionModule ["userDirs"] (withBase "userDirs")) - ]; - +with lib; let + cfg = config.nixfiles.modules.common.xdg; +in { xdg.portal = mkIf this.isHeadful { enable = true; }; hm.xdg = mkMerge [ - { + (with cfg; { enable = true; - userDirs = let - inherit (config.my) home; - tmp = home + "/tmp"; - in { - enable = true; - - desktop = tmp; - documents = "${home}/doc"; - download = tmp; - music = tmp; - pictures = tmp; - publicShare = "${home}/share"; - templates = tmp; - videos = tmp; - }; - } + inherit cacheHome; + inherit configHome; + inherit dataHome; + inherit stateHome; + inherit userDirs; + }) (mkIf this.isHeadful { mimeApps = { enable = true; diff --git a/nixosConfigurations/eonwe/default.nix b/nixosConfigurations/eonwe/default.nix index a5d3278..a8dd167 100644 --- a/nixosConfigurations/eonwe/default.nix +++ b/nixosConfigurations/eonwe/default.nix @@ -40,6 +40,7 @@ with lib; { vcmi vial xonotic + qzdl ]; programs = { |