forked from fediversity/fediversity
113 lines
3.6 KiB
Nix
113 lines
3.6 KiB
Nix
{
|
|
pkgs,
|
|
lib,
|
|
sources ? import ../../../npins,
|
|
...
|
|
}:
|
|
{
|
|
mkNixosConfiguration =
|
|
environment: requests:
|
|
{ ... }:
|
|
{
|
|
imports = [
|
|
../common/sharedOptions.nix
|
|
# tests need this, however outside tests this (and esp its import nixos-test-base) must not be used
|
|
../common/targetNode.nix
|
|
"${sources.nixpkgs}/nixos/modules/profiles/minimal.nix"
|
|
# "${nixpkgs}/nixos/modules/profiles/perlless.nix" # failed under disko
|
|
"${sources.nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
|
|
# systemd-repart
|
|
# ../../../infra/common/nixos/repart.nix
|
|
# disko
|
|
"${sources.disko}/module.nix"
|
|
../../../infra/common/proxmox-qemu-vm.nix
|
|
];
|
|
|
|
# # non-disko
|
|
# boot.loader.grub.enable = false;
|
|
# boot.loader.systemd-boot.enable = true;
|
|
|
|
# boot.loader.efi.efiSysMountPoint = "/boot";
|
|
# boot.loader.systemd-boot.edk2-uefi-shell.enable = true;
|
|
# boot.loader.efi.canTouchEfiVariables = true;
|
|
# # proxmox.qemuConf.bios == "ovmf";
|
|
|
|
# boot.growPartition = true;
|
|
# boot.loader.timeout = 1;
|
|
|
|
nixpkgs.hostPlatform = "x86_64-linux";
|
|
|
|
system.stateVersion = "25.05";
|
|
services.qemuGuest.enable = true;
|
|
systemd.services.qemu-guest-agent = {
|
|
wants = [ "network-online.target" ];
|
|
after = [ "network-online.target" ];
|
|
};
|
|
|
|
services.openssh = {
|
|
enable = true;
|
|
settings.PasswordAuthentication = false;
|
|
};
|
|
networking = {
|
|
firewall.enable = false;
|
|
useDHCP = false;
|
|
usePredictableInterfaceNames = false;
|
|
useNetworkd = true;
|
|
nameservers = [
|
|
"95.215.185.6"
|
|
"95.215.185.7"
|
|
"2a00:51c0::5fd7:b906"
|
|
"2a00:51c0::5fd7:b907"
|
|
];
|
|
};
|
|
|
|
security.sudo.wheelNeedsPassword = false;
|
|
nix.settings.trusted-users = [ "@wheel" ];
|
|
|
|
services.cloud-init = {
|
|
enable = true;
|
|
network.enable = true;
|
|
};
|
|
|
|
users.mutableUsers = false;
|
|
users.users =
|
|
{
|
|
root = {
|
|
# password = "password"; # cannot log in
|
|
# hashedPassword = "$y$j9T$QoArNaV2VrjPhQ6BMG1AA.$uq8jw0.g.dJwIfepqipxzeUD1ochgUs8A5QmVe4qbJ6"; # cannot log in
|
|
hashedPasswordFile = builtins.toString (
|
|
pkgs.writeText "root-password" "$y$j9T$9g0NqdBsKvQ3ETOPPB0hW.$cIiG648jgA/eVqiCPJJZtI5JYiL6oODZtKI6.lCmJA/"
|
|
);
|
|
openssh.authorizedKeys.keys = [
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDHTIqF4CAylSxKPiSo5JOPuocn0y2z38wOSsQ1MUaZ2"
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFZsldWMEsajYysjYsEpNvMOjO4D8L21pTrfQS1T+Hfy"
|
|
];
|
|
};
|
|
# can log in
|
|
kiara = {
|
|
isNormalUser = true;
|
|
extraGroups = [ "wheel" ];
|
|
password = "password";
|
|
openssh.authorizedKeys.keys = [
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDHTIqF4CAylSxKPiSo5JOPuocn0y2z38wOSsQ1MUaZ2"
|
|
];
|
|
};
|
|
# cannot log in
|
|
operator = {
|
|
isNormalUser = true;
|
|
extraGroups = [ "wheel" ];
|
|
password = "password";
|
|
openssh.authorizedKeys.keys = [
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDHTIqF4CAylSxKPiSo5JOPuocn0y2z38wOSsQ1MUaZ2"
|
|
];
|
|
};
|
|
}
|
|
// environment.config.resources."operator-environment".login-shell.apply {
|
|
resources = lib.filterAttrs (_name: value: value ? login-shell) (
|
|
lib.concatMapAttrs (
|
|
k': req: lib.mapAttrs' (k: lib.nameValuePair "${k'}.${k}") req.resources
|
|
) requests
|
|
);
|
|
};
|
|
};
|
|
}
|