Improved nix setup
This commit is contained in:
parent
a6293a1ba4
commit
afea4bacd0
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,3 @@
|
||||||
---@diagnostic disable: missing-fields
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
-- {{{ Capabilities
|
-- {{{ Capabilities
|
||||||
|
@ -15,91 +14,9 @@ M.capabilities = function()
|
||||||
end
|
end
|
||||||
-- }}}
|
-- }}}
|
||||||
-- {{{ Main config function
|
-- {{{ Main config function
|
||||||
function M.config()
|
function M.config(servers)
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require("lspconfig")
|
||||||
|
|
||||||
-- {{{ General server config
|
|
||||||
---@type lspconfig.options
|
|
||||||
local servers = {
|
|
||||||
-- {{{ Typescript
|
|
||||||
tsserver = {
|
|
||||||
on_attach = function(client)
|
|
||||||
-- We handle formatting using null-ls and prettierd
|
|
||||||
client.server_capabilities.documentFormattingProvider = false
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
-- }}}
|
|
||||||
-- {{{ Purescript
|
|
||||||
purescriptls = {
|
|
||||||
root_dir = lspconfig.util.root_pattern("spago.yaml"),
|
|
||||||
settings = {
|
|
||||||
purescript = {
|
|
||||||
censorWarnings = {
|
|
||||||
"UnusedName",
|
|
||||||
"ShadowedName",
|
|
||||||
"UserDefinedWarning",
|
|
||||||
},
|
|
||||||
formatter = "purs-tidy",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
-- }}}
|
|
||||||
-- {{{ Lua
|
|
||||||
lua_ls = {
|
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
format = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
-- Do not send telemetry data containing a randomized but unique identifier
|
|
||||||
telemetry = {
|
|
||||||
enable = false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
-- }}}
|
|
||||||
-- {{{ Latex
|
|
||||||
texlab = {
|
|
||||||
settings = {
|
|
||||||
texlab = {
|
|
||||||
build = {
|
|
||||||
args = {
|
|
||||||
-- Here by default:
|
|
||||||
"-pdf",
|
|
||||||
"-interaction=nonstopmode",
|
|
||||||
"-synctex=1",
|
|
||||||
"%f",
|
|
||||||
-- Required for syntax highlighting inside the generated pdf apparently
|
|
||||||
"-shell-escape",
|
|
||||||
},
|
|
||||||
executable = "latexmk",
|
|
||||||
forwardSearchAfter = true,
|
|
||||||
onSave = true,
|
|
||||||
},
|
|
||||||
chktex = {
|
|
||||||
onOpenAndSave = true,
|
|
||||||
onEdit = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
-- }}}
|
|
||||||
-- {{{ Nix
|
|
||||||
nil_ls = {},
|
|
||||||
nixd = {},
|
|
||||||
-- }}}
|
|
||||||
cssls = {},
|
|
||||||
jsonls = {},
|
|
||||||
dhall_lsp_server = {},
|
|
||||||
typst_lsp = {
|
|
||||||
exportPdf = "onType",
|
|
||||||
},
|
|
||||||
elmls = {},
|
|
||||||
csharp_ls = {},
|
|
||||||
}
|
|
||||||
-- }}}
|
|
||||||
|
|
||||||
local capabilities = M.capabilities()
|
local capabilities = M.capabilities()
|
||||||
for lsp, details in pairs(servers) do
|
for lsp, details in pairs(servers) do
|
||||||
details.capabilities = capabilities
|
details.capabilities = capabilities
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{ config, ... }: {
|
{ config, ... }:
|
||||||
|
{
|
||||||
# {{{ Set up my custom imperanence wrapper
|
# {{{ Set up my custom imperanence wrapper
|
||||||
satellite.persistence = {
|
satellite.persistence = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -77,9 +78,7 @@
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ Python
|
# {{{ Python
|
||||||
satellite.persistence.at.cache.apps.python = {
|
satellite.persistence.at.cache.apps.python = {
|
||||||
files = [
|
files = [ ".python_history" ];
|
||||||
".python_history"
|
|
||||||
];
|
|
||||||
|
|
||||||
directories = [
|
directories = [
|
||||||
".ipython"
|
".ipython"
|
||||||
|
@ -131,23 +130,24 @@
|
||||||
"${config.xdg.cacheHome}/lutris/coverart" # Game cover art
|
"${config.xdg.cacheHome}/lutris/coverart" # Game cover art
|
||||||
|
|
||||||
# Aparently IO intensive stuff like games prefer symlinks?
|
# Aparently IO intensive stuff like games prefer symlinks?
|
||||||
{ directory = "media/games/lutris"; method = "symlink"; } # Lutris games
|
{
|
||||||
|
directory = "media/games/lutris";
|
||||||
|
method = "symlink";
|
||||||
|
} # Lutris games
|
||||||
];
|
];
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ Wine
|
# {{{ Wine
|
||||||
satellite.persistence.at.state.apps.wine.directories = [ ".wine" ];
|
satellite.persistence.at.state.apps.wine.directories = [ ".wine" ];
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ Element
|
# {{{ Element
|
||||||
satellite.persistence.at.state.apps.element.directories = [
|
satellite.persistence.at.state.apps.element.directories = [ "${config.xdg.configHome}/Element" ];
|
||||||
"${config.xdg.configHome}/Element"
|
|
||||||
];
|
|
||||||
# }}}
|
# }}}
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ Cli
|
# {{{ Cli
|
||||||
# {{{ Sops
|
# {{{ Sops
|
||||||
satellite.persistence.at.state.apps.sops.directories = [ "${config.xdg.configHome}/sops/age" ];
|
satellite.persistence.at.state.apps.sops.directories = [ "${config.xdg.configHome}/sops/age" ];
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ QMK
|
# {{{ QMK
|
||||||
home.sessionVariables.QMK_HOME = "${config.xdg.dataHome}/qmk";
|
home.sessionVariables.QMK_HOME = "${config.xdg.dataHome}/qmk";
|
||||||
satellite.persistence.at.state.apps.qmk.directories = [ config.home.sessionVariables.QMK_HOME ];
|
satellite.persistence.at.state.apps.qmk.directories = [ config.home.sessionVariables.QMK_HOME ];
|
||||||
# }}}
|
# }}}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
virtualisation.oci-containers.backend = "docker";
|
virtualisation.oci-containers.backend = "docker";
|
||||||
|
|
||||||
|
|
||||||
environment.persistence = {
|
environment.persistence = {
|
||||||
"/persist/state".directories = [
|
"/persist/state".directories = [
|
||||||
"/var/lib/containers/storage"
|
"/var/lib/containers/storage"
|
||||||
|
|
|
@ -14,6 +14,17 @@ let
|
||||||
(lib.concatStringsSep "\n")
|
(lib.concatStringsSep "\n")
|
||||||
];
|
];
|
||||||
|
|
||||||
|
hasType = type: value:
|
||||||
|
let err = type.verify value; in
|
||||||
|
lib.assertMsg (err == null) err;
|
||||||
|
|
||||||
|
lua = value: assert hasType k.string value;
|
||||||
|
{
|
||||||
|
inherit value;
|
||||||
|
__luaEncoderTag = "lua";
|
||||||
|
__functor = _: arg: lua "(${value})(${encode arg})";
|
||||||
|
};
|
||||||
|
|
||||||
# {{{ Verification helpers
|
# {{{ Verification helpers
|
||||||
toPretty = lib.generators.toPretty { indent = " "; };
|
toPretty = lib.generators.toPretty { indent = " "; };
|
||||||
withError = cond: err: if cond then null else err;
|
withError = cond: err: if cond then null else err;
|
||||||
|
|
|
@ -18,7 +18,7 @@ let
|
||||||
strictLuaLiteral = (k.struct "lua literal" {
|
strictLuaLiteral = (k.struct "lua literal" {
|
||||||
value = k.string;
|
value = k.string;
|
||||||
__luaEncoderTag = k.enum "lua literal tag" [ "lua" ];
|
__luaEncoderTag = k.enum "lua literal tag" [ "lua" ];
|
||||||
}).override { unknown = false; };
|
}).override { unknown = true; };
|
||||||
derivation = k.typedef "derivation" lib.isDerivation;
|
derivation = k.typedef "derivation" lib.isDerivation;
|
||||||
path = k.typedef "path" lib.isPath;
|
path = k.typedef "path" lib.isPath;
|
||||||
functionCheckedWith = arg: type:
|
functionCheckedWith = arg: type:
|
||||||
|
@ -133,22 +133,18 @@ let
|
||||||
# }}}
|
# }}}
|
||||||
};
|
};
|
||||||
|
|
||||||
hasType = type: value:
|
|
||||||
let err = type.verify value; in
|
|
||||||
lib.assertMsg (err == null) err;
|
|
||||||
|
|
||||||
mkLib = { tempestModule }:
|
mkLib = { tempestModule }:
|
||||||
assert hasType k.string tempestModule;
|
assert h.hasType k.string tempestModule;
|
||||||
rec {
|
rec {
|
||||||
inherit (e) encode;
|
inherit (e) encode;
|
||||||
|
inherit (h) lua;
|
||||||
|
|
||||||
# {{{ Common generation helpers
|
# {{{ Common generation helpers
|
||||||
lua = value: assert hasType k.string value;
|
|
||||||
{ inherit value; __luaEncoderTag = "lua"; };
|
|
||||||
importFrom = path: tag:
|
importFrom = path: tag:
|
||||||
assert lib.isPath path;
|
assert lib.isPath path;
|
||||||
assert hasType k.string tag;
|
assert h.hasType k.string tag;
|
||||||
lua "dofile(${encode (toString path)}).${tag}";
|
lua "dofile(${encode (toString path)}).${tag}";
|
||||||
foldedList = value: assert hasType k.attrs value;
|
foldedList = value: assert h.hasType k.attrs value;
|
||||||
{ inherit value; __luaEncoderTag = "foldedList"; };
|
{ inherit value; __luaEncoderTag = "foldedList"; };
|
||||||
thunk = code: _: lua code;
|
thunk = code: _: lua code;
|
||||||
tempest = given: context: lua ''
|
tempest = given: context: lua ''
|
||||||
|
@ -172,12 +168,12 @@ let
|
||||||
unmap = mapping:
|
unmap = mapping:
|
||||||
{ inherit mapping; action = "<nop>"; };
|
{ inherit mapping; action = "<nop>"; };
|
||||||
blacklist = given:
|
blacklist = given:
|
||||||
assert hasType (types.oneOrMany types.neovimEnv) given;
|
assert h.hasType (types.oneOrMany types.neovimEnv) given;
|
||||||
lua /* lua */ ''
|
lua /* lua */ ''
|
||||||
D.tempest.blacklist(${encode given})
|
D.tempest.blacklist(${encode given})
|
||||||
'';
|
'';
|
||||||
whitelist = given:
|
whitelist = given:
|
||||||
assert hasType (types.oneOrMany types.neovimEnv) given;
|
assert h.hasType (types.oneOrMany types.neovimEnv) given;
|
||||||
lua /* lua */ ''
|
lua /* lua */ ''
|
||||||
D.tempest.whitelist(${encode given})
|
D.tempest.whitelist(${encode given})
|
||||||
'';
|
'';
|
||||||
|
@ -187,7 +183,7 @@ let
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ Main config generation entrypoint
|
# {{{ Main config generation entrypoint
|
||||||
generateConfig = rawConfig:
|
generateConfig = rawConfig:
|
||||||
assert hasType types.neovimConfig rawConfig;
|
assert h.hasType types.neovimConfig rawConfig;
|
||||||
let
|
let
|
||||||
config = { lazy = { }; pre = { }; post = { }; } // rawConfig;
|
config = { lazy = { }; pre = { }; post = { }; } // rawConfig;
|
||||||
collectNixDeps = lazyModule:
|
collectNixDeps = lazyModule:
|
||||||
|
|
Loading…
Reference in a new issue