erpnext-nix/test-vm/configuration.nix

99 lines
2.6 KiB
Nix
Raw Permalink Normal View History

{ pkgs, lib, config, modulesPath, ... }:
{
imports = [
"${modulesPath}/profiles/minimal.nix"
"${modulesPath}/profiles/qemu-guest.nix"
"${modulesPath}/virtualisation/qemu-vm.nix"
2023-07-09 12:46:22 +00:00
../modules/erpnext.nix
];
2023-07-09 12:46:22 +00:00
config = {
services.qemuGuest.enable = true;
2024-01-06 16:16:13 +00:00
system.stateVersion = "23.11";
fileSystems."/" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
autoResize = true;
};
boot = {
growPartition = true;
loader.timeout = 5;
};
virtualisation = {
diskSize = 8000; # MB
memorySize = 2048; # MB
# We don't want to use tmpfs, otherwise the nix store's size will be bounded
# by a fraction of available RAM.
writableStoreUseTmpfs = false;
2023-06-05 17:28:33 +00:00
forwardPorts = [{
guest.port = 22;
host.port = 2222;
} {
guest.port = 9090;
host.port = 9090;
2023-06-06 04:19:10 +00:00
} {
2023-07-17 19:06:45 +00:00
guest.port = 443;
2023-06-06 04:19:10 +00:00
host.port = 8081;
2023-06-05 17:28:33 +00:00
}];
};
# So that we can ssh into the VM, see e.g.
# http://blog.patapon.info/nixos-local-vm/#accessing-the-vm-with-ssh
services.openssh.enable = true;
services.openssh.settings.PermitRootLogin = "yes";
# Give root an empty password to ssh in.
users.extraUsers.root.password = "";
2023-06-05 17:28:33 +00:00
users.users.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMNeQYLFauAbzDyIbKC86NUh9yZfiyBm/BtIdkcpZnSU"
2024-01-06 16:16:13 +00:00
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPAsRdVYK0077cdtavmrRr6akrI68T1EDY4Hfv4+W86J teutat3s@ryzensun"
2023-06-05 17:28:33 +00:00
];
users.mutableUsers = false;
2023-06-05 17:28:33 +00:00
networking.firewall.enable = false;
2023-07-17 19:06:45 +00:00
networking.hosts = {
"127.0.0.1" = [ "erp.momo.koeln" ];
};
environment.systemPackages = with pkgs; [
git
htop
neovim
];
2023-07-15 14:32:18 +00:00
age.secrets.erpnext-admin-password = {
file = ../secrets/admin-password.age;
mode = "700";
owner = "erpnext";
};
age.secrets.erpnext-db-root-password = {
file = ../secrets/database-root-password.age;
mode = "700";
owner = "erpnext";
};
age.secrets.erpnext-db-user-password = {
file = ../secrets/database-user-password.age;
mode = "700";
owner = "erpnext";
};
2023-07-09 12:46:22 +00:00
services.erpnext = {
enable = true;
2023-07-17 19:06:45 +00:00
domain = "localhost";
2023-07-15 14:32:18 +00:00
adminPasswordFile = config.age.secrets.erpnext-admin-password.path;
database.rootPasswordFile = config.age.secrets.erpnext-db-root-password.path;
database.userPasswordFile = config.age.secrets.erpnext-db-user-password.path;
2023-07-09 12:46:22 +00:00
caddy = {};
};
2023-07-17 19:06:45 +00:00
services.caddy = {
email = "admins@pub.solar";
globalConfig = ''
local_certs
'';
};
};
}