diff options
Diffstat (limited to 'machines/rpi3-amadeus')
-rw-r--r-- | machines/rpi3-amadeus/README.md | 15 | ||||
-rw-r--r-- | machines/rpi3-amadeus/configuration.nix | 64 | ||||
-rw-r--r-- | machines/rpi3-amadeus/configuration.nix.old | 49 | ||||
-rw-r--r-- | machines/rpi3-amadeus/default.nix | 6 | ||||
-rw-r--r-- | machines/rpi3-amadeus/hyperion-ng.nix | 80 | ||||
-rw-r--r-- | machines/rpi3-amadeus/hyperion.nix | 36 | ||||
-rw-r--r-- | machines/rpi3-amadeus/minimal.nix | 32 | ||||
-rw-r--r-- | machines/rpi3-amadeus/mpdecimal.nix | 27 | ||||
-rw-r--r-- | machines/rpi3-amadeus/spi.dts | 49 | ||||
-rw-r--r-- | machines/rpi3-amadeus/spi.nix | 11 |
10 files changed, 0 insertions, 369 deletions
diff --git a/machines/rpi3-amadeus/README.md b/machines/rpi3-amadeus/README.md deleted file mode 100644 index 4ee0586..0000000 --- a/machines/rpi3-amadeus/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Installing nixos on rpi - -1. Download img from hydra (aarch64) -2. Flash on sd card and boot it -3. passwd for root! -4. run nixos-rebuild with minimal.nix as config -5. run nixos-rebuild with configuration.nix as config - -## TODO - -- spi - -## Resources - -- https://github.com/hexamon-tech/nixos-lorawan-gateway/blob/master/modules/kernel.nix#L11 diff --git a/machines/rpi3-amadeus/configuration.nix b/machines/rpi3-amadeus/configuration.nix deleted file mode 100644 index ba9ff57..0000000 --- a/machines/rpi3-amadeus/configuration.nix +++ /dev/null @@ -1,64 +0,0 @@ -{ config, pkgs, lib, ... }: -{ - imports = [ - ./hyperion.nix - ]; - # NixOS wants to enable GRUB by default - boot.loader.grub.enable = false; - boot.loader.raspberryPi = { - enable = true; - version = 3; - uboot.enable = true; - firmwareConfig = '' - gpu_mem=256 - ''; - }; - # Enables the generation of /boot/extlinux/extlinux.conf - boot.loader.generic-extlinux-compatible.enable = true; - - # !!! If your board is a Raspberry Pi 3, select not latest (5.8 at the time) - # !!! as it is currently broken (see https://github.com/NixOS/nixpkgs/issues/97064) - boot.kernelPackages = pkgs.linuxPackages; - - # !!! Needed for the virtual console to work on the RPi 3, as the default of 16M doesn't seem to be enough. - # If X.org behaves weirdly (I only saw the cursor) then try increasing this to 256M. - # On a Raspberry Pi 4 with 4 GB, you should either disable this parameter or increase to at least 64M if you want the USB ports to work. - boot.kernelParams = ["cma=32M"]; - - hardware.enableRedistributableFirmware = true; - hardware.firmware = with pkgs; [ raspberrypifw ]; - - # File systems configuration for using the installer's partition layout - fileSystems = { - "/" = { - device = "/dev/disk/by-label/NIXOS_SD"; - fsType = "ext4"; - }; - }; - - services.openssh.enable = true; - services.openssh.permitRootLogin = "yes"; - - nix.gc.automatic = true; - nix.gc.options = "--delete-older-than 30d"; - - # !!! Adding a swap file is optional, but strongly recommended! - swapDevices = [ { device = "/swapfile"; size = 1024; } ]; - - environment.systemPackages = with pkgs; [ - vim git curl wget - libraspberrypi - ]; - - users.users.pi = { - isNormalUser = true; - home = "/home/pi"; - extraGroups = [ "wheel" "networkmanager" ]; - }; - services.xserver = { - enable = true; - displayManager.startx.enable = true; - libinput.enable = true; - }; - -} diff --git a/machines/rpi3-amadeus/configuration.nix.old b/machines/rpi3-amadeus/configuration.nix.old deleted file mode 100644 index 13a19db..0000000 --- a/machines/rpi3-amadeus/configuration.nix.old +++ /dev/null @@ -1,49 +0,0 @@ -{ config, pkgs, lib, ... }: -{ - # NixOS wants to enable GRUB by default - boot.loader.grub.enable = false; - - # if you have a Raspberry Pi 2 or 3, pick this: - boot.kernelPackages = pkgs.linuxPackages_latest; - - # A bunch of boot parameters needed for optimal runtime on RPi 3b+ - 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 - ''; - environment.systemPackages = with pkgs; [ - raspberrypi-tools - ]; - - # File systems configuration for using the installer's partition layout - fileSystems = { - "/" = { - device = "/dev/disk/by-label/NIXOS_SD"; - fsType = "ext4"; - }; - }; - - # Preserve space by sacrificing documentation and history - documentation.nixos.enable = false; - nix.gc.automatic = true; - nix.gc.options = "--delete-older-than 30d"; - boot.cleanTmpDir = true; - - # Configure basic SSH access - services.openssh.enable = true; - services.openssh.permitRootLogin = "yes"; - - # Use 1GB of additional swap memory in order to not run out of memory - # when installing lots of things while running other things at the same time. - swapDevices = [ { device = "/swapfile"; size = 1024; } ]; - - - users.users.pi = { - isNormalUser = true; - home = "/home/pi"; - extraGroups = [ "wheel" "networkmanager" ]; - }; -} diff --git a/machines/rpi3-amadeus/default.nix b/machines/rpi3-amadeus/default.nix deleted file mode 100644 index 8f77b8f..0000000 --- a/machines/rpi3-amadeus/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - imports = [ - # ./hardware-configuration.nix - ./configuration.nix - ]; -} diff --git a/machines/rpi3-amadeus/hyperion-ng.nix b/machines/rpi3-amadeus/hyperion-ng.nix deleted file mode 100644 index ed47d53..0000000 --- a/machines/rpi3-amadeus/hyperion-ng.nix +++ /dev/null @@ -1,80 +0,0 @@ -{ stdenv, fetchurl, fetchzip, autoPatchelfHook, callPackage, -expat, glib, systemd, libX11, libXrandr, fontconfig, tlf, ncurses5, bzip2, -readline70, openssl, db, libglvnd, libusb }: -with stdenv.lib; -let - version = "2.0.0-alpha.9"; - - srcAarch64 = fetchurl { - url = "https://github.com/hyperion-project/hyperion.ng/releases/download/${version}/Hyperion-${version}-Linux-aarch64.tar.gz"; - sha256 = "09wvlhp5c1mkvjsgbsiy402cx8na7qykwgv4waivc7m5ns4sl2mf"; - }; - - srcX86 = fetchurl { - url = "https://github.com/hyperion-project/hyperion.ng/releases/download/${version}/Hyperion-${version}-Linux-x86_64.tar.gz"; - sha256 = "1gkjzqkh6qbwzkrdrg9xmznh6b676kmdlw54drqwfycakb7riad2"; - }; - - mpdecimal = callPackage ./mpdecimal.nix {}; - - bzip2_linked = stdenv.mkDerivation { - name = "bzip2-linked"; - unpackPhase = "true"; - installPhase = '' - mkdir -p $out/lib - cp -r ${bzip2.out}/lib/libbz2.so.1.0.6 $out/lib - ln -s $out/lib/libbz2.so.1.0.6 $out/lib/libbz2.so.1.0 - ''; - }; - - python3 = (import (fetchzip { - url = "https://github.com/nixos/nixpkgs/archive/7731621c81b5cd601a176c2109b44c5295049f20.zip"; - # Please update this hash with the one nix says on the first build attempt - sha256 = "0gdf2kkh3qcn9r300sl4khcg0fnixarjcil9pv9hami3dqjbpngv"; - }) { }).python3; -in -stdenv.mkDerivation { - inherit version; - pname = "hyperion-ng"; - - src = srcAarch64; - - nativeBuildInputs = [ autoPatchelfHook ]; - - buildInputs = [ - python3 - systemd - stdenv.cc.cc.lib - fontconfig.lib - tlf - ncurses5 - mpdecimal - glib - readline70 - openssl - db - libglvnd - libusb - expat - libX11 - libXrandr - - bzip2_linked - ]; - - sourceRoot = "share/hyperion"; - - buildPhase = ""; - installPhase = '' - mkdir -p $out/bin $out/lib - cp -r bin $out - cp -r lib $out - - #ln -s ${bzip2}/lib/libbz2.so.1.0.6 $out/lib/libbz2.so.1.0 - ''; - - meta = { - description = "Hyperion is an open source ambient light software. Feel free to join us and contribute new features!"; - homepage = "https://hyperion-project.org/"; - }; -} diff --git a/machines/rpi3-amadeus/hyperion.nix b/machines/rpi3-amadeus/hyperion.nix deleted file mode 100644 index 094be80..0000000 --- a/machines/rpi3-amadeus/hyperion.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ pkgs, ... }: -let - hyperion = pkgs.callPackage ./hyperion-ng.nix { }; - hyperionConfig = pkgs.fetchurl { - url = "https://gist.githubusercontent.com/pniedzwiedzinski/e1810bc4dd08b97512d28c42daa95326/raw/460febec24390dc90d3b70987f07ef1ab8a77b3a/hyperion.config.json"; - sha256 = "1yaiw8ljy6kaq6vnf5ccq2c4wpjlakd00nmq51v1q2sdnc06jmqq"; - }; -in -{ - imports = [ - ./spi.nix - ]; - - environment.systemPackages = [ - hyperion - ]; - - - # networking.firewall.allowedTCPPorts = [ ]; - networking.firewall.enable = false; #TODO - - systemd.services.hyperion = { - enable = true; - wantedBy = ["multi-user.target"]; - serviceConfig = { - ExecStart = "${hyperion}/bin/hyperiond"; - ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; - Restart = "on-failure"; - User = "root"; - Group = "root"; - Type = "simple"; - UMask = "007"; - TimeoutStopSec = "10"; - }; - }; -} diff --git a/machines/rpi3-amadeus/minimal.nix b/machines/rpi3-amadeus/minimal.nix deleted file mode 100644 index 3f2acc7..0000000 --- a/machines/rpi3-amadeus/minimal.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ config, pkgs, lib, ... }: -{ - # NixOS wants to enable GRUB by default - boot.loader.grub.enable = false; - # Enables the generation of /boot/extlinux/extlinux.conf - boot.loader.generic-extlinux-compatible.enable = true; - - # !!! If your board is a Raspberry Pi 3, select not latest (5.8 at the time) - # !!! as it is currently broken (see https://github.com/NixOS/nixpkgs/issues/97064) - boot.kernelPackages = pkgs.linuxPackages; - - # !!! Needed for the virtual console to work on the RPi 3, as the default of 16M doesn't seem to be enough. - # If X.org behaves weirdly (I only saw the cursor) then try increasing this to 256M. - # On a Raspberry Pi 4 with 4 GB, you should either disable this parameter or increase to at least 64M if you want the USB ports to work. - boot.kernelParams = ["cma=32M"]; - - # File systems configuration for using the installer's partition layout - fileSystems = { - "/" = { - device = "/dev/disk/by-label/NIXOS_SD"; - fsType = "ext4"; - }; - }; - - - services.openssh.enable = true; - services.openssh.permitRootLogin = "yes"; - - - # !!! Adding a swap file is optional, but strongly recommended! - swapDevices = [ { device = "/swapfile"; size = 1024; } ]; -} diff --git a/machines/rpi3-amadeus/mpdecimal.nix b/machines/rpi3-amadeus/mpdecimal.nix deleted file mode 100644 index fee59ee..0000000 --- a/machines/rpi3-amadeus/mpdecimal.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ stdenv, fetchurl, gcc, binutils }: - -let - pname = "mpdecimal"; - version = "2.5.0"; -in -stdenv.mkDerivation { - inherit pname version; - - src = fetchurl { - url = "https://www.bytereef.org/software/${pname}/releases/${pname}-${version}.tar.gz"; - sha256 = "1jm0vzlcsapx9ilrvns4iyws6n5i48zpxykmklfpv98jivf7wh8m"; - }; - - buildPhase = '' - ./configure - - sed -i 's/-Wl,//' libmpdec/Makefile - make - ''; - - installPhase = '' - mkdir -p $out/lib - cp libmpdec/*.so* $out/lib - ''; - -} diff --git a/machines/rpi3-amadeus/spi.dts b/machines/rpi3-amadeus/spi.dts deleted file mode 100644 index db76c4b..0000000 --- a/machines/rpi3-amadeus/spi.dts +++ /dev/null @@ -1,49 +0,0 @@ -/dts-v1/; -/plugin/; - -/ { - compatible = "raspberrypi"; - fragment@0 { - target = <&spi>; - __overlay__ { - cs-gpios = <&gpio 8 1>, <&gpio 7 1>; - status = "okay"; - pinctrl-names = "default"; - pinctrl-0 = <&spi0_pins &spi0_cs_pins>; - #address-cells = <1>; - #size-cells = <0>; - spidev@0 { - reg = <0>; // CE0 - spi-max-frequency = <500000>; - compatible = "spidev"; - }; - - spidev@1 { - reg = <1>; // CE1 - spi-max-frequency = <500000>; - compatible = "spidev"; - }; - }; - }; - fragment@1 { - target = <&alt0>; - __overlay__ { - // Drop GPIO 7, SPI 8-11 - brcm,pins = <4 5>; - }; - }; - - fragment@2 { - target = <&gpio>; - __overlay__ { - spi0_pins: spi0_pins { - brcm,pins = <9 10 11>; - brcm,function = <4>; // alt0 - }; - spi0_cs_pins: spi0_cs_pins { - brcm,pins = <8 7>; - brcm,function = <1>; // out - }; - }; - }; -}; diff --git a/machines/rpi3-amadeus/spi.nix b/machines/rpi3-amadeus/spi.nix deleted file mode 100644 index 8a8f332..0000000 --- a/machines/rpi3-amadeus/spi.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs, ... }: -{ - hardware.deviceTree = { - enable = true; - filter = "*rpi*.dtb"; - overlays = [{ - name = "spi"; - dtsFile = ./spi.dts; - }]; - }; -} |