diff --git a/triviOS/boot.nix b/triviOS/boot.nix new file mode 100644 index 0000000..a32f2c6 --- /dev/null +++ b/triviOS/boot.nix @@ -0,0 +1,29 @@ +{ config, modulesPath, pkgs, ... }: { + imports = [ + (modulesPath + "/installer/sd-card/sd-image-aarch64.nix") + ]; + + disabledModules = [ + (modulesPath + "/profiles/base.nix") + (modulesPath + "/profiles/all-hardware.nix") + ]; + + config = { + boot = { + initrd.includeDefaultModules = false; + + kernelPackages = pkgs.linuxPackagesFor (pkgs.linux_rpi3.overrideDerivation (super: { + buildFlags = super.buildFlags ++ [ + "KBUILD_BUILD_VERSION=1-${config.system.nixos.distroName}" + ]; + })); + + kernelParams = [ + "console=ttyS1,115200n8" + "cma=256M" + ]; + }; + + hardware.enableRedistributableFirmware = true; + }; +} diff --git a/triviOS/cli.nix b/triviOS/cli.nix new file mode 100644 index 0000000..4c5903e --- /dev/null +++ b/triviOS/cli.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: { + config = { + environment.systemPackages = with pkgs; [ + libraspberrypi + libgpiod + ]; + + users.users."root".initialPassword = "password"; + }; +} diff --git a/triviOS/default.nix b/triviOS/default.nix index b9130b7..faae8c0 100644 --- a/triviOS/default.nix +++ b/triviOS/default.nix @@ -5,80 +5,13 @@ # # Copyright (C) 2023 - Group 8 -{ pkgs, modulesPath, ... }: { - +{ imports = [ - (modulesPath + "/installer/sd-card/sd-image-aarch64.nix") - (modulesPath + "/profiles/minimal.nix") + ./boot.nix + ./cli.nix + ./minimal.nix + ./net.nix + ./vendor.nix ./web.nix ]; - - disabledModules = [ - (modulesPath + "/profiles/base.nix") - (modulesPath + "/profiles/all-hardware.nix") - ]; - - system.stateVersion = "23.05"; - - system.nixos = { - distroId = "trivios"; - distroName = "TriviOS"; - variant_id = "rpi3"; - }; - sdImage.imageBaseName = "trivios-sd-image"; - - nix.enable = false; - - hardware.enableRedistributableFirmware = true; - environment.systemPackages = with pkgs; [ - libraspberrypi - libgpiod - ]; - - networking = { - hostName = "tripi"; - firewall.allowedTCPPorts = [ 80 ]; - - wireless = { - enable = true; - environmentFile = "/var/lib/wlan.conf"; - networks."@WLAN_SSID@".psk = "@WLAN_PSK@"; - }; - }; - - - services.openssh = { - enable = true; - settings.PasswordAuthentication = true; - settings.PermitRootLogin = "yes"; - }; - - users.users."root".initialPassword = "password"; - - - boot = { - # Doesn't work per https://github.com/NixOS/nixpkgs/issues/146199 - # loader.raspberryPi = { - # enable = true; - # version = 3; - # firmwareConfig = '' - # core_freq=250 - # gpu_mem=256 - # ''; - # }; - - initrd.includeDefaultModules = false; - kernelPackages = pkgs.linuxPackagesFor (pkgs.linux_rpi3.overrideDerivation (super: { - buildFlags = super.buildFlags ++ [ "KBUILD_BUILD_VERSION=1-TriviOS" ]; - })); - - kernelParams = [ - "console=ttyS1,115200n8" - "cma=256M" - ]; - }; - - services.timesyncd.enable = false; - systemd.oomd.enable = false; - systemd.coredump.enable = false; } diff --git a/triviOS/minimal.nix b/triviOS/minimal.nix new file mode 100644 index 0000000..8dc25c4 --- /dev/null +++ b/triviOS/minimal.nix @@ -0,0 +1,16 @@ +{ modulesPath, ... }: { + imports = [ + (modulesPath + "/profiles/minimal.nix") + ]; + + config = { + nix.enable = false; + + services.timesyncd.enable = false; + + systemd = { + oomd.enable = false; + coredump.enable = false; + }; + }; +} diff --git a/triviOS/net.nix b/triviOS/net.nix new file mode 100644 index 0000000..8838aa6 --- /dev/null +++ b/triviOS/net.nix @@ -0,0 +1,20 @@ +{ + config = { + networking = { + hostName = "tripi"; + firewall.allowedTCPPorts = [ 80 ]; + + wireless = { + enable = true; + environmentFile = "/var/lib/wlan.conf"; + networks."@WLAN_SSID@".psk = "@WLAN_PSK@"; + }; + }; + + services.openssh = { + enable = true; + settings.PasswordAuthentication = true; + settings.PermitRootLogin = "yes"; + }; + }; +} diff --git a/triviOS/vendor.nix b/triviOS/vendor.nix new file mode 100644 index 0000000..925ee22 --- /dev/null +++ b/triviOS/vendor.nix @@ -0,0 +1,15 @@ +{ + config = { + system = { + nixos = { + distroId = "trivios"; + distroName = "TriviOS"; + variant_id = "rpi3"; + }; + + stateVersion = "23.05"; + }; + + sdImage.imageBaseName = "trivios-sd-image"; + }; +}