refactor templates
This commit is contained in:
parent
f4accd2d9c
commit
3d875fd981
39
flake.nix
39
flake.nix
|
@ -49,9 +49,20 @@
|
||||||
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, vault-secrets, minecraft-servers, colmena
|
outputs =
|
||||||
, home-manager, hyprpaper, hyprland, nixos-generators, nixos-hardware, nur
|
{ self
|
||||||
, ... }@inputs:
|
, nixpkgs
|
||||||
|
, vault-secrets
|
||||||
|
, minecraft-servers
|
||||||
|
, colmena
|
||||||
|
, home-manager
|
||||||
|
, hyprpaper
|
||||||
|
, hyprland
|
||||||
|
, nixos-generators
|
||||||
|
, nixos-hardware
|
||||||
|
, nur
|
||||||
|
, ...
|
||||||
|
}@inputs:
|
||||||
let
|
let
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
|
|
||||||
|
@ -90,7 +101,8 @@
|
||||||
source /etc/set-environment
|
source /etc/set-environment
|
||||||
nix repl --file "${./.}/repl.nix" $@
|
nix repl --file "${./.}/repl.nix" $@
|
||||||
'';
|
'';
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
# Make the nixosConfigurations for compat reasons
|
# Make the nixosConfigurations for compat reasons
|
||||||
nixosConfigurations =
|
nixosConfigurations =
|
||||||
(import (inputs.colmena + "/src/nix/hive/eval.nix") {
|
(import (inputs.colmena + "/src/nix/hive/eval.nix") {
|
||||||
|
@ -102,12 +114,14 @@
|
||||||
}).nodes;
|
}).nodes;
|
||||||
|
|
||||||
# Make the colmena configuration
|
# Make the colmena configuration
|
||||||
colmena = lib.foldr (el: acc: acc // util.mkColmenaHost el) {
|
colmena = lib.foldr (el: acc: acc // util.mkColmenaHost el)
|
||||||
|
{
|
||||||
meta = {
|
meta = {
|
||||||
inherit specialArgs;
|
inherit specialArgs;
|
||||||
nixpkgs = pkgs;
|
nixpkgs = pkgs;
|
||||||
};
|
};
|
||||||
} nixHosts;
|
}
|
||||||
|
nixHosts;
|
||||||
|
|
||||||
packages.${system} = {
|
packages.${system} = {
|
||||||
inherit apply-local;
|
inherit apply-local;
|
||||||
|
@ -117,19 +131,26 @@
|
||||||
iso = nixos-generators.nixosGenerate {
|
iso = nixos-generators.nixosGenerate {
|
||||||
inherit system pkgs;
|
inherit system pkgs;
|
||||||
format = "iso";
|
format = "iso";
|
||||||
modules = [ (import ./nixos/iso.nix) ];
|
modules = [ (import ./nixos/templates/iso.nix) ];
|
||||||
};
|
};
|
||||||
|
|
||||||
iso-graphical = nixos-generators.nixosGenerate {
|
iso-graphical = nixos-generators.nixosGenerate {
|
||||||
inherit system pkgs;
|
inherit system pkgs;
|
||||||
format = "iso";
|
format = "iso";
|
||||||
modules = [ (import ./nixos/iso-graphical.nix) ];
|
modules = [ (import ./nixos/templates/iso-graphical.nix) ];
|
||||||
};
|
};
|
||||||
|
|
||||||
proxmox-lxc = nixos-generators.nixosGenerate {
|
proxmox-lxc = nixos-generators.nixosGenerate {
|
||||||
inherit system pkgs;
|
inherit system pkgs;
|
||||||
format = "proxmox-lxc";
|
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) ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
{ lib, ... }: {
|
{ lib, ... }: {
|
||||||
|
networking.useDHCP = true;
|
||||||
# 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;
|
|
||||||
|
|
||||||
# Enable qemu guest agent
|
# Enable qemu guest agent
|
||||||
services.qemuGuest.enable = true;
|
services.qemuGuest.enable = true;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{ config, pkgs, lib, ... }: {
|
{ config, pkgs, lib, ... }: {
|
||||||
imports = [ ./common/common.nix ./common/generic-lxc.nix ];
|
imports = [ ../common/common.nix ../common/generic-lxc.nix ];
|
||||||
|
|
||||||
proxmoxLXC = {
|
proxmoxLXC = {
|
||||||
manageNetwork = true;
|
manageNetwork = true;
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
networking.useDHCP = true;
|
networking.useDHCP = true;
|
||||||
|
|
||||||
system.stateVersion = "22.11";
|
system.stateVersion = "23.05";
|
||||||
|
|
||||||
users.users.root.initialPassword = "toor";
|
users.users.root.initialPassword = "toor";
|
||||||
}
|
}
|
28
nixos/templates/proxmox-vm.nix
Normal file
28
nixos/templates/proxmox-vm.nix
Normal 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";
|
||||||
|
}
|
Loading…
Reference in a new issue