Massive nixfmt reformatting

This commit is contained in:
Natsu Kagami 2025-04-03 13:59:50 +02:00
parent fe4492f004
commit b29ddd5e65
Signed by: nki
GPG key ID: 55A032EB38B49ADB
109 changed files with 4323 additions and 2368 deletions

View file

@ -1,6 +1,6 @@
{ pkgs, runCommand, ... }: runCommand "epfl-cups-drivers" { } ''
{ pkgs, runCommand, ... }:
runCommand "epfl-cups-drivers" { } ''
mkdir -p $out/share/cups/model
cp ${./PPD-C5860-bw-EN.PPD} $out/share/cups/model
cp ${./PPD-C5860-color-EN.PPD} $out/share/cups/model
''

View file

@ -1,4 +1,13 @@
{ lib, rustPlatform, fetchFromSourcehut, symlinkJoin, clang, git, writeText, ... }:
{
lib,
rustPlatform,
fetchFromSourcehut,
symlinkJoin,
clang,
git,
writeText,
...
}:
let
src = fetchFromSourcehut {
owner = "~hadronized";
@ -12,9 +21,17 @@ let
pname = "kak-tree-sitter";
version = "1.1.3";
cargoHash = "sha256-1OwPfl1446SYt1556jwR9mvWOWEv+ab+wH7GZQeS4/E=";
cargoBuildOptions = [ "--package" "kak-tree-sitter" "--package" "ktsctl" ];
cargoBuildOptions = [
"--package"
"kak-tree-sitter"
"--package"
"ktsctl"
];
nativeBuildInputs = [ clang git ];
nativeBuildInputs = [
clang
git
];
patches = [
# Allow absolute-path style repos
@ -31,7 +48,7 @@ let
+ .trim_start_matches(":/")
+ .trim_start_matches("/"),
);
self.runtime_dir.join("sources").join(url_dir)
'')
];
@ -40,4 +57,3 @@ let
};
in
kak-tree-sitter

View file

@ -1,25 +1,32 @@
{ callPackage, kakoune, kakoune-unwrapped, ... }:
{
callPackage,
kakoune,
kakoune-unwrapped,
...
}:
let
lsp = callPackage ./lsp.nix { };
rc = (callPackage ./rc.nix { });
in
(kakoune.override {
plugins = callPackage ./plugins.nix { }
plugins =
callPackage ./plugins.nix { }
++ callPackage ./themes.nix { }
++ [
(callPackage ./kaktex { })
(callPackage ./faces.nix { })
rc
lsp.plugin
];
}).overrideAttrs (attrs: {
buildCommand = ''
${attrs.buildCommand or ""}
# location of kak binary is used to find ../share/kak/autoload,
# unless explicitly overriden with KAKOUNE_RUNTIME
rm "$out/bin/kak"
makeWrapper "${kakoune-unwrapped}/bin/kak" "$out/bin/kak" \
--set KAKOUNE_RUNTIME "$out/share/kak" \
--suffix PATH ":" "${lsp.extraPaths}"
'';
})
(callPackage ./kaktex { })
(callPackage ./faces.nix { })
rc
lsp.plugin
];
}).overrideAttrs
(attrs: {
buildCommand = ''
${attrs.buildCommand or ""}
# location of kak binary is used to find ../share/kak/autoload,
# unless explicitly overriden with KAKOUNE_RUNTIME
rm "$out/bin/kak"
makeWrapper "${kakoune-unwrapped}/bin/kak" "$out/bin/kak" \
--set KAKOUNE_RUNTIME "$out/share/kak" \
--suffix PATH ":" "${lsp.extraPaths}"
'';
})

View file

@ -1,7 +1,7 @@
{ callPackage, ... } :
{ callPackage, ... }:
let
utils = callPackage ./utils.nix { };
faces = {
utils = callPackage ./utils.nix { };
faces = {
Default = "%opt{text},%opt{base}";
BufferPadding = "%opt{base},%opt{base}";
MenuForeground = "%opt{blue},white+bF";
@ -27,5 +27,6 @@ faces = {
format_specifier = "+i@string";
mutable_variable = "+i@variable";
class = "+b@variable";
};
in utils.mkFacesScript "default-faces" faces
};
in
utils.mkFacesScript "default-faces" faces

View file

@ -1,4 +1,11 @@
{ fish, lib, writeScript, writeTextDir, kakouneUtils, ... }:
{
fish,
lib,
writeScript,
writeTextDir,
kakouneUtils,
...
}:
let
kaktex-script = writeScript "kaktex" ''
#!/usr/bin/env ${lib.getExe fish}

View file

@ -35,46 +35,83 @@ let
languageServers =
let
vscodeServerWith = { name, extraFileTypes ? [ ] }: {
name = "vscode-${name}-language-server";
value = {
args = [ "--stdio" ];
command = "vscode-${name}-language-server";
filetypes = [ name ] ++ extraFileTypes;
roots = [ "package.json" ".git" ];
package = nodePackages.vscode-langservers-extracted;
vscodeServerWith =
{
name,
extraFileTypes ? [ ],
}:
{
name = "vscode-${name}-language-server";
value = {
args = [ "--stdio" ];
command = "vscode-${name}-language-server";
filetypes = [ name ] ++ extraFileTypes;
roots = [
"package.json"
".git"
];
package = nodePackages.vscode-langservers-extracted;
};
};
};
in
{
ccls = {
args = [ "-v=2" "-log-file=/tmp/ccls.log" ];
args = [
"-v=2"
"-log-file=/tmp/ccls.log"
];
package = ccls;
command = "ccls";
filetypes = [ "c" "cpp" ];
roots = [ "compile_commands.json" ".cquery" ".git" ];
filetypes = [
"c"
"cpp"
];
roots = [
"compile_commands.json"
".cquery"
".git"
];
};
gopls = {
command = "gopls";
package = gopls;
filetypes = [ "go" ];
offset_encoding = "utf-8";
roots = [ "Gopkg.toml" "go.mod" ".git" ".hg" ];
settings = { gopls = { hoverKind = "SynopsisDocumentation"; semanticTokens = true; }; };
roots = [
"Gopkg.toml"
"go.mod"
".git"
".hg"
];
settings = {
gopls = {
hoverKind = "SynopsisDocumentation";
semanticTokens = true;
};
};
settings_section = "gopls";
};
haskell-language-server = {
args = [ "--lsp" ];
command = "haskell-language-server-wrapper";
filetypes = [ "haskell" ];
roots = [ "Setup.hs" "stack.yaml" "*.cabal" "package.yaml" ];
roots = [
"Setup.hs"
"stack.yaml"
"*.cabal"
"package.yaml"
];
settings_section = "haskell";
};
nil = {
command = "nil";
package = nil;
filetypes = [ "nix" ];
roots = [ "flake.nix" "shell.nix" ".git" ];
roots = [
"flake.nix"
"shell.nix"
".git"
];
settings.nil = {
formatting.command = [ "${lib.getExe nixfmt-rfc-style}" ];
};
@ -84,21 +121,43 @@ let
package = python311Packages.python-lsp-server;
filetypes = [ "python" ];
offset_encoding = "utf-8";
roots = [ "requirements.txt" "setup.py" ".git" ".hg" ];
roots = [
"requirements.txt"
"setup.py"
".git"
".hg"
];
};
# Spellchecking server
ltex-ls = {
command = "ltex-ls";
args = [ "--log-file=/tmp" ];
filetypes = [ "latex" "typst" ];
roots = [ "main.tex" "main.typ" ".git" ];
filetypes = [
"latex"
"typst"
];
roots = [
"main.tex"
"main.typ"
".git"
];
package = ltex-ls;
};
tailwind = {
command = "tailwindcss-language-server";
args = [ "--stdio" ];
filetypes = [ "html" "css" "javascript" "typescript" "templ" ];
roots = [ "tailwind.config.{js,cjs,mjs,ts}" "package.json" ".git" ];
filetypes = [
"html"
"css"
"javascript"
"typescript"
"templ"
];
roots = [
"tailwind.config.{js,cjs,mjs,ts}"
"package.json"
".git"
];
settings_section = "tailwindCSS";
settings.tailwindCSS = {
validate = "warning";
@ -115,12 +174,20 @@ let
typescript-language-server = {
args = [ "--stdio" ];
command = "typescript-language-server";
filetypes = [ "typescript" "javascript" ];
filetypes = [
"typescript"
"javascript"
];
roots = [ "package.json" ];
package = nodePackages.typescript-language-server;
};
fsautocomplete = {
args = [ "--adaptive-lsp-server-enabled" "--project-graph-enabled" "--source-text-factory" "RoslynSourceText" ];
args = [
"--adaptive-lsp-server-enabled"
"--project-graph-enabled"
"--source-text-factory"
"RoslynSourceText"
];
command = "fsautocomplete";
filetypes = [ "fsharp" ];
roots = [ "*.fsproj" ];
@ -133,7 +200,11 @@ let
metals = {
command = "metals";
filetypes = [ "scala" ];
roots = [ "build.sbt" "build.sc" "build.mill" ];
roots = [
"build.sbt"
"build.sc"
"build.mill"
];
settings_section = "metals";
settings.metals = {
inlayHints.inferredTypes.enable = true;
@ -143,18 +214,30 @@ let
icons = "unicode";
isHttpEnabled = true;
statusBarProvider = "log-message";
compilerOptions = { overrideDefFormat = "unicode"; };
compilerOptions = {
overrideDefFormat = "unicode";
};
};
package = metals;
};
texlab = {
command = "texlab";
filetypes = [ "latex" ];
roots = [ "main.tex" "all.tex" ".git" ];
roots = [
"main.tex"
"all.tex"
".git"
];
settings_section = "texlab";
settings.texlab = {
build.executable = "latexmk";
build.args = [ "-pdf" "-shell-escape" "-interaction=nonstopmode" "-synctex=1" "%f" ];
build.args = [
"-pdf"
"-shell-escape"
"-interaction=nonstopmode"
"-synctex=1"
"%f"
];
build.forwardSearchAfter = true;
build.onSave = true;
@ -174,7 +257,10 @@ let
tinymist = {
command = "tinymist";
filetypes = [ "typst" ];
roots = [ "main.typ" ".git" ];
roots = [
"main.typ"
".git"
];
settings_section = "tinymist";
settings.tinymist = {
exportPdf = "onSave";
@ -185,14 +271,20 @@ let
marksman = {
command = "marksman";
filetypes = [ "markdown" ];
roots = [ ".marksman.toml" ".git" ];
roots = [
".marksman.toml"
".git"
];
package = marksman;
};
templ = {
command = "templ";
args = [ "lsp" ];
filetypes = [ "templ" ];
roots = [ "go.mod" ".git" ];
roots = [
"go.mod"
".git"
];
package = templ;
};
rust-analyzer = {
@ -203,78 +295,202 @@ let
package = rust-analyzer;
};
} // (builtins.listToAttrs (builtins.map
(ft: vscodeServerWith {
name = ft;
extraFileTypes = if ft == "json" then [ ] else [ "templ" ];
}) [ "html" "css" "json" ]));
}
// (builtins.listToAttrs (
builtins.map
(
ft:
vscodeServerWith {
name = ft;
extraFileTypes = if ft == "json" then [ ] else [ "templ" ];
}
)
[
"html"
"css"
"json"
]
));
faces = [
## Items
# (Rust) Macros
{ face = "attribute"; token = "attribute"; }
{ face = "attribute"; token = "derive"; }
{ face = "macro"; token = "macro"; } # Function-like Macro
{
face = "attribute";
token = "attribute";
}
{
face = "attribute";
token = "derive";
}
{
face = "macro";
token = "macro";
} # Function-like Macro
# Keyword and Fixed Tokens
{ face = "keyword"; token = "keyword"; }
{ face = "operator"; token = "operator"; }
{
face = "keyword";
token = "keyword";
}
{
face = "operator";
token = "operator";
}
# Functions and Methods
{ face = "function"; token = "function"; }
{ face = "method"; token = "method"; }
{
face = "function";
token = "function";
}
{
face = "method";
token = "method";
}
# Constants
{ face = "string"; token = "string"; }
{ face = "format_specifier"; token = "formatSpecifier"; }
{
face = "string";
token = "string";
}
{
face = "format_specifier";
token = "formatSpecifier";
}
# Variables
{ face = "variable"; token = "variable"; modifiers = [ "readonly" ]; }
{ face = "mutable_variable"; token = "variable"; }
{ face = "module"; token = "namespace"; }
{ face = "variable"; token = "type_parameter"; }
{ face = "class"; token = "enum"; }
{ face = "class"; token = "struct"; }
{ face = "class"; token = "trait"; }
{ face = "class"; token = "union"; }
{ face = "class"; token = "class"; }
{
face = "variable";
token = "variable";
modifiers = [ "readonly" ];
}
{
face = "mutable_variable";
token = "variable";
}
{
face = "module";
token = "namespace";
}
{
face = "variable";
token = "type_parameter";
}
{
face = "class";
token = "enum";
}
{
face = "class";
token = "struct";
}
{
face = "class";
token = "trait";
}
{
face = "class";
token = "union";
}
{
face = "class";
token = "class";
}
## Comments
{ face = "documentation"; token = "comment"; modifiers = [ "documentation" ]; }
{ face = "comment"; token = "comment"; }
{
face = "documentation";
token = "comment";
modifiers = [ "documentation" ];
}
{
face = "comment";
token = "comment";
}
# Typst
{ face = "header"; token = "heading"; }
{ face = "ts_markup_link_url"; token = "link"; }
{ face = "ts_markup_link_uri"; token = "ref"; }
{ face = "ts_markup_link_label"; token = "label"; }
{ face = "ts_property"; token = "pol"; }
{ face = "ts_markup_list_checked"; token = "marker"; }
{ face = "ts_constant_builtin_boolean"; token = "bool"; }
{ face = "ts_keyword_control"; token = "delim"; }
{ face = "ts_number"; token = "text"; modifiers = [ "math" ]; }
{ face = "ts_markup_bold"; token = "text"; modifiers = [ "strong" ]; }
{ face = "ts_markup_italic"; token = "text"; modifiers = [ "emph" ]; }
{
face = "header";
token = "heading";
}
{
face = "ts_markup_link_url";
token = "link";
}
{
face = "ts_markup_link_uri";
token = "ref";
}
{
face = "ts_markup_link_label";
token = "label";
}
{
face = "ts_property";
token = "pol";
}
{
face = "ts_markup_list_checked";
token = "marker";
}
{
face = "ts_constant_builtin_boolean";
token = "bool";
}
{
face = "ts_keyword_control";
token = "delim";
}
{
face = "ts_number";
token = "text";
modifiers = [ "math" ];
}
{
face = "ts_markup_bold";
token = "text";
modifiers = [ "strong" ];
}
{
face = "ts_markup_italic";
token = "text";
modifiers = [ "emph" ];
}
];
raw = {
server = { timeout = 1800; };
server = {
timeout = 1800;
};
snippet_support = false;
verbosity = 255;
};
};
per-lang-config = lang:
per-lang-config =
lang:
let
toml = formats.toml { };
servers = lib.filterAttrs (_: server: builtins.elem lang server.filetypes) config.languageServers;
serverSettings = lib.mapAttrs
(name: server: builtins.removeAttrs
(server // {
root_globs = server.roots;
}) [ "package" "filetypes" "roots" ])
servers;
serverSettings = lib.mapAttrs (
name: server:
builtins.removeAttrs
(
server
// {
root_globs = server.roots;
}
)
[
"package"
"filetypes"
"roots"
]
) servers;
serversToml = toml.generate "kak-lsp-${lang}.toml" serverSettings;
lang-id =
if builtins.hasAttr lang config.languageIDs then ''
set-option buffer lsp_language_id ${config.languageIDs.${lang}}
'' else "# No lang-id remap needed";
if builtins.hasAttr lang config.languageIDs then
''
set-option buffer lsp_language_id ${config.languageIDs.${lang}}
''
else
"# No lang-id remap needed";
in
''
# LSP Configuration for ${lang}
@ -288,14 +504,18 @@ let
lang-config =
let
langs = lib.unique (lib.flatten (lib.mapAttrsToList (_: server: server.filetypes) config.languageServers));
langs = lib.unique (
lib.flatten (lib.mapAttrsToList (_: server: server.filetypes) config.languageServers)
);
in
lib.concatMapStringsSep "\n" per-lang-config langs;
faces-config =
let
mapFace = face:
mapFace =
face:
let
modifiers = if builtins.hasAttr "modifiers" face then ", modifiers=${builtins.toJSON face.modifiers}" else "";
modifiers =
if builtins.hasAttr "modifiers" face then ", modifiers=${builtins.toJSON face.modifiers}" else "";
in
"{face=${builtins.toJSON face.face}, token=${builtins.toJSON face.token}${modifiers}}";
faces = lib.concatMapStringsSep ",\n " mapFace config.faces;
@ -319,9 +539,9 @@ let
# language_ids = config.languageIDs;
# } // config.raw);
serverPackages =
builtins.filter (v: v != null)
(lib.mapAttrsToList (_: serv: serv.package or null) config.languageServers);
serverPackages = builtins.filter (v: v != null) (
lib.mapAttrsToList (_: serv: serv.package or null) config.languageServers
);
in
{
extraPaths = lib.makeBinPath (serverPackages ++ [ kak-lsp ]);
@ -385,4 +605,3 @@ in
}
'';
}

View file

@ -1,37 +1,57 @@
{ pkgs, symlinkJoin, writeTextDir, kakouneUtils, ... }:
{
pkgs,
symlinkJoin,
writeTextDir,
kakouneUtils,
...
}:
with {
inherit (kakouneUtils) buildKakounePluginFrom2Nix;
};
let
toDir = name: file: writeTextDir name (builtins.readFile file);
writeActivationScript = script: writeTextDir "on-load.kak" ''
hook global KakBegin .* %{
${script}
}
'';
writeActivationScript =
script:
writeTextDir "on-load.kak" ''
hook global KakBegin .* %{
${script}
}
'';
writeModuleWrapper = name: script: writeTextDir "module.kak" ''
provide-module ${name} %
${script}
'';
writeModuleWrapper =
name: script:
writeTextDir "module.kak" ''
provide-module ${name} %
${script}
'';
kakounePlugin = { name, src, wrapAsModule ? false, activationScript ? null, ... }@attrs:
kakounePlugin =
{
name,
src,
wrapAsModule ? false,
activationScript ? null,
...
}@attrs:
let
module = if wrapAsModule then writeModuleWrapper name (builtins.readFile src) else src;
in
buildKakounePluginFrom2Nix {
pname = name;
version = attrs.version or "latest";
src = if activationScript == null then module else
symlinkJoin {
name = "${name}-src";
paths = [
src =
if activationScript == null then
module
(writeActivationScript activationScript)
];
};
else
symlinkJoin {
name = "${name}-src";
paths = [
module
(writeActivationScript activationScript)
];
};
};
in
builtins.map kakounePlugin [
@ -129,12 +149,14 @@ builtins.map kakounePlugin [
}
{
name = "racket.kak";
src = (builtins.fetchTree {
type = "git";
url = "https://bitbucket.org/KJ_Duncan/kakoune-racket.kak.git";
rev = "e397042009b46916ff089d79166ec0e8ca813a18";
narHash = "sha256-IcxFmvG0jqpMCG/dT9crVRgPgMGKkic6xwrnW5z4+bc=";
}) + "/rc";
src =
(builtins.fetchTree {
type = "git";
url = "https://bitbucket.org/KJ_Duncan/kakoune-racket.kak.git";
rev = "e397042009b46916ff089d79166ec0e8ca813a18";
narHash = "sha256-IcxFmvG0jqpMCG/dT9crVRgPgMGKkic6xwrnW5z4+bc=";
})
+ "/rc";
}
# {
# name = "kakoune-discord";
@ -142,13 +164,14 @@ builtins.map kakounePlugin [
# }
rec {
name = "kakoune-mirror";
src = pkgs.fetchFromGitHub
{
src =
pkgs.fetchFromGitHub {
owner = "Delapouite";
repo = "kakoune-mirror";
rev = "5710635f440bcca914d55ff2ec1bfcba9efe0f15";
sha256 = "sha256-uslx4zZhvjUylrPWvTOugsKYKKpF0EEz1drc1Ckrpjk=";
} + "/mirror.kak";
}
+ "/mirror.kak";
wrapAsModule = true;
activationScript = ''
require-module ${name}

View file

@ -1,10 +1,11 @@
{ lib
, fish
, writeScript
, writeTextDir
, prependRc ? ""
, appendRc ? ""
, ...
{
lib,
fish,
writeScript,
writeTextDir,
prependRc ? "",
appendRc ? "",
...
}:
let

View file

@ -1,9 +1,13 @@
{ writeTextDir, ... }:
let
themes = [
{ name = "catppuccin-latte"; src = ./themes/catppuccin-latte.kak; }
{
name = "catppuccin-latte";
src = ./themes/catppuccin-latte.kak;
}
];
themeToColorscheme = { name, src }: writeTextDir "share/kak/colors/${name}.kak" (builtins.readFile src);
themeToColorscheme =
{ name, src }: writeTextDir "share/kak/colors/${name}.kak" (builtins.readFile src);
in
builtins.map themeToColorscheme themes

View file

@ -1,7 +1,12 @@
{ lib, writeTextDir, ... }: {
mkFacesScript = name: faces: writeTextDir "share/kak/autoload/${name}/faces.kak" ''
hook global KakBegin .* %{
${lib.concatStringsSep "\n" (builtins.attrValues (builtins.mapAttrs (name: face: " face global ${name} \"${face}\"") faces))}
}
'';
{ lib, writeTextDir, ... }:
{
mkFacesScript =
name: faces:
writeTextDir "share/kak/autoload/${name}/faces.kak" ''
hook global KakBegin .* %{
${lib.concatStringsSep "\n" (
builtins.attrValues (builtins.mapAttrs (name: face: " face global ${name} \"${face}\"") faces)
)}
}
'';
}

View file

@ -3,4 +3,3 @@ runCommandLocal "suwako-cursors" { } ''
mkdir -p $out/share/icons
${unzip}/bin/unzip ${./Suwako.zip} -d $out/share/icons
''

View file

@ -1,4 +1,5 @@
{ stdenv, lib }: stdenv.mkDerivation rec {
{ stdenv, lib }:
stdenv.mkDerivation rec {
name = "ttaenc";
version = "3.4.1";

View file

@ -1,4 +1,16 @@
{ lib, fetchFromGitHub, stdenv, nodejs, pnpm, buildGoModule, mage, writeShellScriptBin, nixosTests, autoPatchelfHook, musl }:
{
lib,
fetchFromGitHub,
stdenv,
nodejs,
pnpm,
buildGoModule,
mage,
writeShellScriptBin,
nixosTests,
autoPatchelfHook,
musl,
}:
let
version = "0.24.5-git";
@ -16,7 +28,12 @@ let
sourceRoot = "${finalAttrs.src.name}/frontend";
pnpmDeps = pnpm.fetchDeps {
inherit (finalAttrs) pname version src sourceRoot;
inherit (finalAttrs)
pname
version
src
sourceRoot
;
hash = "sha256-sOCaJDBgEMID+lN5plQpSqaGBIUs5h2tAwDzhtOH53o=";
};
@ -52,7 +69,8 @@ let
});
# Injects a `t.Skip()` into a given test since there's apparently no other way to skip tests here.
skipTest = lineOffset: testCase: file:
skipTest =
lineOffset: testCase: file:
let
jumpAndAppend = lib.concatStringsSep ";" (lib.replicate (lineOffset - 1) "n" ++ [ "a" ]);
in
@ -77,7 +95,10 @@ buildGoModule {
fi
'';
in
[ fakeGit mage ];
[
fakeGit
mage
];
vendorHash = "sha256-UWjlivF9ySXCAr84A1trCJ/n9pB98ZhEyG11qz3PL7g=";