+33
configuration.nix
+33
configuration.nix
···
···
1
+
{
2
+
modulesPath,
3
+
lib,
4
+
pkgs,
5
+
...
6
+
} @ args:
7
+
{
8
+
imports = [
9
+
(modulesPath + "/installer/scan/not-detected.nix")
10
+
(modulesPath + "/profiles/qemu-guest.nix")
11
+
./disk-config.nix
12
+
];
13
+
boot.loader.grub = {
14
+
# no need to set devices, disko will add all devices that have a EF02 partition to the list already
15
+
# devices = [ ];
16
+
efiSupport = true;
17
+
efiInstallAsRemovable = true;
18
+
};
19
+
services.openssh.enable = true;
20
+
21
+
environment.systemPackages = map lib.lowPrio [
22
+
pkgs.curl
23
+
pkgs.gitMinimal
24
+
pkgs.wget
25
+
];
26
+
27
+
users.users.root.openssh.authorizedKeys.keys =
28
+
[
29
+
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFuC5sHe8hegmrgEKntLTArMn/O6m8IOKHxtgAsHHcF1 mar.kimmina@gmail.com"
30
+
];
31
+
32
+
system.stateVersion = "24.05";
33
+
}
+56
disk-config.nix
+56
disk-config.nix
···
···
1
+
# Example to create a bios compatible gpt partition
2
+
{ lib, ... }:
3
+
{
4
+
disko.devices = {
5
+
disk.disk1 = {
6
+
device = lib.mkDefault "/dev/sda";
7
+
type = "disk";
8
+
content = {
9
+
type = "gpt";
10
+
partitions = {
11
+
boot = {
12
+
name = "boot";
13
+
size = "1M";
14
+
type = "EF02";
15
+
};
16
+
esp = {
17
+
name = "ESP";
18
+
size = "500M";
19
+
type = "EF00";
20
+
content = {
21
+
type = "filesystem";
22
+
format = "vfat";
23
+
mountpoint = "/boot";
24
+
};
25
+
};
26
+
root = {
27
+
name = "root";
28
+
size = "100%";
29
+
content = {
30
+
type = "lvm_pv";
31
+
vg = "pool";
32
+
};
33
+
};
34
+
};
35
+
};
36
+
};
37
+
lvm_vg = {
38
+
pool = {
39
+
type = "lvm_vg";
40
+
lvs = {
41
+
root = {
42
+
size = "100%FREE";
43
+
content = {
44
+
type = "filesystem";
45
+
format = "ext4";
46
+
mountpoint = "/";
47
+
mountOptions = [
48
+
"defaults"
49
+
];
50
+
};
51
+
};
52
+
};
53
+
};
54
+
};
55
+
};
56
+
}
+48
flake.lock
+48
flake.lock
···
···
1
+
{
2
+
"nodes": {
3
+
"disko": {
4
+
"inputs": {
5
+
"nixpkgs": [
6
+
"nixpkgs"
7
+
]
8
+
},
9
+
"locked": {
10
+
"lastModified": 1748225455,
11
+
"narHash": "sha256-AzlJCKaM4wbEyEpV3I/PUq5mHnib2ryEy32c+qfj6xk=",
12
+
"owner": "nix-community",
13
+
"repo": "disko",
14
+
"rev": "a894f2811e1ee8d10c50560551e50d6ab3c392ba",
15
+
"type": "github"
16
+
},
17
+
"original": {
18
+
"owner": "nix-community",
19
+
"repo": "disko",
20
+
"type": "github"
21
+
}
22
+
},
23
+
"nixpkgs": {
24
+
"locked": {
25
+
"lastModified": 1748662220,
26
+
"narHash": "sha256-7gGa49iB9nCnFk4h/g9zwjlQAyjtpgcFkODjcOQS0Es=",
27
+
"owner": "NixOS",
28
+
"repo": "nixpkgs",
29
+
"rev": "59138c7667b7970d205d6a05a8bfa2d78caa3643",
30
+
"type": "github"
31
+
},
32
+
"original": {
33
+
"owner": "NixOS",
34
+
"ref": "nixpkgs-unstable",
35
+
"repo": "nixpkgs",
36
+
"type": "github"
37
+
}
38
+
},
39
+
"root": {
40
+
"inputs": {
41
+
"disko": "disko",
42
+
"nixpkgs": "nixpkgs"
43
+
}
44
+
}
45
+
},
46
+
"root": "root",
47
+
"version": 7
48
+
}
+22
flake.nix
+22
flake.nix
···
···
1
+
{
2
+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
3
+
inputs.disko.url = "github:nix-community/disko";
4
+
inputs.disko.inputs.nixpkgs.follows = "nixpkgs";
5
+
6
+
outputs =
7
+
{
8
+
nixpkgs,
9
+
disko,
10
+
...
11
+
}:
12
+
{
13
+
nixosConfigurations.hetzner-lab = nixpkgs.lib.nixosSystem {
14
+
system = "x86_64-linux";
15
+
modules = [
16
+
disko.nixosModules.disko
17
+
./configuration.nix
18
+
./hardware-configuration.nix
19
+
];
20
+
};
21
+
};
22
+
}
+24
hardware-configuration.nix
+24
hardware-configuration.nix
···
···
1
+
# Do not modify this file! It was generated by ‘nixos-generate-config’
2
+
# and may be overwritten by future invocations. Please make changes
3
+
# to /etc/nixos/configuration.nix instead.
4
+
{ config, lib, pkgs, modulesPath, ... }:
5
+
6
+
{
7
+
imports =
8
+
[ (modulesPath + "/profiles/qemu-guest.nix")
9
+
];
10
+
11
+
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
12
+
boot.initrd.kernelModules = [ ];
13
+
boot.kernelModules = [ ];
14
+
boot.extraModulePackages = [ ];
15
+
16
+
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
17
+
# (the default) this is the recommended approach. When using systemd-networkd it's
18
+
# still possible to use this option, but it's recommended to use it in conjunction
19
+
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
20
+
networking.useDHCP = lib.mkDefault true;
21
+
# networking.interfaces.enp1s0.useDHCP = lib.mkDefault true;
22
+
23
+
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
24
+
}