nixpkgs-fmt

This commit is contained in:
oxapentane - 2022-08-24 18:48:33 +02:00
parent d073065f25
commit 1fb49e2b8b
Signed by: oxapentane
GPG Key ID: 91FA5E5BF9AA901C
11 changed files with 132 additions and 120 deletions

View File

@ -82,7 +82,8 @@
);
id_list = [
{ # Barkhausen Bau
{
# Barkhausen Bau
id = 0;
arch = "x86_64-linux";
extraModules = [
@ -90,7 +91,8 @@
diskModule
];
}
{ # Zentralwerk
{
# Zentralwerk
id = 1;
arch = "x86_64-linux";
extraModules = [
@ -98,7 +100,8 @@
diskModule
];
}
{ # Chemnitz
{
# Chemnitz
id = 2;
arch = "x86_64-linux";
extraModules = [
@ -186,5 +189,5 @@
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;
};
};
};
}

View File

@ -8,8 +8,8 @@
networking.interfaces.enp1s0.useDHCP = true;
boot.tmpOnTmpfsSize = "25%";
boot.kernelModules = [ "kvm-intel" ];
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
boot.kernelModules = [ "kvm-intel" ];
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.systemd-boot.configurationLimit = 1;

View File

@ -9,47 +9,49 @@
networking.interfaces.eth0.useDHCP = true;
sdImage = lib.mkForce {
populateFirmwareCommands = let
configTxt = pkgs.writeText "config.txt" ''
[pi3]
kernel=u-boot-rpi3.bin
hdmi_force_hotplug=1
populateFirmwareCommands =
let
configTxt = pkgs.writeText "config.txt" ''
[pi3]
kernel=u-boot-rpi3.bin
hdmi_force_hotplug=1
[pi02]
kernel=u-boot-rpi3.bin
[pi02]
kernel=u-boot-rpi3.bin
[pi4]
kernel=u-boot-rpi4.bin
enable_gic=1
armstub=armstub8-gic.bin
[pi4]
kernel=u-boot-rpi4.bin
enable_gic=1
armstub=armstub8-gic.bin
# Otherwise the resolution will be weird in most cases, compared to
# what the pi3 firmware does by default.
disable_overscan=1
# Otherwise the resolution will be weird in most cases, compared to
# what the pi3 firmware does by default.
disable_overscan=1
# Supported in newer board revisions
arm_boost=1
# Supported in newer board revisions
arm_boost=1
[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# 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.
otg_mode=1
[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# 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.
otg_mode=1
[all]
# Boot in 64-bit mode.
arm_64bit=1
[all]
# Boot in 64-bit mode.
arm_64bit=1
# 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
# a requirement in the future.
enable_uart=1
# 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
# a requirement in the future.
enable_uart=1
# Prevent the firmware from smashing the framebuffer setup done by the mainline kernel
# when attempting to show low-voltage or overtemperature warnings.
avoid_warnings=1
'';
in ''
# Prevent the firmware from smashing the framebuffer setup done by the mainline kernel
# when attempting to show low-voltage or overtemperature warnings.
avoid_warnings=1
'';
in
''
(cd ${pkgs.raspberrypifw}/share/raspberrypi/boot && cp bootcode.bin fixup*.dat start*.elf $NIX_BUILD_TOP/firmware/)
# Add the config

View File

@ -7,11 +7,11 @@
hypervisor = "cloud-hypervisor";
mem = 4096;
vcpu = 8;
interfaces = [ {
interfaces = [{
type = "tap";
id = "serv-dvb-prod";
mac = "02:db:db:db:db:db";
} ];
}];
shares = [
{
source = "/nix/store";
@ -26,7 +26,7 @@
tag = "etc";
proto = "virtiofs";
socket = "etc.socket";
}
}
{
source = "/var/lib/microvms/data-hoarder/var";
mountPoint = "/var";

View File

@ -1,9 +1,9 @@
{
imports = [
./configuration.nix
./hardware-configuration.nix
./radio-config.nix
./secrets.nix
./wireguard-client.nix
];
./configuration.nix
./hardware-configuration.nix
./radio-config.nix
./secrets.nix
./wireguard-client.nix
];
}

View File

@ -1,7 +1,8 @@
{ config, ... }:
let
service_number = 1;
in {
in
{
dump-dvb.api = {
enable = true;
GRPC = {

View File

@ -1,4 +1,4 @@
{ config, ... }:
{ config, ... }:
let
clicky-bunty-user = config.dump-dvb.clickyBuntyServer.user;
data-accumulator-user = config.dump-dvb.dataAccumulator.user;

View File

@ -1,7 +1,8 @@
{ config, ... }:
{ config, ... }:
let
serice_number = 2;
in {
in
{
dump-dvb.funnel = {
enable = true;
GRPC = {

View File

@ -7,12 +7,12 @@ with lib; {
description = "number of the system";
};
dump-dvb.domain = mkOption {
type = types.str;
default = "dvb.solutions";
description = "domain the server is running on";
dump-dvb.domain = mkOption {
type = types.str;
default = "dvb.solutions";
description = "domain the server is running on";
};
};
};
}

View File

@ -27,7 +27,7 @@
# user and group name that will be set as owner of the files.
# `mode', `user', and `group' are optional.
# 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".
# For "efi" images, the GPT partition table is used and a mandatory ESP
@ -77,7 +77,7 @@
copyChannel ? true
, # Additional store paths to copy to the image's store.
additionalPaths ? []
additionalPaths ? [ ]
}:
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";
# Either both or none of {user,group} need to be set
assert lib.all
(attrs: ((attrs.user or null) == null)
== ((attrs.group or null) == null))
contents;
assert onlyNixStore -> contents == [] && configFile == null && !installBootLoader;
(attrs: ((attrs.user or null) == null)
== ((attrs.group or null) == null))
contents;
assert onlyNixStore -> contents == [ ] && configFile == null && !installBootLoader;
with lib;
@ -100,19 +100,21 @@ let format' = format; in let
filename = "nixos." + {
qcow2 = "qcow2";
vdi = "vdi";
vpc = "vhd";
raw = "img";
vdi = "vdi";
vpc = "vhd";
raw = "img";
}.${format} or format;
rootPartition = { # switch-case
rootPartition = {
# switch-case
legacy = "1";
"legacy+gpt" = "2";
efi = "2";
hybrid = "3";
}.${partitionTableType};
partitionDiskScript = { # switch-case
partitionDiskScript = {
# switch-case
legacy = ''
parted --script $diskImage -- \
mklabel msdos \
@ -150,7 +152,7 @@ let format' = format; in let
nixpkgs = cleanSource pkgs.path;
# 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
cp -prd ${nixpkgs.outPath} $out/nixos
chmod -R u+w $out/nixos
@ -162,7 +164,8 @@ let format' = format; in let
'';
binPath = with pkgs; makeBinPath (
[ rsync
[
rsync
util-linux
parted
e2fsprogs
@ -171,16 +174,17 @@ let format' = format; in let
config.system.build.nixos-enter
nix
systemdMinimal
] ++ stdenv.initialPath);
] ++ stdenv.initialPath
);
# 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 :)
# !!! should use XML.
sources = map (x: x.source) contents;
targets = map (x: x.target) contents;
modes = map (x: x.mode or "''") contents;
users = map (x: x.user or "''") contents;
groups = map (x: x.group or "''") contents;
modes = map (x: x.mode or "''") contents;
users = map (x: x.user or "''") contents;
groups = map (x: x.group or "''") contents;
basePaths = [ config.system.build.toplevel ]
++ lib.optional copyChannel channelSources;
@ -373,12 +377,13 @@ let format' = format; in let
'';
buildImage = pkgs.vmTools.runInLinuxVM (
pkgs.runCommand name {
preVM = prepareImage;
buildInputs = with pkgs; [ util-linux e2fsprogs dosfstools ];
postVM = moveOrConvertImage + postVM;
memSize = 1024;
} ''
pkgs.runCommand name
{
preVM = prepareImage;
buildInputs = with pkgs; [ util-linux e2fsprogs dosfstools ];
postVM = moveOrConvertImage + postVM;
memSize = 1024;
} ''
export PATH=${binPath}:$PATH
rootDisk=${if partitionTableType != "none" then "/dev/vda${rootPartition}" else "/dev/vda"}
@ -442,7 +447,7 @@ let format' = format; in let
''
);
in
if onlyNixStore then
pkgs.runCommand name {}
(prepareImage + moveOrConvertImage + postVM)
else buildImage
if onlyNixStore then
pkgs.runCommand name { }
(prepareImage + moveOrConvertImage + postVM)
else buildImage

View File

@ -1,39 +1,39 @@
{ pkgs, config, ... }:
{
dump-dvb = {
gnuradio = {
enable = true;
device = "";
frequency = 170795000;
offset = 19550;
RF = 14;
IF = 32;
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;
};
{
dump-dvb = {
gnuradio = {
enable = true;
device = "";
frequency = 170795000;
offset = 19550;
RF = 14;
IF = 32;
BB = 42;
};
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
'';
};
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 ];
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
'';
};
}
}