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 = {}
|
||||
|
||||
-- {{{ Capabilities
|
||||
|
@ -15,91 +14,9 @@ M.capabilities = function()
|
|||
end
|
||||
-- }}}
|
||||
-- {{{ Main config function
|
||||
function M.config()
|
||||
function M.config(servers)
|
||||
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()
|
||||
for lsp, details in pairs(servers) do
|
||||
details.capabilities = capabilities
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{ config, ... }: {
|
||||
{ config, ... }:
|
||||
{
|
||||
# {{{ Set up my custom imperanence wrapper
|
||||
satellite.persistence = {
|
||||
enable = true;
|
||||
|
@ -77,9 +78,7 @@
|
|||
# }}}
|
||||
# {{{ Python
|
||||
satellite.persistence.at.cache.apps.python = {
|
||||
files = [
|
||||
".python_history"
|
||||
];
|
||||
files = [ ".python_history" ];
|
||||
|
||||
directories = [
|
||||
".ipython"
|
||||
|
@ -131,23 +130,24 @@
|
|||
"${config.xdg.cacheHome}/lutris/coverart" # Game cover art
|
||||
|
||||
# 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
|
||||
satellite.persistence.at.state.apps.wine.directories = [ ".wine" ];
|
||||
# }}}
|
||||
# {{{ Element
|
||||
satellite.persistence.at.state.apps.element.directories = [
|
||||
"${config.xdg.configHome}/Element"
|
||||
];
|
||||
# {{{ Element
|
||||
satellite.persistence.at.state.apps.element.directories = [ "${config.xdg.configHome}/Element" ];
|
||||
# }}}
|
||||
# }}}
|
||||
# {{{ Cli
|
||||
# {{{ Sops
|
||||
# {{{ Sops
|
||||
satellite.persistence.at.state.apps.sops.directories = [ "${config.xdg.configHome}/sops/age" ];
|
||||
# }}}
|
||||
# {{{ QMK
|
||||
# {{{ QMK
|
||||
home.sessionVariables.QMK_HOME = "${config.xdg.dataHome}/qmk";
|
||||
satellite.persistence.at.state.apps.qmk.directories = [ config.home.sessionVariables.QMK_HOME ];
|
||||
# }}}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
virtualisation.oci-containers.backend = "docker";
|
||||
|
||||
|
||||
environment.persistence = {
|
||||
"/persist/state".directories = [
|
||||
"/var/lib/containers/storage"
|
||||
|
|
|
@ -14,6 +14,17 @@ let
|
|||
(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
|
||||
toPretty = lib.generators.toPretty { indent = " "; };
|
||||
withError = cond: err: if cond then null else err;
|
||||
|
|
|
@ -18,7 +18,7 @@ let
|
|||
strictLuaLiteral = (k.struct "lua literal" {
|
||||
value = k.string;
|
||||
__luaEncoderTag = k.enum "lua literal tag" [ "lua" ];
|
||||
}).override { unknown = false; };
|
||||
}).override { unknown = true; };
|
||||
derivation = k.typedef "derivation" lib.isDerivation;
|
||||
path = k.typedef "path" lib.isPath;
|
||||
functionCheckedWith = arg: type:
|
||||
|
@ -133,22 +133,18 @@ let
|
|||
# }}}
|
||||
};
|
||||
|
||||
hasType = type: value:
|
||||
let err = type.verify value; in
|
||||
lib.assertMsg (err == null) err;
|
||||
|
||||
mkLib = { tempestModule }:
|
||||
assert hasType k.string tempestModule;
|
||||
assert h.hasType k.string tempestModule;
|
||||
rec {
|
||||
inherit (e) encode;
|
||||
inherit (h) lua;
|
||||
|
||||
# {{{ Common generation helpers
|
||||
lua = value: assert hasType k.string value;
|
||||
{ inherit value; __luaEncoderTag = "lua"; };
|
||||
importFrom = path: tag:
|
||||
assert lib.isPath path;
|
||||
assert hasType k.string tag;
|
||||
assert h.hasType k.string 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"; };
|
||||
thunk = code: _: lua code;
|
||||
tempest = given: context: lua ''
|
||||
|
@ -172,12 +168,12 @@ let
|
|||
unmap = mapping:
|
||||
{ inherit mapping; action = "<nop>"; };
|
||||
blacklist = given:
|
||||
assert hasType (types.oneOrMany types.neovimEnv) given;
|
||||
assert h.hasType (types.oneOrMany types.neovimEnv) given;
|
||||
lua /* lua */ ''
|
||||
D.tempest.blacklist(${encode given})
|
||||
'';
|
||||
whitelist = given:
|
||||
assert hasType (types.oneOrMany types.neovimEnv) given;
|
||||
assert h.hasType (types.oneOrMany types.neovimEnv) given;
|
||||
lua /* lua */ ''
|
||||
D.tempest.whitelist(${encode given})
|
||||
'';
|
||||
|
@ -187,7 +183,7 @@ let
|
|||
# }}}
|
||||
# {{{ Main config generation entrypoint
|
||||
generateConfig = rawConfig:
|
||||
assert hasType types.neovimConfig rawConfig;
|
||||
assert h.hasType types.neovimConfig rawConfig;
|
||||
let
|
||||
config = { lazy = { }; pre = { }; post = { }; } // rawConfig;
|
||||
collectNixDeps = lazyModule:
|
||||
|
|
Loading…
Reference in a new issue