trivios: refactor file structure

This commit is contained in:
Alejandro Soto 2023-09-13 12:56:25 -06:00
parent ee45d97a8b
commit 01815efbe6
No known key found for this signature in database
GPG key ID: 570448E3382BDEC5
6 changed files with 96 additions and 73 deletions

29
triviOS/boot.nix Normal file
View file

@ -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;
};
}

10
triviOS/cli.nix Normal file
View file

@ -0,0 +1,10 @@
{ pkgs, ... }: {
config = {
environment.systemPackages = with pkgs; [
libraspberrypi
libgpiod
];
users.users."root".initialPassword = "password";
};
}

View file

@ -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;
}

16
triviOS/minimal.nix Normal file
View file

@ -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;
};
};
}

20
triviOS/net.nix Normal file
View file

@ -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";
};
};
}

15
triviOS/vendor.nix Normal file
View file

@ -0,0 +1,15 @@
{
config = {
system = {
nixos = {
distroId = "trivios";
distroName = "TriviOS";
variant_id = "rpi3";
};
stateVersion = "23.05";
};
sdImage.imageBaseName = "trivios-sd-image";
};
}