Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions base/self-update/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ in
};

environment.etc."rauc/system.conf" = {
# TODO: disk labels/paths and statusfile path should be supplied/defined
# by skeleton/installer
text = ''
[system]
compatible=dividat-play-computer
Expand Down
26 changes: 10 additions & 16 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,14 @@ let
# USB live system
live = callPackage ./live { application = application; };

# Installation script
install-playos = callPackage ./installer/install-playos {
grubCfg = ./bootloader/grub.cfg;
};

# Rescue system
rescueSystem = callPackage ./bootloader/rescue {
application = application;
};

# Installer ISO image
# Installer script and ISO (PlayOS skeleton)
installer = callPackage ./installer {};

# Script to deploy updates
deploy-update = callPackage ./deployment/deploy-update {
application = application;
live = if buildLive then live else "";
installer = if buildInstaller then installer else "";
installer = if buildInstaller then installer.isoImage else "";
};

# RAUC bundle
Expand All @@ -108,7 +98,11 @@ let
testingToplevel = callPackage ./testing/system { application = application; };

# Disk image containing pre-installed system
disk = if diskBuildEnabled then callPackage ./testing/disk {} else null;
disk =
if diskBuildEnabled then
callPackage ./testing/disk { inherit (installer) install-playos rescueSystem; }
else
null;

# Script for spinning up VMs
run-in-vm = callPackage ./testing/run-in-vm {};
Expand Down Expand Up @@ -139,7 +133,7 @@ let
};

releaseDisk = pkgs.callPackage ./testing/disk/release.nix {
inherit (releaseValidationComponents) install-playos;
install-playos = releaseValidationComponents.installer.install-playos;
};
in

Expand All @@ -149,7 +143,7 @@ with pkgs; stdenv.mkDerivation {
buildInputs = [
rauc
(python3.withPackages(ps: with ps; [pyparted]))
components.install-playos
components.installer.install-playos
];

buildCommand = ''
Expand All @@ -176,7 +170,7 @@ with pkgs; stdenv.mkDerivation {
''
# Installer ISO image
+ lib.optionalString buildInstaller ''
ln -s ${components.installer}/iso/${components.safeProductName}-installer-${components.version}.iso $out/${components.safeProductName}-installer-${components.version}.iso
ln -s ${components.installer.isoImage}/iso/${components.safeProductName}-installer-${components.version}.iso $out/${components.safeProductName}-installer-${components.version}.iso
''
# RAUC bundle
+ lib.optionalString buildBundle ''
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{ stdenv, lib
, application
, systemMetadata
, squashfsTools, closureInfo, makeInitrd, linkFarm
, importFromNixos
, nixos
, writeScript, dialog
, vim, grub2_efi, rauc
, squashfsCompressionOpts}:
with lib;
let
nixos = importFromNixos "";

squashfsCompressionParams =
if (squashfsCompressionOpts == null)
Expand All @@ -23,7 +22,7 @@ let
do

${dialog}/bin/dialog --clear --title "" \
--backtitle "${application.fullProductName} - Rescue System" \
--backtitle "${systemMetadata.fullProductName} - Rescue System" \
--nocancel \
--menu "Please Select an action" 0 0 0 \
"wipe-user-data" "Delete all user data." \
Expand Down Expand Up @@ -94,7 +93,7 @@ in
'';
};
networking = {
hostName = "${application.safeProductName}-rescue";
hostName = "${systemMetadata.safeProductName}-rescue";
# enable wpa_supplicant
wireless = {
enable = true;
Expand Down
22 changes: 20 additions & 2 deletions installer/configuration.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
{ config, pkgs, lib, install-playos, version, safeProductName, fullProductName, greeting, squashfsCompressionOpts, ... }:
{ install-playos, squashfsCompressionOpts, systemMetadata, ... }:


{ modulesPath, lib, ... }:
with lib;
with systemMetadata;
let
# TODO: WIP ^_^
greeting = label: ''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I support a new greeting art, and inlining it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current greeting is broken also, because the label text overflows the next line gets indented.

░░░░
░▒▒▒▒▒▒▒ ░ ▒
▒▒▒▒▒ ░░▒▒░░░▒▒▒▒▒ ▒▒
▒▒ ░░░░░░░ ▒▒▒▒▒
▒▒▒ ▲ ▲ ▒▒
▒░░ ░
░░░ ░
░░░▒▒ ▒▒░░░ ▒▒▒ ░░ ${label}
▒▒▒▒▒▒▒▒ ░░░▒▒▒░░░
'';

in

{
imports = [
(pkgs.importFromNixos "modules/installer/cd-dvd/iso-image.nix")
"${modulesPath}/installer/cd-dvd/iso-image.nix"
];

# Custom label when identifying OS
Expand Down
52 changes: 41 additions & 11 deletions installer/default.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,48 @@
# Build NixOS system
{ config, lib, pkgs
, version, safeProductName, fullProductName, greeting, install-playos
, squashfsCompressionOpts
# TODO: rename this to "skeleton" that exposes several components:
# - [ ] skeleton configuration params (partition labels, hard-coded paths like /boot/status.ini)
# - [x] the installer script (for e2e and release validation tests)
# - [x] the rescueSystem (for e2e and release validation tests)
# - [x] the installer ISO
{ squashfsCompressionOpts
, systemImage
# TODO: combine this into a single systemMetadata attrset that is defined in the top-level default.nix
, safeProductName, fullProductName, kioskUrl, updateUrl, version
}:
let
nixos = pkgs.importFromNixos "";
pkgs = import ./pkgs;

systemMetadata = {
inherit safeProductName fullProductName kioskUrl updateUrl version;
};

# Rescue system
rescueSystem = pkgs.callPackage ./bootloader/rescue {
inherit (pkgs) nixos;
inherit squashfsCompressionOpts;
inherit systemMetadata;
};


# Installation script
install-playos = pkgs.callPackage ./install-playos {
grubCfg = ./bootloader/grub.cfg;
inherit rescueSystem;
inherit systemImage systemMetadata;
};

configuration = (import ./configuration.nix) {
inherit config pkgs lib install-playos version safeProductName fullProductName greeting squashfsCompressionOpts;
inherit install-playos squashfsCompressionOpts;
inherit systemMetadata;
};

in
(nixos {
inherit configuration;
system = "x86_64-linux";
}).config.system.build.isoImage

isoImage = (pkgs.nixos {
configuration = {
imports = [ configuration ];
};
system = "x86_64-linux";
}).config.system.build.isoImage;
in
{
inherit install-playos isoImage rescueSystem;
}
21 changes: 6 additions & 15 deletions installer/install-playos/default.nix
Original file line number Diff line number Diff line change
@@ -1,32 +1,23 @@
{ stdenv
, substituteAll
, makeWrapper
, grub2_efi
, e2fsprogs
, dosfstools
, utillinux
, python3
, pv
, closureInfo
{ pkgs

, systemImage
, rescueSystem
, grubCfg
, version
, updateUrl
, kioskUrl
, systemMetadata
}:
with pkgs;
let
systemClosureInfo = closureInfo { rootPaths = [ systemImage ]; };

python = python3.withPackages(ps: with ps; [pyparted]);
in
stdenv.mkDerivation {
name = "install-playos-${version}";
name = "install-playos-${systemMetadata.version}";

src = substituteAll {
src = ./install-playos.py;
inherit grubCfg systemImage rescueSystem systemClosureInfo version updateUrl kioskUrl;
inherit grubCfg systemImage rescueSystem systemClosureInfo;
inherit (systemMetadata) version kioskUrl updateUrl;
inherit python;
};

Expand Down
17 changes: 17 additions & 0 deletions installer/pkgs/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
let
nixpkgs = builtins.fetchTarball {
# nixos-24.05 2024-10-07
Copy link
Member

@knuton knuton Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we don't plan to bump this on the regular, maybe there's some kind of context to capture about the specific version picked

(Comment probably premature)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is just temporarily set to one of the earlier releases (dc92081). It's an important question to decide on what this should be set to as it would become the "golden standard" for a long time.

url = "https://github.com/nixos/nixpkgs/archive/ecbc1ca8ffd6aea8372ad16be9ebbb39889e55b6.tar.gz";
sha256 = "0yfaybsa30zx4bm900hgn3hz92javlf4d47ahdaxj9fai00ddc1x";
};

overlay =
self: super: {
rauc = (import ./rauc) super;

nixos = import "${nixpkgs}/nixos";
};
in
import nixpkgs {
overlays = [ overlay ];
}
File renamed without changes.
3 changes: 2 additions & 1 deletion pkgs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ let

importFromNixos = path: import (nixpkgs + "/nixos/" + path);

rauc = (import ./rauc) super;
# use RAUC from installer/skeleton
rauc = (import ../installer/pkgs).rauc;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be an overkill, because it pulls in all the dependencies from installer's nixpkgs.

If we want to avoid this, we could do:

Suggested change
rauc = (import ../installer/pkgs).rauc;
rauc = (import ../installer/pkgs/rauc) super;

The resulting RAUC bundle size difference is quite minimal, around 50MB:

  • with RAUC deps from runtime nixpkgs: 1323M
  • with RAUC deps from installer nixpkgs: 1371M


ocamlPackages = super.ocamlPackages.overrideScope (self: super: {
semver = self.callPackage ./ocaml-modules/semver {};
Expand Down
2 changes: 2 additions & 0 deletions system-image/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ let nixos = pkgs.importFromNixos ""; in
] ++ extraModules;

# Storage
# TODO: should be defined by installer/skeleton config module
fileSystems = {
"/boot" = {
device = "/dev/disk/by-label/ESP";
Expand All @@ -28,6 +29,7 @@ let nixos = pkgs.importFromNixos ""; in
device = "/dev/root";
options = [ "ro" ];
};
# TODO: should be defined by installer/skeleton config module
persistentDataPartition.device = "/dev/disk/by-label/data";
};

Expand Down