Basic Nixos Module
| app | ||
| config | ||
| desktop | ||
| overlay/nixos-check_mk_agent-overlay | ||
| service | ||
| virtualisation | ||
| default.nix | ||
| flake.lock | ||
| flake.nix | ||
| options.nix | ||
| README.md | ||
Nixos - zNix
Vorraussetzung
- Flakes wurden aktiviert https://nixos.wiki/wiki/flakes
- Paket Colmena ist vorhanden nixos colmena https://github.com/zhaofengli/colmena
Anwendung
Alias zur Anwendung:
alias apply_local="colmena apply-local --impure --sudo"
alias apply_remote="colmena apply --impure --on"
Danach kann mit apply_local oder apply_remote hostname der jeweilige Host aktualisiert werden. Flake aktualisieren: nix flake update znix Erneuert die flake.lock.
Options
Preset
Zusammenstellung aus mehreen Optionen:
Desktop Beispiel
znix = {
preset = "desktop";
desktops = ["plasma6" "sddm" "xserver"];
};
Die Option preset = "desktop"; ergibt folgende Config:
znix = {
# Config
config = {
basic = true;
power = true;
localuser = true;
bugfix = true;
shell = true;
};
# Services
service = {
ssh = {
enable = true;
secure = true;
};
checkmk_agent = {
enable = true;
};
};
# Desktop/s
desktop = {
sound = true;
};
desktops = [ "xserver" ];
# Virtualisation
virtualisation = {
podman = {
enable = true;
};
};
# Apps
apps = [ "basic" "desktop" ];
};
Server-VM Beispiel
znix = {
preset = "server";
config = { vm = true; };
};
Die Option preset = "server"; ergibt folgende Config:
znix = {
# Config
config = {
basic = true;
power = true;
secure = true;
localuser = true;
bugfix = true;
shell = true;
};
# Services
service = {
ssh = {
enable = true;
secure = true;
};
logrotate = { enable = true; };
checkmk_agent = {
enable = true;
};
};
# Virtualisation
virtualisation = {
podman = {
enable = true;
};
};
# Apps
apps = [ "basic" ];
};
Setup
flake.nix
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager/release-25.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nixos-hardware.url = "github:NixOS/nixos-hardware";
# -- Znix --
znix.url = "git+https://git.zarix.de/richi/znix.git?ref=main";
znix.inputs.nixpkgs.follows = "nixpkgs";
znix.inputs.nixpkgs-unstable.follows = "nixpkgs-unstable"; # optional
};
outputs = { nixpkgs, home-manager, nixpkgs-unstable, nixos-hardware, ... }@inputs: {
# ...
};
host.nix
imports = [
./hardware-configuration.nix
inputs.home-manager.nixosModules.home-manager
inputs.znix.nixosModules.znix
# ...
];
Alternativ without Flakes
{ config, pkgs, ... }:
let
znixRepo = pkgs.fetchgit {
url = "https://git.zarix.de/richi/znix.git";
rev = "main";
# sha256 = "sha256-Hash-des-Repository-Inhalts"
};
in
{
imports = [
"${znixRepo}/default.nix"
];
# ...
}
Dev
Revision für ein Pakte/Overlay bei Github ermitteln:
nix-prefetch-git https://github.com/Checkmk/checkmk/ --rev refs/tags/v2.2.0p17