Skip to content

Commit

Permalink
Add Nix build.
Browse files Browse the repository at this point in the history
  • Loading branch information
picnoir committed Sep 13, 2023
1 parent 972dfdd commit a69d39e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
26 changes: 19 additions & 7 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
{ pkgs ? import <nixpkgs> {} }:

pkgs.stdenv.mkDerivation {
pname = "nix-dissector";
version = "1.0";
nativeBuildInputs = [ pkgs.autoreconfHook pkgs.pkg-config ];
buildInputs = [ pkgs.wireshark.dev pkgs.glib ];
src = pkgs.lib.cleanSource ./.;

let
# There's a bug upstream. Using my fork until
# https://github.com/mechpen/sockdump/pull/23 gets merged and
# Nixpkgs bumped.
sockdump = pkgs.sockdump.overrideAttrs(old: {
src = pkgs.fetchFromGitHub {
owner = "NinjaTrappeur";
repo = "sockdump";
rev = "5a45e06bc73938334de1375127e82d240b1d7477";
hash = "sha256-q6jdwFhl2G9o2C0BVU6Xz7xizO00yaSQ2KSR/z4fixY=";
};
});
in pkgs.writeShellApplication {
name = "snoop-nix-daemon";
runtimeInputs = [ pkgs.wireshark sockdump ];
text = ''
sudo ls
sudo sockdump --format pcap /nix/var/nix/daemon-socket/socket | wireshark -X lua_script:${./nix-packet.lua} -k -i -
'';
}
5 changes: 2 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

outputs = { self, nixpkgs }: {

packages.x86_64-linux.nix-dissector = import ./default.nix { inherit (nixpkgs.legacyPackages.x86_64-linux) pkgs; };

devShells.x86_64-linux.default = self.packages.x86_64-linux.nix-dissector;
packages.x86_64-linux.snoop-nix-daemon = import ./default.nix { inherit (nixpkgs.legacyPackages.x86_64-linux) pkgs; };
packages.x86_64-linux.default = self.packages.x86_64-linux.snoop-nix-daemon;
};
}

0 comments on commit a69d39e

Please sign in to comment.