- Rename `disks` to `additionalDisks` with structured format (path, readOnly, enableDiscard, blockSize, devIdentifier, useDirect) - Add custom boot options: rootDisk, kernel, initramfs, rootDiskReadonly - Add kernelParams for extra kernel command line options - Add gpu option (default: "context-types=cross-domain:virgl2") - Add sharedDirectories for crosvm --shared-dir - Add global crosvmLogLevel option (default: "info") - Add --name argument to crosvm set to VM name - Migrate deprecated --disk/--rwdisk to --block format - Switch flake to nixos-unstable channel Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
87 lines
2.3 KiB
Nix
87 lines
2.3 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
wayland-proxy-virtwl = {
|
|
url = "git+https://git.dsg.is/davidlowsec/wayland-proxy-virtwl.git?submodules=1";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
crosvm = {
|
|
#url = "git+https://git.dsg.is/davidlowsec/crosvm.git?ref=dsg&submodules=1";
|
|
url = "git+file:///home/david/git/crosvm?ref=dsg&submodules=1";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
treefmt-nix = {
|
|
url = "github:numtide/treefmt-nix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs =
|
|
{
|
|
self,
|
|
nixpkgs,
|
|
wayland-proxy-virtwl,
|
|
crosvm,
|
|
treefmt-nix,
|
|
}:
|
|
let
|
|
eachSystem = nixpkgs.lib.genAttrs [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
];
|
|
|
|
# Build NixOS-based rootfs as qcow2 image
|
|
makeRootfsNixos =
|
|
system:
|
|
{
|
|
guestPrograms ? [ ],
|
|
guestConfig ? { },
|
|
}:
|
|
let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
in
|
|
pkgs.callPackage (import ./rootfs-nixos) {
|
|
inherit guestPrograms guestConfig;
|
|
wayland-proxy-virtwl = wayland-proxy-virtwl.packages.${system}.default;
|
|
};
|
|
|
|
# treefmt configuration
|
|
treefmtConfig = {
|
|
projectRootFile = "flake.nix";
|
|
programs.nixfmt.enable = true;
|
|
};
|
|
in
|
|
{
|
|
formatter = eachSystem (
|
|
system:
|
|
(treefmt-nix.lib.evalModule nixpkgs.legacyPackages.${system} treefmtConfig).config.build.wrapper
|
|
);
|
|
|
|
packages = eachSystem (system: {
|
|
default = makeRootfsNixos system { };
|
|
rootfs-nixos = makeRootfsNixos system { };
|
|
});
|
|
|
|
# Helper function for building custom NixOS rootfs
|
|
lib.makeRootfsNixos = makeRootfsNixos;
|
|
|
|
nixosModules.default =
|
|
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
{
|
|
imports = [ ./modules ];
|
|
|
|
# Inject dependencies when module is enabled
|
|
config = lib.mkIf config.programs.qubes-lite.enable {
|
|
programs.qubes-lite._internal = {
|
|
crosvm = crosvm.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
|
wayland-proxy-virtwl = wayland-proxy-virtwl.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|