forked from sourcegraph/sourcegraph-public-snapshot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
54 lines (49 loc) · 2.25 KB
/
flake.nix
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
{
description = "The Sourcegraph developer environment & packages Nix Flake";
inputs = {
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
# separate nixpkgs pin for more stable changes to binaries we build
nixpkgs-stable.url = "github:NixOS/nixpkgs/e78d25df6f1036b3fa76750ed4603dd9d5fe90fc";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, nixpkgs-stable, flake-utils }:
let
xcompileTargets = with nixpkgs-stable.lib.systems.examples; {
"aarch64-darwin" = nixpkgs-stable.legacyPackages.aarch64-darwin.pkgsx86_64Darwin;
"x86_64-darwin" = import nixpkgs-stable { system = "x86_64-darwin"; crossSystem = aarch64-darwin; };
};
inherit (import ./dev/nix/util.nix { inherit (nixpkgs) lib; }) xcompilify;
in
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
pkgsBins = nixpkgs-stable.legacyPackages.${system};
pkgs' = import nixpkgs { inherit system; overlays = builtins.attrValues self.overlays; };
pkgsX = xcompileTargets.${system} or null;
in
{
legacyPackages = pkgs';
packages = xcompilify { inherit pkgsX; pkgs = pkgsBins; }
(p: {
ctags = p.callPackage ./dev/nix/ctags.nix { };
comby = p.callPackage ./dev/nix/comby.nix { };
p4-fusion = p.callPackage ./dev/nix/p4-fusion.nix { };
}) // {
# doesnt need the same stability as those above
nodejs-18_x = pkgs.callPackage ./dev/nix/nodejs.nix { };
};
# We use pkgs (not pkgs') intentionally to avoid doing extra work of
# building static comby/universal-ctags in our development
# environments.
devShells.default = pkgs.callPackage ./shell.nix { };
formatter = pkgs.nixpkgs-fmt;
}) // {
overlays = {
ctags = final: prev: { universal-ctags = self.packages.${prev.system}.ctags; };
comby = final: prev: { comby = self.packages.${prev.system}.comby; };
nodejs-18_x = final: prev: { nodejs-16_x = self.packages.${prev.system}.nodejs-18_x; };
p4-fusion = final: prev: { p4-fusion = self.packages.${prev.system}.p4-fusion; };
};
};
}