demo: Add a demo app that runs Plasma in a VM

This commit is contained in:
Peter Jones 2022-06-22 14:42:18 -07:00
parent 55a2478ace
commit 9e29bcddf3
No known key found for this signature in database
GPG Key ID: 9DAFAA8D01941E49
4 changed files with 94 additions and 2 deletions

12
example/home.nix Normal file
View File

@ -0,0 +1,12 @@
{ ... }:
{
programs.plasma = {
enable = true;
# A high-level setting:
workspace.clickItemTo = "select";
# A low-level setting:
files."baloofilerc"."Basic Settings"."Indexing-Enabled" = false;
};
}

View File

@ -42,6 +42,20 @@
{
default = self.packages.${system}.rc2nix;
demo = (inputs.nixpkgs.lib.nixosSystem {
inherit system;
modules = [
(import test/demo.nix {
pkgs = nixpkgsFor.x86_64-linux;
home-manager = inputs.home-manager;
module = self.homeManagerModules.plasma;
extraPackages = with self.packages.${system}; [
rc2nix
];
})
];
}).config.system.build.vm;
rc2nix = pkgs.writeShellApplication {
name = "rc2nix";
runtimeInputs = with pkgs; [ ruby ];
@ -53,6 +67,11 @@
{
default = self.apps.${system}.rc2nix;
demo = {
type = "app";
program = "${self.packages.${system}.demo}/bin/run-plasma-demo-vm";
};
rc2nix = {
type = "app";
program = "${self.packages.${system}.rc2nix}/bin/rc2nix";

62
test/demo.nix Normal file
View File

@ -0,0 +1,62 @@
{ pkgs
, home-manager
, module
, extraPackages
}:
let
homeConfig = {
imports = [ ../example/home.nix ];
};
user = import ./user.nix {
inherit module home-manager homeConfig;
};
in
{ modulesPath, ... }:
{
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
(modulesPath + "/virtualisation/qemu-vm.nix")
user
];
config = {
networking.hostName = "plasma-demo";
fileSystems."/" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
autoResize = true;
};
boot = {
growPartition = true;
loader.timeout = 5;
kernelParams = [
"console=ttyS0"
"boot.shell_on_fail"
];
};
virtualisation = {
forwardPorts = [{
from = "host";
host.port = 2222;
guest.port = 22;
}];
};
services.xserver = {
enable = true;
displayManager.sddm.enable = true;
displayManager.defaultSession = "plasma";
desktopManager.plasma5.enable = true;
displayManager.autoLogin.enable = true;
displayManager.autoLogin.user = "fake";
};
environment.systemPackages = extraPackages;
};
}

View File

@ -19,8 +19,7 @@
useGlobalPkgs = true;
users.fake = { ... }: {
imports = [ module ];
config = homeConfig;
imports = [ module homeConfig ];
};
};
}