feat: bring back nix support and fix the beaker-src

Co-authored-by: beeb5k <beebeeb5k@gmail.com>
This commit is contained in:
spl3g
2026-03-21 17:37:15 +03:00
committed by frosty
parent ddf39b5650
commit 8229aaa489
3 changed files with 148 additions and 0 deletions

View File

@@ -47,6 +47,32 @@ On Alpine, `shadow` is needed for the user creation process during the install.
# xbps-install -S libxml2-devel libcurl-devel
```
### NixOS
Add the flake to your inputs and import the module. That is all you need.
Here's an example of using the modules in a flake:
```
# flake.nix
{
inputs = {
omnisearch = {
url = "git+https://git.bwaaa.monster/omnisearch";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, omnisearch, ... }: {
nixosConfigurations.mySystem = nixpkgs.lib.nixosSystem {
modules = [
omnisearch.nixosModules.default
{
services.omnisearch.enable = true;
}
];
};
};
}
```
### macOS (Homebrew)
```
$ brew install libxml2 curl openssl pkg-config

46
flake.lock generated Normal file
View File

@@ -0,0 +1,46 @@
{
"nodes": {
"beaker-src": {
"flake": false,
"locked": {
"lastModified": 1773884524,
"narHash": "sha256-1dnlofWaxI/YRID+WPz2jHZNDyloBubDt/bAQk9ePLU=",
"ref": "refs/heads/master",
"rev": "abc598baf15d6f8a4de395a27ba34b1e769558e1",
"revCount": 21,
"shallow": false,
"type": "git",
"url": "https://git.bwaaa.monster/beaker"
},
"original": {
"shallow": false,
"type": "git",
"url": "https://git.bwaaa.monster/beaker"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1773734432,
"narHash": "sha256-IF5ppUWh6gHGHYDbtVUyhwy/i7D261P7fWD1bPefOsw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "cda48547b432e8d3b18b4180ba07473762ec8558",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"beaker-src": "beaker-src",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

76
flake.nix Normal file
View File

@@ -0,0 +1,76 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
beaker-src = {
url = "git+https://git.bwaaa.monster/beaker?shallow=0";
flake = false;
};
};
outputs =
{
self,
nixpkgs,
beaker-src,
}:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
in
{
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt);
packages = forAllSystems (
system:
let
pkgs = import nixpkgs { inherit system; };
beaker = pkgs.stdenv.mkDerivation {
pname = "beaker";
version = "git";
src = beaker-src;
makeFlags = [
"INSTALL_PREFIX=$(out)/"
"LDCONFIG=true"
];
};
in
{
default = pkgs.stdenv.mkDerivation {
pname = "omnisearch";
version = "git";
src = ./.;
buildInputs = [
pkgs.libxml2.dev
pkgs.curl.dev
pkgs.openssl
beaker
];
preBuild = ''
makeFlagsArray+=(
"PREFIX=$out"
"CFLAGS=-Wall -Wextra -O2 -Isrc -I${pkgs.libxml2.dev}/include/libxml2"
"LIBS=-lbeaker -lcurl -lxml2 -lpthread -lm -lssl -lcrypto"
)
'';
installPhase = ''
mkdir -p $out/bin $out/share/omnisearch
install -Dm755 bin/omnisearch $out/bin/omnisearch
cp -r templates static -t $out/share/omnisearch/
'';
meta = {
description = "Lightweight metasearch engine in C";
platforms = pkgs.lib.platforms.linux;
};
};
}
);
nixosModules.default = import ./module.nix self;
};
}