From 17928bd2eabb2dca1c870c8af3f43eeac96e181b Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Wed, 2 Aug 2023 13:41:53 +0300 Subject: 2023-08-02 --- modules/common/common/default.nix | 1 + modules/common/common/nix/default.nix | 2 ++ modules/common/common/xdg.nix | 53 +++++++++++++++++++++++++++++++++++ modules/common/git.nix | 11 +++----- 4 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 modules/common/common/xdg.nix (limited to 'modules/common') 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; }; }; -- cgit 1.4.1