forked from flox/flox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
181 lines (155 loc) · 6.77 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# ============================================================================ #
#
# A cross-platform environment manager with sharing as a service.
#
# ---------------------------------------------------------------------------- #
{
description = "flox - Harness the power of Nix";
nixConfig.extra-substituters = [ "https://cache.flox.dev" ];
nixConfig.extra-trusted-public-keys = [
"flox-cache-public-1:7F4OyH7ZCnFhcze3fJdfyXYLQw/aV7GEed86nQ7IsOs="
];
# Roll forward monthly as **our** stable branch advances. Note that we also
# build against the staging branch in CI to detect regressions before they
# reach stable.
inputs.nixpkgs.url = "github:flox/nixpkgs/stable";
inputs.sqlite3pp.url = "github:aakropotkin/sqlite3pp";
inputs.sqlite3pp.inputs.nixpkgs.follows = "nixpkgs";
inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
inputs.pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
inputs.crane.url = "github:ipetkov/crane";
inputs.fenix.url = "github:nix-community/fenix";
inputs.fenix.inputs.nixpkgs.follows = "nixpkgs";
# -------------------------------------------------------------------------- #
outputs =
inputs:
let
# ------------------------------------------------------------------------ #
nixpkgs.legacyPackages = {
inherit (inputs.nixpkgs.legacyPackages)
x86_64-linux
x86_64-darwin
aarch64-linux
aarch64-darwin
;
};
nixpkgs.lib = inputs.nixpkgs.lib;
in
rec {
# Overlays
# --------
overlays.deps = nixpkgs.lib.composeManyExtensions [
(final: prev: {
# Add IWYU pragmas to `nlohmann_json'
# ( _include what you use_ extensions to headers for static analysis )
nlohmann_json = final.callPackage ./pkgs/nlohmann_json { inherit (prev) nlohmann_json; };
# Uncomment to compile Nix with debug symbols on Linux
# nix = final.enableDebugging (final.callPackage ./pkgs/nix {});
nix = final.callPackage ./pkgs/nix { };
cpp-semver = final.callPackage ./pkgs/cpp-semver { };
})
inputs.sqlite3pp.overlays.default
inputs.fenix.overlays.default
];
# Packages defined in this repository.
overlays.flox =
final: prev:
let
callPackage = final.lib.callPackageWith (
final
// {
inherit inputs; # passing in inputs... beware
inherit (inputs) self;
pkgsFor = final;
}
);
in
{
# Generates a `.git/hooks/pre-commit' script.
pre-commit-check = callPackage ./pkgs/pre-commit-check { inherit (inputs) pre-commit-hooks; };
GENERATED_DATA = ./test_data/generated;
MANUALLY_GENERATED = ./test_data/manually_generated;
# We depend on several nightly features of rustfmt,
# so pick the current nightly version.
# We're using `default.withComponents`
# which _should_ only pull the nightly rustfmt component.
# Alternatively, we could use nixpkgs.rustfmt,
# and rebuild with a (stable) fenix toolchain and `asNightly = true`,
# which would avoid the need to pull another channel altogether.
rustfmt = final.fenix.default.withComponents [ "rustfmt" ];
rust-toolchain = final.fenix.stable;
rust-external-deps = callPackage ./pkgs/rust-external-deps { };
rust-internal-deps = callPackage ./pkgs/rust-internal-deps { };
# (Linux-only) LD_AUDIT library for using dynamic libraries in Flox envs.
ld-floxlib = callPackage ./pkgs/ld-floxlib { };
flox-src = callPackage ./pkgs/flox-src { };
flox-activation-scripts = callPackage ./pkgs/flox-activation-scripts { };
flox-package-builder = callPackage ./pkgs/flox-package-builder { };
# Package Database Utilities: scrape, search, and resolve.
flox-pkgdb = callPackage ./pkgs/flox-pkgdb { };
flox-buildenv = callPackage ./pkgs/flox-buildenv { };
flox-watchdog = callPackage ./pkgs/flox-watchdog { }; # Flox Command Line Interface ( development build ).
flox-activations = callPackage ./pkgs/flox-activations { };
flox-cli = callPackage ./pkgs/flox-cli { };
flox-manpages = callPackage ./pkgs/flox-manpages { }; # Flox Command Line Interface Manpages
flox = callPackage ./pkgs/flox { }; # Flox Command Line Interface ( production build ).
# Wrapper scripts for running test suites.
flox-cli-tests = callPackage ./pkgs/flox-cli-tests { };
};
# Composes dependency overlays and the overlay defined here.
overlays.default = nixpkgs.lib.composeExtensions overlays.deps overlays.flox;
# ------------------------------------------------------------------------ #
# Apply overlays to the `nixpkgs` _base_ set.
# This is exposed as an output later; but we don't use the name
# `legacyPackages' to avoid checking the full closure with
# `nix flake check' and `nix search'.
pkgsContext = builtins.mapAttrs (system: pkgs: pkgs.extend overlays.default) nixpkgs.legacyPackages;
# ------------------------------------------------------------------------ #
checks = builtins.mapAttrs (system: pkgs: { inherit (pkgs) pre-commit-check; }) pkgsContext;
# ------------------------------------------------------------------------ #
packages = builtins.mapAttrs (system: pkgs: {
inherit (pkgs)
flox-activation-scripts
flox-pkgdb
flox-buildenv
flox-package-builder
flox-watchdog
flox-activations
flox-cli
flox-cli-tests
flox-manpages
flox
ld-floxlib
pre-commit-check
rust-external-deps
rust-internal-deps
;
default = pkgs.flox;
}) pkgsContext;
# ------------------------------------------------------------------------ #
devShells = builtins.mapAttrs (
system: pkgsBase:
let
pkgs = pkgsBase.extend (
final: prev: {
flox-cli-tests = prev.flox-cli-tests.override {
PROJECT_TESTS_DIR = "/cli/tests";
PKGDB_BIN = null;
FLOX_BIN = null;
WATCHDOG_BIN = null;
};
flox-cli = prev.flox-cli.override {
flox-pkgdb = null;
flox-watchdog = null;
};
checksFor = checks.${final.system};
}
);
in
{
default = pkgs.callPackage ./shells/default { };
}
) pkgsContext;
}; # End `outputs'
# -------------------------------------------------------------------------- #
}