-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathflake.nix
97 lines (97 loc) · 2.96 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-22.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs";
arapov-nixpkgs = {
url = "github:arapov/nixpkgs/hardkernel";
};
flake-utils = {
url = "github:numtide/flake-utils";
};
};
outputs = inputs: {
overlays = {
odroidhc4-uboot = final: prev:
let uboot-nixpkgs = final.applyPatches {
name = "nixpkgs-hc4-defconfig";
src = inputs.arapov-nixpkgs;
patches = [ ./hc4-uboot.patch ];
};
in
{
meson64-tools = final.callPackage "${uboot-nixpkgs}/pkgs/misc/meson64-tools" { };
inherit (final.callPackage "${uboot-nixpkgs}/pkgs/misc/uboot" { })
ubootOdroidC4
ubootOdroidHC4;
inherit (final.callPackage "${uboot-nixpkgs}/pkgs/misc/uboot/hardkernel-firmware.nix" { })
firmwareOdroidC2
firmwareOdroidC4;
};
};
nixosModules = {
odroidhc4 = {
imports = [
inputs.self.nixosModules.sd-image
inputs.self.nixosModules.odroidhc4-uboot
];
};
sd-image = ({ lib, ... }: {
imports = [
# the 22.05 release unconditionally uses zstd which is broken on Linux 5.18
# until https://github.com/NixOS/nixpkgs/pull/178830 is merged.
"${inputs.nixpkgs-unstable}/nixos/modules/installer/sd-card/sd-image-aarch64-new-kernel-installer.nix"
];
# Remove zfs from supported filesystems as it fails due to not being able to
# build the kernel module
boot.supportedFilesystems = lib.mkForce [
"btrfs"
"reiserfs"
"vfat"
"f2fs"
"xfs"
"ntfs"
"cifs"
];
sdImage.compressImage = false;
});
odroidhc4-uboot = ({ pkgs, lib, ... }: {
# it doesn't come with a LICENSE... :(
# @angerman, please add one.
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"meson64-tools"
];
nixpkgs.overlays = [ inputs.self.overlays.odroidhc4-uboot ];
});
};
lib = {
makeSdImage = nixos: nixos.pkgs.buildPackages.symlinkJoin {
name = "build-${nixos.config.sdImage.imageName}";
paths = [
nixos.config.system.build.sdImage
nixos.pkgs.ubootOdroidHC4
];
};
};
nixosConfigurations = {
example-hc4 = inputs.nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
inputs.self.nixosModules.odroidhc4
];
};
};
packages.aarch64-linux =
let
pkgs = import inputs.nixpkgs {
system = "aarch64-linux";
overlays = [ inputs.self.overlays.odroidhc4-uboot ];
config.allowUnfreePredicate = pkg: builtins.elem (inputs.nixpkgs.lib.getName pkg) [
"meson64-tools"
];
};
in
{
uboot-odroid-hc4 = pkgs.ubootOdroidHC4;
};
};
}