Merge branch 'master' into 2305

This commit is contained in:
Andreas Zweili 2023-06-08 13:40:03 +02:00
commit f405f6a6d5
29 changed files with 410 additions and 285 deletions

View File

@ -1,3 +0,0 @@
{ inputs }: {
inputs = inputs;
}

View File

@ -28,9 +28,8 @@
, home-manager
}:
let
custom = import ./custom { inherit inputs; };
mkComputer = import "${custom.inputs.self}/lib/mk_computer.nix";
mkRaspi = import "${custom.inputs.self}/lib/mk_raspi.nix";
mkComputer = import "${inputs.self}/lib/mk_computer.nix";
mkRaspi = import "${inputs.self}/lib/mk_raspi.nix";
mksdImage = host: (self.nixosConfigurations.${host}.extendModules {
modules = [ "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix" ];
}).config.system.build.sdImage;
@ -53,79 +52,79 @@
gwyn = mkComputer {
hostname = "gwyn";
home-module = "desktop";
inherit custom inputs;
inherit inputs;
};
desktop-vm = mkComputer {
hostname = "desktop-vm";
home-module = "desktop";
inherit custom inputs;
inherit inputs;
};
staubfinger = mkComputer {
hostname = "staubfinger";
home-module = "desktop";
inherit custom inputs;
inherit inputs;
};
# Servers
git = mkRaspi {
hostname = "git";
inherit custom inputs;
inherit inputs;
};
loki-test = mkRaspi {
hostname = "loki-test";
inherit custom inputs;
inherit inputs;
};
mail = mkRaspi {
hostname = "mail";
inherit custom inputs;
inherit inputs;
};
nextcloud = mkRaspi {
hostname = "nextcloud";
inherit custom inputs;
inherit inputs;
};
plex = mkRaspi {
hostname = "plex";
inherit custom inputs;
inherit inputs;
};
proxy = mkRaspi {
hostname = "proxy";
inherit custom inputs;
inherit inputs;
};
management = mkRaspi {
hostname = "management";
home-module = "management";
inherit custom inputs;
inherit inputs;
};
mobile = mkRaspi {
hostname = "mobile";
home-module = "management";
inherit custom inputs;
inherit inputs;
};
restic-server = mkRaspi {
hostname = "restic-server";
inherit custom inputs;
inherit inputs;
};
test-raspi = mkRaspi {
hostname = "test-raspi";
inherit custom inputs;
inherit inputs;
};
ttrss = mkRaspi {
hostname = "ttrss";
inherit custom inputs;
inherit inputs;
};
};
homeConfigurations = {
"zweili@co-ws-con4" = home-manager.lib.homeManagerConfiguration {
pkgs = import custom.inputs.nixpkgs {
pkgs = import inputs.nixpkgs {
system = "x86_64-linux";
config = {
allowUnfree = true;
};
};
modules = [
"${custom.inputs.self}/home-manager/work-wsl.nix"
"${inputs.self}/home-manager/work-wsl.nix"
];
extraSpecialArgs = {
inherit custom inputs;
inherit inputs;
};
};
};

View File

@ -1,17 +0,0 @@
{ custom, system }: { config, nixosConfig, ... }:
{
imports = [
"${custom.inputs.self}/home-manager/common"
"${custom.inputs.self}/home-manager/software/fzf"
"${custom.inputs.self}/home-manager/software/git"
"${custom.inputs.self}/home-manager/software/vim"
"${custom.inputs.self}/home-manager/software/starship"
];
home.username = nixosConfig.az-username;
programs.git.userEmail = "andreas@zweili.ch";
programs.bash = {
enable = true;
};
}

View File

@ -0,0 +1,5 @@
{ ... }: {
imports = [
./common
];
}

View File

@ -0,0 +1,94 @@
{ config, inputs, nixosConfig, pkgs, ... }:
{
imports = [
"${inputs.self}/home-manager/modules"
"${inputs.self}/home-manager/software/alacritty"
"${inputs.self}/home-manager/software/ansible"
"${inputs.self}/home-manager/software/calibre"
"${inputs.self}/home-manager/software/czkawka"
"${inputs.self}/home-manager/software/emacs"
"${inputs.self}/home-manager/software/espanso"
"${inputs.self}/home-manager/software/dunst"
"${inputs.self}/home-manager/software/evince"
"${inputs.self}/home-manager/software/fzf"
"${inputs.self}/home-manager/software/git"
"${inputs.self}/home-manager/software/grobi"
"${inputs.self}/home-manager/software/keeweb"
"${inputs.self}/home-manager/software/mime-apps"
"${inputs.self}/home-manager/software/mpv"
"${inputs.self}/home-manager/software/nitrogen"
"${inputs.self}/home-manager/software/obsidian"
"${inputs.self}/home-manager/software/rapid-photo-downloader"
"${inputs.self}/home-manager/software/signal"
"${inputs.self}/home-manager/software/ssh"
"${inputs.self}/home-manager/software/starship"
"${inputs.self}/home-manager/software/telegram"
"${inputs.self}/home-manager/software/vim"
"${inputs.self}/home-manager/software/work-desktop"
"${inputs.self}/home-manager/software/yt-dlp"
];
home = {
username = nixosConfig.az-username;
packages = with pkgs; [
digikam
docker-compose
exercism
freetube
chromium
libreoffice-fresh
meld
nodejs # needed for ansible-language-server
nodePackages.prettier # formatting files
pulseaudio # required for volume controls in qtile
plexamp
remmina
shotwell
sound-juicer
unstable.tagger
];
};
programs.git.userEmail = "andreas@zweili.ch";
# raw config files
home.file.".config/qtile/config.py".source = "${inputs.self}/home-manager/configs/qtile/config.py";
home.file.".config/qtile/autostart.sh".source = "${inputs.self}/home-manager/configs/qtile/autostart.sh";
home.file.".config/qtile/autostart.d/xdg-portal-add-path.sh".source = "${inputs.self}/home-manager/configs/flatpak/xdg-portal-add-path.sh";
programs.bash = {
enable = true;
bashrcExtra = ''
open-port() {
local port=$1
sudo iptables -A INPUT -p tcp --dport $port -j ACCEPT
}
close-port() {
local port=$1
sudo iptables -D INPUT -p tcp --dport $port -j ACCEPT
}
'';
shellAliases = {
management-server = "mosh ${config.home.username}@10.7.89.150 -- tmux new -A -s 0";
work-management = "mosh --ssh='ssh -i ~/.ssh/zweili.key' zweili@10.49.0.100 -- tmux new -A -s 0";
};
};
services.nextcloud-client = {
enable = true;
startInBackground = true;
};
gtk.theme.name = "Arc-Darker";
xdg.userDirs = {
enable = true;
pictures = "${config.home.homeDirectory}/nextcloud/20_pictures";
createDirectories = true;
};
xsession = {
numlock.enable = true;
};
services.network-manager-applet.enable = true;
}

View File

@ -0,0 +1,17 @@
{ inputs, nixosConfig, ... }:
{
imports = [
"${inputs.self}/home-manager/modules"
"${inputs.self}/home-manager/software/fzf"
"${inputs.self}/home-manager/software/git"
"${inputs.self}/home-manager/software/vim"
"${inputs.self}/home-manager/software/starship"
];
home.username = nixosConfig.az-username;
programs.git.userEmail = "andreas@zweili.ch";
programs.bash = {
enable = true;
};
}

View File

@ -0,0 +1,28 @@
{ inputs, nixosConfig, pkgs, ... }:
{
imports = [
"${inputs.self}/home-manager/modules"
"${inputs.self}/home-manager/software/emacs"
"${inputs.self}/home-manager/software/fzf"
"${inputs.self}/home-manager/software/git"
"${inputs.self}/home-manager/software/ssh"
"${inputs.self}/home-manager/software/starship"
"${inputs.self}/home-manager/software/vim"
];
home.username = nixosConfig.az-username;
home.packages = with pkgs; [
docker-compose
exercism
nodePackages.prettier # formatting files
rclone
xclip
];
programs.git.userEmail = "andreas@zweili.ch";
programs.bash = {
enable = true;
};
}

View File

@ -1,8 +1,8 @@
{ custom, inputs }: { config, nixosConfig, ... }:
{ inputs, nixosConfig, ... }:
{
imports = [
"${custom.inputs.self}/home-manager/common"
"${custom.inputs.self}/home-manager/software/git"
"${inputs.self}/home-manager/modules"
"${inputs.self}/home-manager/software/git"
];
home.username = nixosConfig.az-username;

View File

@ -1,14 +1,14 @@
{ custom, pkgs, ... }:
{ inputs, pkgs, ... }:
{
imports = [
"${custom.inputs.self}/home-manager/common"
"${custom.inputs.self}/home-manager/software/ansible"
"${custom.inputs.self}/home-manager/software/emacs"
"${custom.inputs.self}/home-manager/software/fzf"
"${custom.inputs.self}/home-manager/software/git"
"${custom.inputs.self}/home-manager/software/starship"
"${custom.inputs.self}/home-manager/software/vagrant-wsl"
"${custom.inputs.self}/home-manager/software/vim"
"${inputs.self}/home-manager/modules"
"${inputs.self}/home-manager/software/ansible"
"${inputs.self}/home-manager/software/emacs"
"${inputs.self}/home-manager/software/fzf"
"${inputs.self}/home-manager/software/git"
"${inputs.self}/home-manager/software/starship"
"${inputs.self}/home-manager/software/vagrant-wsl"
"${inputs.self}/home-manager/software/vim"
];
programs.git.userEmail = "zweili@contria.com";

View File

@ -1,4 +1,4 @@
{ custom, hostname, inputs, system ? "x86_64-linux", home-module ? "headless", username ? "andreas" }:
{ hostname, inputs, system ? "x86_64-linux", home-module ? "headless", username ? "andreas" }:
let
overlay-unstable = final: prev: {
unstable = import inputs.nixpkgs-unstable {
@ -52,8 +52,9 @@ inputs.nixpkgs.lib.nixosSystem
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit inputs system; };
home-manager.users.andreas.imports = [
(import "${inputs.self}/home-manager/${home-module}.nix" { inherit custom system; })
"${inputs.self}/home-manager/profiles/${home-module}.nix"
];
}
]);

View File

@ -1,4 +1,4 @@
{ custom, hostname, inputs, system ? "aarch64-linux", home-module ? "headless", username ? "andreas" }:
{ hostname, inputs, system ? "aarch64-linux", home-module ? "headless", username ? "andreas" }:
let
overlay-unstable = final: prev: {
unstable = import inputs.nixpkgs-unstable {
@ -47,8 +47,9 @@ inputs.nixpkgs.lib.nixosSystem {
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit inputs system; };
home-manager.users.${username}.imports = [
(import "${inputs.self}/home-manager/${home-module}.nix" { inherit custom system; })
"${inputs.self}/home-manager/profiles/${home-module}.nix"
];
}
]);

View File

@ -4,14 +4,19 @@ Do not import this module into the main `default.nix` file. Otherwise the other
systems aren't buildable anymore because some options from the `nixos-hardware`
input get applied immediately.
Just import it in any system you need with the following code:
Just import it in any system you need with the following code where variant is
either `ethernet` or `usb`. `ethernet` is for a Pi which is intended as a
server and is connected with a fixed IP to the network. `usb` is for a
Raspberry Pi which can be connected via USB-C to another device, e.g. an iPad.
The ethernet port is configured to get its IP via DHCP and via uSB-C the Pi is
reachable via the IP provided in the configuration.
```nix
imports = [
"${inputs.self}/modules/hardware/raspi4"
"${inputs.self}/modules/hardware/raspi4-VARIANT"
];
hardware = {
az-raspi4 = {
az-raspi4-VARIANT = {
enable = true;
hostname = "some-hostname";
ip = "10.7.89.150";

View File

@ -0,0 +1,38 @@
{ inputs, lib, pkgs, ... }:
{
imports = [
inputs.nixos-hardware.nixosModules.raspberry-pi-4
];
boot = {
supportedFilesystems = lib.mkForce [ "f2fs" "ntfs" "cifs" "ext4" "vfat" "nfs" "nfs4" ];
};
fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
options = [ "noatime" ];
};
};
hardware.raspberry-pi."4".fkms-3d.enable = true;
hardware.raspberry-pi."4".audio.enable = true;
hardware.pulseaudio.enable = true;
environment.systemPackages = with pkgs; [
libraspberrypi
raspberrypi-eeprom
];
environment.shellAliases = {
raspi-cpu = ''
sudo vcgencmd get_throttled && sudo vcgencmd measure_temp
'';
raspi-firmware-update = ''
sudo mkdir -p /mnt && \
sudo mount /dev/disk/by-label/FIRMWARE /mnt && \
BOOTFS=/mnt FIRMWARE_RELEASE_STATUS=stable sudo -E rpi-eeprom-update -d -a && \
sudo umount /mnt
'';
};
}

View File

@ -1,78 +0,0 @@
{ config, inputs, lib, pkgs, ... }:
let
cfg = config.hardware.az-raspi4;
in
{
imports = [
inputs.nixos-hardware.nixosModules.raspberry-pi-4
];
options = {
hardware.az-raspi4 = {
enable = lib.mkEnableOption "Enable options required for Raspberry Pi 4.";
hostname = lib.mkOption {
type = lib.types.str;
description = "The hostname of the system.";
};
ip = lib.mkOption {
type = lib.types.str;
description = "The IP of the system.";
};
};
};
config = lib.mkIf cfg.enable {
boot = {
supportedFilesystems = lib.mkForce [ "f2fs" "ntfs" "cifs" "ext4" "vfat" "nfs" "nfs4" ];
};
fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
options = [ "noatime" ];
};
};
hardware.raspberry-pi."4".fkms-3d.enable = true;
hardware.raspberry-pi."4".audio.enable = true;
hardware.pulseaudio.enable = true;
environment.systemPackages = with pkgs; [
libraspberrypi
raspberrypi-eeprom
];
networking = {
useDHCP = false;
hostName = cfg.hostname;
hosts = {
"127.0.0.1" = [ "${cfg.hostname}.2li.local" ];
ip = [ "${cfg.hostname}.2li.local" ];
};
defaultGateway = "10.7.89.1";
nameservers = [ "10.7.89.1" ];
interfaces.eth0.ipv4.addresses = [
{
address = cfg.ip;
prefixLength = 24;
}
];
};
environment.shellAliases = {
raspi-cpu = ''
sudo vcgencmd get_throttled && sudo vcgencmd measure_temp
'';
raspi-firmware-update = ''
sudo mkdir -p /mnt && \
sudo mount /dev/disk/by-label/FIRMWARE /mnt && \
BOOTFS=/mnt FIRMWARE_RELEASE_STATUS=stable sudo -E rpi-eeprom-update -d -a && \
sudo umount /mnt
'';
};
services = {
az-log2ram.enable = true;
az-syslog.enable = true;
};
};
}

View File

@ -0,0 +1,48 @@
{ config, lib, ... }:
let
cfg = config.hardware.az-raspi4-ethernet;
in
{
imports = [
./base.nix
];
options = {
hardware.az-raspi4-ethernet = {
enable = lib.mkEnableOption "Enable options required for Raspberry Pi 4.";
hostname = lib.mkOption {
type = lib.types.str;
description = "The hostname of the system.";
};
ip = lib.mkOption {
type = lib.types.str;
description = "The IP of the system.";
};
};
};
config = lib.mkIf cfg.enable {
networking = {
useDHCP = false;
hostName = cfg.hostname;
hosts = {
"127.0.0.1" = [ "${cfg.hostname}.2li.local" ];
ip = [ "${cfg.hostname}.2li.local" ];
};
defaultGateway = "10.7.89.1";
nameservers = [ "10.7.89.1" ];
interfaces.eth0.ipv4.addresses = [
{
address = cfg.ip;
prefixLength = 24;
}
];
};
services = {
az-log2ram.enable = true;
az-syslog.enable = true;
};
};
}

View File

@ -0,0 +1,109 @@
{ config, lib, ... }:
let
cfg = config.hardware.az-raspi4-usb;
in
{
imports = [
./base.nix
];
options = {
hardware.az-raspi4-usb = {
enable = lib.mkEnableOption "Enable options required for Raspberry Pi 4.";
hostname = lib.mkOption {
type = lib.types.str;
description = "The hostname of the system.";
};
ip = lib.mkOption {
type = lib.types.str;
description = "The IP of the system.";
};
};
};
config = lib.mkIf cfg.enable {
hardware.raspberry-pi."4".dwc2.enable = true;
networking = {
hostName = cfg.hostname;
hosts = {
"127.0.0.1" = [ "${cfg.hostname}.2li.local" ];
ip = [ "${cfg.hostname}.2li.local" ];
};
interfaces.usb0.ipv4.addresses = [
{
address = cfg.ip;
prefixLength = 24;
}
];
wireless = {
enable = true;
userControlled.enable = true;
interfaces = [ "wlan0" ];
networks = {
"Gröibschi" = {
psk = "schottland";
};
};
};
};
boot.loader.raspberryPi.firmwareConfig = "dtoverlay=dwc2";
networking.dhcpcd.denyInterfaces = [ "usb0" ];
services.dhcpd4 = {
enable = true;
interfaces = [ "usb0" ];
extraConfig = ''
option domain-name "2li.mobile";
option subnet-mask 255.255.255.0;
option broadcast-address 10.213.0.255;
option domain-name-servers 84.200.69.80, 84.200.70.40;
subnet 10.213.0.0 netmask 255.255.255.0 {
option routers ${cfg.ip};
range 10.213.0.100 10.213.0.200;
}
'';
};
systemd.services."usb-otg" = {
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
wantedBy = [ "default.target" ];
script = ''
mkdir -p /sys/kernel/config/usb_gadget/pi4
cd /sys/kernel/config/usb_gadget/pi4
echo 0x1d6b > idVendor # Linux Foundation
echo 0x0104 > idProduct # Multifunction Composite Gadget
echo 0x0100 > bcdDevice # v1.0.0
echo 0x0200 > bcdUSB # USB2
echo 0xEF > bDeviceClass
echo 0x02 > bDeviceSubClass
echo 0x01 > bDeviceProtocol
mkdir -p /sys/kernel/config/usb_gadget/pi4/strings/0x409
echo "fedcba9876543211" > strings/0x409/serialnumber
echo "Nebucatnetzer" > strings/0x409/manufacturer
echo "PI4 USB Device" > strings/0x409/product
mkdir -p /sys/kernel/config/usb_gadget/pi4/configs/c.1/strings/0x409
echo "Config 1: ECM network" > configs/c.1/strings/0x409/configuration
echo 250 > configs/c.1/MaxPower
# Add functions here
# see gadget configurations below
# End functions
mkdir -p /sys/kernel/config/usb_gadget/pi4/functions/ecm.usb0
HOST="00:dc:c8:f7:75:14" # "HostPC"
SELF="00:dd:dc:eb:6d:a1" # "BadUSB"
echo $HOST > functions/ecm.usb0/host_addr
echo $SELF > functions/ecm.usb0/dev_addr
ln -s functions/ecm.usb0 configs/c.1/
udevadm settle -t 5 || :
ls /sys/class/udc > UDC
'';
};
systemd.services.dhcpd4.after = [ "usb-otg.service" ];
systemd.services."network-addresses-usb0".after = [ "usb-otg.service" ];
};
}

View File

@ -66,7 +66,7 @@
# Disable the root user
users.users.root.hashedPassword = "!";
# Define a user account. Don't forget to set a password with passwd.
# Define a user account. Don't forget to set a password with `passwd`.
users.users.${config.az-username} = {
isNormalUser = true;
initialPassword = "password";

View File

@ -4,10 +4,10 @@ let
in
{
imports = [
"${inputs.self}/modules/hardware/raspi4"
"${inputs.self}/modules/hardware/raspi4/raspi-ethernet.nix"
];
hardware = {
az-raspi4 = {
az-raspi4-ethernet = {
enable = true;
hostname = hostname;
ip = "10.7.89.109";

View File

@ -1,10 +1,10 @@
{ hostname }: { inputs, pkgs, ... }:
{
imports = [
"${inputs.self}/modules/hardware/raspi4"
"${inputs.self}/modules/hardware/raspi4/raspi-ethernet.nix"
];
hardware = {
az-raspi4 = {
az-raspi4-ethernet = {
enable = true;
hostname = hostname;
ip = "10.7.89.10";

View File

@ -1,10 +1,10 @@
{ hostname }: { inputs, pkgs, ... }:
{
imports = [
"${inputs.self}/modules/hardware/raspi4"
"${inputs.self}/modules/hardware/raspi4/raspi-ethernet.nix"
];
hardware = {
az-raspi4 = {
az-raspi4-ethernet = {
enable = true;
hostname = hostname;
ip = "10.7.89.123";

View File

@ -1,7 +1,7 @@
{ hostname }: { inputs, ... }:
{
imports = [
"${inputs.self}/modules/hardware/raspi4"
"${inputs.self}/modules/hardware/raspi4/raspi-ethernet.nix"
];
fileSystems = {
"/mnt/external" = {
@ -12,7 +12,7 @@
};
hardware = {
az-raspi4 = {
az-raspi4-ethernet = {
enable = true;
hostname = hostname;
ip = "10.7.89.150";

View File

@ -1,138 +1,16 @@
{ hostname }: { inputs, lib, pkgs, ... }:
let
ip = "10.213.0.1";
in
{
imports = [
inputs.nixos-hardware.nixosModules.raspberry-pi-4
"${inputs.self}/modules/hardware/raspi4/raspi-usb.nix"
];
boot = {
supportedFilesystems = lib.mkForce [ "f2fs" "ntfs" "cifs" "ext4" "vfat" "nfs" "nfs4" ];
kernelModules = [ "libcomposite" ];
};
fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
options = [ "noatime" ];
};
};
hardware.raspberry-pi."4".fkms-3d.enable = true;
hardware.raspberry-pi."4".audio.enable = true;
hardware.raspberry-pi."4".dwc2.enable = true;
hardware.pulseaudio.enable = true;
environment.systemPackages = with pkgs; [
libraspberrypi
raspberrypi-eeprom
];
networking = {
hostName = hostname;
hosts = {
"127.0.0.1" = [ "${hostname}.2li.local" ];
ip = [ "${hostname}.2li.local" ];
};
interfaces.usb0.ipv4.addresses = [
{
address = ip;
prefixLength = 24;
}
];
wireless = {
hardware = {
az-raspi4-usb = {
enable = true;
userControlled.enable = true;
interfaces = [ "wlan0" ];
networks = {
"Gröibschi" = {
psk = "schottland";
};
};
hostname = hostname;
ip = "10.213.0.1";
};
};
boot.loader.raspberryPi.firmwareConfig = "dtoverlay=dwc2";
networking.dhcpcd.denyInterfaces = [ "usb0" ];
services.dnsmasq = {
enable = true;
resolveLocalQueries = false;
settings = {
domain-needed = true;
bogus-priv = true;
interface = "usb0";
dhcp-range = [ "10.213.0.100,10.213.0.200,8h" ];
dhcp-option = [ "3,10.213.0.1" "121,10.213.0.0/24,10.213.0.1" ];
local = "/2li.mobile/";
domain = "2li.mobile";
expand-hosts = true;
server = [
"84.200.69.80"
"84.200.70.40"
];
};
};
networking.firewall.allowedUDPPorts = [
53 # DNS
67 # DHCP
];
environment.shellAliases = {
raspi-cpu = ''
sudo vcgencmd get_throttled && sudo vcgencmd measure_temp
'';
raspi-firmware-update = ''
sudo mkdir -p /mnt && \
sudo mount /dev/disk/by-label/FIRMWARE /mnt && \
BOOTFS=/mnt FIRMWARE_RELEASE_STATUS=stable sudo -E rpi-eeprom-update -d -a && \
sudo umount /mnt
'';
};
systemd.services."usb-otg" = {
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
wantedBy = [ "default.target" ];
script = ''
mkdir -p /sys/kernel/config/usb_gadget/pi4
cd /sys/kernel/config/usb_gadget/pi4
echo 0x1d6b > idVendor # Linux Foundation
echo 0x0104 > idProduct # Multifunction Composite Gadget
echo 0x0100 > bcdDevice # v1.0.0
echo 0x0200 > bcdUSB # USB2
echo 0xEF > bDeviceClass
echo 0x02 > bDeviceSubClass
echo 0x01 > bDeviceProtocol
mkdir -p /sys/kernel/config/usb_gadget/pi4/strings/0x409
echo "fedcba9876543211" > strings/0x409/serialnumber
echo "Nebucatnetzer" > strings/0x409/manufacturer
echo "PI4 USB Device" > strings/0x409/product
mkdir -p /sys/kernel/config/usb_gadget/pi4/configs/c.1/strings/0x409
echo "Config 1: ECM network" > configs/c.1/strings/0x409/configuration
echo 250 > configs/c.1/MaxPower
# Add functions here
# see gadget configurations below
# End functions
mkdir -p /sys/kernel/config/usb_gadget/pi4/functions/ecm.usb0
HOST="00:dc:c8:f7:75:14" # "HostPC"
SELF="00:dd:dc:eb:6d:a1" # "BadUSB"
echo $HOST > functions/ecm.usb0/host_addr
echo $SELF > functions/ecm.usb0/dev_addr
ln -s functions/ecm.usb0 configs/c.1/
udevadm settle -t 5 || :
ls /sys/class/udc > UDC
'';
};
systemd.services.dhcpd4.after = [ "usb-otg.service" ];
systemd.services."network-addresses-usb0".after = [ "usb-otg.service" ];
services = {
az-docker.enable = true;
az-log2ram.enable = true;
};
programs = {
az-nix-direnv.enable = true;
az-tmux.enable = true;

View File

@ -1,10 +1,10 @@
{ hostname }: { inputs, pkgs, ... }:
{
imports = [
"${inputs.self}/modules/hardware/raspi4"
"${inputs.self}/modules/hardware/raspi4/raspi-ethernet.nix"
];
hardware = {
az-raspi4 = {
az-raspi4-ethernet = {
enable = true;
hostname = hostname;
ip = "10.7.89.103";

View File

@ -1,10 +1,10 @@
{ hostname }: { inputs, pkgs, ... }:
{
imports = [
"${inputs.self}/modules/hardware/raspi4"
"${inputs.self}/modules/hardware/raspi4/raspi-ethernet.nix"
];
hardware = {
az-raspi4 = {
az-raspi4-ethernet = {
enable = true;
hostname = hostname;
ip = "10.7.89.112";

View File

@ -1,10 +1,10 @@
{ hostname }: { inputs, pkgs, ... }:
{
imports = [
"${inputs.self}/modules/hardware/raspi4"
"${inputs.self}/modules/hardware/raspi4/raspi-ethernet.nix"
];
hardware = {
az-raspi4 = {
az-raspi4-ethernet = {
enable = true;
hostname = hostname;
ip = "10.7.89.99";

View File

@ -1,10 +1,10 @@
{ hostname }: { inputs, pkgs, ... }:
{
imports = [
"${inputs.self}/modules/hardware/raspi4"
"${inputs.self}/modules/hardware/raspi4/raspi-ethernet.nix"
];
hardware = {
az-raspi4 = {
az-raspi4-ethernet = {
enable = true;
hostname = hostname;
ip = "10.7.89.30";

View File

@ -1,10 +1,10 @@
{ hostname }: { inputs, pkgs, ... }:
{
imports = [
"${inputs.self}/modules/hardware/raspi4"
"${inputs.self}/modules/hardware/raspi4/raspi-ethernet.nix"
];
hardware = {
az-raspi4 = {
az-raspi4-ethernet = {
enable = true;
hostname = hostname;
ip = "10.7.89.40";

View File

@ -1,10 +1,10 @@
{ hostname }: { inputs, pkgs, ... }:
{
imports = [
"${inputs.self}/modules/hardware/raspi4"
"${inputs.self}/modules/hardware/raspi4/raspi-ethernet.nix"
];
hardware = {
az-raspi4 = {
az-raspi4-ethernet = {
enable = true;
hostname = hostname;
ip = "10.7.89.115";