aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md26
-rw-r--r--flake.lock46
-rw-r--r--flake.nix76
3 files changed, 148 insertions, 0 deletions
diff --git a/README.md b/README.md
index 05fa0ed..6e7a176 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..468ecff
--- /dev/null
+++ b/flake.lock
@@ -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
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..eaf5253
--- /dev/null
+++ b/flake.nix
@@ -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;
+ };
+}