+builder for proxmox nixos-template
This commit is contained in:
parent
f85332f321
commit
68ecbd3bf1
43
flake.lock
generated
43
flake.lock
generated
@ -205,6 +205,42 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixlib": {
|
||||
"locked": {
|
||||
"lastModified": 1736643958,
|
||||
"narHash": "sha256-tmpqTSWVRJVhpvfSN9KXBvKEXplrwKnSZNAoNPf/S/s=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"rev": "1418bc28a52126761c02dd3d89b2d8ca0f521181",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixos-generators": {
|
||||
"inputs": {
|
||||
"nixlib": "nixlib",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1742568034,
|
||||
"narHash": "sha256-QaMEhcnscfF2MqB7flZr+sLJMMYZPnvqO4NYf9B4G38=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixos-generators",
|
||||
"rev": "42ee229088490e3777ed7d1162cb9e9d8c3dbb11",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixos-generators",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1745391562,
|
||||
@ -255,16 +291,10 @@
|
||||
},
|
||||
"nixpkgs-master": {
|
||||
"locked": {
|
||||
"lastModified": 1747452614,
|
||||
"narHash": "sha256-hSEz6JHZTJJTeIudt0SK3UoZnfThHwKCUGvSe5/zn8g=",
|
||||
"lastModified": 1747037043,
|
||||
"narHash": "sha256-8xalMZYksBYrtjXXNyUwnkZN3pxHn41s8ouX0eet8/U=",
|
||||
"lastModified": 1747413287,
|
||||
"narHash": "sha256-hOnqJr0tZBERWa29JWf9B3/8qr82mlt/UlKPvS7iYzA=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e067fb89ac3e59f993f257c799318132f1492f01",
|
||||
"rev": "e235177a380b21a46776b4a6354e109d419292e5",
|
||||
"rev": "b965e4c283060415956ccd39eee4ca34a6a56cf8",
|
||||
"type": "github"
|
||||
},
|
||||
@ -346,6 +376,7 @@
|
||||
"dotfiles": "dotfiles",
|
||||
"home-manager": "home-manager_2",
|
||||
"hyprpanel": "hyprpanel",
|
||||
"nixos-generators": "nixos-generators",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"nixpkgs-9e9486b": "nixpkgs-9e9486b",
|
||||
"nixpkgs-locked": "nixpkgs-locked",
|
||||
|
41
flake.nix
41
flake.nix
@ -28,6 +28,11 @@
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
nixos-generators = {
|
||||
url = "github:nix-community/nixos-generators";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
hyprpanel.url = "github:Jas-SinghFSU/HyprPanel";
|
||||
rose-pine-hyprcursor.url = "github:ndom91/rose-pine-hyprcursor";
|
||||
|
||||
@ -55,10 +60,31 @@
|
||||
];
|
||||
forAllSystems = nixpkgs.lib.genAttrs systems;
|
||||
in {
|
||||
packages =
|
||||
forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
|
||||
packages = let
|
||||
# Import the regular packages for all systems
|
||||
regularPkgs = forAllSystems (
|
||||
system:
|
||||
import ./pkgs nixpkgs.legacyPackages.${system}
|
||||
);
|
||||
in
|
||||
regularPkgs
|
||||
// {
|
||||
x86_64-linux =
|
||||
regularPkgs.x86_64-linux
|
||||
// {
|
||||
# Build a QEMU image compatible with Proxmox using nixos-generators
|
||||
proxmox-hermes-image = inputs.nixos-generators.nixosGenerate {
|
||||
system = "x86_64-linux";
|
||||
format = "proxmox";
|
||||
modules = [
|
||||
./hosts/m3-hermes/default.nix
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
overlays = import ./overlays {inherit inputs outputs;};
|
||||
homeManagerModules = import ./modules/home-manager;
|
||||
|
||||
nixosConfigurations = {
|
||||
m3-ares = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {
|
||||
@ -98,15 +124,6 @@
|
||||
agenix.nixosModules.default
|
||||
];
|
||||
};
|
||||
m3-prox-pod = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {inherit inputs outputs;};
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
./hosts/m3-prox-pod
|
||||
inputs.disko.nixosModules.disko
|
||||
agenix.nixosModules.default
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
devShells.x86_64-linux.infraShell = let
|
||||
@ -115,7 +132,7 @@
|
||||
pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
opentofu
|
||||
nixos-anywhere.packages.x86_64-linux.nixos-anywhere
|
||||
nixos-anywhere
|
||||
];
|
||||
shellHook = ''
|
||||
echo "Infrastructure Management Shell"
|
||||
|
@ -12,7 +12,9 @@ in {
|
||||
config = mkIf cfg.enable {
|
||||
programs.nushell = {
|
||||
enable = true;
|
||||
package = pkgs.pinned.nushell;
|
||||
plugins = with pkgs.nushellPlugins; [
|
||||
skim
|
||||
];
|
||||
envFile.text = ''
|
||||
$env.config.show_banner = false
|
||||
$env.NIX_PATH = "nixpkgs=channel:nixos-unstable"
|
||||
@ -31,6 +33,7 @@ in {
|
||||
--color header:bold
|
||||
--header 'Press CTRL-Y to copy command into clipboard'"
|
||||
$env.FLAKE = $"($env.HOME)/p/nixos/nixos-config"
|
||||
source /run/agenix/${config.home.username}-secrets
|
||||
'';
|
||||
configFile.text = ''
|
||||
if (tty) == "/dev/tty1" {
|
||||
|
17
home/m3tam3re/m3-aether.nix
Normal file
17
home/m3tam3re/m3-aether.nix
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
imports = [
|
||||
../common
|
||||
../features/cli
|
||||
./home-server.nix
|
||||
];
|
||||
|
||||
features = {
|
||||
cli = {
|
||||
fish.enable = true;
|
||||
skim.enable = true;
|
||||
nitch.enable = true;
|
||||
secrets.enable = false;
|
||||
starship.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
@ -8,7 +8,7 @@
|
||||
features = {
|
||||
cli = {
|
||||
fish.enable = true;
|
||||
fzf.enable = true;
|
||||
skim.enable = true;
|
||||
nitch.enable = true;
|
||||
secrets.enable = false;
|
||||
starship.enable = true;
|
||||
|
111
hosts/m3-aether/configuration.nix
Normal file
111
hosts/m3-aether/configuration.nix
Normal file
@ -0,0 +1,111 @@
|
||||
# Edit this configuration file to define what should be installed on
|
||||
# your system. Help is available in the configuration.nix(5) man page, on
|
||||
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
||||
{pkgs, ...}: {
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./disko-config.nix
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
|
||||
# Bootloader.
|
||||
boot.loader.grub = {
|
||||
efiSupport = true;
|
||||
efiInstallAsRemovable = true;
|
||||
};
|
||||
|
||||
networking.hostName = "m3-helios"; # Define your hostname.
|
||||
networking.hostId = "3ebf1cd3";
|
||||
# Pick only one of the below networking options.
|
||||
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
||||
networking.networkmanager.enable =
|
||||
true; # Easiest to use and most distros use this by default.
|
||||
# Set your time zone.
|
||||
time.timeZone = "Europe/Berlin";
|
||||
|
||||
# Configure network proxy if necessary
|
||||
# networking.proxy.default = "http://user:password@proxy:port/";
|
||||
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
|
||||
|
||||
# Select internationalisation properties.
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
# console = {
|
||||
# font = "Lat2-Terminus16";
|
||||
# keyMap = "us";
|
||||
# useXkbConfig = true; # use xkb.options in tty.
|
||||
# };
|
||||
|
||||
# Enable the X11 windowing system.
|
||||
# services.xserver.enable = true;
|
||||
|
||||
# Enable the GNOME Desktop Environment.
|
||||
# services.xserver.displayManager.gdm.enable = true;
|
||||
# services.xserver.desktopManager.gnome.enable = true;
|
||||
|
||||
# Configure keymap in X11
|
||||
# services.xserver.xkb.layout = "us";
|
||||
# services.xserver.xkb.options = "eurosign:e,caps:escape";
|
||||
|
||||
# Enable CUPS to print documents.
|
||||
# services.printing.enable = true;
|
||||
|
||||
# Enable sound.
|
||||
# hardware.pulseaudio.enable = true;
|
||||
# OR
|
||||
|
||||
# Enable touchpad support (enabled default in most desktopManager).
|
||||
# services.libinput.enable = true;
|
||||
|
||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||
|
||||
# List packages installed in system profile. To search, run:
|
||||
# $ nix search wget
|
||||
environment.systemPackages = with pkgs; [neovim git];
|
||||
|
||||
# Some programs need SUID wrappers, can be configured further or are
|
||||
# started in user sessions.
|
||||
# programs.mtr.enable = true;
|
||||
# programs.gnupg.agent = {
|
||||
# enable = true;
|
||||
# enableSSHSupport = true;
|
||||
# };
|
||||
|
||||
# List services that you want to enable:
|
||||
|
||||
# Enable the OpenSSH daemon.
|
||||
services.openssh.enable = true;
|
||||
services.fstrim = {
|
||||
enable = true; # For SSD/thin-provisioned storage
|
||||
interval = "weekly";
|
||||
};
|
||||
|
||||
# Open ports in the firewall.
|
||||
# networking.firewall.allowedTCPPorts = [ ... ];
|
||||
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||
# Or disable the firewall altogether.
|
||||
# networking.firewall.enable = false;
|
||||
|
||||
# Copy the NixOS configuration file and link it from the resulting system
|
||||
# (/run/current-system/configuration.nix). This is useful in case you
|
||||
# accidentally delete configuration.nix.
|
||||
# system.copySystemConfiguration = true;
|
||||
|
||||
# This option defines the first version of NixOS you have installed on this particular machine,
|
||||
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
|
||||
#
|
||||
# Most users should NEVER change this value after the initial install, for any reason,
|
||||
# even if you've upgraded your system to a new NixOS release.
|
||||
#
|
||||
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
|
||||
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
|
||||
# to actually do that.
|
||||
#
|
||||
# This value being lower than the current NixOS release does NOT mean your system is
|
||||
# out of date, out of support, or vulnerable.
|
||||
#
|
||||
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
|
||||
# and migrated your data accordingly.
|
||||
#
|
||||
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
|
||||
system.stateVersion = "24.11"; # Did you read the comment?
|
||||
}
|
50
hosts/m3-aether/default.nix
Normal file
50
hosts/m3-aether/default.nix
Normal file
@ -0,0 +1,50 @@
|
||||
# A staring point is the basic NIXOS configuration generated by the ISO installer.
|
||||
# On an existing NIXOS install you can use the following command in your flakes basedir:
|
||||
# sudo nixos-generate-config --dir ./hosts/m3tam3re
|
||||
#
|
||||
# Please make sure to change the first couple of lines in your configuration.nix:
|
||||
# { config, inputs, ouputs, lib, pkgs, ... }:
|
||||
#
|
||||
# {
|
||||
# imports = [ # Include the results of the hardware scan.
|
||||
# ./hardware-configuration.nix
|
||||
# inputs.home-manager.nixosModules.home-manager
|
||||
# ];
|
||||
# ...
|
||||
#
|
||||
# Moreover please update the packages option in your user configuration and add the home-manager options:
|
||||
# users.users = {
|
||||
# m3tam3re = {
|
||||
# isNormalUser = true;
|
||||
# initialPassword = "12345";
|
||||
# extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
|
||||
# packages = [ inputs.home-manager.packages.${pkgs.system}.default ];
|
||||
# };
|
||||
# };
|
||||
#
|
||||
# home-manager = {
|
||||
# useUserPackages = true;
|
||||
# extraSpecialArgs = { inherit inputs outputs; };
|
||||
# users.m3tam3re =
|
||||
# import ../../home/m3tam3re/${config.networking.hostName}.nix;
|
||||
# };
|
||||
#
|
||||
# Please also change your hostname accordingly:
|
||||
#:w
|
||||
# networking.hostName = "nixos"; # Define your hostname.
|
||||
{
|
||||
imports = [
|
||||
../common
|
||||
./configuration.nix
|
||||
./programs.nix
|
||||
./secrets.nix
|
||||
./services
|
||||
];
|
||||
|
||||
extraServices = {
|
||||
flatpak.enable = true;
|
||||
ollama.enable = false;
|
||||
podman.enable = true;
|
||||
virtualisation.enable = false;
|
||||
};
|
||||
}
|
39
hosts/m3-aether/disko-config.nix
Normal file
39
hosts/m3-aether/disko-config.nix
Normal file
@ -0,0 +1,39 @@
|
||||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
main = {
|
||||
type = "disk";
|
||||
device = "/dev/sda";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
size = "1M";
|
||||
type = "EF02"; # for GRUB MBR
|
||||
priority = 1;
|
||||
};
|
||||
esp = {
|
||||
size = "512M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = ["defaults" "umask=0077"];
|
||||
};
|
||||
};
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
mountOptions = ["noatime" "nodiratime" "discard"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
24
hosts/m3-aether/hardware-configuration.nix
Normal file
24
hosts/m3-aether/hardware-configuration.nix
Normal file
@ -0,0 +1,24 @@
|
||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/profiles/qemu-guest.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
# still possible to use this option, but it's recommended to use it in conjunction
|
||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.ens18.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
}
|
14
hosts/m3-aether/programs.nix
Normal file
14
hosts/m3-aether/programs.nix
Normal file
@ -0,0 +1,14 @@
|
||||
{pkgs, ...}: {
|
||||
programs.nix-ld.enable = true;
|
||||
programs.nix-ld.libraries = with pkgs; [
|
||||
# Add any missing dynamic libraries for unpackaged programs
|
||||
# here, NOT in environment.systemPackages
|
||||
];
|
||||
programs.fish.enable = true;
|
||||
programs.nh = {
|
||||
enable = true;
|
||||
clean.enable = true;
|
||||
clean.extraArgs = "--keep-since 4d --keep 3";
|
||||
flake = "/home/m3tam3re/p/nixos/nixos-config";
|
||||
};
|
||||
}
|
15
hosts/m3-aether/secrets.nix
Normal file
15
hosts/m3-aether/secrets.nix
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
age = {
|
||||
secrets = {
|
||||
traefik = {
|
||||
file = ../../secrets/traefik.age;
|
||||
mode = "770";
|
||||
owner = "traefik";
|
||||
};
|
||||
m3tam3re-secrets = {
|
||||
file = ../../secrets/m3tam3re-secrets.age;
|
||||
owner = "m3tam3re";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
0
hosts/m3-aether/services/cloud-init.nix
Normal file
0
hosts/m3-aether/services/cloud-init.nix
Normal file
11
hosts/m3-aether/services/default.nix
Normal file
11
hosts/m3-aether/services/default.nix
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
imports = [
|
||||
./cloud-init.nix
|
||||
];
|
||||
systemd.sleep.extraConfig = ''
|
||||
AllowSuspend=no
|
||||
AllowHibernation=no
|
||||
AllowHybridSleep=no
|
||||
AllowSuspendThenHibernate=no
|
||||
'';
|
||||
}
|
45
hosts/m3-hermes/default.nix
Normal file
45
hosts/m3-hermes/default.nix
Normal file
@ -0,0 +1,45 @@
|
||||
{modulesPath, ...}: {
|
||||
imports = [
|
||||
"${modulesPath}/profiles/qemu-guest.nix"
|
||||
];
|
||||
|
||||
system.stateVersion = "24.11";
|
||||
|
||||
networking.hostName = "m3-hermes";
|
||||
|
||||
services.cloud-init = {
|
||||
enable = true;
|
||||
network.enable = true;
|
||||
settings = {
|
||||
system_info.distro = "nixos";
|
||||
datasource_list = ["NoCloud" "ConfigDrive"];
|
||||
};
|
||||
};
|
||||
|
||||
users.users.root.initialPassword = "nixos";
|
||||
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
PermitRootLogin = "prohibit-password";
|
||||
PasswordAuthentication = false;
|
||||
};
|
||||
};
|
||||
|
||||
networking = {
|
||||
useDHCP = false;
|
||||
useNetworkd = true;
|
||||
firewall.enable = true;
|
||||
};
|
||||
|
||||
systemd.network.enable = true;
|
||||
|
||||
console.keyMap = "us";
|
||||
|
||||
# Bootloader
|
||||
boot.loader.grub.enable = true;
|
||||
boot.loader.grub.device = "/dev/sda";
|
||||
|
||||
# Enable QEMU guest agent
|
||||
services.qemuGuest.enable = true;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user