-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
66 lines (53 loc) · 1.83 KB
/
flake.nix
File metadata and controls
66 lines (53 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{
description = "CycloneDX SBOM generator for Crystal shard files";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
cyclonedx-cr = pkgs.crystal.buildCrystalPackage rec {
pname = "cyclonedx-cr";
version = "1.2.0";
src = ./.;
shardsFile = ./shards.nix;
crystalBinaries.cyclonedx-cr.src = "src/main.cr";
crystalBinaries.cyclonedx-cr.options = [ "--release" "--no-debug" ];
nativeBuildInputs = [ pkgs.crystal pkgs.shards ];
buildInputs = [ ];
buildPhase = ''
runHook preBuild
shards build --release
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp bin/cyclonedx-cr $out/bin/cyclonedx-cr
runHook postInstall
'';
doCheck = false;
meta = with pkgs.lib; {
description = "CycloneDX SBOM generator for Crystal shard files";
homepage = "https://github.com/hahwul/cyclonedx-cr";
license = licenses.mit;
maintainers = [ "hahwul" ];
mainProgram = "cyclonedx-cr";
};
};
in
{
packages.default = cyclonedx-cr;
devShells.default = pkgs.mkShell {
inputsFrom = [ cyclonedx-cr ];
nativeBuildInputs = with pkgs; [ crystal shards crystal2nix ];
shellHook = ''
echo "cyclonedx-cr development environment loaded (via Nix)"
echo "Running shards install..."
shards install || true
'';
};
});
}