Files
inception-of-things/vm/configuration.nix
2025-12-17 23:09:21 +01:00

119 lines
2.2 KiB
Nix

{
pkgs,
modulesPath,
hostname,
...
}:
{
imports = [
(modulesPath + "/profiles/minimal.nix")
];
networking.hostName = hostname;
nixpkgs.config = {
allowUnfree = true;
};
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
# Since `fileSystems` is ignored by nixos-generators, we need to be creative
systemd.services.mount-iot = {
description = "Mount the IOT shared folder";
script = ''
mkdir -p /iot
/run/wrappers/bin/mount -t 9p -o trans=virtio,version=9p2000.L host0 /iot
rm -rf /home/user/iot /root/iot
# for gui logins
mkdir /home/user/iot -p
cp -r /iot/p* /iot/bonus /home/user/iot/
chown -R user /home/user/iot
# for ssh logins
mkdir /root/iot -p
cp -r /iot/p* /iot/bonus /root/iot/
'';
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = false;
};
};
users.users = {
root.password = "toor";
user = {
password = "iot";
isNormalUser = true;
extraGroups = [ "wheel" "docker" "libvirt" ];
};
};
services = {
k3s.enable = true;
getty.autologinUser = "root";
xserver = {
enable = true;
xkb = {
layout = "fr";
variant = "us";
};
};
displayManager = {
gdm.enable = true;
autoLogin = {
enable = true;
user = "test";
};
};
desktopManager.gnome.enable = true;
libinput.enable = true;
};
hardware.graphics = {
enable = true;
enable32Bit = true;
};
virtualisation = {
virtualbox.host.enable = true;
docker.enable = true;
};
boot.kernelParams = [ "kvm.enable_virt_at_load=0" ];
programs = {
zsh = {
enable = true;
enableBashCompletion = true;
autosuggestions.enable = true;
syntaxHighlighting.enable = true;
shellAliases = (import ./aliases.nix);
};
};
environment = {
etc.hosts.mode = "0644";
systemPackages = with pkgs; [
bindfs
git
zip
neovim
eza
bat
vagrant
k3d
kubectl
];
};
system.stateVersion = "24.11";
}