quickpeep/flake.nix

94 lines
2.4 KiB
Nix

{
description = "QuickPeep Search Engine Flake for Nix";
inputs = {
utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
};
outputs = { self, nixpkgs, utils, naersk }:
utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages."${system}";
naersk-lib = naersk.lib."${system}";
in rec {
# `nix build`
packages.quickpeep = naersk-lib.buildPackage {
pname = "quickpeep";
root = ./.;
buildInputs = with pkgs; [
openssl
pkgconfig
];
nativeBuildInputs = with pkgs; [
# Idea from https://github.com/NixOS/nixpkgs/blob/634141959076a8ab69ca2cca0f266852256d79ee/pkgs/servers/matrix-conduit/default.nix
pkgs.rust.packages.stable.rustPlatform.bindgenHook
];
overrideMain = attrs: {
preConfigure = ''
export PATH="${pkgs.sqlx-cli}/bin:$PATH"
pushd quickpeep
bash dev_db.sh
popd
'';
};
};
# packages.quickpeepWebStatic = pkgs.stdenv.mkDerivation {
# name = "quickpeepWebStatic";
#
# src = ./quickpeep_static;
#
# buildInputs = [ pkgs.yarn ];
#
# preparePhase = ''
# yarn install
# '';
#
# buildPhase = ''
# yarn build
# cp -r dist/* $out
# '';
# };
packages.quickpeepWebStatic = pkgs.mkYarnPackage {
name = "quickpeepWebStatic";
src = ./quickpeep_static;
packageJSON = ./quickpeep_static/package.json;
yarnLock = ./quickpeep_static/yarn.lock;
yarnNix = ./quickpeep_static/yarn.nix;
postBuild = ''
yarn build
'';
installPhase = ''
# nop ?
'';
distPhase = ''
mkdir $out
cp -r deps/quickpeep_static/dist/* $out/
'';
};
defaultPackage = packages.quickpeep;
# NixOS Modules
nixosModules = {
quickpeepSearch = import ./nixos_modules/quickpeepSearch.nix self;
quickpeepRaker = import ./nixos_modules/quickpeepRaker.nix self;
};
# `nix run`
apps.quickpeep = utils.lib.mkApp {
drv = packages.quickpeep;
};
defaultApp = apps.quickpeep;
# `nix develop`
devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [ rustc cargo ];
};
});
}