Skip to content

Commit

Permalink
simplify demo
Browse files Browse the repository at this point in the history
  • Loading branch information
m1-s committed Feb 21, 2024
1 parent 4e56cfe commit bce9e39
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 31 deletions.
9 changes: 3 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,10 @@
inherit system;
modules = [
(import test/demo.nix {
pkgs = nixpkgsFor.x86_64-linux;
home-manager = inputs.home-manager;
module = self.homeManagerModules.plasma-manager;
extraPackages = with self.packages.${system}; [
rc2nix
];
home-manager-module = inputs.home-manager.nixosModules.home-manager;
plasma-module = self.homeManagerModules.plasma-manager;
})
(_: {environment.systemPackages = [ self.packages.${system}.rc2nix]; })
];
}).config.system.build.vm;

Expand Down
4 changes: 2 additions & 2 deletions script/write_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import re
import sys
from typing import Dict
from typing import Dict, Optional


class KConfParser:
Expand Down Expand Up @@ -89,7 +89,7 @@ def save(self):
f.write(f"{self.key_value_to_line(key, value)}\n")

@staticmethod
def get_key_value(line: str) -> tuple[str, str | None]:
def get_key_value(line: str) -> tuple[str, Optional[str]]:
line_splitted = line.split("=", 1)
key = line_splitted[0].strip()
value = line_splitted[1].strip() if len(line_splitted) > 1 else None
Expand Down
44 changes: 21 additions & 23 deletions test/demo.nix
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
{ pkgs
, home-manager
, module
, extraPackages
{ home-manager-module
, plasma-module
}:

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
home-manager-module
];

config = {
Expand All @@ -40,13 +28,11 @@ in
];
};

virtualisation = {
forwardPorts = [{
from = "host";
host.port = 2222;
guest.port = 22;
}];
};
virtualisation.forwardPorts = [{
from = "host";
host.port = 2222;
guest.port = 22;
}];

services.xserver = {
enable = true;
Expand All @@ -57,6 +43,18 @@ in
displayManager.autoLogin.user = "fake";
};

environment.systemPackages = extraPackages;
system.stateVersion = "22.05";

users.users.fake = {
createHome = true;
isNormalUser = true;
password = "password";
group = "users";
};

home-manager.users.fake = {
home.stateVersion = "22.05";
imports = [ plasma-module ];
};
};
}

0 comments on commit bce9e39

Please sign in to comment.