mirror of
https://github.com/dump-dvb/nix-config.git
synced 2024-06-19 06:06:02 +02:00
nixpkgs-fmt
This commit is contained in:
parent
d073065f25
commit
1fb49e2b8b
11
flake.nix
11
flake.nix
|
@ -82,7 +82,8 @@
|
||||||
);
|
);
|
||||||
|
|
||||||
id_list = [
|
id_list = [
|
||||||
{ # Barkhausen Bau
|
{
|
||||||
|
# Barkhausen Bau
|
||||||
id = 0;
|
id = 0;
|
||||||
arch = "x86_64-linux";
|
arch = "x86_64-linux";
|
||||||
extraModules = [
|
extraModules = [
|
||||||
|
@ -90,7 +91,8 @@
|
||||||
diskModule
|
diskModule
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
{ # Zentralwerk
|
{
|
||||||
|
# Zentralwerk
|
||||||
id = 1;
|
id = 1;
|
||||||
arch = "x86_64-linux";
|
arch = "x86_64-linux";
|
||||||
extraModules = [
|
extraModules = [
|
||||||
|
@ -98,7 +100,8 @@
|
||||||
diskModule
|
diskModule
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
{ # Chemnitz
|
{
|
||||||
|
# Chemnitz
|
||||||
id = 2;
|
id = 2;
|
||||||
arch = "x86_64-linux";
|
arch = "x86_64-linux";
|
||||||
extraModules = [
|
extraModules = [
|
||||||
|
@ -186,5 +189,5 @@
|
||||||
mobile-box-disk."x86_64-linux" = self.nixosConfigurations.mobile-box.config.system.build.diskImage;
|
mobile-box-disk."x86_64-linux" = self.nixosConfigurations.mobile-box.config.system.build.diskImage;
|
||||||
sops-binaries."x86_64-linux" = sops-nix.packages."x86_64-linux".sops-install-secrets;
|
sops-binaries."x86_64-linux" = sops-nix.packages."x86_64-linux".sops-install-secrets;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
networking.interfaces.enp1s0.useDHCP = true;
|
networking.interfaces.enp1s0.useDHCP = true;
|
||||||
boot.tmpOnTmpfsSize = "25%";
|
boot.tmpOnTmpfsSize = "25%";
|
||||||
|
|
||||||
boot.kernelModules = [ "kvm-intel" ];
|
boot.kernelModules = [ "kvm-intel" ];
|
||||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
boot.loader.systemd-boot.enable = true;
|
boot.loader.systemd-boot.enable = true;
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
boot.loader.systemd-boot.configurationLimit = 1;
|
boot.loader.systemd-boot.configurationLimit = 1;
|
||||||
|
|
|
@ -9,47 +9,49 @@
|
||||||
networking.interfaces.eth0.useDHCP = true;
|
networking.interfaces.eth0.useDHCP = true;
|
||||||
|
|
||||||
sdImage = lib.mkForce {
|
sdImage = lib.mkForce {
|
||||||
populateFirmwareCommands = let
|
populateFirmwareCommands =
|
||||||
configTxt = pkgs.writeText "config.txt" ''
|
let
|
||||||
[pi3]
|
configTxt = pkgs.writeText "config.txt" ''
|
||||||
kernel=u-boot-rpi3.bin
|
[pi3]
|
||||||
hdmi_force_hotplug=1
|
kernel=u-boot-rpi3.bin
|
||||||
|
hdmi_force_hotplug=1
|
||||||
|
|
||||||
[pi02]
|
[pi02]
|
||||||
kernel=u-boot-rpi3.bin
|
kernel=u-boot-rpi3.bin
|
||||||
|
|
||||||
[pi4]
|
[pi4]
|
||||||
kernel=u-boot-rpi4.bin
|
kernel=u-boot-rpi4.bin
|
||||||
enable_gic=1
|
enable_gic=1
|
||||||
armstub=armstub8-gic.bin
|
armstub=armstub8-gic.bin
|
||||||
|
|
||||||
# Otherwise the resolution will be weird in most cases, compared to
|
# Otherwise the resolution will be weird in most cases, compared to
|
||||||
# what the pi3 firmware does by default.
|
# what the pi3 firmware does by default.
|
||||||
disable_overscan=1
|
disable_overscan=1
|
||||||
|
|
||||||
# Supported in newer board revisions
|
# Supported in newer board revisions
|
||||||
arm_boost=1
|
arm_boost=1
|
||||||
|
|
||||||
[cm4]
|
[cm4]
|
||||||
# Enable host mode on the 2711 built-in XHCI USB controller.
|
# Enable host mode on the 2711 built-in XHCI USB controller.
|
||||||
# This line should be removed if the legacy DWC2 controller is required
|
# This line should be removed if the legacy DWC2 controller is required
|
||||||
# (e.g. for USB device mode) or if USB support is not required.
|
# (e.g. for USB device mode) or if USB support is not required.
|
||||||
otg_mode=1
|
otg_mode=1
|
||||||
|
|
||||||
[all]
|
[all]
|
||||||
# Boot in 64-bit mode.
|
# Boot in 64-bit mode.
|
||||||
arm_64bit=1
|
arm_64bit=1
|
||||||
|
|
||||||
# U-Boot needs this to work, regardless of whether UART is actually used or not.
|
# U-Boot needs this to work, regardless of whether UART is actually used or not.
|
||||||
# Look in arch/arm/mach-bcm283x/Kconfig in the U-Boot tree to see if this is still
|
# Look in arch/arm/mach-bcm283x/Kconfig in the U-Boot tree to see if this is still
|
||||||
# a requirement in the future.
|
# a requirement in the future.
|
||||||
enable_uart=1
|
enable_uart=1
|
||||||
|
|
||||||
# Prevent the firmware from smashing the framebuffer setup done by the mainline kernel
|
# Prevent the firmware from smashing the framebuffer setup done by the mainline kernel
|
||||||
# when attempting to show low-voltage or overtemperature warnings.
|
# when attempting to show low-voltage or overtemperature warnings.
|
||||||
avoid_warnings=1
|
avoid_warnings=1
|
||||||
'';
|
'';
|
||||||
in ''
|
in
|
||||||
|
''
|
||||||
(cd ${pkgs.raspberrypifw}/share/raspberrypi/boot && cp bootcode.bin fixup*.dat start*.elf $NIX_BUILD_TOP/firmware/)
|
(cd ${pkgs.raspberrypifw}/share/raspberrypi/boot && cp bootcode.bin fixup*.dat start*.elf $NIX_BUILD_TOP/firmware/)
|
||||||
|
|
||||||
# Add the config
|
# Add the config
|
||||||
|
|
|
@ -7,11 +7,11 @@
|
||||||
hypervisor = "cloud-hypervisor";
|
hypervisor = "cloud-hypervisor";
|
||||||
mem = 4096;
|
mem = 4096;
|
||||||
vcpu = 8;
|
vcpu = 8;
|
||||||
interfaces = [ {
|
interfaces = [{
|
||||||
type = "tap";
|
type = "tap";
|
||||||
id = "serv-dvb-prod";
|
id = "serv-dvb-prod";
|
||||||
mac = "02:db:db:db:db:db";
|
mac = "02:db:db:db:db:db";
|
||||||
} ];
|
}];
|
||||||
shares = [
|
shares = [
|
||||||
{
|
{
|
||||||
source = "/nix/store";
|
source = "/nix/store";
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
tag = "etc";
|
tag = "etc";
|
||||||
proto = "virtiofs";
|
proto = "virtiofs";
|
||||||
socket = "etc.socket";
|
socket = "etc.socket";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
source = "/var/lib/microvms/data-hoarder/var";
|
source = "/var/lib/microvms/data-hoarder/var";
|
||||||
mountPoint = "/var";
|
mountPoint = "/var";
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./configuration.nix
|
./configuration.nix
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
./radio-config.nix
|
./radio-config.nix
|
||||||
./secrets.nix
|
./secrets.nix
|
||||||
./wireguard-client.nix
|
./wireguard-client.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
{ config, ... }:
|
{ config, ... }:
|
||||||
let
|
let
|
||||||
service_number = 1;
|
service_number = 1;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
dump-dvb.api = {
|
dump-dvb.api = {
|
||||||
enable = true;
|
enable = true;
|
||||||
GRPC = {
|
GRPC = {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, ... }:
|
{ config, ... }:
|
||||||
let
|
let
|
||||||
clicky-bunty-user = config.dump-dvb.clickyBuntyServer.user;
|
clicky-bunty-user = config.dump-dvb.clickyBuntyServer.user;
|
||||||
data-accumulator-user = config.dump-dvb.dataAccumulator.user;
|
data-accumulator-user = config.dump-dvb.dataAccumulator.user;
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
{ config, ... }:
|
{ config, ... }:
|
||||||
let
|
let
|
||||||
serice_number = 2;
|
serice_number = 2;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
dump-dvb.funnel = {
|
dump-dvb.funnel = {
|
||||||
enable = true;
|
enable = true;
|
||||||
GRPC = {
|
GRPC = {
|
||||||
|
|
|
@ -7,12 +7,12 @@ with lib; {
|
||||||
description = "number of the system";
|
description = "number of the system";
|
||||||
};
|
};
|
||||||
|
|
||||||
dump-dvb.domain = mkOption {
|
dump-dvb.domain = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "dvb.solutions";
|
default = "dvb.solutions";
|
||||||
description = "domain the server is running on";
|
description = "domain the server is running on";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
# user and group name that will be set as owner of the files.
|
# user and group name that will be set as owner of the files.
|
||||||
# `mode', `user', and `group' are optional.
|
# `mode', `user', and `group' are optional.
|
||||||
# When setting one of `user' or `group', the other needs to be set too.
|
# When setting one of `user' or `group', the other needs to be set too.
|
||||||
contents ? []
|
contents ? [ ]
|
||||||
|
|
||||||
, # Type of partition table to use; either "legacy", "efi", or "none".
|
, # Type of partition table to use; either "legacy", "efi", or "none".
|
||||||
# For "efi" images, the GPT partition table is used and a mandatory ESP
|
# For "efi" images, the GPT partition table is used and a mandatory ESP
|
||||||
|
@ -77,7 +77,7 @@
|
||||||
copyChannel ? true
|
copyChannel ? true
|
||||||
|
|
||||||
, # Additional store paths to copy to the image's store.
|
, # Additional store paths to copy to the image's store.
|
||||||
additionalPaths ? []
|
additionalPaths ? [ ]
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert partitionTableType == "legacy" || partitionTableType == "legacy+gpt" || partitionTableType == "efi" || partitionTableType == "hybrid" || partitionTableType == "none";
|
assert partitionTableType == "legacy" || partitionTableType == "legacy+gpt" || partitionTableType == "efi" || partitionTableType == "hybrid" || partitionTableType == "none";
|
||||||
|
@ -85,10 +85,10 @@ assert partitionTableType == "legacy" || partitionTableType == "legacy+gpt" || p
|
||||||
assert partitionTableType != "none" -> fsType == "ext4";
|
assert partitionTableType != "none" -> fsType == "ext4";
|
||||||
# Either both or none of {user,group} need to be set
|
# Either both or none of {user,group} need to be set
|
||||||
assert lib.all
|
assert lib.all
|
||||||
(attrs: ((attrs.user or null) == null)
|
(attrs: ((attrs.user or null) == null)
|
||||||
== ((attrs.group or null) == null))
|
== ((attrs.group or null) == null))
|
||||||
contents;
|
contents;
|
||||||
assert onlyNixStore -> contents == [] && configFile == null && !installBootLoader;
|
assert onlyNixStore -> contents == [ ] && configFile == null && !installBootLoader;
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
@ -100,19 +100,21 @@ let format' = format; in let
|
||||||
|
|
||||||
filename = "nixos." + {
|
filename = "nixos." + {
|
||||||
qcow2 = "qcow2";
|
qcow2 = "qcow2";
|
||||||
vdi = "vdi";
|
vdi = "vdi";
|
||||||
vpc = "vhd";
|
vpc = "vhd";
|
||||||
raw = "img";
|
raw = "img";
|
||||||
}.${format} or format;
|
}.${format} or format;
|
||||||
|
|
||||||
rootPartition = { # switch-case
|
rootPartition = {
|
||||||
|
# switch-case
|
||||||
legacy = "1";
|
legacy = "1";
|
||||||
"legacy+gpt" = "2";
|
"legacy+gpt" = "2";
|
||||||
efi = "2";
|
efi = "2";
|
||||||
hybrid = "3";
|
hybrid = "3";
|
||||||
}.${partitionTableType};
|
}.${partitionTableType};
|
||||||
|
|
||||||
partitionDiskScript = { # switch-case
|
partitionDiskScript = {
|
||||||
|
# switch-case
|
||||||
legacy = ''
|
legacy = ''
|
||||||
parted --script $diskImage -- \
|
parted --script $diskImage -- \
|
||||||
mklabel msdos \
|
mklabel msdos \
|
||||||
|
@ -150,7 +152,7 @@ let format' = format; in let
|
||||||
nixpkgs = cleanSource pkgs.path;
|
nixpkgs = cleanSource pkgs.path;
|
||||||
|
|
||||||
# FIXME: merge with channel.nix / make-channel.nix.
|
# FIXME: merge with channel.nix / make-channel.nix.
|
||||||
channelSources = pkgs.runCommand "nixos-${config.system.nixos.version}" {} ''
|
channelSources = pkgs.runCommand "nixos-${config.system.nixos.version}" { } ''
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
cp -prd ${nixpkgs.outPath} $out/nixos
|
cp -prd ${nixpkgs.outPath} $out/nixos
|
||||||
chmod -R u+w $out/nixos
|
chmod -R u+w $out/nixos
|
||||||
|
@ -162,7 +164,8 @@ let format' = format; in let
|
||||||
'';
|
'';
|
||||||
|
|
||||||
binPath = with pkgs; makeBinPath (
|
binPath = with pkgs; makeBinPath (
|
||||||
[ rsync
|
[
|
||||||
|
rsync
|
||||||
util-linux
|
util-linux
|
||||||
parted
|
parted
|
||||||
e2fsprogs
|
e2fsprogs
|
||||||
|
@ -171,16 +174,17 @@ let format' = format; in let
|
||||||
config.system.build.nixos-enter
|
config.system.build.nixos-enter
|
||||||
nix
|
nix
|
||||||
systemdMinimal
|
systemdMinimal
|
||||||
] ++ stdenv.initialPath);
|
] ++ stdenv.initialPath
|
||||||
|
);
|
||||||
|
|
||||||
# I'm preserving the line below because I'm going to search for it across nixpkgs to consolidate
|
# I'm preserving the line below because I'm going to search for it across nixpkgs to consolidate
|
||||||
# image building logic. The comment right below this now appears in 4 different places in nixpkgs :)
|
# image building logic. The comment right below this now appears in 4 different places in nixpkgs :)
|
||||||
# !!! should use XML.
|
# !!! should use XML.
|
||||||
sources = map (x: x.source) contents;
|
sources = map (x: x.source) contents;
|
||||||
targets = map (x: x.target) contents;
|
targets = map (x: x.target) contents;
|
||||||
modes = map (x: x.mode or "''") contents;
|
modes = map (x: x.mode or "''") contents;
|
||||||
users = map (x: x.user or "''") contents;
|
users = map (x: x.user or "''") contents;
|
||||||
groups = map (x: x.group or "''") contents;
|
groups = map (x: x.group or "''") contents;
|
||||||
|
|
||||||
basePaths = [ config.system.build.toplevel ]
|
basePaths = [ config.system.build.toplevel ]
|
||||||
++ lib.optional copyChannel channelSources;
|
++ lib.optional copyChannel channelSources;
|
||||||
|
@ -373,12 +377,13 @@ let format' = format; in let
|
||||||
'';
|
'';
|
||||||
|
|
||||||
buildImage = pkgs.vmTools.runInLinuxVM (
|
buildImage = pkgs.vmTools.runInLinuxVM (
|
||||||
pkgs.runCommand name {
|
pkgs.runCommand name
|
||||||
preVM = prepareImage;
|
{
|
||||||
buildInputs = with pkgs; [ util-linux e2fsprogs dosfstools ];
|
preVM = prepareImage;
|
||||||
postVM = moveOrConvertImage + postVM;
|
buildInputs = with pkgs; [ util-linux e2fsprogs dosfstools ];
|
||||||
memSize = 1024;
|
postVM = moveOrConvertImage + postVM;
|
||||||
} ''
|
memSize = 1024;
|
||||||
|
} ''
|
||||||
export PATH=${binPath}:$PATH
|
export PATH=${binPath}:$PATH
|
||||||
|
|
||||||
rootDisk=${if partitionTableType != "none" then "/dev/vda${rootPartition}" else "/dev/vda"}
|
rootDisk=${if partitionTableType != "none" then "/dev/vda${rootPartition}" else "/dev/vda"}
|
||||||
|
@ -442,7 +447,7 @@ let format' = format; in let
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
if onlyNixStore then
|
if onlyNixStore then
|
||||||
pkgs.runCommand name {}
|
pkgs.runCommand name { }
|
||||||
(prepareImage + moveOrConvertImage + postVM)
|
(prepareImage + moveOrConvertImage + postVM)
|
||||||
else buildImage
|
else buildImage
|
||||||
|
|
|
@ -1,39 +1,39 @@
|
||||||
{ pkgs, config, ... }:
|
{ pkgs, config, ... }:
|
||||||
{
|
{
|
||||||
dump-dvb = {
|
dump-dvb = {
|
||||||
gnuradio = {
|
gnuradio = {
|
||||||
enable = true;
|
enable = true;
|
||||||
device = "";
|
device = "";
|
||||||
frequency = 170795000;
|
frequency = 170795000;
|
||||||
offset = 19550;
|
offset = 19550;
|
||||||
RF = 14;
|
RF = 14;
|
||||||
IF = 32;
|
IF = 32;
|
||||||
BB = 42;
|
BB = 42;
|
||||||
};
|
|
||||||
telegramDecoder = {
|
|
||||||
enable = true;
|
|
||||||
server = [ "http://127.0.0.1:8080" ];
|
|
||||||
offline = true;
|
|
||||||
};
|
|
||||||
dataAccumulator = {
|
|
||||||
enable = true;
|
|
||||||
host = "0.0.0.0";
|
|
||||||
port = 8080;
|
|
||||||
DB.backend = "CSVFILE";
|
|
||||||
R09CsvFile = "/var/lib/data-accumulator/formatted.csv";
|
|
||||||
offline = true;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
networking.firewall.allowedTCPPorts = [ 80 config.dump-dvb.wartrammer.port ];
|
telegramDecoder = {
|
||||||
dump-dvb.wartrammer.enable = true;
|
enable = true;
|
||||||
systemd.services."start-wifi-hotspot" = {
|
server = [ "http://127.0.0.1:8080" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
offline = true;
|
||||||
serviceConfig = {
|
};
|
||||||
Type = "simple";
|
dataAccumulator = {
|
||||||
};
|
enable = true;
|
||||||
script = ''
|
host = "0.0.0.0";
|
||||||
${pkgs.linux-router}/bin/lnxrouter --ap wlp0s20u2 dump-dvb -g 10.3.141.1 -p trolling-dvb
|
port = 8080;
|
||||||
'';
|
DB.backend = "CSVFILE";
|
||||||
};
|
R09CsvFile = "/var/lib/data-accumulator/formatted.csv";
|
||||||
|
offline = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
networking.firewall.allowedTCPPorts = [ 80 config.dump-dvb.wartrammer.port ];
|
||||||
|
dump-dvb.wartrammer.enable = true;
|
||||||
|
systemd.services."start-wifi-hotspot" = {
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "simple";
|
||||||
|
};
|
||||||
|
script = ''
|
||||||
|
${pkgs.linux-router}/bin/lnxrouter --ap wlp0s20u2 dump-dvb -g 10.3.141.1 -p trolling-dvb
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user