-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
163 lines (144 loc) · 5.36 KB
/
flake.nix
File metadata and controls
163 lines (144 loc) · 5.36 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
{
nixConfig = {
extra-substituters = ["https://elodin-nix-cache.s3.us-west-2.amazonaws.com"];
extra-trusted-public-keys = [
"elodin-cache-1:vvbmIQvTOjcBjIs8Ri7xlT2I3XAmeJyF5mNlWB+fIwM="
];
};
inputs = {
aleph.url = "github:elodin-sys/elodin?ref=7dba6c5&dir=aleph";
flake-utils.follows = "aleph/flake-utils";
nixpkgs.follows = "aleph/nixpkgs";
self.submodules = true;
};
outputs = {
nixpkgs,
aleph,
self,
...
}: rec {
system = "aarch64-linux";
# Define custom overlay for our packages
overlays.default = final: prev: {
pylibiio = final.callPackage ./nix/pkgs/pylibiio.nix {};
pyadi-iio = final.callPackage ./nix/pkgs/pyadi-iio.nix {
pylibiio = final.pylibiio;
};
test-plutosdr = final.callPackage ./nix/pkgs/test-plutosdr.nix {
pylibiio = final.pylibiio;
pyadiIio = final.pyadi-iio; # Map the package name correctly
};
# Phaser data: pass local data directory, and scripts for on-device demos
phaser-data = final.callPackage ./nix/pkgs/phaser-data.nix {
localDataSrc = ./data;
scriptsSrc = ./scripts;
};
# Extend Python packages to include our custom packages
python3 = prev.python3.override {
packageOverrides = pyfinal: pyprev: {
cupy = final.callPackage ./nix/pkgs/cupy.nix {};
};
};
python3Packages = final.python3.pkgs;
};
nixosModules.default = {config, pkgs, ...}: {
imports = with aleph.nixosModules; [
# hardware modules
jetpack # core module required to make jetpack-nixos work
hardware # aleph specific hardware module, brings in the forked-kernel and device tree
fs # module that allows building sd-card images compatible with aleph
# networking modules
# usb-eth # sets up the usb ethernet gadget present on aleph
wifi # sets up wifi using iwd
# default tooling
aleph-setup # a setup tool that guides you through setting up wifi and a user on first login
aleph-base # a set of default configuration options that make developing on aleph easier
aleph-dev # a default set of packages like cuda, opencv, and git that make developing on aleph easier
# Import our custom modules
./nix/modules/plutosdr.nix
];
# overlays required to get elodin and nvidia packages
# NOTE: Order matters! aleph.overlays.jetpack must come BEFORE aleph.overlays.default
# so that aleph's gitReposOverlay properly overrides nvidia-jetpack with custom device tree sources
nixpkgs.overlays = [
aleph.overlays.jetpack # Apply jetpack overlay first
aleph.overlays.default # Then apply aleph overlay (includes custom gitRepos for devicetree)
overlays.default # Add our custom overlay last
];
system.stateVersion = "25.05";
i18n.supportedLocales = [(config.i18n.defaultLocale + "/UTF-8")];
# Enable PlutoSDR support with GPU demos
services.plutosdr = {
enable = true;
users = [ "aleph-phaser" ]; # Add our user to plugdev/dialout groups
enableGnuRadio = true; # long build time and heavy dependencies
enableGpuDemos = true; # Enable GPU-accelerated radar demos
};
# Additional system packages for Phaser development
environment.systemPackages = with pkgs; [
# Development tools
git
vim
tmux
htop
# Network tools for testing
wget
curl
nmap
iperf3
# USB and hardware debugging
usbutils
pciutils
lshw
# Python development
python3
# Build tools (in case we need to compile anything)
gcc
gnumake
cmake
pkg-config
];
users.users.aleph-phaser = {
isNormalUser = true;
openssh.authorizedKeys.keys = [
# contents of ~/.ssh/aleph-phaser.pub:
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDwxggwJgH427UbKZcaw2sHpO+Roa+0aMfN27W0eVwQ9 aleph-phaser"
];
extraGroups = [
"wheel"
"dialout"
"video"
"audio"
"networkmanager"
"podman"
# Note: plugdev is added automatically by the plutosdr module
];
shell = "/run/current-system/sw/bin/bash";
};
services.openssh.enable = true; # enable ssh
services.openssh.settings = {
PasswordAuthentication = true;
PubkeyAuthentication = true;
PermitRootLogin = "yes";
};
security.sudo.wheelNeedsPassword = false;
nix.settings.trusted-users = ["@wheel" "root" "ubuntu" "aleph-phaser"];
networking.firewall.enable = false;
};
# sets up two different nixos systems default and installer
# installer is setup to be flashed to a usb drive, and contains the
# aleph-installer tool. This tool lets you install the system to the nvme
# drive
nixosConfigurations = {
default = nixpkgs.lib.nixosSystem {
inherit system;
modules = [nixosModules.default];
};
};
packages.aarch64-linux = {
sdimage = aleph.packages.aarch64-linux.sdimage;
# the toplevel config, this allows you to use the deploy.sh script:
default = nixosConfigurations.default.config.system.build.toplevel;
};
};
}