forked from cleverca22/not-os
-
Notifications
You must be signed in to change notification settings - Fork 2
/
default.nix
66 lines (63 loc) · 2.15 KB
/
default.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
{ configuration ? import ./configuration.nix
, pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/dea79b56f7218ba75653260232c07d2f5ad2f109.tar.gz") { inherit system; config = {}; }
#, pkgs ? import <nixpkgs> { inherit system; config = {}; }
, extraModules ? []
, system ? builtins.currentSystem
}:
let
pkgsModule = rec {
_file = ./default.nix;
key = _file;
config = {
nixpkgs.localSystem = { inherit system; };
};
};
baseModules = [
./base.nix
./system-path.nix
./stage-1.nix
./stage-2.nix
./runit.nix
(pkgs.path + "/nixos/modules/system/etc/etc.nix")
(pkgs.path + "/nixos/modules/system/activation/activation-script.nix")
(pkgs.path + "/nixos/modules/misc/nixpkgs.nix")
(pkgs.path + "/nixos/modules/system/boot/kernel.nix")
(pkgs.path + "/nixos/modules/misc/assertions.nix")
(pkgs.path + "/nixos/modules/misc/lib.nix")
(pkgs.path + "/nixos/modules/config/sysctl.nix")
./nixos-compat.nix
pkgsModule
];
evalConfig = modules: pkgs.lib.evalModules {
prefix = [];
check = true;
modules = modules ++ baseModules ++ extraModules;
args = {};
};
in
rec {
os = evalConfig [ configuration ];
config = os.config;
# Build with nix-build -A <attr>
stage-1 = os.config.system.build.bootStage1;
stage-2 = os.config.system.build.bootStage2;
runvm = os.config.system.build.runvm;
kernel = os.config.system.build.kernel;
initrd = os.config.system.build.initialRamdisk;
rootfs = os.config.system.build.squashfs;
images = os.config.system.build.images;
ext4 = os.config.system.build.ext4;
boot = os.config.system.build.boot;
syslinux = os.config.system.build.syslinux;
raw = os.config.system.build.raw;
qcow2 = os.config.system.build.qcow2;
toplevel = os.config.system.build.toplevel;
path = os.config.system.path;
dist = os.config.system.build.dist;
extra-utils = os.config.system.build.extraUtils;
shrunk = os.config.system.build.shrunk;
site = (import ./site);
# Evaluate with nix-instantiate --eval --strict -A <attr>
root-modules = os.config.system.build.rootModules;
cmdline = os.config.boot.kernelParams;
}