Nix packages for third-party projects that don't ship their own flakes
2.9 kB
97 lines
1{
2 description = "Nix packages for third-party projects that don't ship their own flakes";
3
4 inputs = {
5 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6 };
7
8 outputs =
9 { self, nixpkgs }:
10 let
11 systems = [
12 "x86_64-linux"
13 "aarch64-linux"
14 "x86_64-darwin"
15 "aarch64-darwin"
16 ];
17 forAllSystems = nixpkgs.lib.genAttrs systems;
18 in
19 {
20 packages = forAllSystems (
21 system:
22 let
23 pkgs = nixpkgs.legacyPackages.${system};
24 # boxd is a binary-only redistributable CLI (unfreeRedistributable).
25 # Import a pkgs set that only allows that attr so `nix build .#boxd`
26 # works without a global allowUnfree.
27 pkgsUnfree = import nixpkgs {
28 inherit system;
29 config.allowUnfreePredicate =
30 pkg: builtins.elem (nixpkgs.lib.getName pkg) [ "boxd" ];
31 };
32 in
33 {
34 vit = pkgs.callPackage ./packages/vit { };
35 spinel = pkgs.callPackage ./packages/spinel { };
36 rook = pkgs.callPackage ./packages/rook { };
37 default = self.packages.${system}.vit;
38 }
39 // pkgs.lib.optionalAttrs (
40 builtins.elem system [
41 "x86_64-linux"
42 "aarch64-linux"
43 "aarch64-darwin"
44 ]
45 ) {
46 # Official prebuilt CLI (static binary); no darwin-x86_64 upstream.
47 boxd = pkgsUnfree.callPackage ./packages/boxd { };
48 }
49 // pkgs.lib.optionalAttrs (system == "x86_64-linux") {
50 # Official preview tarball is only fetched for x86_64-linux.
51 zed-preview = pkgs.callPackage ./packages/zed-preview { };
52 }
53 );
54
55 # Convenience: `nix run .#vit -- --help`, `nix run .#spinel -- --help`
56 apps = forAllSystems (
57 system:
58 {
59 vit = {
60 type = "app";
61 program = "${self.packages.${system}.vit}/bin/vit";
62 };
63 spinel = {
64 type = "app";
65 program = "${self.packages.${system}.spinel}/bin/spinel";
66 };
67 spin = {
68 type = "app";
69 program = "${self.packages.${system}.spinel}/bin/spin";
70 };
71 rook = {
72 type = "app";
73 program = "${self.packages.${system}.rook}/bin/rook";
74 };
75 default = self.apps.${system}.vit;
76 }
77 // nixpkgs.lib.optionalAttrs (
78 builtins.elem system [
79 "x86_64-linux"
80 "aarch64-linux"
81 "aarch64-darwin"
82 ]
83 ) {
84 boxd = {
85 type = "app";
86 program = "${self.packages.${system}.boxd}/bin/boxd";
87 };
88 }
89 // nixpkgs.lib.optionalAttrs (system == "x86_64-linux") {
90 zed-preview = {
91 type = "app";
92 program = "${self.packages.${system}.zed-preview}/bin/zed-preview";
93 };
94 }
95 );
96 };
97}