praca nad stworzeniem defaultowego profilu, z którego kolejne profile będą dziedziczyć.
This commit is contained in:
23
hosts/garand-laptop/home/codium/lib.nix
Normal file
23
hosts/garand-laptop/home/codium/lib.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{...}: {
|
||||
# This function merges a default profile with specific overrides
|
||||
# It takes the default profile settings, extensions, keybindings, etc., and merges them with profile-specific ones
|
||||
mergeProfile = defaultProfile: specificProfile: {
|
||||
extensions = (defaultProfile.extensions or []) ++ (specificProfile.extensions or []);
|
||||
|
||||
userSettings = (defaultProfile.userSettings or {}) // (specificProfile.userSettings or {});
|
||||
|
||||
# Merge keybindings by concatenating arrays
|
||||
keybindings = (defaultProfile.keybindings or []) ++ (specificProfile.keybindings or []);
|
||||
|
||||
languageSnippets =
|
||||
(defaultProfile.languageSnippets or {})
|
||||
// (let
|
||||
snippets = specificProfile.languageSnippets or {};
|
||||
mergeSnippets = language: defaultSnippets:
|
||||
if builtins.hasAttr language snippets
|
||||
then defaultSnippets // snippets.${language}
|
||||
else defaultSnippets;
|
||||
in
|
||||
builtins.mapAttrs mergeSnippets (defaultProfile.languageSnippets or {}));
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user