diff --git a/submodules/default.nix b/submodules/default.nix index b7c62fb..a0d2a31 100644 --- a/submodules/default.nix +++ b/submodules/default.nix @@ -2,6 +2,12 @@ let beets-cfg = config.my.beets-config; tmux-cfg = config.my.tmux-config; + mkIfFlakeLoc = condition: errorMsg: value: + (lib.mkIf (condition && + !(config.my.flakeLocation == null && + (lib.warn ("Didn't set 'my.flakeLocation', " + errorMsg) true))) + value); + flakeSubmodules = "${config.my.flakeLocation}/submodules"; in { options = { @@ -19,30 +25,24 @@ in home = { file = { - ".config/beets/config.yaml" = lib.mkIf (beets-cfg.enable && !( - config.my.flakeLocation == null && - (lib.warn - "Didn't set 'my.flakeLocation', I won't symlink beets' config.yaml into place" - true) - )) { - source = config.lib.file.mkOutOfStoreSymlink - "${config.my.flakeLocation}/submodules/beets-config/config.yaml"; - # Recursive only applies to directories. If false, do one - # symlink (which is the directory). Otherwise, do every file - # recursively - # - # recursive = true; - }; + ".config/beets/config.yaml" = (mkIfFlakeLoc beets-cfg.enable + "I won't symlink beets' config.yaml into place" + { + source = config.lib.file.mkOutOfStoreSymlink + "${config.my.flakeLocation}/submodules/beets-config/config.yaml"; + # Recursive only applies to directories. If false, do one + # symlink (which is the directory). Otherwise, do every file + # recursively + # + # recursive = true; + }); - ".config/tmux/tmux.conf" = lib.mkIf (tmux-cfg.enable && !( - config.my.flakeLocation == null && - (lib.warn - "Didn't set 'my.flakeLocation', I won't symlink tmux's tmux.conf into place" - true) - )) { - source = config.lib.file.mkOutOfStoreSymlink - "${config.my.flakeLocation}/submodules/tmux-config/tmux.conf"; - }; + ".config/tmux/tmux.conf" = (mkIfFlakeLoc tmux-cfg.enable + "I won't symlink tmux's tmux.conf into place" + { + source = config.lib.file.mkOutOfStoreSymlink + "${flakeSubmodules}/submodules/tmux-config/tmux.conf"; + }); }; }; };