70 lines
1.5 KiB
Nix
70 lines
1.5 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
let
|
|
inherit (lib) mkOption mkIf mkMerge types;
|
|
cfg = config.devtools;
|
|
in
|
|
{
|
|
options.devtools = {
|
|
postgres.enable = mkOption {
|
|
default = false;
|
|
type = types.bool;
|
|
};
|
|
virtualisation.enable = mkOption {
|
|
default = false;
|
|
type = types.bool;
|
|
};
|
|
docker.enable = mkOption {
|
|
default = false;
|
|
type = types.bool;
|
|
};
|
|
};
|
|
|
|
config = {
|
|
services.postgresql = {
|
|
enable = cfg.postgres.enable;
|
|
package = pkgs.postgresql_17;
|
|
ensureDatabases = [ "dpv" ];
|
|
ensureUsers = [
|
|
{
|
|
name = "dpv";
|
|
ensureDBOwnership = true;
|
|
}
|
|
];
|
|
authentication = lib.mkForce ''
|
|
# Generated file; do not edit!
|
|
# TYPE DATABASE USER ADDRESS METHOD
|
|
local all all trust
|
|
host all all 127.0.0.1/32 trust
|
|
host all all ::1/128 trust
|
|
'';
|
|
};
|
|
|
|
virtualisation = mkMerge [
|
|
(mkIf cfg.virtualisation.enable {
|
|
libvirtd = {
|
|
enable = true;
|
|
qemu = {
|
|
swtpm.enable = true;
|
|
ovmf.enable = true;
|
|
ovmf.packages = [ pkgs.OVMFFull.fd ];
|
|
};
|
|
};
|
|
spiceUSBRedirection.enable = true;
|
|
})
|
|
|
|
(mkIf cfg.docker.enable {
|
|
docker = {
|
|
enable = true;
|
|
rootless = {
|
|
enable = true;
|
|
setSocketVariable = true;
|
|
};
|
|
};
|
|
})
|
|
];
|
|
|
|
programs.virt-manager.enable = cfg.virtualisation.enable;
|
|
};
|
|
}
|