From 2ca93eb2e860fdd1efbddb9eb6e11739db84334d Mon Sep 17 00:00:00 2001 From: revol-xut Date: Sat, 7 May 2022 23:11:09 +0200 Subject: [PATCH] adding mobile box as seperate system --- flake.lock | 56 +++++++++++++------ flake.nix | 11 ++-- .../configuration-dell-wyse-3040.nix | 0 .../configuration-rpi-4b.nix | 0 hosts/mobile-box/configuration.nix | 54 ++++++++++++++++++ hosts/mobile-box/hardware-configuration.nix | 36 ++++++++++++ modules/file_sharing.nix | 2 +- modules/mobile-box.nix | 4 +- 8 files changed, 140 insertions(+), 23 deletions(-) rename {hosts/traffic-stop-box => hardware}/configuration-dell-wyse-3040.nix (100%) rename {hosts/traffic-stop-box => hardware}/configuration-rpi-4b.nix (100%) create mode 100644 hosts/mobile-box/configuration.nix create mode 100644 hosts/mobile-box/hardware-configuration.nix diff --git a/flake.lock b/flake.lock index 4f179e7..19a2a87 100644 --- a/flake.lock +++ b/flake.lock @@ -28,7 +28,7 @@ "decode-server": { "inputs": { "naersk": "naersk", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "utils": "utils_2" }, "locked": { @@ -48,7 +48,7 @@ "dvb-api": { "inputs": { "naersk": "naersk_2", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_4", "utils": "utils_3" }, "locked": { @@ -67,10 +67,7 @@ }, "naersk": { "inputs": { - "nixpkgs": [ - "decode-server", - "nixpkgs" - ] + "nixpkgs": "nixpkgs" }, "locked": { "lastModified": 1651574473, @@ -88,10 +85,7 @@ }, "naersk_2": { "inputs": { - "nixpkgs": [ - "dvb-api", - "nixpkgs" - ] + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1650265945, @@ -128,6 +122,20 @@ } }, "nixpkgs": { + "locked": { + "lastModified": 1651927509, + "narHash": "sha256-fGVGUdEsriuAL1vkUh29FlOQmEkPRnSfRGImWYaVjos=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2fdb6f2e08e7989b03a2a1aa8538d99e3eeea881", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1651571855, "narHash": "sha256-KZie6c2J2DUPLjG2PkYSwGLvD6RygA3TxZSPQpctbNI=", @@ -143,7 +151,21 @@ "type": "github" } }, - "nixpkgs_2": { + "nixpkgs_3": { + "locked": { + "lastModified": 1651927509, + "narHash": "sha256-fGVGUdEsriuAL1vkUh29FlOQmEkPRnSfRGImWYaVjos=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2fdb6f2e08e7989b03a2a1aa8538d99e3eeea881", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_4": { "locked": { "lastModified": 1651007983, "narHash": "sha256-GNay7yDPtLcRcKCNHldug85AhAvBpTtPEJWSSDYBw8U=", @@ -159,7 +181,7 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_5": { "locked": { "lastModified": 1651848520, "narHash": "sha256-KkJ28fShdd78+zal5HlHsXUICOCtO7Bdvylc5zlp5Mk=", @@ -175,7 +197,7 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_6": { "locked": { "lastModified": 1651571855, "narHash": "sha256-KZie6c2J2DUPLjG2PkYSwGLvD6RygA3TxZSPQpctbNI=", @@ -191,7 +213,7 @@ "type": "github" } }, - "nixpkgs_5": { + "nixpkgs_7": { "locked": { "lastModified": 1651007983, "narHash": "sha256-GNay7yDPtLcRcKCNHldug85AhAvBpTtPEJWSSDYBw8U=", @@ -209,7 +231,7 @@ }, "radio-conf": { "inputs": { - "nixpkgs": "nixpkgs_4", + "nixpkgs": "nixpkgs_6", "utils": "utils_4" }, "locked": { @@ -232,7 +254,7 @@ "decode-server": "decode-server", "dvb-api": "dvb-api", "naersk": "naersk_3", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_5", "radio-conf": "radio-conf", "stops": "stops_2", "windshield": "windshield" @@ -347,7 +369,7 @@ }, "windshield": { "inputs": { - "nixpkgs": "nixpkgs_5", + "nixpkgs": "nixpkgs_7", "utils": "utils_5" }, "locked": { diff --git a/flake.nix b/flake.nix index 9a657c1..4e23ab8 100644 --- a/flake.nix +++ b/flake.nix @@ -44,8 +44,8 @@ specialArgs = { inherit inputs; }; modules = [ ./hosts/traffic-stop-box/configuration.nix - (./hosts/traffic-stop-box/hardware-configuration.nix) - ./hosts/traffic-stop-box/configuration-dell-wyse-3040.nix + ./hosts/traffic-stop-box/hardware-configuration.nix + ./hardware/configuration-dell-wyse-3040.nix ./modules/gnuradio.nix ./modules/radio_wireguard_client.nix ./modules/numbering.nix @@ -82,9 +82,11 @@ specialArgs = { inherit inputs; }; modules = [ "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-base.nix" - ./hosts/traffic-stop-box/configuration.nix - ./hosts/traffic-stop-box/configuration-dell-wyse-3040.nix + ./hosts/mobile-box/configuration.nix + ./hosts/mobile-box/hardware-configuration.nix + ./hardware/configuration-dell-wyse-3040.nix ./modules/numbering.nix + ./modules/mobile-box.nix { nixpkgs.overlays = [ radio-conf.overlay."x86_64-linux" @@ -92,6 +94,7 @@ data-accumulator.overlay."x86_64-linux" ]; dvb-dump.stopsJson = "${stops}/stops.json"; + dvb-dump.systemNumber = 130; } ]; }; diff --git a/hosts/traffic-stop-box/configuration-dell-wyse-3040.nix b/hardware/configuration-dell-wyse-3040.nix similarity index 100% rename from hosts/traffic-stop-box/configuration-dell-wyse-3040.nix rename to hardware/configuration-dell-wyse-3040.nix diff --git a/hosts/traffic-stop-box/configuration-rpi-4b.nix b/hardware/configuration-rpi-4b.nix similarity index 100% rename from hosts/traffic-stop-box/configuration-rpi-4b.nix rename to hardware/configuration-rpi-4b.nix diff --git a/hosts/mobile-box/configuration.nix b/hosts/mobile-box/configuration.nix new file mode 100644 index 0000000..aa91db6 --- /dev/null +++ b/hosts/mobile-box/configuration.nix @@ -0,0 +1,54 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, inputs, ... }: + +{ + imports = + [ + # Enabled modules + ../../modules/base.nix + ]; + + boot.tmpOnTmpfs = true; + + hardware.hackrf.enable = true; + + networking.hostName = "mobile-box"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + documentation.enable = false; + + nix.gc = { + automatic = true; + dates = "daily"; + }; + + services.journald.extraConfig = '' + SystemMaxUse=5M + ''; + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # 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. It‘s 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.11"; # Did you read the comment? + +} diff --git a/hosts/mobile-box/hardware-configuration.nix b/hosts/mobile-box/hardware-configuration.nix new file mode 100644 index 0000000..d6300c0 --- /dev/null +++ b/hosts/mobile-box/hardware-configuration.nix @@ -0,0 +1,36 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" "sdhci_acpi" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { + device = "/dev/disk/by-label/nixos"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { + device = "/dev/disk/by-label/boot"; + fsType = "vfat"; + }; + + swapDevices = [ + { + device = "/dev/mmcblk0p1"; + } + ]; + + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/modules/file_sharing.nix b/modules/file_sharing.nix index aae6650..76a9fae 100644 --- a/modules/file_sharing.nix +++ b/modules/file_sharing.nix @@ -6,7 +6,7 @@ virtualHosts = { "files.dvb.solutions" = { enableACME = true; - enableSSL = true; + onlySSL = true; root = "/var/lib/data-accumulator/"; extraConfig = '' autoindex on; diff --git a/modules/mobile-box.nix b/modules/mobile-box.nix index 5e9cd7a..52a1467 100644 --- a/modules/mobile-box.nix +++ b/modules/mobile-box.nix @@ -1,4 +1,4 @@ -{pkgs, config, lib}: +{pkgs, config, lib, ...}: let file = ../configs/mobile_box.json; in @@ -34,6 +34,7 @@ in StartLimitIntervalSec = "150s"; }; }; + "data-accumulator" = { enable = true; wantedBy = [ "multi-user.target" ]; @@ -52,6 +53,7 @@ in Restart = "always"; }; }; + "start-wifi-hotspot" = { wantedBy = [ "multi-user.target" ]; serviceConfig = {