From 201fdae48f7d255f4aed6558a1fd0c0f2ddcec3d Mon Sep 17 00:00:00 2001 From: Astro Date: Thu, 23 Sep 2021 00:04:02 +0200 Subject: [PATCH] pulsebert: reinstall for rpi3 --- host-registry.nix | 1 - hosts/pipebert/default.nix | 213 --------------------- hosts/pipebert/generate.sh | 9 - hosts/pipebert/hardware-configuration.nix | 37 ---- hosts/pipebert/pipewire-pulse.conf.in.json | 16 -- hosts/pipebert/pipewire-pulse.conf.json | 46 ----- hosts/pulsebert/default.nix | 11 +- hosts/pulsebert/hardware-configuration.nix | 2 +- 8 files changed, 6 insertions(+), 329 deletions(-) delete mode 100644 hosts/pipebert/default.nix delete mode 100755 hosts/pipebert/generate.sh delete mode 100644 hosts/pipebert/hardware-configuration.nix delete mode 100644 hosts/pipebert/pipewire-pulse.conf.in.json delete mode 100644 hosts/pipebert/pipewire-pulse.conf.json diff --git a/host-registry.nix b/host-registry.nix index 98f2d6bc..2d417f5d 100644 --- a/host-registry.nix +++ b/host-registry.nix @@ -23,7 +23,6 @@ rec { builders = [ "ssh://client@172.22.99.110" ]; wol = true; }; - pipebert.ip4 = "172.22.99.207"; samba = { }; storage-ng.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMeg5ojU7U8+Lx824y+brazVJ007mEJDM7C7aUruOWGP"; diff --git a/hosts/pipebert/default.nix b/hosts/pipebert/default.nix deleted file mode 100644 index c91c268c..00000000 --- a/hosts/pipebert/default.nix +++ /dev/null @@ -1,213 +0,0 @@ -# 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, lib, pkgs, ... }: - -let - octoprintPort = 8080; -in { - imports = [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ]; - - boot = { - loader = { - grub.enable = false; - generic-extlinux-compatible.enable = false; - raspberryPi = { - enable = true; - version = 3; - uboot.enable = false; - }; - }; - #kernelPackages = pkgs.linuxPackages_rpi4; - kernelPackages = pkgs.linuxPackages_latest; - - tmpOnTmpfs = true; - }; - - c3d2 = { - isInHq = true; - mapHqHosts = true; - hq.interface = "eth0"; - }; - - nix = { - buildCores = 4; - maxJobs = 2; - }; - - networking = { - hostName = "pipebert"; # 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; - firewall.enable = false; - }; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - git - htop - libraspberrypi - mpd - mpv - ncmpcpp - ncpamixer - pulseaudio # required for pactl - 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" ]; - }; - - # Enable sound. - sound.enable = true; - hardware.bluetooth = { - enable = true; - settings = { - Policy.AutoEnable = true; - General = { - Enable = "Source,Sink,Media,Socket"; - #DiscoverableTimeout = 0; - #Discoverable = true; - }; - }; - }; - - services.pipewire = { - enable = true; - alsa.enable = true; - config.pipewire-pulse = lib.importJSON ./pipewire-pulse.conf.json; - pulse.enable = true; - }; - security.rtkit.enable = true; - - # tell Avahi to publish CUPS and PulseAudio - services.avahi = { - enable = true; - publish = { - enable = true; - addresses = true; - userServices = true; - }; - }; - - security.acme = { - acceptTerms = true; - email = "mail@c3d2.de"; - }; - - services.dhcpd4 = { - enable = true; - interfaces = [ config.c3d2.hq.interface ]; - authoritative = false; - # the leases are defined in the secrets module imported - # at the top-level of this flake - }; - - services.nginx = { - enable = true; - #recommendedGzipSettings = true; - recommendedProxySettings = true; - virtualHosts = { - "drkkr.hq.c3d2.de" = { - default = true; - enableACME = true; - forceSSL = true; - locations."/" = { - proxyPass = "http://127.0.0.1:${toString octoprintPort}"; - proxyWebsockets = true; - extraConfig = '' - proxy_set_header X-Scheme $scheme; - proxy_set_header Accept-Encoding identity; - client_max_body_size 2000M; - ''; - }; - locations."/cam/stream" = { - proxyPass = "http://localhost:3020/?action=stream"; - extraConfig = "proxy_pass_request_headers off;"; - }; - locations."/cam/capture" = { - proxyPass = "http://localhost:3020/?action=snapshot"; - extraConfig = "proxy_pass_request_headers off;"; - }; - }; - }; - }; - services.octoprint = rec { - enable = true; - port = octoprintPort; - extraConfig.webcam = { - snapshot = "http://localhost:3020?action=snapshot"; - stream = "https://drkkr.hq.c3d2.de/cam/stream"; - }; - # plugins = let - # python = pkgs.octoprint.python; - - # octoprint-filament-sensor-universal = python.pkgs.buildPythonPackage rec { - # pname = "OctoPrint-Filament-Sensor-Universal"; - # version = "1.0.0"; - - # src = pkgs.fetchFromGitHub { - # owner = "lopsided98"; - # repo = pname; - # rev = "8a72696867a9a008c5a79b49a9b029a4fc426720"; - # sha256 = "1a7lzmjbwx47qhrkjp3hggiwnx172x4axcz0labm9by17zxlsimr"; - # }; - - # propagatedBuildInputs = [ pkgs.octoprint python.pkgs.libgpiod ]; - # }; - # #in p: [ octoprint-filament-sensor-universal ]; - # in p: []; - }; - - # Allow access to printer serial port and GPIO - users.users.${config.services.octoprint.user}.extraGroups = [ "dialout" "gpio" ]; - - services.mjpg-streamer = { - enable = true; - inputPlugin = "input_uvc.so -d /dev/v4l/by-id/usb-046d_0817_4B7115A0-video-index0 -r 640x480 -f 30 -pl 50hz -ex auto"; - outputPlugin = "output_http.so -p 3020"; - }; - - # Allow gpio group to access GPIO devices - users.groups.gpio = { }; - services.udev.extraRules = '' - KERNEL=="gpiochip*", GROUP="gpio", MODE="0660" - ''; - - # 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.05"; # Did you read the comment? -} diff --git a/hosts/pipebert/generate.sh b/hosts/pipebert/generate.sh deleted file mode 100755 index 4407ee35..00000000 --- a/hosts/pipebert/generate.sh +++ /dev/null @@ -1,9 +0,0 @@ -#! /usr/bin/env nix-shell -#! nix-shell -i bash -p jq - -# shellcheck shell=bash - -dir=$(dirname "$(readlink -f "$0")") -default_pipewire_pulse=$(nix-instantiate --eval -E '(import { }).pkgs.path')/nixos/modules/services/desktops/pipewire/pipewire-pulse.conf.json - -jq -s '.[0] * .[1] * .[2]' "$dir/pipewire-pulse.conf.in.json" "$default_pipewire_pulse" > "$dir/pipewire-pulse.conf.json" <(jq -cnS '{ "context.modules": [ inputs."context.modules" ] | add}' "$default_pipewire_pulse" "$dir/pipewire-pulse.conf.in.json") diff --git a/hosts/pipebert/hardware-configuration.nix b/hosts/pipebert/hardware-configuration.nix deleted file mode 100644 index f6c0d84f..00000000 --- a/hosts/pipebert/hardware-configuration.nix +++ /dev/null @@ -1,37 +0,0 @@ -# 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 = [ "usbhid" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; - boot.kernelParams = [ "snd_bcm2835.enable_headphones=1" ]; - - fileSystems."/" = { - device = "/dev/disk/by-label/NIXOS_SD"; - fsType = "ext4"; - }; - - fileSystems."/boot" = { - device = "/dev/disk/by-label/FIRMWARE"; - fsType = "vfat"; - }; - - swapDevices = [ ]; - - hardware.enableRedistributableFirmware = true; - #networking.wireless.enable = true; - boot.loader.raspberryPi.firmwareConfig = '' - gpu_mem=192 - dtparam=audio=on - ''; - - powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; -} diff --git a/hosts/pipebert/pipewire-pulse.conf.in.json b/hosts/pipebert/pipewire-pulse.conf.in.json deleted file mode 100644 index 9ff61a85..00000000 --- a/hosts/pipebert/pipewire-pulse.conf.in.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "context.modules": [ - { - "name": "libpipewire-module-zeroconf-publish" - }, - { - "name": "libpipewire-module-protocol-pulse", - "args": { - "server.address": [ - "unix:native", - "tcp:4713" - ] - } - } - ] -} diff --git a/hosts/pipebert/pipewire-pulse.conf.json b/hosts/pipebert/pipewire-pulse.conf.json deleted file mode 100644 index 3e04a2c5..00000000 --- a/hosts/pipebert/pipewire-pulse.conf.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "context.modules": [ - { - "args": {}, - "flags": [ - "ifexists", - "nofail" - ], - "name": "libpipewire-module-rtkit" - }, - { - "name": "libpipewire-module-protocol-native" - }, - { - "name": "libpipewire-module-client-node" - }, - { - "name": "libpipewire-module-adapter" - }, - { - "name": "libpipewire-module-metadata" - }, - { - "args": { - "server.address": [ - "unix:native", - "tcp:4713" - ], - "vm.overrides": { - "pulse.min.quantum": "1024/48000" - } - }, - "name": "libpipewire-module-protocol-pulse" - }, - { - "name": "libpipewire-module-zeroconf-publish" - } - ], - "context.properties": {}, - "context.spa-libs": { - "audio.convert.*": "audioconvert/libspa-audioconvert", - "support.*": "support/libspa-support" - }, - "context.exec": [], - "stream.properties": {} -} diff --git a/hosts/pulsebert/default.nix b/hosts/pulsebert/default.nix index 27149374..292b4e87 100644 --- a/hosts/pulsebert/default.nix +++ b/hosts/pulsebert/default.nix @@ -19,12 +19,11 @@ in generic-extlinux-compatible.enable = false; raspberryPi = { enable = true; - version = 4; - uboot.enable = false; + version = 3; + uboot.enable = true; }; }; - #kernelPackages = pkgs.linuxPackages_rpi4; - kernelPackages = pkgs.linuxPackages_latest; + kernelPackages = pkgs.linuxPackages_5_13; tmpOnTmpfs = true; }; @@ -37,7 +36,7 @@ in nix = { buildCores = 4; - maxJobs = 4; + maxJobs = 2; }; networking = { @@ -227,5 +226,5 @@ in # 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 = "20.09"; # Did you read the comment? + system.stateVersion = "21.05"; # Did you read the comment? } diff --git a/hosts/pulsebert/hardware-configuration.nix b/hosts/pulsebert/hardware-configuration.nix index f6c0d84f..57d653a5 100644 --- a/hosts/pulsebert/hardware-configuration.nix +++ b/hosts/pulsebert/hardware-configuration.nix @@ -19,7 +19,7 @@ fsType = "ext4"; }; - fileSystems."/boot" = { + fileSystems."/boot/firmware" = { device = "/dev/disk/by-label/FIRMWARE"; fsType = "vfat"; };