radiobert: init

This commit is contained in:
Astro 2021-09-23 03:32:17 +02:00
parent 201fdae48f
commit 837ae7c7e0
6 changed files with 179 additions and 2 deletions

View File

@ -211,8 +211,10 @@
system = "aarch64-linux";
};
pipebert = nixosSystem' {
modules = [ ./hosts/pipebert ];
radiobert = nixosSystem' {
modules = [
./hosts/radiobert
];
system = "aarch64-linux";
};

View File

@ -117,6 +117,8 @@ rec {
ip4 = "172.20.73.45";
ip6 = "2a00:8180:2c00:282:1024:5fff:febd:9be7";
};
radiobert.ip4 = "172.22.99.117";
};
hqGlobal = builtins.attrNames hosts;

119
hosts/radiobert/default.nix Normal file
View File

@ -0,0 +1,119 @@
{ config, lib, pkgs, modulesPath, ... }:
{
boot.initrd.availableKernelModules = [ "usbhid" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
};
fileSystems."/boot/firmware" = {
device = "/dev/disk/by-label/FIRMWARE";
fsType = "vfat";
};
swapDevices = [ ];
hardware.enableRedistributableFirmware = true;
#networking.wireless.enable = true;
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
boot = {
loader = {
grub.enable = false;
generic-extlinux-compatible.enable = false;
raspberryPi = {
enable = true;
version = 3;
uboot.enable = true;
firmwareConfig = ''
gpu_mem=192
dtparam=audio=on
'';
};
};
kernelPackages = pkgs.linuxPackages_latest;
tmpOnTmpfs = true;
};
c3d2 = {
isInHq = true;
mapHqHosts = true;
hq.interface = "eth0";
};
nix = {
buildCores = 4;
maxJobs = 2;
};
networking = {
hostName = "radiobert"; # Define your hostname.
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
useDHCP = false;
interfaces.eth0.useDHCP = true;
interfaces.wlan0.useDHCP = true;
# TODO
firewall.enable = false;
};
services.openwebrx.enable = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
git
libraspberrypi
vim
wget
];
programs.tmux.enable = true;
# Do not log to flash:
services.journald.extraConfig = ''
Storage=volatile
'';
# Enable the OpenSSH daemon.
services.openssh = {
enable = true;
permitRootLogin = "yes";
};
security.sudo = {
enable = true;
wheelNeedsPassword = false;
};
users.users.k-ot = {
isNormalUser = true;
extraGroups = [ "wheel" "audio" ];
};
security.acme = {
acceptTerms = true;
email = "mail@c3d2.de";
};
# Allow access to USB
services.udev.extraRules = ''
SUBSYSTEM=="usb", MODE:="0666"
'';
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "21.05"; # Did you read the comment?
}

View File

@ -30,6 +30,7 @@ in {
imports = [
./users
./stats.nix
./openwebrx.nix
];
options.c3d2 = with lib;

45
lib/openwebrx.nix Normal file
View File

@ -0,0 +1,45 @@
{ self, system, config, lib, pkgs, ... }:
let
cfg = config.services.openwebrx;
in
{
options.services.openwebrx = {
enable = lib.mkEnableOption "Enable OpenWebRX Web interface for Software-Defined Radios";
package = lib.mkOption {
default = pkgs.openwebrx;
};
};
config = lib.mkIf cfg.enable {
users = {
users.openwebrx = {
isSystemUser = true;
group = "openwebrx";
home = "/var/lib/openwebrx";
};
groups.openwebrx = {};
};
systemd.services.openwebrx = {
wantedBy = [ "multi-user.target" ];
path = [
cfg.package
cfg.package.csdr
pkgs.alsaUtils
pkgs.netcat
];
serviceConfig = {
ExecStart = "openwebrx";
Restart = "always";
User = "openwebrx";
Groups = "openwebrx";
WorkingDirectory = "/var/lib/openwebrx";
};
};
systemd.tmpfiles.rules = [
"d /var/lib/openwebrx 0755 openwebrx openwebrx -"
];
};
}

View File

@ -15,6 +15,10 @@ let
rev = version;
sha256 = "1vip5a3xgskcwba3xi66zfr986xrsch9na7my818cm8vw345y57b";
};
patchPhase = ''
substituteInPlace configure.ac \
--replace -Wformat=0 ""
'';
nativeBuildInputs = [
autoreconfHook
@ -106,4 +110,8 @@ buildPythonApplication rec {
owrx_connector
direwolf
];
passthru = {
inherit csdr js8py owrx_connector direwolf;
};
}