run nixfmt
This commit is contained in:
@@ -1,4 +1,12 @@
|
||||
{ config, lib, pkgs, inputs, self, ... }: {
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
self,
|
||||
...
|
||||
}:
|
||||
{
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
imports = [
|
||||
../gnome
|
||||
@@ -83,7 +91,10 @@
|
||||
home-manager.enable = true;
|
||||
bat = {
|
||||
enable = true;
|
||||
extraPackages = with pkgs.bat-extras; [ batdiff batwatch ];
|
||||
extraPackages = with pkgs.bat-extras; [
|
||||
batdiff
|
||||
batwatch
|
||||
];
|
||||
config = {
|
||||
pager = "less -FR";
|
||||
};
|
||||
@@ -277,8 +288,13 @@
|
||||
bright_white = "#ffffff";
|
||||
};
|
||||
component_style = {
|
||||
playback_metadata = { fg = "#8abeb7"; };
|
||||
playback_progress_bar = { bg = "#1d1f21"; fg = "#c5c8c6"; };
|
||||
playback_metadata = {
|
||||
fg = "#8abeb7";
|
||||
};
|
||||
playback_progress_bar = {
|
||||
bg = "#1d1f21";
|
||||
fg = "#c5c8c6";
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
@@ -299,6 +315,39 @@
|
||||
host = "https://bin.freun.dev";
|
||||
auth_token_file = "${config.xdg.configHome}/hastebin/auth_token";
|
||||
clipboard_command = "${pkgs.wl-copy-both}/bin/wl-copy";
|
||||
default_renderers =
|
||||
let
|
||||
code = [
|
||||
"js"
|
||||
"ts"
|
||||
"jsx"
|
||||
"tsx"
|
||||
"rs"
|
||||
"nix"
|
||||
"cr"
|
||||
"ecr"
|
||||
"rb"
|
||||
"erb"
|
||||
"yaml"
|
||||
"yml"
|
||||
"json"
|
||||
"toml"
|
||||
"html"
|
||||
"xml"
|
||||
"css"
|
||||
"scss"
|
||||
"sass"
|
||||
"less"
|
||||
"sql"
|
||||
"sh"
|
||||
];
|
||||
in
|
||||
lib.listToAttrs (
|
||||
lib.map (name: {
|
||||
inherit name;
|
||||
value = "hl";
|
||||
}) code
|
||||
);
|
||||
};
|
||||
};
|
||||
zed-editor = {
|
||||
@@ -334,23 +383,68 @@
|
||||
paperwm = {
|
||||
enable = true;
|
||||
winprops = [
|
||||
{ wm_class = "vivaldi-stable"; preferredWidth = "67%"; }
|
||||
{ wm_class = "yubioath-flutter"; scratch_layer = true; }
|
||||
{ wm_class = "signal"; scratch_layer = true; }
|
||||
{ wm_class = "Slack"; scratch_layer = true; }
|
||||
{ wm_class = "Supersonic"; scratch_layer = true; }
|
||||
{ wm_class = "io.github.seadve.Kooha"; scratch_layer = true; }
|
||||
{ wm_class = "/.*/"; preferredWidth = "33"; }
|
||||
{
|
||||
wm_class = "vivaldi-stable";
|
||||
preferredWidth = "67%";
|
||||
}
|
||||
{
|
||||
wm_class = "yubioath-flutter";
|
||||
scratch_layer = true;
|
||||
}
|
||||
{
|
||||
wm_class = "signal";
|
||||
scratch_layer = true;
|
||||
}
|
||||
{
|
||||
wm_class = "Slack";
|
||||
scratch_layer = true;
|
||||
}
|
||||
{
|
||||
wm_class = "Supersonic";
|
||||
scratch_layer = true;
|
||||
}
|
||||
{
|
||||
wm_class = "io.github.seadve.Kooha";
|
||||
scratch_layer = true;
|
||||
}
|
||||
{
|
||||
wm_class = "/.*/";
|
||||
preferredWidth = "33";
|
||||
}
|
||||
];
|
||||
keybindings = {
|
||||
move-down = [ "<Control><Super>Down" "<Shift><Super>j" ];
|
||||
move-left = [ "<Control><Super>Left" "<Shift><Super>h" ];
|
||||
move-right = [ "<Control><Super>Right" "<Shift><Super>l" ];
|
||||
move-up = [ "<Control><Super>Up" "<Shift><Super>k" ];
|
||||
switch-down = [ "<Super>Down" "<Super>j" ];
|
||||
switch-left = [ "<Super>Left" "<Super>h" ];
|
||||
switch-right = [ "<Super>Right" "<Super>l" ];
|
||||
switch-up = [ "<Super>Up" "<Super>k" ];
|
||||
move-down = [
|
||||
"<Control><Super>Down"
|
||||
"<Shift><Super>j"
|
||||
];
|
||||
move-left = [
|
||||
"<Control><Super>Left"
|
||||
"<Shift><Super>h"
|
||||
];
|
||||
move-right = [
|
||||
"<Control><Super>Right"
|
||||
"<Shift><Super>l"
|
||||
];
|
||||
move-up = [
|
||||
"<Control><Super>Up"
|
||||
"<Shift><Super>k"
|
||||
];
|
||||
switch-down = [
|
||||
"<Super>Down"
|
||||
"<Super>j"
|
||||
];
|
||||
switch-left = [
|
||||
"<Super>Left"
|
||||
"<Super>h"
|
||||
];
|
||||
switch-right = [
|
||||
"<Super>Right"
|
||||
"<Super>l"
|
||||
];
|
||||
switch-up = [
|
||||
"<Super>Up"
|
||||
"<Super>k"
|
||||
];
|
||||
};
|
||||
};
|
||||
freon = {
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
{ inputs, lib, pkgs, config, ... }:
|
||||
{
|
||||
inputs,
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
completion = pkgs.stdenv.mkDerivation {
|
||||
name = "dnote-completion";
|
||||
phases = [ "unpackPhase" "installPhase" ];
|
||||
phases = [
|
||||
"unpackPhase"
|
||||
"installPhase"
|
||||
];
|
||||
src = inputs.dnote;
|
||||
installPhase = ''
|
||||
mkdir -p $out/lib/dnote/zsh-completion/completions
|
||||
|
||||
@@ -5,7 +5,13 @@
|
||||
programs.neovim =
|
||||
let
|
||||
toLua = lib.generators.toLua { };
|
||||
luaMap = rhs: { rhs = rhs; lua = true; options = { silent = true; }; };
|
||||
luaMap = rhs: {
|
||||
rhs = rhs;
|
||||
lua = true;
|
||||
options = {
|
||||
silent = true;
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
@@ -50,7 +56,10 @@
|
||||
filetypes = [ "crystal" ];
|
||||
globs = [ "*.cr" ];
|
||||
exe = "${pkgs.crystal}/bin/crystal";
|
||||
args = file: [ "tool" "format" ];
|
||||
args = file: [
|
||||
"tool"
|
||||
"format"
|
||||
];
|
||||
stdin = false;
|
||||
}
|
||||
];
|
||||
@@ -69,7 +78,11 @@
|
||||
}
|
||||
{
|
||||
event = "FileType";
|
||||
pattern = [ "gitcommit" "gitrebase" "gitconfig" ];
|
||||
pattern = [
|
||||
"gitcommit"
|
||||
"gitrebase"
|
||||
"gitconfig"
|
||||
];
|
||||
command = "set bufhidden=delete";
|
||||
}
|
||||
{
|
||||
@@ -111,17 +124,41 @@
|
||||
vim-crystal
|
||||
{
|
||||
plugin = telescope-nvim;
|
||||
dependencies = [ plenary-nvim telescope-file-browser-nvim commander-nvim telescope-ui-select-nvim ];
|
||||
dependencies = [
|
||||
plenary-nvim
|
||||
telescope-file-browser-nvim
|
||||
commander-nvim
|
||||
telescope-ui-select-nvim
|
||||
];
|
||||
config =
|
||||
let
|
||||
commands = [
|
||||
{ cmd = "<cmd>!rails db:migrate<cr>"; desc = "Run rails migrations"; }
|
||||
{ cmd = "<cmd>!yarn codegen --no-watch<cr>"; desc = "Run yarn codegen"; }
|
||||
{ cmd = "<cmd>!rails translations:update<cr>"; desc = "Update i18n translations"; }
|
||||
{ cmd = "<cmd>!deploy staging-v6 -t $(git branch --show-current)<cr>"; desc = "Deploy to staging"; }
|
||||
{ cmd = "<cmd>!db-restore -d db-prod-inc<cr>"; desc = "Restore db from prod-inc"; }
|
||||
{
|
||||
cmd = "<cmd>!rails db:migrate<cr>";
|
||||
desc = "Run rails migrations";
|
||||
}
|
||||
{
|
||||
cmd = "<cmd>!yarn codegen --no-watch<cr>";
|
||||
desc = "Run yarn codegen";
|
||||
}
|
||||
{
|
||||
cmd = "<cmd>!rails translations:update<cr>";
|
||||
desc = "Update i18n translations";
|
||||
}
|
||||
{
|
||||
cmd = "<cmd>!deploy staging-v6 -t $(git branch --show-current)<cr>";
|
||||
desc = "Deploy to staging";
|
||||
}
|
||||
{
|
||||
cmd = "<cmd>!db-restore -d db-prod-inc<cr>";
|
||||
desc = "Restore db from prod-inc";
|
||||
}
|
||||
];
|
||||
mappings = { i = { "<c-h>" = "which_key"; }; };
|
||||
mappings = {
|
||||
i = {
|
||||
"<c-h>" = "which_key";
|
||||
};
|
||||
};
|
||||
in
|
||||
''
|
||||
local telescope = require('telescope')
|
||||
@@ -146,27 +183,21 @@
|
||||
})
|
||||
'';
|
||||
mappings = {
|
||||
normal = (
|
||||
lib.attrsets.mapAttrs
|
||||
(key: value: luaMap "require('telescope.builtin').${value}")
|
||||
{
|
||||
"<leader>f" = "find_files";
|
||||
"<leader>r" = "live_grep";
|
||||
"<leader>b" = "buffers";
|
||||
"<leader>h" = "help_tags";
|
||||
"<leader>o" = "oldfiles";
|
||||
"<leader>s" = "git_status";
|
||||
"<leader>/" = "current_buffer_fuzzy_find";
|
||||
"<leader>c" = "git_branches";
|
||||
}
|
||||
) // (
|
||||
lib.attrsets.mapAttrs
|
||||
(key: value: luaMap "require('telescope').extensions.${value}")
|
||||
{
|
||||
"<leader>n" = "file_browser.file_browser";
|
||||
"<leader>:" = "commander.filter";
|
||||
}
|
||||
);
|
||||
normal =
|
||||
(lib.attrsets.mapAttrs (key: value: luaMap "require('telescope.builtin').${value}") {
|
||||
"<leader>f" = "find_files";
|
||||
"<leader>r" = "live_grep";
|
||||
"<leader>b" = "buffers";
|
||||
"<leader>h" = "help_tags";
|
||||
"<leader>o" = "oldfiles";
|
||||
"<leader>s" = "git_status";
|
||||
"<leader>/" = "current_buffer_fuzzy_find";
|
||||
"<leader>c" = "git_branches";
|
||||
})
|
||||
// (lib.attrsets.mapAttrs (key: value: luaMap "require('telescope').extensions.${value}") {
|
||||
"<leader>n" = "file_browser.file_browser";
|
||||
"<leader>:" = "commander.filter";
|
||||
});
|
||||
};
|
||||
}
|
||||
{
|
||||
@@ -176,17 +207,25 @@
|
||||
vim.cmd('colorscheme base16-tomorrow-night')
|
||||
'';
|
||||
}
|
||||
{ plugin = octo-nvim; config = "require('octo').setup()"; }
|
||||
{
|
||||
plugin = octo-nvim;
|
||||
config = "require('octo').setup()";
|
||||
}
|
||||
{
|
||||
plugin = gitsigns-nvim;
|
||||
dependencies = [ plenary-nvim ];
|
||||
config = ''
|
||||
require('gitsigns').setup(${toLua {
|
||||
current_line_blame = true;
|
||||
}})
|
||||
require('gitsigns').setup(${
|
||||
toLua {
|
||||
current_line_blame = true;
|
||||
}
|
||||
})
|
||||
'';
|
||||
}
|
||||
{ plugin = windline-nvim; config = "require('wlsample.airline')"; }
|
||||
{
|
||||
plugin = windline-nvim;
|
||||
config = "require('wlsample.airline')";
|
||||
}
|
||||
{
|
||||
plugin = luasnip;
|
||||
config = ''
|
||||
@@ -252,7 +291,10 @@
|
||||
}
|
||||
{
|
||||
plugin = toggleterm-nvim;
|
||||
dependencies = [ plenary-nvim pkgs.lazygit ];
|
||||
dependencies = [
|
||||
plenary-nvim
|
||||
pkgs.lazygit
|
||||
];
|
||||
config = ''
|
||||
local Terminal = require('toggleterm.terminal').Terminal
|
||||
local lazygit = Terminal:new({
|
||||
@@ -277,16 +319,18 @@
|
||||
}
|
||||
{
|
||||
plugin = copilot-cmp;
|
||||
dependencies = [{
|
||||
plugin = copilot-lua;
|
||||
config = ''
|
||||
require('copilot').setup({
|
||||
suggestion = { enabled = false },
|
||||
panel = { enajkbled = false },
|
||||
copilot_node_command = '${pkgs.nodejs}/bin/node',
|
||||
})
|
||||
'';
|
||||
}];
|
||||
dependencies = [
|
||||
{
|
||||
plugin = copilot-lua;
|
||||
config = ''
|
||||
require('copilot').setup({
|
||||
suggestion = { enabled = false },
|
||||
panel = { enajkbled = false },
|
||||
copilot_node_command = '${pkgs.nodejs}/bin/node',
|
||||
})
|
||||
'';
|
||||
}
|
||||
];
|
||||
config = ''
|
||||
require('copilot_cmp').setup()
|
||||
'';
|
||||
@@ -318,9 +362,11 @@
|
||||
''
|
||||
require('bufferline').setup({ options = ${toLua options} })
|
||||
'';
|
||||
dependencies = [{
|
||||
plugin = nvim-web-devicons;
|
||||
}];
|
||||
dependencies = [
|
||||
{
|
||||
plugin = nvim-web-devicons;
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
lsp = {
|
||||
@@ -342,7 +388,11 @@
|
||||
name = "yamlls";
|
||||
config = {
|
||||
settings = {
|
||||
redhat = { telemetry = { enabled = false; }; };
|
||||
redhat = {
|
||||
telemetry = {
|
||||
enabled = false;
|
||||
};
|
||||
};
|
||||
yaml = {
|
||||
schemas = {
|
||||
"https://json.schemastore.org/github-workflow" = ".github/workflows/*.yml";
|
||||
@@ -351,7 +401,10 @@
|
||||
"https://json.schemastore.org/prettierrc.yaml" = ".prettierrc.yaml";
|
||||
"https://json.schemastore.org/prettier.config.yml" = "prettier.config.yml";
|
||||
"https://json.schemastore.org/prettier.config.yaml" = "prettier.config.yaml";
|
||||
"https://schema.jokke.space/caddy.json" = [ "*caddy*.yml" "*caddy*.yaml" ];
|
||||
"https://schema.jokke.space/caddy.json" = [
|
||||
"*caddy*.yml"
|
||||
"*caddy*.yaml"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -363,7 +416,10 @@
|
||||
config = {
|
||||
settings = {
|
||||
tailwindCSS = {
|
||||
classAttributes = [ "class" "className" ];
|
||||
classAttributes = [
|
||||
"class"
|
||||
"className"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -377,8 +433,14 @@
|
||||
};
|
||||
rootPattern = [ "package.json" ];
|
||||
}
|
||||
{ name = "eslint"; package = vscode-langservers-extracted; }
|
||||
{ name = "nixd"; package = nixd; }
|
||||
{
|
||||
name = "eslint";
|
||||
package = vscode-langservers-extracted;
|
||||
}
|
||||
{
|
||||
name = "nixd";
|
||||
package = nixd;
|
||||
}
|
||||
{
|
||||
name = "bashls";
|
||||
package = nodePackages.bash-language-server.overrideAttrs (oldAttrs: {
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
let
|
||||
inherit (builtins) attrNames filter readDir;
|
||||
dirs =
|
||||
let files = readDir ./.;
|
||||
in filter (name: files."${name}" == "directory") (attrNames files);
|
||||
let
|
||||
files = readDir ./.;
|
||||
in
|
||||
filter (name: files."${name}" == "directory") (attrNames files);
|
||||
in
|
||||
{
|
||||
imports = map (dir: ./${dir}) dirs;
|
||||
|
||||
@@ -1,19 +1,28 @@
|
||||
{ pkgs, config, lib, ... }:
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.programs.fb-client;
|
||||
in
|
||||
{
|
||||
options.programs.fb-client = let inherit (lib) mkEnableOption mkOption types; in {
|
||||
enable = mkEnableOption { };
|
||||
pastebin = mkOption {
|
||||
type = types.str;
|
||||
default = "https://paste.xinu.at";
|
||||
options.programs.fb-client =
|
||||
let
|
||||
inherit (lib) mkEnableOption mkOption types;
|
||||
in
|
||||
{
|
||||
enable = mkEnableOption { };
|
||||
pastebin = mkOption {
|
||||
type = types.str;
|
||||
default = "https://paste.xinu.at";
|
||||
};
|
||||
clipboard_cmd = mkOption {
|
||||
type = types.pathInStore;
|
||||
default = "${pkgs.wl-clipboard}/bin/wl-copy";
|
||||
};
|
||||
};
|
||||
clipboard_cmd = mkOption {
|
||||
type = types.pathInStore;
|
||||
default = "${pkgs.wl-clipboard}/bin/wl-copy";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = [ pkgs.fb-client ];
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
{ config, lib, osConfig, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
osConfig,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.gnome;
|
||||
in
|
||||
@@ -38,7 +43,12 @@ in
|
||||
};
|
||||
power = {
|
||||
powerButton = lib.mkOption {
|
||||
type = enum [ "suspend" "interactive" "hibernate" "nothing" ];
|
||||
type = enum [
|
||||
"suspend"
|
||||
"interactive"
|
||||
"hibernate"
|
||||
"nothing"
|
||||
];
|
||||
default = "interactive";
|
||||
};
|
||||
};
|
||||
@@ -75,56 +85,66 @@ in
|
||||
};
|
||||
|
||||
config = {
|
||||
dconf.settings = with lib.hm.gvariant; {
|
||||
"org/gnome/shell/keybindings" = cfg.keybindings.builtin;
|
||||
"org/gnome/settings-daemon/plugins/media-keys" = {
|
||||
custom-keybindings = (
|
||||
lib.lists.imap0
|
||||
(i: _: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom${toString i}/")
|
||||
cfg.keybindings.custom
|
||||
);
|
||||
};
|
||||
"org/gnome/desktop/input-sources" = {
|
||||
sources = map (source: mkTuple [ "xkb" source ]) cfg.keyboard.sources;
|
||||
};
|
||||
"org/gnome/mutter" = {
|
||||
experimental-features = [ "scale-monitor-framebuffer" ];
|
||||
};
|
||||
"org/gnome/settings-daemon/plugins/xsettings" = {
|
||||
overrides = [ (mkTuple [ "GdkWindowScalingFactor" cfg.scalingFactor ]) ];
|
||||
};
|
||||
"org/gnome/desktop/interface" = {
|
||||
scaling-factor = cfg.scalingFactor;
|
||||
};
|
||||
"org/gnome/settings-daemon/plugins/power" = {
|
||||
"power-button-action" = cfg.power.powerButton;
|
||||
};
|
||||
"org/gnome/settings-daemon/plugins/color" = with cfg.nightLight; {
|
||||
night-light-enabled = enable;
|
||||
night-light-temperature = temperature;
|
||||
night-light-schedule-automatic = isNull schedule;
|
||||
night-light-schedule-from = lib.mkIf (!isNull schedule) schedule.from;
|
||||
night-light-schedule-to = lib.mkIf (!isNull schedule) schedule.to;
|
||||
};
|
||||
"org/gnome/desktop/calendar" = {
|
||||
show-weekdate = cfg.calendar.showWeekNumbers;
|
||||
};
|
||||
"org/gnome/desktop/datetime" = {
|
||||
automatic-timezone = cfg.automaticTimeZone;
|
||||
};
|
||||
"system/locale" = {
|
||||
region = cfg.region;
|
||||
};
|
||||
} // (
|
||||
builtins.listToAttrs (
|
||||
lib.lists.imap0
|
||||
(i: keybinding: {
|
||||
name = "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom${toString i}";
|
||||
value = keybinding;
|
||||
})
|
||||
cfg.keybindings.custom
|
||||
)
|
||||
);
|
||||
dconf.settings =
|
||||
with lib.hm.gvariant;
|
||||
{
|
||||
"org/gnome/shell/keybindings" = cfg.keybindings.builtin;
|
||||
"org/gnome/settings-daemon/plugins/media-keys" = {
|
||||
custom-keybindings = (
|
||||
lib.lists.imap0 (
|
||||
i: _: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom${toString i}/"
|
||||
) cfg.keybindings.custom
|
||||
);
|
||||
};
|
||||
"org/gnome/desktop/input-sources" = {
|
||||
sources = map (
|
||||
source:
|
||||
mkTuple [
|
||||
"xkb"
|
||||
source
|
||||
]
|
||||
) cfg.keyboard.sources;
|
||||
};
|
||||
"org/gnome/mutter" = {
|
||||
experimental-features = [ "scale-monitor-framebuffer" ];
|
||||
};
|
||||
"org/gnome/settings-daemon/plugins/xsettings" = {
|
||||
overrides = [
|
||||
(mkTuple [
|
||||
"GdkWindowScalingFactor"
|
||||
cfg.scalingFactor
|
||||
])
|
||||
];
|
||||
};
|
||||
"org/gnome/desktop/interface" = {
|
||||
scaling-factor = cfg.scalingFactor;
|
||||
};
|
||||
"org/gnome/settings-daemon/plugins/power" = {
|
||||
"power-button-action" = cfg.power.powerButton;
|
||||
};
|
||||
"org/gnome/settings-daemon/plugins/color" = with cfg.nightLight; {
|
||||
night-light-enabled = enable;
|
||||
night-light-temperature = temperature;
|
||||
night-light-schedule-automatic = isNull schedule;
|
||||
night-light-schedule-from = lib.mkIf (!isNull schedule) schedule.from;
|
||||
night-light-schedule-to = lib.mkIf (!isNull schedule) schedule.to;
|
||||
};
|
||||
"org/gnome/desktop/calendar" = {
|
||||
show-weekdate = cfg.calendar.showWeekNumbers;
|
||||
};
|
||||
"org/gnome/desktop/datetime" = {
|
||||
automatic-timezone = cfg.automaticTimeZone;
|
||||
};
|
||||
"system/locale" = {
|
||||
region = cfg.region;
|
||||
};
|
||||
}
|
||||
// (builtins.listToAttrs (
|
||||
lib.lists.imap0 (i: keybinding: {
|
||||
name = "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom${toString i}";
|
||||
value = keybinding;
|
||||
}) cfg.keybindings.custom
|
||||
));
|
||||
home.file.".face".source = lib.mkIf (!isNull cfg.profilePicture) cfg.profilePicture;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
let
|
||||
inherit (builtins) attrNames filter readDir;
|
||||
dirs =
|
||||
let files = readDir ./.;
|
||||
in filter (name: files."${name}" == "directory") (attrNames files);
|
||||
let
|
||||
files = readDir ./.;
|
||||
in
|
||||
filter (name: files."${name}" == "directory") (attrNames files);
|
||||
in
|
||||
{
|
||||
imports = map (dir: ./${dir}) dirs;
|
||||
imports = map (dir: ./${dir}) dirs;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.gnome.extensions.freon;
|
||||
in
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.gnome.extensions;
|
||||
in
|
||||
@@ -10,18 +15,52 @@ in
|
||||
type = package;
|
||||
default = pkgs.gnomeExtensions.paperwm;
|
||||
};
|
||||
cycle-height-steps = lib.mkOption { type = listOf numbers.nonnegative; default = [ 0.33 0.5 0.67 1.0 ]; };
|
||||
cycle-width-steps = lib.mkOption { type = listOf numbers.nonnegative; default = [ 0.33 0.5 0.67 1.0 ]; };
|
||||
horizontal-margin = lib.mkOption { type = ints.unsigned; default = 5; };
|
||||
vertical-margin = lib.mkOption { type = ints.unsigned; default = 5; };
|
||||
window-gap = lib.mkOption { type = ints.unsigned; default = 5; };
|
||||
cycle-height-steps = lib.mkOption {
|
||||
type = listOf numbers.nonnegative;
|
||||
default = [
|
||||
0.33
|
||||
0.5
|
||||
0.67
|
||||
1.0
|
||||
];
|
||||
};
|
||||
cycle-width-steps = lib.mkOption {
|
||||
type = listOf numbers.nonnegative;
|
||||
default = [
|
||||
0.33
|
||||
0.5
|
||||
0.67
|
||||
1.0
|
||||
];
|
||||
};
|
||||
horizontal-margin = lib.mkOption {
|
||||
type = ints.unsigned;
|
||||
default = 5;
|
||||
};
|
||||
vertical-margin = lib.mkOption {
|
||||
type = ints.unsigned;
|
||||
default = 5;
|
||||
};
|
||||
window-gap = lib.mkOption {
|
||||
type = ints.unsigned;
|
||||
default = 5;
|
||||
};
|
||||
winprops = lib.mkOption {
|
||||
type = listOf (submodule {
|
||||
options = {
|
||||
wm_class = lib.mkOption { type = str; default = ""; };
|
||||
title = lib.mkOption { type = str; default = ""; };
|
||||
wm_class = lib.mkOption {
|
||||
type = str;
|
||||
default = "";
|
||||
};
|
||||
title = lib.mkOption {
|
||||
type = str;
|
||||
default = "";
|
||||
};
|
||||
scratch_layer = lib.mkEnableOption { };
|
||||
preferredWidth = lib.mkOption { type = nullOr str; default = null; };
|
||||
preferredWidth = lib.mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
});
|
||||
default = [ ];
|
||||
@@ -36,13 +75,23 @@ in
|
||||
config = lib.mkIf cfg.paperwm.enable {
|
||||
home.packages = [ cfg.paperwm.package ];
|
||||
dconf.settings = {
|
||||
"org/gnome/shell".enabled-extensions =
|
||||
lib.mkIf cfg.paperwm.enable [ cfg.paperwm.package.extensionUuid ];
|
||||
"org/gnome/shell/extensions/paperwm" = with cfg.paperwm; lib.mkIf cfg.paperwm.enable {
|
||||
inherit cycle-height-steps cycle-width-steps horizontal-margin vertical-margin window-gap;
|
||||
winprops = map (props: builtins.toJSON props) winprops;
|
||||
};
|
||||
"org/gnome/shell/extensions/paperwm/keybindings" = lib.mkIf cfg.paperwm.enable cfg.paperwm.keybindings;
|
||||
"org/gnome/shell".enabled-extensions = lib.mkIf cfg.paperwm.enable [
|
||||
cfg.paperwm.package.extensionUuid
|
||||
];
|
||||
"org/gnome/shell/extensions/paperwm" =
|
||||
with cfg.paperwm;
|
||||
lib.mkIf cfg.paperwm.enable {
|
||||
inherit
|
||||
cycle-height-steps
|
||||
cycle-width-steps
|
||||
horizontal-margin
|
||||
vertical-margin
|
||||
window-gap
|
||||
;
|
||||
winprops = map (props: builtins.toJSON props) winprops;
|
||||
};
|
||||
"org/gnome/shell/extensions/paperwm/keybindings" =
|
||||
lib.mkIf cfg.paperwm.enable cfg.paperwm.keybindings;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -40,17 +40,32 @@
|
||||
];
|
||||
formatters = [
|
||||
{
|
||||
filetypes = [ "typescript" "typescriptreact" "svelte" ];
|
||||
globs = [ "*.ts" "*.tsx" "*.svelte" ];
|
||||
filetypes = [
|
||||
"typescript"
|
||||
"typescriptreact"
|
||||
"svelte"
|
||||
];
|
||||
globs = [
|
||||
"*.ts"
|
||||
"*.tsx"
|
||||
"*.svelte"
|
||||
];
|
||||
exe = "npx";
|
||||
args = file: [ "prettier" "--stdin-filepath" file ];
|
||||
args = file: [
|
||||
"prettier"
|
||||
"--stdin-filepath"
|
||||
file
|
||||
];
|
||||
stdin = true;
|
||||
}
|
||||
{
|
||||
filetypes = [ "prisma" ];
|
||||
globs = [ "*.prisma" ];
|
||||
exe = "${pkgs.nodePackages.prisma}/bin/prisma";
|
||||
args = file: [ "format" "--schema" ];
|
||||
args = file: [
|
||||
"format"
|
||||
"--schema"
|
||||
];
|
||||
stdin = false;
|
||||
}
|
||||
];
|
||||
@@ -67,13 +82,21 @@
|
||||
{
|
||||
name = "prismals";
|
||||
package = nodePackages."@prisma/language-server";
|
||||
rootPattern = [ "package.json" "deno.json" ];
|
||||
rootPattern = [
|
||||
"package.json"
|
||||
"deno.json"
|
||||
];
|
||||
}
|
||||
{
|
||||
name = "graphql";
|
||||
package = nodePackages.graphql-language-service-cli;
|
||||
config = {
|
||||
filetypes = [ "typescript" "typescriptreact" "graphql" "svelte" ];
|
||||
filetypes = [
|
||||
"typescript"
|
||||
"typescriptreact"
|
||||
"graphql"
|
||||
"svelte"
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
@@ -38,7 +38,10 @@ in
|
||||
profilePicture = ../assets/profile-pictures/moco.png;
|
||||
calendar.showWeekNumbers = true;
|
||||
extensions.paperwm.winprops = [
|
||||
{ wm_class = "gnome-pomodoro"; scratch_layer = true; }
|
||||
{
|
||||
wm_class = "gnome-pomodoro";
|
||||
scratch_layer = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
@@ -77,16 +80,40 @@ in
|
||||
formatters = [
|
||||
{
|
||||
filetypes = [ "ruby" ];
|
||||
globs = [ "*.rb" "Gemfile" "*.rake" ];
|
||||
globs = [
|
||||
"*.rb"
|
||||
"Gemfile"
|
||||
"*.rake"
|
||||
];
|
||||
exe = "bundle";
|
||||
args = file: [ "exec" "rufo" "-x" "--filename" file ];
|
||||
args = file: [
|
||||
"exec"
|
||||
"rufo"
|
||||
"-x"
|
||||
"--filename"
|
||||
file
|
||||
];
|
||||
stdin = true;
|
||||
}
|
||||
{
|
||||
filetypes = [ "javascript" "typescript" "javascriptreact" "typescriptreact" ];
|
||||
globs = [ "*.js" "*.jsx" "*.ts" "*.tsx" ];
|
||||
filetypes = [
|
||||
"javascript"
|
||||
"typescript"
|
||||
"javascriptreact"
|
||||
"typescriptreact"
|
||||
];
|
||||
globs = [
|
||||
"*.js"
|
||||
"*.jsx"
|
||||
"*.ts"
|
||||
"*.tsx"
|
||||
];
|
||||
exe = "npx";
|
||||
args = file: [ "prettier" "--stdin-filepath" file ];
|
||||
args = file: [
|
||||
"prettier"
|
||||
"--stdin-filepath"
|
||||
file
|
||||
];
|
||||
stdin = true;
|
||||
}
|
||||
];
|
||||
@@ -109,14 +136,21 @@ in
|
||||
|
||||
programs.ssh.matchBlocks =
|
||||
let
|
||||
aliases = [ "moco" "mocoapp" "mocoapp.com" ];
|
||||
matcher = subdomains:
|
||||
aliases = [
|
||||
"moco"
|
||||
"mocoapp"
|
||||
"mocoapp.com"
|
||||
];
|
||||
matcher =
|
||||
subdomains:
|
||||
builtins.concatStringsSep " " (
|
||||
map
|
||||
(alias: builtins.concatStringsSep " " (
|
||||
map (
|
||||
alias:
|
||||
builtins.concatStringsSep " " (
|
||||
map (subdomain: "*.${subdomain}.${alias} ${subdomain}.${alias}") subdomains
|
||||
))
|
||||
aliases);
|
||||
)
|
||||
) aliases
|
||||
);
|
||||
in
|
||||
{
|
||||
"console.*.moco" = {
|
||||
@@ -126,69 +160,97 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
"${matcher ["reto" "reto.intern"]}" = {
|
||||
hostname = "reto.intern.mocoapp.com";
|
||||
user = "jokke";
|
||||
};
|
||||
"${matcher [
|
||||
"reto"
|
||||
"reto.intern"
|
||||
]}" =
|
||||
{
|
||||
hostname = "reto.intern.mocoapp.com";
|
||||
user = "jokke";
|
||||
};
|
||||
|
||||
"${matcher ["web"]}" = {
|
||||
"${matcher [ "web" ]}" = {
|
||||
hostname = "mocoapp.com";
|
||||
};
|
||||
"${matcher ["prod-inc"]}" = {
|
||||
"${matcher [ "prod-inc" ]}" = {
|
||||
hostname = "prod-inc.mocoapp.com";
|
||||
};
|
||||
"${matcher ["prod"]}" = {
|
||||
"${matcher [ "prod" ]}" = {
|
||||
hostname = "web02.mocoapp";
|
||||
};
|
||||
"${matcher ["pfg" "primeforcegroup"]}" = {
|
||||
hostname = "primeforcegroup.mocoapp.com";
|
||||
};
|
||||
"${matcher ["crafft"]}" = {
|
||||
"${matcher [
|
||||
"pfg"
|
||||
"primeforcegroup"
|
||||
]}" =
|
||||
{
|
||||
hostname = "primeforcegroup.mocoapp.com";
|
||||
};
|
||||
"${matcher [ "crafft" ]}" = {
|
||||
hostname = "crafft.mocoapp.com";
|
||||
};
|
||||
"${matcher ["bd" "businessdecision"]}" = {
|
||||
hostname = "businessdecision.mocoapp.com";
|
||||
};
|
||||
"${matcher ["festland"]}" = {
|
||||
"${matcher [
|
||||
"bd"
|
||||
"businessdecision"
|
||||
]}" =
|
||||
{
|
||||
hostname = "businessdecision.mocoapp.com";
|
||||
};
|
||||
"${matcher [ "festland" ]}" = {
|
||||
hostname = "festland.mocoapp.com";
|
||||
};
|
||||
"${matcher ["oi" "one-inside"]}" = {
|
||||
hostname = "one-inside.mocoapp.com";
|
||||
};
|
||||
"${matcher ["se" "scope-engineering"]}" = {
|
||||
hostname = "scope-engineering.mocoapp.com";
|
||||
};
|
||||
"${matcher ["cpc" "cpc-ag"]}" = {
|
||||
hostname = "cpc-ag.mocoapp.com";
|
||||
};
|
||||
"${matcher ["weareact3"]}" = {
|
||||
"${matcher [
|
||||
"oi"
|
||||
"one-inside"
|
||||
]}" =
|
||||
{
|
||||
hostname = "one-inside.mocoapp.com";
|
||||
};
|
||||
"${matcher [
|
||||
"se"
|
||||
"scope-engineering"
|
||||
]}" =
|
||||
{
|
||||
hostname = "scope-engineering.mocoapp.com";
|
||||
};
|
||||
"${matcher [
|
||||
"cpc"
|
||||
"cpc-ag"
|
||||
]}" =
|
||||
{
|
||||
hostname = "cpc-ag.mocoapp.com";
|
||||
};
|
||||
"${matcher [ "weareact3" ]}" = {
|
||||
hostname = "weareact3.mocoapp.com";
|
||||
};
|
||||
"${matcher ["avenit"]}" = {
|
||||
"${matcher [ "avenit" ]}" = {
|
||||
hostname = "avenit.mocoapp.com";
|
||||
};
|
||||
"${matcher ["staging"]}" = {
|
||||
"${matcher [ "staging" ]}" = {
|
||||
hostname = "staging.mocoapp.com";
|
||||
};
|
||||
"${matcher ["staging-v2"]}" = {
|
||||
"${matcher [ "staging-v2" ]}" = {
|
||||
hostname = "staging-v2.mocoapp.com";
|
||||
};
|
||||
"${matcher ["staging-v3"]}" = {
|
||||
"${matcher [ "staging-v3" ]}" = {
|
||||
hostname = "staging-v3.mocoapp.com";
|
||||
};
|
||||
"${matcher ["staging-v4"]}" = {
|
||||
"${matcher [ "staging-v4" ]}" = {
|
||||
hostname = "staging-v4.mocoapp.com";
|
||||
};
|
||||
"${matcher ["staging-v5"]}" = {
|
||||
"${matcher [ "staging-v5" ]}" = {
|
||||
hostname = "staging-v5.mocoapp.com";
|
||||
};
|
||||
"${matcher ["staging-v6"]}" = {
|
||||
"${matcher [ "staging-v6" ]}" = {
|
||||
hostname = "staging-v6.mocoapp.com";
|
||||
};
|
||||
"${matcher ["prod-db" "production-db"]}" = {
|
||||
hostname = "production-db.mocoapp";
|
||||
};
|
||||
"${matcher ["pdf-renderer"]}" = {
|
||||
"${matcher [
|
||||
"prod-db"
|
||||
"production-db"
|
||||
]}" =
|
||||
{
|
||||
hostname = "production-db.mocoapp";
|
||||
};
|
||||
"${matcher [ "pdf-renderer" ]}" = {
|
||||
hostname = "mocoapp-pdf-renderer01.mocoapp.com";
|
||||
};
|
||||
"*.moco *.mocoapp *.mocoapp.com" = {
|
||||
|
||||
@@ -1,14 +1,24 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.programs.neovim;
|
||||
toLua = lib.generators.toLua { };
|
||||
buildPluginConfig = p:
|
||||
buildPluginConfig =
|
||||
p:
|
||||
let
|
||||
pluginConfig = if builtins.hasAttr "plugin" p then p else { plugin = p; };
|
||||
name = pluginConfig.plugin.name;
|
||||
|
||||
config = if (builtins.isNull pluginConfig.config or null) then "" else pluginConfig.config;
|
||||
mappings = if (builtins.isNull pluginConfig.mappings or null) then "" else generateMappings pluginConfig.mappings;
|
||||
mappings =
|
||||
if (builtins.isNull pluginConfig.mappings or null) then
|
||||
""
|
||||
else
|
||||
generateMappings pluginConfig.mappings;
|
||||
mergedConfig = config + mappings;
|
||||
in
|
||||
[
|
||||
@@ -17,9 +27,10 @@ let
|
||||
config = lib.modules.mkIf (mergedConfig != "") ''
|
||||
Plugins[${toLua name}] = {}
|
||||
Plugins[${toLua name}].setup = function()
|
||||
${lib.strings.concatMapStrings
|
||||
(line: if line == "" then "" else " ${line}\n")
|
||||
(lib.strings.splitString "\n" mergedConfig)
|
||||
${
|
||||
lib.strings.concatMapStrings (line: if line == "" then "" else " ${line}\n") (
|
||||
lib.strings.splitString "\n" mergedConfig
|
||||
)
|
||||
|
||||
}
|
||||
end
|
||||
@@ -28,9 +39,8 @@ let
|
||||
'';
|
||||
type = "lua";
|
||||
}
|
||||
] ++ (
|
||||
lib.lists.concatMap buildPluginConfig pluginConfig.dependencies or [ ]
|
||||
);
|
||||
]
|
||||
++ (lib.lists.concatMap buildPluginConfig pluginConfig.dependencies or [ ]);
|
||||
|
||||
lspPluginConfig = with pkgs.vimPlugins; {
|
||||
plugin = nvim-lspconfig;
|
||||
@@ -41,76 +51,100 @@ let
|
||||
luasnip
|
||||
];
|
||||
|
||||
config = (builtins.readFile ./lsp-config.lua) + ''
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.workspace.didChangeWatchedFiles.dynamicRegistration = true
|
||||
local lspconfig = require('lspconfig')
|
||||
local util = require('lspconfig.util')
|
||||
config =
|
||||
(builtins.readFile ./lsp-config.lua)
|
||||
+ ''
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.workspace.didChangeWatchedFiles.dynamicRegistration = true
|
||||
local lspconfig = require('lspconfig')
|
||||
local util = require('lspconfig.util')
|
||||
|
||||
local on_attach = function (client, bufnr)
|
||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
local map = function (lhs, rhs)
|
||||
print('set mapping ' .. lhs)
|
||||
end
|
||||
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
|
||||
${lib.strings.concatLines (lib.attrsets.mapAttrsToList (name: value: ''
|
||||
local buf_${name} = vim.lsp.buf[${toLua name}]
|
||||
if buf_${name} then
|
||||
vim.keymap.set('n', ${toLua value}, buf_${name}, { buffer = bufnr })
|
||||
local on_attach = function (client, bufnr)
|
||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
local map = function (lhs, rhs)
|
||||
print('set mapping ' .. lhs)
|
||||
end
|
||||
''
|
||||
) cfg.lsp.mappings.buf)}
|
||||
${lib.strings.concatLines (lib.attrsets.mapAttrsToList (name: value: ''
|
||||
local diagnostic_${name} = vim.lsp.buf[${toLua name}]
|
||||
if diagnostic_${name} then
|
||||
vim.keymap.set('n', ${toLua value}, diagnostic_${name}, { buffer = bufnr })
|
||||
end
|
||||
'') cfg.lsp.mappings.diagnostic)}
|
||||
end
|
||||
|
||||
vim.env.PATH = ${toLua (lib.makeBinPath (map (s: s.package) (builtins.filter (s: builtins.hasAttr "package" s) cfg.lsp.servers)) + ":")} .. vim.env.PATH
|
||||
local servers = ${toLua (map (
|
||||
{ name, config ? {}, rootPattern ? null, ... }: {
|
||||
inherit name;
|
||||
config = config // (if (builtins.isNull rootPattern) then {} else { inherit rootPattern; });
|
||||
}
|
||||
) cfg.lsp.servers)}
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
for _, server in ipairs(servers) do
|
||||
local server_config = server.config
|
||||
server_config.on_attach = on_attach
|
||||
server_config.capabilities = capabilities
|
||||
server_config.flags = {
|
||||
debounce_text_changes = 150
|
||||
}
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
|
||||
if server_config.rootPattern then
|
||||
server_config.root_dir = util.root_pattern(
|
||||
unpack(server_config.rootPattern)
|
||||
${lib.strings.concatLines (
|
||||
lib.attrsets.mapAttrsToList (name: value: ''
|
||||
local buf_${name} = vim.lsp.buf[${toLua name}]
|
||||
if buf_${name} then
|
||||
vim.keymap.set('n', ${toLua value}, buf_${name}, { buffer = bufnr })
|
||||
end
|
||||
'') cfg.lsp.mappings.buf
|
||||
)}
|
||||
${lib.strings.concatLines (
|
||||
lib.attrsets.mapAttrsToList (name: value: ''
|
||||
local diagnostic_${name} = vim.lsp.buf[${toLua name}]
|
||||
if diagnostic_${name} then
|
||||
vim.keymap.set('n', ${toLua value}, diagnostic_${name}, { buffer = bufnr })
|
||||
end
|
||||
'') cfg.lsp.mappings.diagnostic
|
||||
)}
|
||||
end
|
||||
|
||||
vim.env.PATH = ${
|
||||
toLua (
|
||||
lib.makeBinPath (
|
||||
map (s: s.package) (builtins.filter (s: builtins.hasAttr "package" s) cfg.lsp.servers)
|
||||
)
|
||||
end
|
||||
+ ":"
|
||||
)
|
||||
} .. vim.env.PATH
|
||||
local servers = ${
|
||||
toLua (
|
||||
map (
|
||||
{
|
||||
name,
|
||||
config ? { },
|
||||
rootPattern ? null,
|
||||
...
|
||||
}:
|
||||
{
|
||||
inherit name;
|
||||
config = config // (if (builtins.isNull rootPattern) then { } else { inherit rootPattern; });
|
||||
}
|
||||
) cfg.lsp.servers
|
||||
)
|
||||
}
|
||||
|
||||
lspconfig[server.name].setup(server_config)
|
||||
end
|
||||
'';
|
||||
for _, server in ipairs(servers) do
|
||||
local server_config = server.config
|
||||
server_config.on_attach = on_attach
|
||||
server_config.capabilities = capabilities
|
||||
server_config.flags = {
|
||||
debounce_text_changes = 150
|
||||
}
|
||||
|
||||
if server_config.rootPattern then
|
||||
server_config.root_dir = util.root_pattern(
|
||||
unpack(server_config.rootPattern)
|
||||
)
|
||||
end
|
||||
|
||||
lspconfig[server.name].setup(server_config)
|
||||
end
|
||||
'';
|
||||
|
||||
};
|
||||
|
||||
treesitterPluginConfig = with pkgs.vimPlugins; {
|
||||
plugin = nvim-treesitter.withPlugins cfg.withTreesitterPlugins;
|
||||
config = ''
|
||||
require('nvim-treesitter.configs').setup(${toLua {
|
||||
highlight = {
|
||||
enable = true;
|
||||
additional_vim_regex_highlighting = false;
|
||||
};
|
||||
}});
|
||||
require('nvim-treesitter.configs').setup(${
|
||||
toLua {
|
||||
highlight = {
|
||||
enable = true;
|
||||
additional_vim_regex_highlighting = false;
|
||||
};
|
||||
}
|
||||
});
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -122,17 +156,24 @@ let
|
||||
|
||||
formatter.setup({
|
||||
filetype = {
|
||||
${lib.strings.concatMapStringsSep ",\n " ({ exe, args, stdin, no_append, filetypes, ... }:
|
||||
${lib.strings.concatMapStringsSep ",\n " (
|
||||
{
|
||||
exe,
|
||||
args,
|
||||
stdin,
|
||||
no_append,
|
||||
filetypes,
|
||||
...
|
||||
}:
|
||||
lib.strings.concatMapStringsSep ",\n " (filetype: ''
|
||||
[${toLua filetype}] = {
|
||||
function ()
|
||||
return {
|
||||
exe = ${toLua exe},
|
||||
args = {
|
||||
${lib.strings.concatMapStringsSep ",\n " (arg:
|
||||
if arg == "<<FILE>>"
|
||||
then "util.escape_path(util.get_current_buffer_file_path())"
|
||||
else toLua arg
|
||||
${lib.strings.concatMapStringsSep ",\n " (
|
||||
arg:
|
||||
if arg == "<<FILE>>" then "util.escape_path(util.get_current_buffer_file_path())" else toLua arg
|
||||
) (args "<<FILE>>")}
|
||||
},
|
||||
stdin = ${toLua stdin},
|
||||
@@ -153,137 +194,218 @@ let
|
||||
'';
|
||||
};
|
||||
|
||||
customTypes = let inherit (lib) mkOption mkEnableOption types; in {
|
||||
mapping = types.submodule {
|
||||
options = {
|
||||
rhs = mkOption { type = types.str; };
|
||||
lua = mkEnableOption { };
|
||||
options = mkOption {
|
||||
type = types.nullOr (
|
||||
types.submodule {
|
||||
options = {
|
||||
buffer = mkOption { type = types.nullOr (types.either types.int types.bool); default = null; };
|
||||
nowait = mkOption { type = types.nullOr types.bool; default = null; };
|
||||
silent = mkOption { type = types.nullOr types.bool; default = null; };
|
||||
expr = mkOption { type = types.nullOr types.bool; default = null; };
|
||||
script = mkOption { type = types.nullOr types.bool; default = null; };
|
||||
unique = mkOption { type = types.nullOr types.bool; default = null; };
|
||||
replace_keycodes = mkOption { type = types.nullOr types.bool; default = null; };
|
||||
};
|
||||
}
|
||||
);
|
||||
default = { };
|
||||
customTypes =
|
||||
let
|
||||
inherit (lib) mkOption mkEnableOption types;
|
||||
in
|
||||
{
|
||||
mapping = types.submodule {
|
||||
options = {
|
||||
rhs = mkOption { type = types.str; };
|
||||
lua = mkEnableOption { };
|
||||
options = mkOption {
|
||||
type = types.nullOr (
|
||||
types.submodule {
|
||||
options = {
|
||||
buffer = mkOption {
|
||||
type = types.nullOr (types.either types.int types.bool);
|
||||
default = null;
|
||||
};
|
||||
nowait = mkOption {
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
};
|
||||
silent = mkOption {
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
};
|
||||
expr = mkOption {
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
};
|
||||
script = mkOption {
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
};
|
||||
unique = mkOption {
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
};
|
||||
replace_keycodes = mkOption {
|
||||
type = types.nullOr types.bool;
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
default = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
modeMappings = types.attrsOf (types.either types.str customTypes.mapping);
|
||||
|
||||
mappings = types.submodule {
|
||||
options = {
|
||||
normal = mkOption {
|
||||
type = customTypes.modeMappings;
|
||||
default = { };
|
||||
};
|
||||
insert = mkOption {
|
||||
type = customTypes.modeMappings;
|
||||
default = { };
|
||||
};
|
||||
visual = mkOption {
|
||||
type = customTypes.modeMappings;
|
||||
default = { };
|
||||
};
|
||||
command = mkOption {
|
||||
type = customTypes.modeMappings;
|
||||
default = { };
|
||||
};
|
||||
select = mkOption {
|
||||
type = customTypes.modeMappings;
|
||||
default = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
plugin = types.either types.package (
|
||||
types.submodule {
|
||||
options = {
|
||||
plugin = mkOption { type = types.package; };
|
||||
dependencies = mkOption {
|
||||
type = types.listOf customTypes.plugin;
|
||||
default = [ ];
|
||||
};
|
||||
mappings = mkOption {
|
||||
type = customTypes.mappings;
|
||||
default = { };
|
||||
};
|
||||
config = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
autoCommand = types.submodule {
|
||||
options = {
|
||||
event = mkOption { type = types.either types.str (types.listOf types.str); };
|
||||
pattern = mkOption { type = types.either types.str (types.listOf types.str); };
|
||||
command = mkOption { type = types.str; };
|
||||
};
|
||||
};
|
||||
|
||||
lspServer = types.submodule {
|
||||
options = {
|
||||
name = mkOption { type = types.str; };
|
||||
config = mkOption {
|
||||
type = types.attrs;
|
||||
default = { };
|
||||
};
|
||||
package = mkOption {
|
||||
type = types.nullOr types.package;
|
||||
default = null;
|
||||
};
|
||||
rootPattern = mkOption {
|
||||
type = types.nullOr (types.listOf types.str);
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
formatter = types.submodule {
|
||||
options = {
|
||||
filetypes = mkOption { type = types.listOf types.str; };
|
||||
globs = mkOption { type = types.listOf types.str; };
|
||||
exe = mkOption { type = types.either types.path types.str; };
|
||||
args = mkOption {
|
||||
type = types.functionTo (types.listOf types.str);
|
||||
default = _: [ ];
|
||||
};
|
||||
stdin = mkEnableOption { };
|
||||
no_append = mkEnableOption { };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
modeMappings = types.attrsOf (types.either types.str customTypes.mapping);
|
||||
|
||||
mappings = types.submodule {
|
||||
options = {
|
||||
normal = mkOption { type = customTypes.modeMappings; default = { }; };
|
||||
insert = mkOption { type = customTypes.modeMappings; default = { }; };
|
||||
visual = mkOption { type = customTypes.modeMappings; default = { }; };
|
||||
command = mkOption { type = customTypes.modeMappings; default = { }; };
|
||||
select = mkOption { type = customTypes.modeMappings; default = { }; };
|
||||
};
|
||||
};
|
||||
|
||||
plugin = types.either types.package (types.submodule {
|
||||
options = {
|
||||
plugin = mkOption { type = types.package; };
|
||||
dependencies = mkOption {
|
||||
type = types.listOf customTypes.plugin;
|
||||
default = [ ];
|
||||
};
|
||||
mappings = mkOption { type = customTypes.mappings; default = { }; };
|
||||
config = mkOption { type = types.nullOr types.str; default = null; };
|
||||
};
|
||||
});
|
||||
|
||||
autoCommand = types.submodule {
|
||||
options = {
|
||||
event = mkOption { type = types.either types.str (types.listOf types.str); };
|
||||
pattern = mkOption { type = types.either types.str (types.listOf types.str); };
|
||||
command = mkOption { type = types.str; };
|
||||
};
|
||||
};
|
||||
|
||||
lspServer = types.submodule {
|
||||
options = {
|
||||
name = mkOption { type = types.str; };
|
||||
config = mkOption { type = types.attrs; default = { }; };
|
||||
package = mkOption { type = types.nullOr types.package; default = null; };
|
||||
rootPattern = mkOption { type = types.nullOr (types.listOf types.str); default = null; };
|
||||
};
|
||||
};
|
||||
|
||||
formatter = types.submodule {
|
||||
options = {
|
||||
filetypes = mkOption { type = types.listOf types.str; };
|
||||
globs = mkOption { type = types.listOf types.str; };
|
||||
exe = mkOption { type = types.either types.path types.str; };
|
||||
args = mkOption { type = types.functionTo (types.listOf types.str); default = _: [ ]; };
|
||||
stdin = mkEnableOption { };
|
||||
no_append = mkEnableOption { };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
generateMappings = mappings: lib.strings.concatLines (
|
||||
lib.attrsets.mapAttrsToList
|
||||
(mode: modeMappings:
|
||||
generateMappings =
|
||||
mappings:
|
||||
lib.strings.concatLines (
|
||||
lib.attrsets.mapAttrsToList (
|
||||
mode: modeMappings:
|
||||
lib.strings.concatLines (
|
||||
lib.attrsets.mapAttrsToList
|
||||
(name: value:
|
||||
lib.attrsets.mapAttrsToList (
|
||||
name: value:
|
||||
|
||||
let
|
||||
mapping = { lhs = name; lua = false; options = { }; } // (if builtins.isString value then { rhs = value; } else value);
|
||||
args = [
|
||||
(toLua (builtins.substring 0 1 mode))
|
||||
(toLua mapping.lhs)
|
||||
(if mapping.lua then mapping.rhs else toLua mapping.rhs)
|
||||
(
|
||||
toLua (
|
||||
builtins.listToAttrs (
|
||||
builtins.filter ({ value, ... }: !isNull (value)) (lib.attrsets.attrsToList mapping.options)
|
||||
)
|
||||
)
|
||||
let
|
||||
mapping = {
|
||||
lhs = name;
|
||||
lua = false;
|
||||
options = { };
|
||||
} // (if builtins.isString value then { rhs = value; } else value);
|
||||
args = [
|
||||
(toLua (builtins.substring 0 1 mode))
|
||||
(toLua mapping.lhs)
|
||||
(if mapping.lua then mapping.rhs else toLua mapping.rhs)
|
||||
(toLua (
|
||||
builtins.listToAttrs (
|
||||
builtins.filter ({ value, ... }: !isNull (value)) (lib.attrsets.attrsToList mapping.options)
|
||||
)
|
||||
];
|
||||
in
|
||||
"vim.keymap.set(${lib.strings.concatStringsSep ", " args})"
|
||||
)
|
||||
modeMappings
|
||||
))
|
||||
];
|
||||
in
|
||||
"vim.keymap.set(${lib.strings.concatStringsSep ", " args})"
|
||||
) modeMappings
|
||||
)
|
||||
)
|
||||
mappings
|
||||
);
|
||||
) mappings
|
||||
);
|
||||
|
||||
generateAutoCommand = { event, pattern, command, group ? null }: ''
|
||||
vim.api.nvim_create_autocmd(${toLua event}, {
|
||||
pattern = ${toLua pattern},
|
||||
command = ${toLua command},
|
||||
group = ${if isNull group then toLua group else ''
|
||||
vim.api.nvim_create_augroup(${toLua group}, { clear = true })
|
||||
''},
|
||||
})
|
||||
'';
|
||||
generateAutoCommand =
|
||||
{
|
||||
event,
|
||||
pattern,
|
||||
command,
|
||||
group ? null,
|
||||
}:
|
||||
''
|
||||
vim.api.nvim_create_autocmd(${toLua event}, {
|
||||
pattern = ${toLua pattern},
|
||||
command = ${toLua command},
|
||||
group = ${
|
||||
if isNull group then
|
||||
toLua group
|
||||
else
|
||||
''
|
||||
vim.api.nvim_create_augroup(${toLua group}, { clear = true })
|
||||
''
|
||||
},
|
||||
})
|
||||
'';
|
||||
|
||||
generateAutoCommands = autoCommands: lib.strings.concatLines (
|
||||
map generateAutoCommand autoCommands
|
||||
);
|
||||
generateAutoCommands = autoCommands: lib.strings.concatLines (map generateAutoCommand autoCommands);
|
||||
|
||||
generateSignDefinitions = signs: lib.strings.concatLines (
|
||||
lib.attrsets.mapAttrsToList
|
||||
(name: value:
|
||||
generateSignDefinitions =
|
||||
signs:
|
||||
lib.strings.concatLines (
|
||||
lib.attrsets.mapAttrsToList (
|
||||
name: value:
|
||||
let
|
||||
hl = "DiagnosticSign${lib.strings.toUpper (builtins.substring 0 1 name)}${builtins.substring 1 (-1) name}";
|
||||
hl = "DiagnosticSign${
|
||||
lib.strings.toUpper (builtins.substring 0 1 name)
|
||||
}${builtins.substring 1 (-1) name}";
|
||||
in
|
||||
"vim.fn.sign_define(${toLua hl}, ${toLua { text = value; texthl = hl; numhl = ""; }})"
|
||||
)
|
||||
signs
|
||||
);
|
||||
"vim.fn.sign_define(${toLua hl}, ${
|
||||
toLua {
|
||||
text = value;
|
||||
texthl = hl;
|
||||
numhl = "";
|
||||
}
|
||||
})"
|
||||
) signs
|
||||
);
|
||||
in
|
||||
{
|
||||
options.programs.neovim =
|
||||
@@ -291,12 +413,18 @@ in
|
||||
inherit (lib) mkOption types;
|
||||
in
|
||||
{
|
||||
mappings = mkOption { type = customTypes.mappings; default = { }; };
|
||||
mappings = mkOption {
|
||||
type = customTypes.mappings;
|
||||
default = { };
|
||||
};
|
||||
plug = mkOption {
|
||||
type = types.listOf customTypes.plugin;
|
||||
default = [ ];
|
||||
};
|
||||
leader = mkOption { type = types.str; default = "\\"; };
|
||||
leader = mkOption {
|
||||
type = types.str;
|
||||
default = "\\";
|
||||
};
|
||||
options = mkOption {
|
||||
type = types.attrs;
|
||||
default = { };
|
||||
@@ -314,10 +442,22 @@ in
|
||||
default = { };
|
||||
};
|
||||
signs = {
|
||||
error = mkOption { type = types.str; default = ""; };
|
||||
warning = mkOption { type = types.str; default = ""; };
|
||||
info = mkOption { type = types.str; default = ""; };
|
||||
hint = mkOption { type = types.str; default = ""; };
|
||||
error = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
warning = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
info = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
hint = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
lsp = {
|
||||
servers = mkOption {
|
||||
@@ -325,8 +465,14 @@ in
|
||||
default = [ ];
|
||||
};
|
||||
mappings = {
|
||||
buf = mkOption { type = types.attrsOf types.str; default = { }; };
|
||||
diagnostic = mkOption { type = types.attrsOf types.str; default = { }; };
|
||||
buf = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = { };
|
||||
};
|
||||
diagnostic = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
withTreesitterPlugins = mkOption {
|
||||
@@ -345,22 +491,30 @@ in
|
||||
"local Plugins = {}"
|
||||
(generateMappings cfg.mappings)
|
||||
(generateAutoCommands cfg.autoCommands)
|
||||
(lib.strings.concatLines (lib.attrsets.mapAttrsToList (name: value: "vim.env.${name} = ${toLua value}") cfg.env))
|
||||
(lib.strings.concatLines (lib.attrsets.mapAttrsToList (name: value: "vim.opt.${name} = ${toLua value}") cfg.options))
|
||||
(lib.strings.concatLines (
|
||||
lib.attrsets.mapAttrsToList (name: value: "vim.env.${name} = ${toLua value}") cfg.env
|
||||
))
|
||||
(lib.strings.concatLines (
|
||||
lib.attrsets.mapAttrsToList (name: value: "vim.opt.${name} = ${toLua value}") cfg.options
|
||||
))
|
||||
(generateSignDefinitions cfg.signs)
|
||||
"vim.g.mapleader = ${toLua cfg.leader}"
|
||||
''
|
||||
local undodir = ${toLua (
|
||||
if builtins.hasAttr "undodir" cfg.options
|
||||
then cfg.options.undodir
|
||||
else "${config.xdg.cacheHome}/nvim/undo"
|
||||
)}
|
||||
local undodir = ${
|
||||
toLua (
|
||||
if builtins.hasAttr "undodir" cfg.options then
|
||||
cfg.options.undodir
|
||||
else
|
||||
"${config.xdg.cacheHome}/nvim/undo"
|
||||
)
|
||||
}
|
||||
vim.opt.undodir = undodir
|
||||
vim.fn.mkdir(undodir, 'p')
|
||||
''
|
||||
];
|
||||
plugins = lib.lists.concatMap buildPluginConfig (
|
||||
cfg.plug ++ [
|
||||
cfg.plug
|
||||
++ [
|
||||
lspPluginConfig
|
||||
treesitterPluginConfig
|
||||
formatterPluginConfig
|
||||
@@ -371,12 +525,12 @@ in
|
||||
};
|
||||
|
||||
xdg.configFile = (
|
||||
lib.attrsets.mapAttrs'
|
||||
(name: value: {
|
||||
name = "nvim/${name}";
|
||||
value = { source = value; };
|
||||
})
|
||||
cfg.snippets
|
||||
lib.attrsets.mapAttrs' (name: value: {
|
||||
name = "nvim/${name}";
|
||||
value = {
|
||||
source = value;
|
||||
};
|
||||
}) cfg.snippets
|
||||
);
|
||||
|
||||
home.shellAliases =
|
||||
|
||||
Reference in New Issue
Block a user