-
Notifications
You must be signed in to change notification settings - Fork 0
/
lazor.nix
64 lines (51 loc) · 1.92 KB
/
lazor.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
{ config, pkgs, lib, ... }:
{
imports = [ ./kernel.nix ./stub-bootloader.nix ];
boot.loader.stub.enable = true;
boot.loader.generic-extlinux-compatible.enable = false;
boot.loader.systemd-boot.enable = false;
boot.loader.efi.canTouchEfiVariables = false;
boot.loader.grub.enable = false;
boot.kernelParams = [ "console=tty1" ];
powerManagement.cpuFreqGovernor = lib.mkDefault "schedutil";
hardware.enableAllFirmware = true; # FIXME: is this needed?
systemd.services.rmtfs =
let
# This isn't good, we should use the real firmware instead of stubs.
rmtfs_firmware = pkgs.runCommand "rmtfs-firmware" {} ''
mkdir $out
dd if=/dev/zero bs=1M count=2 of=$out/modem_fs1
dd if=/dev/zero bs=1M count=2 of=$out/modem_fs2
dd if=/dev/zero bs=1M count=2 of=$out/modem_fsg
dd if=/dev/zero bs=1M count=2 of=$out/modem_fsc
'';
/*
#!/bin/bash
[ $(dd if="/dev/mmcblk*boot0" bs=3 skip=0 count=1 status_none) != "FSG" ] && return 1
fsg_size="$(dd if="/dev/mmcblk*boot0" bs=1 skip=4 count=8 status=none)"
[ $fsg_size -eq 0 ] && return 0 # wifi only
dd if="/dev/mmcblk*boot0" of=modem.fsg bs=512 skip=1 count=$((fsg_size / 512)) status=none
offset="$((fsg_size / 512 * 512))"
[ $((fsg_size % 512)) -ne 0 ] && dd if="/dev/mmcblk*boot0" of=modem.fsg bs=1 skip=$((offset + 512))" \
seek=$offset count="$((fsg_size % 512))" status=none
*/
in {
enable = true;
wantedBy = [ "multi-user.target" ];
requires = [ "qrtr-ns.service" ];
after = [ "qrtr-ns.service" ];
serviceConfig = {
Type = "exec";
ExecStart = "${pkgs.rmtfs}/bin/rmtfs -r -s -o ${rmtfs_firmware}";
Restart = "always";
RestartSec = "1";
};
};
systemd.services.qrtr-ns = {
serviceConfig = {
ExecStart = "${pkgs.qrtr}/bin/qrtr-ns -f 1";
Restart = "always";
};
};
environment.systemPackages = [ pkgs.qrtr ];
}