mad

mad / Start EE laptops via nix

Last active 3 weeks ago

Like 0
Expires 1 year from now

nixos-rebuild -I nixpkgs=channel:nixos-26.05 -I nixos-config=$(pwd)/configuration.nix build-vm-with-bootloader

mad revised this gist 3 weeks ago · 86e0b02

1 file changed, 104 insertions

configuration.nix (file created)
@@ -0,0 +1,104 @@
1 + # Get a VM:
2 + # nixos-rebuild -I nixpkgs=channel:nixos-26.05 -I nixos-config=$(pwd)/configuration.nix build-vm-with-bootloader
3 + {
4 + config,
5 + lib,
6 + pkgs,
7 + ...
8 + }:
9 + let
10 + in
11 + {
12 +
13 + boot = {
14 + plymouth = {
15 + enable = true;
16 + theme = "solar";
17 + };
18 +
19 + # Enable "Silent boot"
20 + consoleLogLevel = 3;
21 + kernelParams = [
22 + "quiet"
23 + "rd.udev.log_level=3"
24 + "rd.systemd.show_status=auto"
25 + "plymouth.use-simpledrm"
26 + ];
27 + loader.timeout = 0;
28 + loader.systemd-boot.enable = true;
29 + };
30 +
31 + hardware.graphics.enable = true;
32 +
33 + virtualisation.vmVariant = {
34 + virtualisation = {
35 + memorySize = 4096;
36 + cores = 3;
37 + };
38 + virtualisation.qemu.options = [
39 + "-device virtio-vga"
40 + ];
41 + services.getty.autologinUser = "root";
42 + };
43 +
44 + virtualisation.vmVariantWithBootLoader = {
45 + virtualisation = {
46 + memorySize = 2048;
47 + cores = 2;
48 + };
49 + virtualisation.qemu.options = [
50 + "-device virtio-vga"
51 + ];
52 + services.getty.autologinUser = "root";
53 + };
54 +
55 + time.timeZone = "Europe/Berlin";
56 + i18n.defaultLocale = "de_DE.UTF-8";
57 +
58 + users.users.root.password = "captain";
59 + users.mutableUsers = false;
60 +
61 + nix.settings.experimental-features = [ "nix-command" "flakes" ];
62 +
63 + console.keyMap = "de";
64 +
65 + programs.bash.loginShellInit = ''
66 + echo Welcome Captain!
67 + '';
68 +
69 + users.users."cadet" = {
70 + isNormalUser = true;
71 + initialPassword = "space cadet";
72 + };
73 +
74 + services.pipewire = {
75 + enable = true;
76 + alsa.enable = true;
77 + pulse.enable = true;
78 + };
79 +
80 +
81 + services.getty = {
82 + greetingLine = "Spaceship Laptops";
83 + # without mkForce it shows the "nixos-help" line
84 + helpLine = lib.mkForce "To boldy go where no one has gone before!" ;
85 + };
86 +
87 + environment.systemPackages = with pkgs; [
88 + neovim
89 + htop
90 + # (callPackage ./empty-epsilon.nix {})
91 + ];
92 +
93 + services.cage = {
94 + enable = true;
95 + user = "cadet";
96 + program = "${pkgs.empty-epsilon}/bin/EmptyEpsilon";
97 + };
98 +
99 + systemd.services."cage-tty1".serviceConfig.Restart = lib.mkForce "always";
100 +
101 + networking.wireless.enable = true;
102 +
103 + system.stateVersion = "26.05";
104 + }