first basic config for nixos-anywhere

This commit is contained in:
2026-07-23 17:32:31 +02:00
parent 130f637373
commit 97c0427ebe
5 changed files with 126 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
{ pkgs, ... }:
{
system.stateVersion = "26.05";
networking.hostName = "server";
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
services.openssh = {
enable = true;
settings = {
PasswordAuthentication = false;
PermitRootLogin = "prohibit-password";
};
};
networking.firewall = {
enable = true;
allowedTCPPorts = [
22
80
443
];
};
environment.systemPackages = with pkgs; [
git
vim
curl
wget
];
}
+39
View File
@@ -0,0 +1,39 @@
{
disko.devices = {
disk = {
main = {
device = "/dev/sda";
type = "disk";
content = {
type = "gpt";
partitions = {
ESP = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
};
};
}
+39
View File
@@ -0,0 +1,39 @@
{
description = "Hetzner NixOS vps";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-anywhere.url = "github:numtide/nixos-anywhere";
home-manager = {
url = "github:nix-community/home-manager/release-26.05";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, disko, home-manager, ... }:
{
nixosConfigurations.server = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
disko.nixosModules.disko
./disko.nix
./configuration.nix
./users.nix
home-manager.nixosModules.home-manager
{
home-manager.users.root = import ./home.nix;
}
];
};
};
}
+5
View File
@@ -0,0 +1,5 @@
{
home.stateVersion = "26.05";
programs.bash.enable = true;
}
+7
View File
@@ -0,0 +1,7 @@
{
users.users.root = {
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC6WNm4YAQO85j0aNQkKSH7QnmhgzKA4hA2ggi6cDyKk"
];
};
}