Compare commits
3 commits
89b9624031
...
069c5e979a
Author | SHA1 | Date | |
---|---|---|---|
069c5e979a | |||
28bf1a9a0d | |||
e95279f45c |
6 changed files with 134 additions and 2 deletions
|
@ -79,6 +79,13 @@ in
|
||||||
rerere.enabled = true;
|
rerere.enabled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Use nix-index for command-not-found handler
|
||||||
|
programs.command-not-found.enable = false;
|
||||||
|
programs.nix-index = {
|
||||||
|
enable = true;
|
||||||
|
enableBashIntegration = true;
|
||||||
|
};
|
||||||
|
|
||||||
# Enable fail2ban because of the OpenSSH server
|
# Enable fail2ban because of the OpenSSH server
|
||||||
services.fail2ban = {
|
services.fail2ban = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
@ -45,7 +45,7 @@ self = {
|
||||||
{
|
{
|
||||||
config.nixpkgs.overlays = [
|
config.nixpkgs.overlays = [
|
||||||
( import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = "${self}/pkgs/top-level/impure.nix"; } )
|
( import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = "${self}/pkgs/top-level/impure.nix"; } )
|
||||||
( import "${inputs.nixpkgs}/pkgs/top-level/by-name-overlay.nix" "${self}/pkgs/by-name" )
|
( import ./pkgs/top-level/by-name-overlay.nix "${self}/pkgs/by-name" )
|
||||||
self.overlays.versionInfoFixup
|
self.overlays.versionInfoFixup
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
66
pkgs/by-name/ni/nix-index/cnfOutput.patch
Normal file
66
pkgs/by-name/ni/nix-index/cnfOutput.patch
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
diff --git a/command-not-found.sh b/command-not-found.sh
|
||||||
|
index 5f30bad..3854297 100755
|
||||||
|
--- a/command-not-found.sh
|
||||||
|
+++ b/command-not-found.sh
|
||||||
|
@@ -73,51 +73,30 @@ EOF
|
||||||
|
else
|
||||||
|
if [ -e "$HOME/.nix-profile/manifest.json" ]; then
|
||||||
|
>&2 cat <<EOF
|
||||||
|
-The program '$cmd' is currently not installed. You can install it
|
||||||
|
-by typing:
|
||||||
|
- nix profile install $toplevel#$attrs
|
||||||
|
-
|
||||||
|
-Or run it once with:
|
||||||
|
- nix shell $toplevel#$attrs -c $cmd ...
|
||||||
|
+The program '$cmd' is not in your PATH. You can make it available in an
|
||||||
|
+ephemeral shell by typing:
|
||||||
|
+ nix shell $toplevel#$attrs
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
>&2 cat <<EOF
|
||||||
|
-The program '$cmd' is currently not installed. You can install it
|
||||||
|
-by typing:
|
||||||
|
- nix-env -iA $toplevel.$attrs
|
||||||
|
-
|
||||||
|
-Or run it once with:
|
||||||
|
- nix-shell -p $attrs --run '$cmd ...'
|
||||||
|
+The program '$cmd' is not in your PATH. You can make it available in an
|
||||||
|
+ephemeral shell by typing:
|
||||||
|
+ nix-shell -p $attrs
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
>&2 cat <<EOF
|
||||||
|
-The program '$cmd' is currently not installed. It is provided by
|
||||||
|
-several packages. You can install it by typing one of the following:
|
||||||
|
-EOF
|
||||||
|
-
|
||||||
|
- # ensure we get each element of attrs
|
||||||
|
- # in a cross platform way
|
||||||
|
- while read attr; do
|
||||||
|
- if [ -e "$HOME/.nix-profile/manifest.json" ]; then
|
||||||
|
- >&2 echo " nix profile install $toplevel#$attr"
|
||||||
|
- else
|
||||||
|
- >&2 echo " nix-env -iA $toplevel.$attr"
|
||||||
|
- fi
|
||||||
|
- done <<< "$attrs"
|
||||||
|
-
|
||||||
|
- >&2 cat <<EOF
|
||||||
|
-
|
||||||
|
-Or run it once with:
|
||||||
|
+The program '$cmd' is not in your PATH. You can make it available in an
|
||||||
|
+ephemeral shell by typing:
|
||||||
|
EOF
|
||||||
|
|
||||||
|
while read attr; do
|
||||||
|
if [ -e "$HOME/.nix-profile/manifest.json" ]; then
|
||||||
|
- >&2 echo " nix shell $toplevel#$attr -c $cmd ..."
|
||||||
|
+ >&2 echo " nix shell $toplevel#$attr"
|
||||||
|
else
|
||||||
|
- >&2 echo " nix-shell -p $attr --run '$cmd ...'"
|
||||||
|
+ >&2 echo " nix-shell -p $attr"
|
||||||
|
fi
|
||||||
|
done <<< "$attrs"
|
||||||
|
;;
|
9
pkgs/by-name/ni/nix-index/override.nix
Normal file
9
pkgs/by-name/ni/nix-index/override.nix
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{self, super, package }:
|
||||||
|
|
||||||
|
package.override {
|
||||||
|
nix-index-unwrapped = self.nix-index-unwrapped.overrideAttrs (oldAttrs: {
|
||||||
|
patches = oldAttrs.patches or [] ++ [
|
||||||
|
./cnfOutput.patch
|
||||||
|
];
|
||||||
|
});
|
||||||
|
}
|
50
pkgs/top-level/by-name-overlay.nix
Normal file
50
pkgs/top-level/by-name-overlay.nix
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
# Modified copy of github:NixOS/nixpkgs pkgs/top-level/by-name-overlay.nix
|
||||||
|
# as of commit c0d0be00d4ecc4b51d2d6948e37466194c1e6c51
|
||||||
|
|
||||||
|
# This file turns the pkgs/by-name directory into an overlay that adds all the defined packages.
|
||||||
|
# No validity checks are done here.
|
||||||
|
|
||||||
|
# Type: Path -> Overlay
|
||||||
|
baseDirectory:
|
||||||
|
let
|
||||||
|
lib = (import ../../outputs.nix {}).lib;
|
||||||
|
|
||||||
|
inherit (builtins)
|
||||||
|
readDir
|
||||||
|
;
|
||||||
|
|
||||||
|
inherit (lib.attrsets)
|
||||||
|
mapAttrs
|
||||||
|
mapAttrsToList
|
||||||
|
mergeAttrsList
|
||||||
|
;
|
||||||
|
|
||||||
|
# Package files for a single shard
|
||||||
|
# Type: String -> String -> String -> AttrsOf Path
|
||||||
|
namesForShard = nixFilename: shard: type:
|
||||||
|
if type != "directory" then
|
||||||
|
# Ignore all non-directories.
|
||||||
|
{ }
|
||||||
|
else
|
||||||
|
mapAttrs
|
||||||
|
(name: _: baseDirectory + "/${shard}/${name}/${nixFilename}")
|
||||||
|
(readDir (baseDirectory + "/${shard}"));
|
||||||
|
|
||||||
|
# The attribute set mapping names to the package files defining them
|
||||||
|
# Type: String -> AttrsOf Path
|
||||||
|
packageFiles = nixFilename: lib.pipe baseDirectory [
|
||||||
|
readDir
|
||||||
|
(mapAttrsToList (namesForShard nixFilename))
|
||||||
|
mergeAttrsList
|
||||||
|
# Filter out paths that don't have a ${nixFilename} file
|
||||||
|
(lib.filterAttrs (_: lib.pathExists))
|
||||||
|
];
|
||||||
|
in
|
||||||
|
self: super:
|
||||||
|
mapAttrs (name: file:
|
||||||
|
self.callPackage file { inherit self super; package = super.${name}; }
|
||||||
|
) (packageFiles "override.nix")
|
||||||
|
// mapAttrs (name: file:
|
||||||
|
self.callPackage file { }
|
||||||
|
) (packageFiles "package.nix")
|
||||||
|
|
|
@ -16,7 +16,7 @@ let
|
||||||
( import ../overlays/selfExpr.nix { nixpkgsPath = "${builtins.toString ../..}/pkgs/top-level/impure.nix"; } )
|
( import ../overlays/selfExpr.nix { nixpkgsPath = "${builtins.toString ../..}/pkgs/top-level/impure.nix"; } )
|
||||||
( import ../overlays/unstable.nix )
|
( import ../overlays/unstable.nix )
|
||||||
( import ../overlays/version-info-fixup.nix { inherit inputs; } )
|
( import ../overlays/version-info-fixup.nix { inherit inputs; } )
|
||||||
( import "${inputs.nixpkgs}/pkgs/top-level/by-name-overlay.nix" ../by-name )
|
( import ./by-name-overlay.nix ../by-name )
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
Loading…
Reference in a new issue