TAKE THAT NIX
This commit is contained in:
parent
9972d90400
commit
d08d5a6c9a
93
home.nix
93
home.nix
|
@ -1,89 +1,6 @@
|
|||
{ config, pkgs, lib, ... }: with builtins;
|
||||
# find a way to make this let in statement not here, but in modules/neovim-config.nix
|
||||
let
|
||||
mkSettings = s:
|
||||
concatStringsSep
|
||||
"\n"
|
||||
(attrValues
|
||||
(mapAttrs
|
||||
(k: v:
|
||||
if typeOf v == "bool" then
|
||||
if v then "set ${k}" else "set no${k}"
|
||||
else
|
||||
"set ${k}=${toString v}")
|
||||
s
|
||||
)
|
||||
);
|
||||
boolToString = b: if b then "true" else "false";
|
||||
toLuaTable = as:
|
||||
"{" +
|
||||
( concatStringsSep
|
||||
", "
|
||||
( filter
|
||||
(attr: !isNull attr)
|
||||
( attrValues
|
||||
( mapAttrs
|
||||
(k: v: if v then "${k}=true" else null)
|
||||
as
|
||||
)
|
||||
)
|
||||
)
|
||||
) +
|
||||
"}";
|
||||
mkMapping = {
|
||||
mode,
|
||||
binding,
|
||||
command,
|
||||
nowait?false,
|
||||
silent?false,
|
||||
unique?false,
|
||||
expr?false
|
||||
}:
|
||||
"vim.api.nvim_set_keymap(${toJSON mode}, ${toJSON binding}, ${toJSON command}, ${toLuaTable {inherit nowait silent unique expr;}})";
|
||||
mkMappings =
|
||||
m:
|
||||
"lua << END-OF-KEYBINDS\n" +
|
||||
(concatStringsSep "\n" (map mkMapping m)) +
|
||||
"\nEND-OF-KEYBINDS";
|
||||
mkRuntimes = rs:
|
||||
if rs == [] then "" else
|
||||
"set runtimepath+=" +
|
||||
( concatStringsSep
|
||||
","
|
||||
(map (rt: "${rt}") rs)
|
||||
);
|
||||
mkVimHeader = h: "\"\"\"\"\"\"\"\" ${h} \"\"\"\"\"\"\"\"\"";
|
||||
mkVimSection = section:
|
||||
(concatStringsSep "\n\n\n"
|
||||
(filter
|
||||
(v: !isNull v)
|
||||
(attrValues
|
||||
(mapAttrs
|
||||
(k: v: if "" == v then null else (mkVimHeader k) + "\n" + v)
|
||||
section
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
mkVimSections = sections: concatStringsSep "\n\n\n" (map mkVimSection sections);
|
||||
mkConfig = { settings?{}, mappings?[], runtimes?[], extra?"" }:
|
||||
mkVimSections [
|
||||
{"ADDITIONAL RUNTIME DIRS" = mkRuntimes runtimes;}
|
||||
{"SETTINGS" = mkSettings settings;}
|
||||
{"KEY BINGINGS" = mkMappings mappings;}
|
||||
{"MANUAL SETTINGS" = extra;}
|
||||
];
|
||||
|
||||
# Via https://gist.github.com/nat-418/d76586da7a5d113ab90578ed56069509
|
||||
fromGitHub = ref: repo: pkgs.vimUtils.buildVimPluginFrom2Nix {
|
||||
pname = "${lib.strings.sanitizeDerivationName repo}";
|
||||
version = ref;
|
||||
src = builtins.fetchGit {
|
||||
url = "https://github.com/${repo}.git";
|
||||
ref = ref;
|
||||
};
|
||||
};
|
||||
in
|
||||
{ config, pkgs, lib, ... }:
|
||||
with builtins;
|
||||
with import ./modules/neovim-config.nix { inherit pkgs lib fromGitHub; };
|
||||
{
|
||||
# Home Manager needs a bit of information about you and the paths it should
|
||||
# manage.
|
||||
|
@ -115,6 +32,7 @@ in
|
|||
gimp
|
||||
lollypop
|
||||
skim
|
||||
telegram-desktop
|
||||
picard
|
||||
syncthing
|
||||
armcord
|
||||
|
@ -128,17 +46,18 @@ in
|
|||
apostrophe
|
||||
warp
|
||||
syncplay
|
||||
virt-manager
|
||||
mpv
|
||||
wl-clipboard
|
||||
adw-gtk3
|
||||
] ++ ( with pkgs.gnome; [
|
||||
gnome-boxes
|
||||
gnome-tweaks
|
||||
dconf-editor
|
||||
] ++ ( with pkgs.gnomeExtensions; [
|
||||
night-theme-switcher
|
||||
rounded-window-corners
|
||||
appindicator
|
||||
gsconnect
|
||||
]));
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
{ pkgs, lib, fromGitHub }: with builtins;
|
||||
rec
|
||||
{
|
||||
mkSettings = s:
|
||||
concatStringsSep
|
||||
|
|
Loading…
Reference in a new issue