refactor templates

This commit is contained in:
Vivian 2023-01-07 12:52:42 +01:00
parent f4accd2d9c
commit 3d875fd981
6 changed files with 65 additions and 21 deletions

View file

@ -49,9 +49,20 @@
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
};
outputs = { self, nixpkgs, vault-secrets, minecraft-servers, colmena
, home-manager, hyprpaper, hyprland, nixos-generators, nixos-hardware, nur
, ... }@inputs:
outputs =
{ self
, nixpkgs
, vault-secrets
, minecraft-servers
, colmena
, home-manager
, hyprpaper
, hyprland
, nixos-generators
, nixos-hardware
, nur
, ...
}@inputs:
let
inherit (nixpkgs) lib;
@ -90,7 +101,8 @@
source /etc/set-environment
nix repl --file "${./.}/repl.nix" $@
'';
in {
in
{
# Make the nixosConfigurations for compat reasons
nixosConfigurations =
(import (inputs.colmena + "/src/nix/hive/eval.nix") {
@ -102,12 +114,14 @@
}).nodes;
# Make the colmena configuration
colmena = lib.foldr (el: acc: acc // util.mkColmenaHost el) {
meta = {
inherit specialArgs;
nixpkgs = pkgs;
};
} nixHosts;
colmena = lib.foldr (el: acc: acc // util.mkColmenaHost el)
{
meta = {
inherit specialArgs;
nixpkgs = pkgs;
};
}
nixHosts;
packages.${system} = {
inherit apply-local;
@ -117,19 +131,26 @@
iso = nixos-generators.nixosGenerate {
inherit system pkgs;
format = "iso";
modules = [ (import ./nixos/iso.nix) ];
modules = [ (import ./nixos/templates/iso.nix) ];
};
iso-graphical = nixos-generators.nixosGenerate {
inherit system pkgs;
format = "iso";
modules = [ (import ./nixos/iso-graphical.nix) ];
modules = [ (import ./nixos/templates/iso-graphical.nix) ];
};
proxmox-lxc = nixos-generators.nixosGenerate {
inherit system pkgs;
format = "proxmox-lxc";
modules = [ (import ./nixos/proxmox-lxc.nix) ];
modules = [ (import ./nixos/templates/proxmox-lxc.nix) ];
};
# Currently broken as it assumes `local-lvm` exists
proxmox-vm = nixos-generators.nixosGenerate {
inherit system pkgs;
format = "proxmox";
modules = [ (import ./nixos/templates/proxmox-vm.nix) ];
};
};

View file

@ -1,10 +1,5 @@
{ lib, ... }: {
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking.useDHCP = false;
networking.interfaces.ens18.useDHCP = lib.mkDefault true;
networking.useDHCP = true;
# Enable qemu guest agent
services.qemuGuest.enable = true;

View file

@ -1,5 +1,5 @@
{ config, pkgs, lib, ... }: {
imports = [ ./common/common.nix ./common/generic-lxc.nix ];
imports = [ ../common/common.nix ../common/generic-lxc.nix ];
proxmoxLXC = {
manageNetwork = true;
@ -21,7 +21,7 @@
networking.useDHCP = true;
system.stateVersion = "22.11";
system.stateVersion = "23.05";
users.users.root.initialPassword = "toor";
}

View file

@ -0,0 +1,28 @@
{ config, pkgs, lib, ... }: {
imports = [ ../common/common.nix ../common/generic-vm.nix ];
proxmox.qemuConf = {
virtio0 = "local-zsfs:vm-9999-disk-0";
cores = 1;
memory = 1024;
bios = "ovmf";
};
# Enable SSH
services.openssh = {
enable = true;
passwordAuthentication = false;
permitRootLogin = "yes";
openFirewall = true;
};
networking.hostName = lib.mkDefault "template";
time.timeZone = lib.mkDefault "Europe/Amsterdam";
networking.useDHCP = true;
system.stateVersion = "23.05";
users.users.root.initialPassword = "toor";
}