{ description = "OmniSearch metasearch engine"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; }; outputs = { self, nixpkgs }: let systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ]; forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system}); in { packages = forAllSystems (pkgs: let libbeaker = pkgs.stdenv.mkDerivation { pname = "libbeaker"; version = "unstable-2026-08-16"; src = ./vendor/beaker; nativeBuildInputs = [ pkgs.gnumake ]; installPhase = '' runHook preInstall make install INSTALL_PREFIX="$out/" LDCONFIG=true runHook postInstall ''; }; in rec { default = omnisearch; omnisearch = pkgs.stdenv.mkDerivation { pname = "omnisearch"; version = "unstable"; src = pkgs.lib.cleanSourceWith { src = self; filter = path: type: !(builtins.elem (baseNameOf path) [ "bin" "obj" ]); }; nativeBuildInputs = [ pkgs.gnumake pkgs.pkg-config pkgs.makeWrapper ]; buildInputs = [ libbeaker pkgs.curl pkgs.libxml2 pkgs.openssl ]; env.NIX_CFLAGS_COMPILE = "-I${pkgs.libxml2.dev}/include/libxml2"; # The upstream Makefile normally obtains these from Git, which is # unavailable in a Nix source snapshot. makeFlags = [ "VERSION=unstable" "GIT_REMOTE=https://codeberg.org/gabrielf/omnisearch" ]; preBuild = '' makeFlagsArray+=( "LDFLAGS=-L${libbeaker}/lib -L${pkgs.lib.getLib pkgs.curl}/lib -L${pkgs.lib.getLib pkgs.libxml2}/lib -L${pkgs.openssl.out}/lib" ) ''; installPhase = '' runHook preInstall install -Dm755 bin/omnisearch "$out/libexec/omnisearch" mkdir -p "$out/share/omnisearch" cp -r templates static locales "$out/share/omnisearch/" makeWrapper "$out/libexec/omnisearch" "$out/bin/omnisearch" \ --chdir "$out/share/omnisearch" runHook postInstall ''; meta = { description = "Lightweight metasearch engine written in C"; homepage = "https://codeberg.org/gabrielf/omnisearch"; license = pkgs.lib.licenses.gpl2Only; mainProgram = "omnisearch"; platforms = pkgs.lib.platforms.unix; }; }; }); devShells = forAllSystems (pkgs: { default = pkgs.mkShell { inputsFrom = [ self.packages.${pkgs.stdenv.hostPlatform.system}.omnisearch ]; shellHook = '' export NIX_CFLAGS_COMPILE="''${NIX_CFLAGS_COMPILE:-} -I${pkgs.libxml2.dev}/include/libxml2" ${pkgs.lib.optionalString pkgs.stdenv.hostPlatform.isLinux '' export MAKEFLAGS="LDFLAGS=-L${pkgs.lib.getLib pkgs.curl}/lib\\ -L${pkgs.stdenv.cc.libc}/lib ''${MAKEFLAGS:-}" ''} ''; }; }); nixosModules.default = import ./nixos-module.nix { inherit self; }; }; }