feat: add nix package, module, and container
Signed-off-by: seth <getchoo@tuta.io>
This commit is contained in:
parent
45403e9d9b
commit
e928eb67df
7 changed files with 497 additions and 67 deletions
51
nix/derivation.nix
Normal file
51
nix/derivation.nix
Normal file
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
naersk,
|
||||
CoreFoundation,
|
||||
Security,
|
||||
SystemConfiguration,
|
||||
version,
|
||||
optimizeSize ? false,
|
||||
}: let
|
||||
filter = path: type: let
|
||||
path' = toString path;
|
||||
base = baseNameOf path';
|
||||
|
||||
dirBlocklist = ["nix"];
|
||||
|
||||
matches = lib.any (suffix: lib.hasSuffix suffix base) [".rs"];
|
||||
isCargo = base == "Cargo.lock" || base == "Cargo.toml";
|
||||
isAllowedDir = !(builtins.elem base dirBlocklist);
|
||||
in
|
||||
(type == "directory" && isAllowedDir) || matches || isCargo;
|
||||
|
||||
filterSource = src:
|
||||
lib.cleanSourceWith {
|
||||
src = lib.cleanSource src;
|
||||
inherit filter;
|
||||
};
|
||||
in
|
||||
naersk.buildPackage {
|
||||
pname = "refraction";
|
||||
inherit version;
|
||||
|
||||
src = filterSource ../.;
|
||||
|
||||
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
CoreFoundation
|
||||
Security
|
||||
SystemConfiguration
|
||||
];
|
||||
|
||||
RUSTFLAGS = lib.optionalString optimizeSize "-C codegen-units=1 -C strip=symbols -C opt-level=z";
|
||||
|
||||
meta = with lib; {
|
||||
mainProgram = "refraction";
|
||||
description = "Discord bot for Prism Launcher";
|
||||
homepage = "https://github.com/PrismLauncher/refraction";
|
||||
license = licenses.gpl3Plus;
|
||||
platforms = with platforms; linux ++ darwin;
|
||||
maintainers = with maintainers; [getchoo Scrumplex];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue