-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.nix
More file actions
50 lines (44 loc) · 1.17 KB
/
default.nix
File metadata and controls
50 lines (44 loc) · 1.17 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
{
self ? import ./nix/utils/import-flake.nix { src = ./.; },
inputs ? self.inputs,
system ? builtins.currentSystem,
pkgs ? import inputs.nixpkgs {
config = { };
overlays = [ inputs.rust-overlay.overlays.default ];
inherit system;
},
lib ? import "${inputs.nixpkgs}/lib",
}:
let
scope = lib.makeScope pkgs.newScope (s: {
inherit
lib
pkgs
self
system
inputs
flake
;
devLib = s.callPackage ./nix/lib.nix { };
format = s.callPackage ./nix/formatter.nix { };
rust = s.callPackage ./nix/rust.nix { };
devShells = s.rust.shells;
crates = s.rust.crates;
apps = s.rust.apps;
});
flakeLib = inputs.flake-utils.lib;
flake = with scope; {
inherit devShells;
inherit (format) formatter;
apps = devLib.filterApps apps;
packages = lib.filterAttrs (n: v: lib.isDerivation v) crates;
checks = flakeLib.filterPackages system (flake.packages // flake.apps);
legacyPackages.lib = devLib;
};
# return final attribute set (non-recursive)
finalScope = (scope.packages scope) // {
# but include the original scope
inherit scope;
};
in
finalScope // finalScope.flake.packages