nixos-config/flake.nix

122 lines
2.7 KiB
Nix

{
description = "System config";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, home-manager, ... }@inputs:
let
inherit (nixpkgs) lib;
util = import ./lib {
inherit system pkgs home-manager lib;
overlays = (pkgs.overlays);
};
inherit (util) user;
inherit (util) host;
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [ ];
};
system = "x86_64-linux";
vm1BiosConfig = {
boot = {
type = "bios";
qemu = true;
grubInstallDevice = "/dev/vda";
};
core.enable = true;
};
vm1UefiConfig = {
boot = {
type = "uefi";
qemu = true;
};
core.enable = true;
};
vm2Config = {
boot = {
type = "uefi";
qemu = true;
};
core.enable = true;
};
nixosUsers = [{
name = "erwin";
groups = [ "wheel" "networkmanager" "video" ];
uid = 1000;
shell = pkgs.fish;
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMNoTcRsAxDwpiIj6nhUXwzSQjtcgKCR0RDlzP57wi0W erwin@horusvr-ws2"
];
}];
in
{
homeManagerConfigurations = {
erwin = user.mkHMUser {
userConfig = {
git.enable = true;
ssh.enable = true;
applications.enable = true;
gpg.enable = true;
fish.enable = true;
sway.enable = true;
};
username = "erwin";
};
};
nixosConfigurations = {
vm1 = host.mkHost {
name = "vm1";
NICs = [ "enp1s0" ];
kernelPackage = pkgs.linuxPackages;
initrdMods = [ "ahci" "xhci_pci" "sr_mod" ];
kernelMods = [ "kvm-amd" ];
kernelParams = [ ];
systemConfig = vm1UefiConfig;
users = nixosUsers;
cpuCores = 6;
};
vm2 = host.mkHost {
name = "vm2";
NICs = [ "enp1s0" ];
kernelPackage = pkgs.linuxPackages;
initrdMods = [ "ahci" "xhci_pci" "sr_mod" ];
kernelMods = [ "kvm-amd" ];
kernelParams = [ ];
systemConfig = vm2Config;
users = nixosUsers;
cpuCores = 4;
};
# loki = host.mkHost {
# name = "loki";
# NICs = [ "enp4s0" ];
# kernelPackage = pkgs.linuxPackages;
# initrdMods = [ "nvme" "xhci_pci" "ahci" ];
# kernelMods = [ "kvm-amd" ];
# };
};
};
}