-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modules/home-manager: patch nix-index to remove FHS outputs
This is part of a PR over at nix-community/nix-index#243 which makes `--top-level` a default argument. This in turn removes FHS entries by default from being matched when using `nix-locate`. This was always a pain point for me so I am glad someone knew how to fix it. Unfortunately since that PR seems a bit stalled I've in turn needed to patch directly. I've poked upstream to help move that PR along, and once it does merge I'll drop this patch.
- Loading branch information
Showing
2 changed files
with
62 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
modules/home-manager/programs/nix-index/skip-fhs-by-default.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
diff --git a/CHANGELOG.md b/CHANGELOG.md | ||
index 3c09c04..25f62e8 100644 | ||
--- a/CHANGELOG.md | ||
+++ b/CHANGELOG.md | ||
@@ -3,6 +3,8 @@ | ||
### Fixed | ||
### Changed | ||
|
||
+* `--top-level` is now the default. To use the old default, add `--all`. | ||
+ | ||
## 0.1.8 | ||
### Added | ||
|
||
diff --git a/command-not-found.sh b/command-not-found.sh | ||
index 5f30bad..64457ef 100755 | ||
--- a/command-not-found.sh | ||
+++ b/command-not-found.sh | ||
@@ -16,7 +16,7 @@ command_not_found_handle () { | ||
|
||
toplevel=nixpkgs # nixpkgs should always be available even in NixOS | ||
cmd=$1 | ||
- attrs=$(@out@/bin/nix-locate --minimal --no-group --type x --type s --top-level --whole-name --at-root "/bin/$cmd") | ||
+ attrs=$(@out@/bin/nix-locate --minimal --no-group --type x --type s --whole-name --at-root "/bin/$cmd") | ||
len=$(echo -n "$attrs" | grep -c "^") | ||
|
||
case $len in | ||
diff --git a/src/bin/nix-locate.rs b/src/bin/nix-locate.rs | ||
index 760d398..2c18747 100644 | ||
--- a/src/bin/nix-locate.rs | ||
+++ b/src/bin/nix-locate.rs | ||
@@ -187,7 +187,7 @@ fn process_args(matches: Opts) -> result::Result<Args, clap::Error> { | ||
file_type: matches | ||
.r#type | ||
.unwrap_or_else(|| files::ALL_FILE_TYPES.to_vec()), | ||
- only_toplevel: matches.top_level, | ||
+ only_toplevel: !matches.all, | ||
color, | ||
minimal: matches.minimal, | ||
}; | ||
@@ -255,9 +255,9 @@ struct Opts { | ||
#[clap(long, name = "HASH")] | ||
hash: Option<String>, | ||
|
||
- /// Only print matches from packages that show up in `nix-env -qa`. | ||
+ /// Print all matches, not only print from packages that show up in `nix-env -qa`. | ||
#[clap(long)] | ||
- top_level: bool, | ||
+ all: bool, | ||
|
||
/// Only print matches for files that have this type. If the option is given multiple times, | ||
/// a file will be printed if it has any of the given types. |