automaitcally select treefmt config

This commit is contained in:
Grimmauld 2024-05-16 11:59:05 +02:00
parent a791b41455
commit 3d88a303bd
Signed by: Grimmauld
GPG key ID: C2946668769F91FB
9 changed files with 76 additions and 3 deletions

View file

@ -36,6 +36,7 @@ in
(writeShellScriptBin "silent-add" "git add --intent-to-add $@ ; git update-index --assume-unchanged $@")
urlencode
rfindup
pstree
file
wget

View file

@ -32,6 +32,8 @@ let
treefmt_conf = pkgs.writeText "treefmt.toml" (
concatLines (map (v: (conf_def v.fmt)) (filter (v: !isNull v.fmt) tooling.lang_servers))
);
find_conf = pkgs.writeShellScriptBin "find-treefmt-conf" "(${getExe pkgs.rfindup} treefmt.toml -e 2>/dev/null || echo ${treefmt_conf}) | tr -d '\n'";
in
{
config = mkIf (enable && tooling.enable) {
@ -44,7 +46,8 @@ in
++ (map (v: v.lsp.package) (filter (v: !isNull v.lsp) tooling.lang_servers))
++ (map (v: v.fmt.package) (filter (v: !isNull v.fmt) tooling.lang_servers));
environment.shellAliases."treefmt" = "${getExe pkgs.treefmt} --config-file ${treefmt_conf}";
# environment.shellAliases."treefmt" = "${getExe pkgs.treefmt} --config-file ${treefmt_conf}";
environment.shellAliases."treefmt" = "${getExe pkgs.treefmt} --config-file $(${getExe find_conf})";
grimmShared.tooling.nvim.extraLuaRC =
[ "vim.g.coq_settings = { auto_start = 'shut-up' }" ]

View file

@ -52,7 +52,10 @@ in
XDG_CONFIG_HOME = "$HOME/.config";
};
environment.systemPackages = with pkgs; [ xwaylandvideobridge ];
environment.systemPackages = with pkgs; [
xwaylandvideobridge
confwhich
];
};
options.grimmShared.portals = mkEnableOption "Enables portals for wlr, gtk and kde as well as fixes fonts";

View file

@ -0,0 +1,28 @@
{
lib,
rustPlatform,
fetchFromGitea,
}:
rustPlatform.buildRustPackage {
pname = "confwhich";
version = "unstable-2024-05-14";
src = fetchFromGitea {
domain = "git.grimmauld.de";
owner = "Grimmauld";
repo = "confwhich";
rev = "e561b82d1e2b0d0998ccbef316014297f3468fb6";
hash = "sha256-dMkUJMQjlKzmSsgtH0xOZ5Bk654+h84M1cTx8hVM5SQ=";
};
cargoHash = "sha256-cn9vtRO+negpIVs0rnp2y5q7L4w554dfBK9MtbWd8FA=";
meta = {
description = "tool to find the path of xdg config files";
homepage = "https://git.grimmauld.de/Grimmauld/confwhich";
license = lib.licenses.bsd3;
mainProgram = "confwhich";
maintainers = with lib.maintainers; [ grimmauld ];
platforms = lib.platforms.linux;
};
}

View file

@ -0,0 +1,28 @@
{
lib,
rustPlatform,
fetchFromGitea,
}:
rustPlatform.buildRustPackage {
pname = "rfindup";
version = "unstable-2024-05-16";
src = fetchFromGitea {
domain = "git.grimmauld.de";
owner = "Grimmauld";
repo = "rfindup";
rev = "fe2c39e74c667593896ce03033cccdffda6b288d";
hash = "sha256-N23sKOfir07WIFbjdHNku7nLTtRd7A5tfs7kvdeCyeU=";
};
cargoHash = "sha256-MD7ViPWkL/aYECWj1f+NdVrPVwwFTd8GyyKSUUgXXHE=";
meta = {
description = "tool to find files by name in parent directories";
homepage = "https://git.grimmauld.de/Grimmauld/rfindup";
license = lib.licenses.bsd3;
mainProgram = "rfindup";
maintainers = with lib.maintainers; [ grimmauld ];
platforms = lib.platforms.linux;
};
}

View file

@ -31,7 +31,7 @@ let
{
# xonsh update
url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/305316.patch";
hash = "sha256-/OSbAur16Q1XZ/Nhf8VAzaQ3gqbaxWkQlf5G4UWKnh8=";
hash = "sha256-W3jh6qRA/7V1fImLm3vRmaT6h6gL5rlNBUuIidZHaZc=";
}
];

4
overlays/confwhich.nix Normal file
View file

@ -0,0 +1,4 @@
{ prev, ... }:
{
confwhich = prev.callPackage ../custom/confwhich/package.nix { };
}

View file

@ -28,5 +28,7 @@
./mcontrolcenter.nix
./ccache-wrapper.nix
./searchclip.nix
./confwhich.nix
./rfindup.nix
];
}

4
overlays/rfindup.nix Normal file
View file

@ -0,0 +1,4 @@
{ prev, ... }:
{
rfindup = prev.callPackage ../custom/rfindup/package.nix { };
}