forked from kuruczgy/x1e-nixos-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
66 lines (61 loc) · 2.24 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
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
};
outputs = { self, nixpkgs }:
let
# Modify this if you are building on something other than x86_64-linux.
buildSystem = "x86_64-linux";
# Modify this of you want to attempt using a different device.
# See the `arch/arm64/boot/dts/qcom` directory in the Linux
# kernel source tree for available device trees.
deviceTreeName = "qcom/x1e80100-lenovo-yoga-slim7x.dtb";
nixpkgs-patched =
let pkgs-unpatched = nixpkgs.legacyPackages.${buildSystem}; in (pkgs-unpatched.applyPatches {
name = "nixpkgs-patched";
src = nixpkgs;
patches = [
./nixpkgs-devicetree.patch
./nixpkgs-efi-shell.patch
];
}).overrideAttrs { allowSubstitutes = true; };
pkgs-cross = import nixpkgs-patched {
overlays = [ (import ./packages/overlay.nix) ];
localSystem.system = buildSystem;
crossSystem.system = "aarch64-linux";
allowUnsupportedSystem = true;
};
in
(import ./default.nix) // {
nixosConfigurations = {
iso = nixpkgs.lib.nixosSystem {
modules = [
"${nixpkgs-patched}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
./iso.nix
./modules/x1e80100.nix
./modules/common.nix
{
nixpkgs.pkgs = pkgs-cross;
hardware.deviceTree.name = deviceTreeName;
# Required to evaluate packages from `pkgs-cross` on the device.
isoImage.storeContents = [ nixpkgs-patched ];
}
];
};
system = nixpkgs.lib.nixosSystem {
modules = [
./examples/flake-based-config/configuration.nix
self.nixosModules.x1e
./modules/common.nix
({ lib, ... }: {
nixpkgs.pkgs = nixpkgs.legacyPackages.aarch64-linux;
hardware.deviceTree.name = deviceTreeName;
# Copy the cross-compiled kernel from the install ISO. Remove
# this if you want to natively compile the kernel on your device.
boot.kernelPackages = lib.mkForce pkgs-cross.x1e80100-linux;
})
];
};
};
};
}