-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
111 lines (99 loc) · 3.43 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
{
inputs = {
# nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
# nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
#nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = {nixpkgs, ...}: let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
};
lib = nixpkgs.lib;
in rec {
devShell.${system} = pkgs.mkShell {
buildInputs = with pkgs; [
rsync
zstd
git
];
};
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
nixosConfigurations.m1 = lib.nixosSystem {
system = "aarch64-linux";
modules = [
({
pkgs,
config,
...
}: {
imports = [
./kboot-conf
# "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix"
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
];
sdImage = {
#compressImage = false;
populateFirmwareCommands = let
configTxt = pkgs.writeText "README" ''
Nothing to see here. This empty partition is here because I don't know how to turn its creation off.
'';
in ''
cp ${configTxt} firmware/README
'';
populateRootCommands = ''
${config.boot.loader.kboot-conf.populateCmd} -c ${config.system.build.toplevel} -d ./files/kboot.conf
'';
};
#boot.loader.grub.enable = false;
boot.loader.kboot-conf.enable = true;
# Use kernel >6.6
boot.kernelPackages = pkgs.linuxPackages_latest;
# Stop ZFS breasking the build
boot.supportedFilesystems = lib.mkForce ["btrfs" "cifs" "f2fs" "jfs" "ntfs" "reiserfs" "vfat" "xfs"];
# I'm not completely sure if some of these could be omitted,
# but want to make sure disk access works
boot.initrd.availableKernelModules = [
"nvme"
"nvme-core"
"phy-rockchip-naneng-combphy"
"phy-rockchip-snps-pcie3"
];
# Petitboot uses this port and baud rate on the boards serial port,
# it's probably good to keep the options same for the running
# kernel for serial console access to work well
boot.kernelParams = ["console=ttyS2,1500000"];
hardware.deviceTree.name = "rockchip/rk3568-odroid-m1.dtb";
# Enable nix flakes
nix.package = pkgs.nixFlakes;
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
nix.nixPath = ["nixpkgs=${nixpkgs}"];
# includes this flake in the live iso : "/etc/nixcfg"
environment.etc.nixcfg.source =
builtins.filterSource
(path: type:
baseNameOf path
!= ".git"
&& type != "symlink"
&& !(pkgs.lib.hasSuffix ".qcow2" path)
&& baseNameOf path != "secrets")
../.;
environment.systemPackages = [
pkgs.git #gotta have git
];
services.openssh = {
enable = true;
settings.PermitRootLogin = "yes";
};
users.extraUsers.root.initialPassword = lib.mkForce "odroid";
})
];
};
images = {
m1 = nixosConfigurations.m1.config.system.build.sdImage;
};
};
}