mirror of
https://github.com/donovanglover/nix-config.git
synced 2025-04-10 00:58:55 +02:00
meta: Add network example
This is a working example of using the modules in our existing configuration to start a network of virtual machines with nixos-build-vms. Note that VMs take longer to start up in this case than nixos-rebuild build-vm, and that said VMs may lack certain functionality (such as dynamic resolution in GNOME) that would otherwise be present with build-vm. Although networks are certainly cute (and I'm glad that I feel familiar with them thanks to my better understanding of Nix), they do seem less convenient than nixos-rebuild build-vm and don't appear to support Nix flakes. Networks therefore seem more useful for running multiple one-off services that couldn't otherwise be ran in a container.
This commit is contained in:
parent
168134bcf3
commit
bd7c1d553b
@ -10,5 +10,12 @@
|
|||||||
./starship.nix
|
./starship.nix
|
||||||
./stylix.nix
|
./stylix.nix
|
||||||
./thunar.nix
|
./thunar.nix
|
||||||
|
./user.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
virtualisation.vmVariant = {
|
||||||
|
imports = [
|
||||||
|
./virtualization.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
12
modules/user.nix
Normal file
12
modules/user.nix
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
let VARIABLES = import ../src/variables.nix; in {
|
||||||
|
users = {
|
||||||
|
mutableUsers = false;
|
||||||
|
|
||||||
|
users."${VARIABLES.username}" = {
|
||||||
|
isNormalUser = true;
|
||||||
|
uid = 1000;
|
||||||
|
password = "user";
|
||||||
|
extraGroups = [ "wheel" "networkmanager" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
17
modules/virtualization.nix
Normal file
17
modules/virtualization.nix
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
virtualisation = {
|
||||||
|
memorySize = 8192;
|
||||||
|
cores = 4;
|
||||||
|
};
|
||||||
|
|
||||||
|
virtualisation.qemu.options = [
|
||||||
|
"-device virtio-vga-gl"
|
||||||
|
"-display sdl,gl=on,show-cursor=off"
|
||||||
|
"-full-screen"
|
||||||
|
"-audio pa,model=hda"
|
||||||
|
];
|
||||||
|
|
||||||
|
environment.sessionVariables = {
|
||||||
|
WLR_NO_HARDWARE_CURSORS = "1";
|
||||||
|
};
|
||||||
|
}
|
16
networks/default.nix
Normal file
16
networks/default.nix
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
plasma = {
|
||||||
|
imports = [
|
||||||
|
../modules/virtualization.nix
|
||||||
|
../modules/user.nix
|
||||||
|
../modules/plasma.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
gnome = {
|
||||||
|
imports = [
|
||||||
|
../modules/virtualization.nix
|
||||||
|
../modules/user.nix
|
||||||
|
../modules/gnome.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
24
src/main.nix
24
src/main.nix
@ -194,16 +194,6 @@ let VARIABLES = import ./variables.nix; in {
|
|||||||
time.timeZone = "${VARIABLES.timezone}"; # Timezone
|
time.timeZone = "${VARIABLES.timezone}"; # Timezone
|
||||||
|
|
||||||
# user
|
# user
|
||||||
users = {
|
|
||||||
mutableUsers = false;
|
|
||||||
|
|
||||||
users."${VARIABLES.username}" = {
|
|
||||||
isNormalUser = true;
|
|
||||||
uid = 1000;
|
|
||||||
password = "user";
|
|
||||||
extraGroups = [ "wheel" "networkmanager" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
home-manager.users.user = {
|
home-manager.users.user = {
|
||||||
home.username = VARIABLES.username;
|
home.username = VARIABLES.username;
|
||||||
@ -229,20 +219,6 @@ let VARIABLES = import ./variables.nix; in {
|
|||||||
|
|
||||||
systemd.services.NetworkManager-wait-online.enable = false;
|
systemd.services.NetworkManager-wait-online.enable = false;
|
||||||
|
|
||||||
# virtualization
|
|
||||||
virtualisation.vmVariant = {
|
|
||||||
virtualisation = {
|
|
||||||
memorySize = 8192;
|
|
||||||
cores = 4;
|
|
||||||
};
|
|
||||||
|
|
||||||
virtualisation.qemu.options = [ "-device virtio-vga-gl" "-display sdl,gl=on,show-cursor=off" "-full-screen" "-audio pa,model=hda" ];
|
|
||||||
|
|
||||||
environment.sessionVariables = {
|
|
||||||
WLR_NO_HARDWARE_CURSORS = "1";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# mullvad-vpn
|
# mullvad-vpn
|
||||||
services.mullvad-vpn = {
|
services.mullvad-vpn = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user