Unverified Commit 10aacf09 authored by numinit's avatar numinit Committed by GitHub
Browse files

kismet: 2023-07-R2 -> 2025-09-R1 (+test fix) (#455673)

parents 3c8d5946 436ca6d2
Loading
Loading
Loading
Loading
+68 −19
Original line number Diff line number Diff line
@@ -28,7 +28,14 @@ let
    typeOf
    match
    ;
  inherit (lib.lists) all isList flatten;
  inherit (lib.lists)
    all
    isList
    head
    tail
    flatten
    foldl'
    ;
  inherit (lib.attrsets)
    attrsToList
    filterAttrs
@@ -48,19 +55,60 @@ let
    in
    prev
    // {
      check = value: prev.check value && (override type value);
      check =
        value:
        let
          prevResult = builtins.tryEval (prev.check value);
          nextResult = builtins.tryEval (override type value);
        in
        prevResult.success && prevResult.value && nextResult.success && nextResult.value;

      # We need to typecheck prior to merging, so deoptimize in case prev.merge is a functor.
      merge = opts: prev.merge opts;
    };

  # Deep listOf.
  listOf' = deep types.listOf (type: value: all type.check value);
  inherit (types) listOf;
  listOf' = deep listOf (type: value: all type.check value);

  # Deep attrsOf.
  attrsOf' = deep types.attrsOf (type: value: all (item: type.check item.value) (attrsToList value));
  inherit (types) attrsOf;
  attrsOf' = deep attrsOf (type: value: all (item: type.check item.value) (attrsToList value));

  # Deep either and oneOf that performs typecheck prior to merging.
  inherit (types) either;
  either' =
    first: second:
    let
      prev = either first second;
    in
    prev
    // {
      check =
        value:
        let
          firstResult = builtins.tryEval (first.check value);
          secondResult = builtins.tryEval (second.check value);
        in
        firstResult.success && firstResult.value || secondResult.success && secondResult.value;

      # We need to typecheck prior to merging, so deoptimize in case prev.merge is a functor.
      merge = opts: prev.merge opts;
    };

  oneOf' =
    ts:
    let
      head' =
        if ts == [ ] then throw "types.oneOf needs to get at least one type in its argument" else head ts;
      tail' = tail ts;
    in
    foldl' either' head' tail';

  # Kismet config atoms.
  atom =
    with types;
    oneOf [
    oneOf' [
      number
      bool
      str
@@ -68,7 +116,10 @@ let

  # Composite types.
  listOfAtom = listOf' atom;
  atomOrList = with types; either atom listOfAtom;
  atomOrList = oneOf' [
    atom
    listOfAtom
  ];
  lists = listOf' atomOrList;
  kvPair = attrsOf' atomOrList;
  kvPairs = listOf' kvPair;
@@ -80,9 +131,7 @@ let
  # Toplevel config type.
  topLevel =
    let
      topLevel' =
        with types;
        oneOf [
      topLevel' = oneOf' [
        headerKvPairs
        headerKvPair
        kvPairs
@@ -92,7 +141,7 @@ let
        atom
      ];
    in
    topLevel'
    attrsOf' topLevel'
    // {
      description = "Kismet config stanza";
    };
@@ -239,7 +288,7 @@ in
        https://www.kismetwireless.net/docs/readme/configuring/configfiles/
      '';
      default = { };
      type = with types; attrsOf topLevel;
      type = topLevel;
      example = literalExpression ''
        {
          /* Examples for atoms */
+5 −4
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ in
        };

      station =
        { config, ... }:
        { config, pkgs, ... }:
        {
          networking.interfaces.eth1.ipv4.addresses = lib.mkForce [
            {
@@ -98,10 +98,11 @@ in
              inherit serverAddress;
            };
          };
          environment.systemPackages = [ pkgs.nettools ];
        };

      monitor =
        { config, ... }:
        { config, pkgs, ... }:
        {
          networking.interfaces.eth1.ipv4.addresses = lib.mkForce [
            {
@@ -189,10 +190,10 @@ in
            };
          };

          environment.systemPackages = with pkgs; [
          environment.systemPackages = [
            config.services.kismet.package
            config.services.vwifi.package
            jq
            pkgs.jq
          ];
        };
    };
+8 −2
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
  elfutils,
  fetchFromGitHub,
  glib,
  libbtbb,
  libcap,
  libmicrohttpd,
  libnl,
@@ -13,6 +14,7 @@
  libusb1,
  libwebsockets,
  lm_sensors,
  mosquitto,
  networkmanager,
  nix-update-script,
  nixosTests,
@@ -22,6 +24,7 @@
  protobuf,
  protobufc,
  python3,
  rtl-sdr-librtlsdr,
  sqlite,
  withNetworkManager ? false,
  withPython ? stdenv.buildPlatform.canExecute stdenv.hostPlatform,
@@ -31,13 +34,13 @@

stdenv.mkDerivation (finalPackage: {
  pname = "kismet";
  version = "2023-07-R2";
  version = "2025-09-R1";

  src = fetchFromGitHub {
    owner = "kismetwireless";
    repo = "kismet";
    tag = "kismet-${finalPackage.version}";
    hash = "sha256-QwTjjZHnrlATFvHK9PLDTt76UjfZdzCmV6uXVgIMIYg=";
    hash = "sha256-bwgeBIa5P1he0azWBu1YTXS9EGlHdJK8hS6A5Rj9XU4=";
  };

  postPatch = ''
@@ -76,6 +79,7 @@ stdenv.mkDerivation (finalPackage: {
  buildInputs = [
    binutils
    elfutils
    libbtbb
    libcap
    libmicrohttpd
    libnl
@@ -83,9 +87,11 @@ stdenv.mkDerivation (finalPackage: {
    openssl
    libusb1
    libwebsockets
    mosquitto
    pcre2
    protobuf
    protobufc
    rtl-sdr-librtlsdr
    sqlite
    zlib
  ]