Skip to content

Commit

Permalink
dev: add network debugging tools
Browse files Browse the repository at this point in the history
  • Loading branch information
berbiche committed Apr 3, 2024
1 parent 4227db1 commit b95b565
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 6 deletions.
28 changes: 28 additions & 0 deletions overlays/asroute.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
final: prev: {
asroute = prev.lib.flip prev.callPackage { } (
{ stdenv
, lib
, fetchFromGitHub
, rustPlatform
}:
rustPlatform.buildRustPackage rec {
pname = "asroute";
version = "0.1.0";

src = fetchFromGitHub {
repo = pname;
owner = "stevenpack";
rev = "v${version}";
hash = "sha256-+H3AYe+OWrxxaJ78ofuivz7DB/Fi8voZQyb1p2cCAns=";
};

cargoHash = "sha256-ZZz5i415lHWHVBL+Abe5C7gVjwm7/mbJ6I+/mp/96vI=";

meta = with lib; {
description = "Interpret traceroute output to show names of ASN traversed";
homepage = src.meta.homepage;
license = [ licenses.mit ];
maintainers = [ maintainers.berbiche ];
};
});
}
3 changes: 3 additions & 0 deletions profiles/dev/home-manager/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,8 @@ in

# onefetch's libresolv dependency does not build on aarch64
onefetch # neofetch for a git repository : lines of code, repo, etc.
] ++ lib.filter (lib.myLib.supportedOn pkgs.stdenv.hostPlatform.system) [
gping
asroute
];
}
7 changes: 1 addition & 6 deletions profiles/dev/home-manager/neovim/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ let
'');
n = nvim;
};

supportedOn = platform: pkg:
if pkg.meta ? platforms && pkg.meta ? badPlatforms
then builtins.elem platform pkg.meta.platforms && !builtins.elem platform pkg.meta.badPlatforms
else true;
in
{
imports = [
Expand All @@ -38,7 +33,7 @@ in
pkgs.fzf
pkgs.neovim-remote
]
++ lib.optional (supportedOn pkgs.stdenv.hostPlatform.system pkgs.neovide) pkgs.neovide;
++ lib.optional (lib.myLib.supportedOn pkgs.stdenv.hostPlatform.system pkgs.neovide) pkgs.neovide;

# programs.neovim.defaultEditor = true;
home.sessionVariables = {
Expand Down
7 changes: 7 additions & 0 deletions top-level/lib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,11 @@ lib.extend (libfinal: libprev: {
# Returns a list of nix files in the directory without recursing (and without `default.nix`)
myLib.nixFilesInDir = directory:
libprev.filter (n: libprev.hasSuffix "nix" n && n != "default.nix") (libprev.myLib.filesInDir directory);

# Returns a boolean indicating whether the the package `pkg` is supported on platform `platform`
# `true`: supported, `false`: unsupported
myLib.supportedOn = platform: pkg:
if pkg.meta ? platforms && pkg.meta ? badPlatforms
then builtins.elem platform pkg.meta.platforms && !builtins.elem platform pkg.meta.badPlatforms
else true;
})

0 comments on commit b95b565

Please sign in to comment.