-
Notifications
You must be signed in to change notification settings - Fork 15
/
vm.nix
70 lines (60 loc) · 1.49 KB
/
vm.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{ lib, config, pkgs, modulesPath, examples, ... }:
let
preloadContainerdImages = lib.attrValues examples;
in {
imports = [
# Import qemu-vm directly to avoid using vmVariant since this config
# is only intended to be used as a VM. Using vmVariant will emit assertion
# errors regarding `fileSystems."/"` and `boot.loader.grub.device`.
(modulesPath + "/virtualisation/qemu-vm.nix")
./kubernetes.nix
# ./k3s.nix
./redis-spec.nix
];
# Enable rootful & rootless nix-snapshotter. This also starts rootful &
# rootless containerd respectively.
services.nix-snapshotter = {
enable = true;
setContainerdSnapshotter = true;
inherit preloadContainerdImages;
};
services.nix-snapshotter.rootless = {
enable = true;
inherit preloadContainerdImages;
};
nix.settings.experimental-features = [ "nix-command" "flakes" ];
environment.systemPackages = with pkgs; [
bat
containerd
cri-tools
git
jq
kubectl
nerdctl
nix-snapshotter
redis
tree
vim
];
users.users = {
root = {
initialHashedPassword = null;
password = "root";
};
rootless = {
isNormalUser = true;
extraGroups = [ "wheel" ];
password = "rootless";
group = "rootless";
};
};
virtualisation = {
memorySize = 4096;
cores = 4;
graphics = false;
diskImage = null;
};
services.openssh.enable = true;
networking.firewall.allowedTCPPorts = [ 22 ];
system.stateVersion = "23.05";
}