WEFT_OS/infra/nixos/configuration.nix
Marco Allegretti 294bd163b9 build(nix): use Rust 1.93.0 via rust-overlay for all package builds
Add oxalica/rust-overlay flake input; override rustPlatform in
weft-packages.nix with cargo/rustc from rust-bin.stable.1.93.0;
apply overlay in both devShell and nixosConfigurations.weft-vm.
Fixes build failure where nixos-25.05 Rust 1.86.0 was below the
rust-version requirement of wasmtime and other dependencies.
2026-03-12 21:28:14 +01:00

136 lines
3.3 KiB
Nix

{ pkgs, lib, self, modulesPath, rustOverlay, ... }:
{
imports = [
"${modulesPath}/profiles/qemu-guest.nix"
"${modulesPath}/virtualisation/qemu-vm.nix"
];
system.stateVersion = "25.05";
boot.loader.grub = {
enable = true;
device = "/dev/vda";
};
fileSystems."/" = {
device = "/dev/vda1";
fsType = "ext4";
};
virtualisation = {
qemu.options = [ "-vga virtio" "-display gtk,gl=on" ];
memorySize = 4096;
cores = 4;
diskSize = 20480;
};
hardware.graphics = {
enable = true;
extraPackages = with pkgs; [ mesa.drivers virglrenderer ];
};
networking = {
hostName = "weft-vm";
firewall.enable = false;
};
time.timeZone = "UTC";
users.users.weft = {
isNormalUser = true;
description = "WEFT OS session user";
extraGroups = [ "video" "render" "seat" "input" "audio" ];
password = "";
autoSubUidGidRange = false;
};
services.getty.autologinUser = "weft";
security.polkit.enable = true;
services.dbus.enable = true;
services.udev.packages = [ pkgs.libinput ];
environment.systemPackages = with pkgs; [
mesa
wayland-utils
libinput
bash
coreutils
curl
htop
pkgs.weft.weft-servo-shell
pkgs.weft.weft-app-shell
pkgs.weft.weft-pack
];
nixpkgs.overlays = [
rustOverlay
(final: prev: {
rust193 = final.rust-bin.stable."1.93.0".default;
weft = final.callPackage ./weft-packages.nix {
rust193 = final.rust193;
};
})
];
systemd.user.services = {
weft-compositor = {
description = "WEFT OS Wayland Compositor";
after = [ "graphical-session.target" ];
partOf = [ "graphical-session.target" ];
wantedBy = [ "graphical-session.target" ];
serviceConfig = {
Type = "notify";
ExecStart = "${pkgs.weft.weft-compositor}/bin/weft-compositor";
Restart = "on-failure";
RestartSec = "1";
};
};
weft-servo-shell = {
description = "WEFT OS System Shell";
requires = [ "weft-compositor.service" ];
after = [ "weft-compositor.service" ];
wantedBy = [ "graphical-session.target" ];
environment = {
WAYLAND_DISPLAY = "wayland-1";
};
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.weft.weft-servo-shell}/bin/weft-servo-shell";
Restart = "on-failure";
RestartSec = "2";
};
};
weft-appd = {
description = "WEFT Application Daemon";
requires = [ "weft-compositor.service" ];
after = [ "weft-compositor.service" "weft-servo-shell.service" ];
serviceConfig = {
Type = "notify";
ExecStart = "${pkgs.weft.weft-appd}/bin/weft-appd";
Restart = "on-failure";
RestartSec = "1s";
Environment = [
"WEFT_RUNTIME_BIN=${pkgs.weft.weft-runtime}/bin/weft-runtime"
"WEFT_FILE_PORTAL_BIN=${pkgs.weft.weft-file-portal}/bin/weft-file-portal"
"WEFT_MOUNT_HELPER=${pkgs.weft.weft-mount-helper}/bin/weft-mount-helper"
];
};
};
};
programs.bash.loginShellInit = ''
if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
systemctl --user start graphical-session.target
fi
'';
nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
trusted-users = [ "root" "weft" ];
};
}