diff --git a/flake.lock b/flake.lock index 1f958b7..b73d8f8 100644 --- a/flake.lock +++ b/flake.lock @@ -363,6 +363,26 @@ "type": "github" } }, + "eh": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1790587643, + "narHash": "sha256-U7fJQKbPScT82dbmLWOg/wriKqvDF+OCgTDGm8LtdEY=", + "owner": "NotAShelf", + "repo": "eh", + "rev": "196d9e1bf8604006ec10b20da29ffed6e725b559", + "type": "github" + }, + "original": { + "owner": "NotAShelf", + "repo": "eh", + "type": "github" + } + }, "firefox-gnome-theme": { "flake": false, "locked": { @@ -1479,6 +1499,7 @@ "authentik-nix": "authentik-nix", "determinate": "determinate", "disko": "disko", + "eh": "eh", "flake-file": "flake-file", "flake-parts": "flake-parts_2", "home-manager": "home-manager", diff --git a/flake.nix b/flake.nix index 5fde03b..a6b2746 100644 --- a/flake.nix +++ b/flake.nix @@ -13,6 +13,10 @@ url = "github:nix-community/disko?ref=latest"; inputs.nixpkgs.follows = "nixpkgs"; }; + eh = { + url = "github:NotAShelf/eh"; + inputs.nixpkgs.follows = "nixpkgs"; + }; flake-file.url = "github:vic/flake-file"; flake-parts = { url = "github:hercules-ci/flake-parts"; diff --git a/modules/profiles/personal.nix b/modules/profiles/personal.nix index 7087c0e..7457ebf 100644 --- a/modules/profiles/personal.nix +++ b/modules/profiles/personal.nix @@ -96,6 +96,7 @@ codexbar cpond direnv + eh gen-license gitfetch hyfetch diff --git a/modules/programs/cli/eh.nix b/modules/programs/cli/eh.nix new file mode 100644 index 0000000..40d40f1 --- /dev/null +++ b/modules/programs/cli/eh.nix @@ -0,0 +1,47 @@ +{inputs, ...}: { + flake-file.inputs.eh = { + url = "github:NotAShelf/eh"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + flake.modules.homeManager.eh = { + # keep-sorted start + lib, + pkgs, + # keep-sorted end + ... + }: let + inherit (lib) getExe; + inherit (pkgs.stdenv.hostPlatform) system; + + # The eh package installs a `,` multicall symlink that shadows + # nix-index-database's comma command; drop it while keeping eh and the + # other multicall binaries. + eh = inputs.eh.packages.${system}.eh.overrideAttrs (old: { + postInstall = + (old.postInstall or "") + + '' + rm -f $out/bin/, + rm -f $out/share/bash-completion/completions/, + rm -f $out/share/zsh/site-functions/_, + rm -f $out/share/fish/vendor_completions.d/,.fish + ''; + }); + in { + home.packages = [eh]; + + programs.fish.interactiveShellInitSnippets = [ + # Alias eh's non-conflicting multicall names to explicit subcommands so + # they still work even if the PATH symlinks are unavailable. + '' + alias nr='${getExe eh} run' + alias ns='${getExe eh} shell' + alias nb='${getExe eh} build' + alias nd='${getExe eh} develop' + alias ni='${getExe eh} info' + alias nu='${getExe eh} update' + alias dev='${getExe eh} develop' + '' + ]; + }; +}