mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-18 16:28:55 +00:00
Allow customizing features
This commit is contained in:
parent
bd9a5a1b1d
commit
26b0e3b21d
2 changed files with 39 additions and 19 deletions
22
flake.nix
22
flake.nix
|
@ -10,30 +10,14 @@
|
||||||
extra-substituters = [ "https://natsukagami.cachix.org" ];
|
extra-substituters = [ "https://natsukagami.cachix.org" ];
|
||||||
trusted-public-keys = [ "natsukagami.cachix.org-1:3U6GV8i8gWEaXRUuXd2S4ASfYgdl2QFPWg4BKPbmYiQ=" ];
|
trusted-public-keys = [ "natsukagami.cachix.org-1:3U6GV8i8gWEaXRUuXd2S4ASfYgdl2QFPWg4BKPbmYiQ=" ];
|
||||||
};
|
};
|
||||||
outputs = { self, nixpkgs, naersk, flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system:
|
outputs = { self, nixpkgs, flake-utils, ... }@inputs: flake-utils.lib.eachDefaultSystem (system:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs { inherit system; };
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
|
||||||
naersk' = pkgs.callPackage naersk { };
|
naersk = pkgs.callPackage inputs.naersk { };
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
packages.youmubot = naersk'.buildPackage {
|
packages.youmubot = pkgs.callPackage ./package.nix { inherit naersk; };
|
||||||
name = "youmubot";
|
|
||||||
version = "0.1.0";
|
|
||||||
|
|
||||||
root = ./.;
|
|
||||||
cargoBuildOptions = opts: opts ++ [ "--package youmubot" ];
|
|
||||||
|
|
||||||
buildInputs = with pkgs; [
|
|
||||||
openssl
|
|
||||||
];
|
|
||||||
|
|
||||||
nativeBuildInputs = nixpkgs.lib.optionals pkgs.stdenv.isLinux (with pkgs; [
|
|
||||||
pkg-config
|
|
||||||
]);
|
|
||||||
|
|
||||||
SQLX_OFFLINE = "true";
|
|
||||||
};
|
|
||||||
|
|
||||||
defaultPackage = packages.youmubot;
|
defaultPackage = packages.youmubot;
|
||||||
|
|
||||||
|
|
36
package.nix
Normal file
36
package.nix
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
{ naersk
|
||||||
|
, lib
|
||||||
|
, stdenv
|
||||||
|
, pkg-config
|
||||||
|
, openssl
|
||||||
|
|
||||||
|
, enableCodeforces ? true
|
||||||
|
, enableOsu ? true
|
||||||
|
, ...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
customizeFeatures = !(enableCodeforces && enableOsu);
|
||||||
|
featureFlags = lib.optionals customizeFeatures (
|
||||||
|
[ "--no-default-features" "--features=core" ]
|
||||||
|
++ lib.optional enableCodeforces "--features=codeforces"
|
||||||
|
++ lib.optional enableOsu "--features=osu"
|
||||||
|
);
|
||||||
|
in
|
||||||
|
naersk.buildPackage {
|
||||||
|
name = "youmubot";
|
||||||
|
version = "0.1.0";
|
||||||
|
|
||||||
|
root = ./.;
|
||||||
|
cargoBuildOptions = opts: opts ++ [ "--package youmubot" ] ++ featureFlags;
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
openssl
|
||||||
|
];
|
||||||
|
|
||||||
|
nativeBuildInputs = lib.optionals stdenv.isLinux [
|
||||||
|
pkg-config
|
||||||
|
];
|
||||||
|
|
||||||
|
SQLX_OFFLINE = "true";
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue