-
Notifications
You must be signed in to change notification settings - Fork 3
/
nix-cde.nix
59 lines (50 loc) · 1.15 KB
/
nix-cde.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
nix-cde-self:
{ sources
, default_build_system ? null
}:
project:
{ build_system ? default_build_system
, host_system ? build_system
, cross_system ? null
, is_shell ? false
, overlay ? self: super: {}
, self ? null
}:
let
# Packages for the host (running) system
pkgs = if (cross_system == null)
then sources.nixpkgs.legacyPackages.${host_system}
else (import sources.nixpkgs {
localSystem = host_system;
crossSystem = cross_system;
});
# Packages for the build system
pkgs_native = sources.nixpkgs.legacyPackages.${build_system};
lib = pkgs_native.lib;
stdenv = pkgs_native.stdenv;
nix-cde = nix-cde-self {
inherit sources;
default_build_system = build_system;
};
base_module = { config, ... }:
{
config._module.args = {
inherit is_shell lib nix-cde pkgs pkgs_native sources stdenv;
src = pkgs.nix-gitignore.gitignoreSource config.src_exclude config.src;
};
};
modules = lib.evalModules {
modules = [
base_module
./main.nix
project
];
specialArgs = {
inherit self;
modulesPath = toString ./.;
};
};
in {
inherit modules;
outputs = modules.config;
}