Skip to content

Instantly share code, notes, and snippets.

@CRTified
Last active May 4, 2021 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CRTified/1c35fd357e6bf08da029860698862f67 to your computer and use it in GitHub Desktop.
Save CRTified/1c35fd357e6bf08da029860698862f67 to your computer and use it in GitHub Desktop.
rpi3b+ wifi problem
{ config, pkgs, ... }:
{
imports = [ # Include the results of the hardware scan.
./hardware-configuration.nix
];
boot.kernelPackages = pkgs.linuxPackages_latest; # Doesn't change anything
boot.kernelParams = [ "cma=256M" ];
boot.loader.raspberryPi.enable = true;
boot.loader.raspberryPi.version = 3;
boot.loader.raspberryPi.uboot.enable = true;
boot.loader.raspberryPi.firmwareConfig = ''
gpu_mem=256
'';
boot.loader.grub.enable = false;
boot.loader.generic-extlinux-compatible.enable = false;
boot.extraModprobeConfig = ''
options cf680211 ieee80211_regdom="DE"
'';
hardware.enableRedistributableFirmware = true;
hardware.firmware = [ pkgs.wireless-regdb ];
networking.hostName = "octonix";
networking.wireless.enable = true;
systemd.services."wpa_supplicant".serviceConfig.Restart = "always";
environment.systemPackages = with pkgs; [ libraspberrypi libgpiod ];
networking.useDHCP = false;
networking.interfaces.eth0.useDHCP = true;
networking.interfaces.wlan0.useDHCP = true;
networking.firewall = {
enable = true;
allowedTCPPorts = [ config.services.octoprint.port 5050 ];
};
users.groups."gpio" = { };
users.users.octoprint.extraGroups = [ "gpio" ];
services.udev.extraRules = ''
SUBSYSTEM=="gpio", KERNEL=="gpiochip*", GROUP="gpio", MODE="0660"
'';
systemd.services.octoprint = {
path = [ pkgs.libraspberrypi ];
serviceConfig.AmbientCapabilities = [ "CAP_NET_BIND_SERVICE" ];
};
services = {
octoprint = {
enable = true;
port = 80;
extraConfig = {
plugins = {
pi_support = {
vcgencmd_throttle_check_command = "${pkgs.libraspberrypi}/bin/vcgencmd get_throttled";
};
dashboard = {
showWebCam = true;
};
psucontrol = {
autoOn = true;
disconnectOnPowerOff = true;
enablePseudoOnOff = true;
offSysCommand = "${pkgs.libgpiod}/bin/gpioset -l 0 4=0";
onSysCommand = "${pkgs.libgpiod}/bin/gpioset -l 0 4=1";
postOnDelay = "2";
switchingMethod = "SYSTEM";
};
};
webcam = {
snapshot = "http://127.0.0.1:8080/?action=snapshot";
stream = "http://127.0.0.1:8080/?action=stream";
};
};
plugins = p:
with p; [
abl-expert
# bedlevelvisualizer
displayprogress
displaylayerprogress
marlingcodedocumentation
titlestatus
octoklipper
octoprint-dashboard
psucontrol
printtimegenius
(buildPlugin rec {
pname = "GCodeSystemCommands";
version = "1.0.1";
src = pkgs.fetchFromGitHub {
owner = "kantlivelong";
repo = "OctoPrint-GCodeSystemCommands";
rev = "${version}";
sha256 = "07nvc5l0q9n7cbdrw40ljkwv9b85d2kpbh3ziza1f28mh6y7iszg";
};
meta = with pkgs.lib; {
description =
"This OctoPrint plugin adds the ability to define GCode commands that execute local system commands.";
homepage =
"https://github.com/kantlivelong/OctoPrint-GCodeSystemCommands";
license = licenses.agpl3Only;
};
})
];
};
mjpg-streamer = { enable = true; };
klipper = {
enable = true;
octoprintIntegration = true;
settings = { };
};
};
system.stateVersion = "21.05"; # Did you read the comment?
}
{
network = {
description = "My personal machines";
enableRollback = true;
};
rockpi-ha = import ./rockpi-ha/configuration.nix;
octonix = import ./octonix/configuration.nix;
cottonbox = import ./cottonbox/configuration.nix;
defaults = { pkgs, ... }: {
boot = { tmpOnTmpfs = true; };
environment.systemPackages = with pkgs; [ rxvt_unicode.terminfo ];
networking.wireless.networks."Meridia".psk =
"wifi password";
users.users.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP24nedJ3U/LYiupJ274rTLPwafqssmRZbJlixe6YOls cottonbox"
];
console = { useXkbConfig = true; };
time.timeZone = "Europe/Berlin";
i18n = {
defaultLocale = "de_DE.UTF-8";
extraLocaleSettings = { "LC_TIME" = "de_DE.UTF-8"; };
};
services.openssh = {
enable = true;
openFirewall = true;
permitRootLogin = "prohibit-password";
};
nixpkgs = {
config = { pulseaudio = true; };
overlays = [
(self: super: {
scream-receivers =
super.scream-receivers.override { pulseSupport = true; };
})
# Patch to prevent evdev from grabbing input on start
(self: super: {
qemu = super.qemu.overrideAttrs (old: {
patches = [ ./misc/0001-Disable-input-grab-on-startup.patch ];
});
})
];
};
};
}
{
octonix = { config, pkgs, ... }: {
deployment = {
targetHost = "192.168.10.4";
hasFastConnection = true;
};
nixpkgs.localSystem.system = "aarch64-linux";
};
}
@CRTified
Copy link
Author

CRTified commented May 4, 2021

nix-info -m on the machine used for running nixops deploy:

  • system: "x86_64-linux"
  • host os: Linux 5.10.30, NixOS, 21.05pre284305.1df834e6c6e (Okapi)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3.10
  • channels(root): "home-manager, nixos-21.05pre286925.3e62e383f4b, nixos-unstable, nur"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment