NixOSConfig/lib/system.nix

48 lines
1.9 KiB
Nix

{ nixpkgs }:
name :
{ dualBoot ? false } :
let
lib = nixpkgs.lib;
configPath = ./machines/${name}.nix;
machineConfig =
if builtins.pathExists configPath then
configPath
else
./hardware/base.nix;
in
lib.nixosSystem {
system = "x86_64-linux";
modules = [
(
{ config, pkgs, lib, ... }: {
imports = [
machineConfig
];
virtualisation =
let
config = {
boot.loader.efi.efiSysMountPoint = lib.mkVMOverride "/boot";
virtualisation.qemu.options = [
"-display sdl"
];
virtualisation.sharedDirectories = {
keys = {
source = "/etc/ssh";
target = "/etc/ssh";
};
};
};
in {
vmVariant = config;
vmVariantWithBootLoader = config;
};
# Networking
networking.hostName = name;
})
];
}