diff --git a/common/tooling/default.nix b/common/tooling/default.nix index cf577ce..ea92411 100644 --- a/common/tooling/default.nix +++ b/common/tooling/default.nix @@ -36,6 +36,7 @@ in (writeShellScriptBin "silent-add" "git add --intent-to-add $@ ; git update-index --assume-unchanged $@") urlencode + rfindup pstree file wget diff --git a/common/tooling/lsp.nix b/common/tooling/lsp.nix index 179fc97..fb65e1f 100644 --- a/common/tooling/lsp.nix +++ b/common/tooling/lsp.nix @@ -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' }" ] diff --git a/common/xdg/portals.nix b/common/xdg/portals.nix index 18d349d..20b1d01 100644 --- a/common/xdg/portals.nix +++ b/common/xdg/portals.nix @@ -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"; diff --git a/custom/confwhich/package.nix b/custom/confwhich/package.nix new file mode 100644 index 0000000..3f39c58 --- /dev/null +++ b/custom/confwhich/package.nix @@ -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; + }; +} diff --git a/custom/rfindup/package.nix b/custom/rfindup/package.nix new file mode 100644 index 0000000..0a39f61 --- /dev/null +++ b/custom/rfindup/package.nix @@ -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; + }; +} diff --git a/fake_flake.nix b/fake_flake.nix index ac82abb..6b88203 100644 --- a/fake_flake.nix +++ b/fake_flake.nix @@ -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="; } ]; diff --git a/overlays/confwhich.nix b/overlays/confwhich.nix new file mode 100644 index 0000000..04a8af6 --- /dev/null +++ b/overlays/confwhich.nix @@ -0,0 +1,4 @@ +{ prev, ... }: +{ + confwhich = prev.callPackage ../custom/confwhich/package.nix { }; +} diff --git a/overlays/default.nix b/overlays/default.nix index c190969..f3695c4 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -28,5 +28,7 @@ ./mcontrolcenter.nix ./ccache-wrapper.nix ./searchclip.nix + ./confwhich.nix + ./rfindup.nix ]; } diff --git a/overlays/rfindup.nix b/overlays/rfindup.nix new file mode 100644 index 0000000..d8bf2ad --- /dev/null +++ b/overlays/rfindup.nix @@ -0,0 +1,4 @@ +{ prev, ... }: +{ + rfindup = prev.callPackage ../custom/rfindup/package.nix { }; +}