Nix packages for third-party projects that don't ship their own flakes
3.3 kB
107 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 whetuu = pkgs.callPackage ./packages/whetuu { };
38 pullrun = pkgs.callPackage ./packages/pullrun { };
39 default = self.packages.${system}.vit;
40 }
41 // pkgs.lib.optionalAttrs (
42 builtins.elem system [
43 "x86_64-linux"
44 "aarch64-linux"
45 "aarch64-darwin"
46 ]
47 ) {
48 # Official prebuilt CLI (static binary); no darwin-x86_64 upstream.
49 boxd = pkgsUnfree.callPackage ./packages/boxd { };
50 }
51 // pkgs.lib.optionalAttrs (system == "x86_64-linux") {
52 # Official preview tarball is only fetched for x86_64-linux.
53 zed-preview = pkgs.callPackage ./packages/zed-preview { };
54 }
55 );
56
57 # Convenience: `nix run .#vit -- --help`, `nix run .#spinel -- --help`
58 apps = forAllSystems (
59 system:
60 {
61 vit = {
62 type = "app";
63 program = "${self.packages.${system}.vit}/bin/vit";
64 };
65 spinel = {
66 type = "app";
67 program = "${self.packages.${system}.spinel}/bin/spinel";
68 };
69 spin = {
70 type = "app";
71 program = "${self.packages.${system}.spinel}/bin/spin";
72 };
73 rook = {
74 type = "app";
75 program = "${self.packages.${system}.rook}/bin/rook";
76 };
77 whetuu = {
78 type = "app";
79 program = "${self.packages.${system}.whetuu}/bin/whetuu";
80 };
81 pullrun = {
82 type = "app";
83 program = "${self.packages.${system}.pullrun}/bin/pullrun";
84 };
85 default = self.apps.${system}.vit;
86 }
87 // nixpkgs.lib.optionalAttrs (
88 builtins.elem system [
89 "x86_64-linux"
90 "aarch64-linux"
91 "aarch64-darwin"
92 ]
93 ) {
94 boxd = {
95 type = "app";
96 program = "${self.packages.${system}.boxd}/bin/boxd";
97 };
98 }
99 // nixpkgs.lib.optionalAttrs (system == "x86_64-linux") {
100 zed-preview = {
101 type = "app";
102 program = "${self.packages.${system}.zed-preview}/bin/zed-preview";
103 };
104 }
105 );
106 };
107}