Have a good crack at trying to get buildRustPackage-based flake working
This commit is contained in:
parent
99a4c91ac3
commit
001357c825
|
@ -0,0 +1,5 @@
|
||||||
|
# Nix flake for QuickPeep
|
||||||
|
|
||||||
|
Building:
|
||||||
|
|
||||||
|
`nix build '.#' -j 8`
|
|
@ -1,20 +1,17 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"naersk": {
|
"flake-utils": {
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": "nixpkgs"
|
|
||||||
},
|
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1648544490,
|
"lastModified": 1648297722,
|
||||||
"narHash": "sha256-EoBDcccV70tfz2LAs5lK0BjC7en5mzUVlgLsd5E6DW4=",
|
"narHash": "sha256-W+qlPsiZd8F3XkzXOzAoR+mpFqzm3ekQkJNa+PIh1BQ=",
|
||||||
"owner": "nix-community",
|
"owner": "numtide",
|
||||||
"repo": "naersk",
|
"repo": "flake-utils",
|
||||||
"rev": "e30ef9a5ce9b3de8bb438f15829c50f9525ca730",
|
"rev": "0f8662f1319ad6abf89b3380dd2722369fc51ade",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nix-community",
|
"owner": "numtide",
|
||||||
"repo": "naersk",
|
"repo": "flake-utils",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -32,40 +29,10 @@
|
||||||
"type": "indirect"
|
"type": "indirect"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1648219316,
|
|
||||||
"narHash": "sha256-Ctij+dOi0ZZIfX5eMhgwugfvB+WZSrvVNAyAuANOsnQ=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "30d3d79b7d3607d56546dd2a6b49e156ba0ec634",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"id": "nixpkgs",
|
|
||||||
"type": "indirect"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"naersk": "naersk",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": "nixpkgs"
|
||||||
"utils": "utils"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"utils": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1648297722,
|
|
||||||
"narHash": "sha256-W+qlPsiZd8F3XkzXOzAoR+mpFqzm3ekQkJNa+PIh1BQ=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "0f8662f1319ad6abf89b3380dd2722369fc51ade",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,33 +2,57 @@
|
||||||
description = "QuickPeep Search Engine Flake for Nix";
|
description = "QuickPeep Search Engine Flake for Nix";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
naersk.url = "github:nix-community/naersk";
|
# Do we need to declare this ...? nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.11";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, utils, naersk }:
|
outputs = { self, nixpkgs, flake-utils }:
|
||||||
utils.lib.eachDefaultSystem (system: let
|
flake-utils.lib.eachDefaultSystem (system: let
|
||||||
pkgs = nixpkgs.legacyPackages."${system}";
|
pkgs = nixpkgs.legacyPackages."${system}";
|
||||||
naersk-lib = naersk.lib."${system}";
|
rustPlatform = pkgs.rust.packages.stable.rustPlatform;
|
||||||
in rec {
|
in rec {
|
||||||
# `nix build`
|
# `nix build`
|
||||||
packages.quickpeep = naersk-lib.buildPackage {
|
packages.quickpeep = rustPlatform.buildRustPackage {
|
||||||
pname = "quickpeep";
|
pname = "quickpeep";
|
||||||
root = ./..;
|
version = "0.1.0";
|
||||||
|
|
||||||
|
#src = ./..;
|
||||||
|
#buildAndTestSubdir = "../quickpeep";
|
||||||
|
|
||||||
|
src = builtins.fetchGit {
|
||||||
|
ref = "main";
|
||||||
|
rev = "99a4c91ac33301e3d808d2f17498b710725a77e9";
|
||||||
|
url = "https://bics.ga/reivilibre/quickpeep.git";
|
||||||
|
};
|
||||||
|
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
openssl
|
openssl
|
||||||
pkgconfig
|
pkgconfig
|
||||||
|
# Needed to generate a dev database
|
||||||
|
pkgs.sqlx-cli
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Generate the dev database
|
||||||
|
preConfigure = ''
|
||||||
|
export PATH="${pkgs.sqlx-cli}/bin:$PATH"
|
||||||
|
cd quickpeep
|
||||||
|
bash dev_db.sh
|
||||||
|
'';
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
# Idea from https://github.com/NixOS/nixpkgs/blob/634141959076a8ab69ca2cca0f266852256d79ee/pkgs/servers/matrix-conduit/default.nix
|
# Idea from https://github.com/NixOS/nixpkgs/blob/634141959076a8ab69ca2cca0f266852256d79ee/pkgs/servers/matrix-conduit/default.nix
|
||||||
pkgs.rust.packages.stable.rustPlatform.bindgenHook
|
rustPlatform.bindgenHook
|
||||||
|
openssl
|
||||||
|
pkgconfig
|
||||||
];
|
];
|
||||||
|
|
||||||
|
#cargoSha256 = pkgs.lib.fakeSha256;
|
||||||
|
cargoSha256 = "sha256-8J/twLhzs/Coou07Hs7mIiBpwDAPANgXMIwoplWZXRs=";
|
||||||
};
|
};
|
||||||
defaultPackage = packages.quickpeep;
|
defaultPackage = packages.quickpeep;
|
||||||
|
|
||||||
# `nix run`
|
# `nix run`
|
||||||
apps.quickpeep = utils.lib.mkApp {
|
apps.quickpeep = flake-utils.lib.mkApp {
|
||||||
drv = packages.quickpeep;
|
drv = packages.quickpeep;
|
||||||
};
|
};
|
||||||
defaultApp = apps.quickpeep;
|
defaultApp = apps.quickpeep;
|
||||||
|
|
Loading…
Reference in New Issue