chore: cleanup + update nix flake
This commit is contained in:
parent
f4fa737124
commit
24c8406590
6 changed files with 91 additions and 109 deletions
|
@ -7,47 +7,35 @@
|
|||
SystemConfiguration,
|
||||
version,
|
||||
optimizeSize ? false,
|
||||
}: let
|
||||
filter = path: type: let
|
||||
path' = toString path;
|
||||
base = baseNameOf path';
|
||||
parent = baseNameOf (dirOf path');
|
||||
}:
|
||||
naersk.buildPackage {
|
||||
pname = "refraction";
|
||||
inherit version;
|
||||
|
||||
dirBlocklist = ["nix"];
|
||||
|
||||
matches = lib.any (suffix: lib.hasSuffix suffix base) [".rs"];
|
||||
isCargo = base == "Cargo.lock" || base == "Cargo.toml";
|
||||
isTag = parent == "tags";
|
||||
isAllowedDir = !(builtins.elem base dirBlocklist);
|
||||
in
|
||||
(type == "directory" && isAllowedDir) || matches || isCargo || isTag;
|
||||
|
||||
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
|
||||
src = lib.fileset.toSource {
|
||||
root = ../.;
|
||||
fileset = lib.fileset.unions [
|
||||
../src
|
||||
../build.rs
|
||||
../Cargo.lock
|
||||
../Cargo.toml
|
||||
../tags
|
||||
];
|
||||
};
|
||||
|
||||
RUSTFLAGS = lib.optionalString optimizeSize "-C codegen-units=1 -C strip=symbols -C opt-level=z";
|
||||
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
CoreFoundation
|
||||
Security
|
||||
SystemConfiguration
|
||||
];
|
||||
|
||||
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];
|
||||
};
|
||||
}
|
||||
cargoBuildFlags = lib.optionals 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;
|
||||
maintainers = with maintainers; [getchoo Scrumplex];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue