Skip to content

Commit

Permalink
Merge pull request #19 from michaelvanstraten/add-strato-host
Browse files Browse the repository at this point in the history
Add host configuration for strato server
  • Loading branch information
michaelvanstraten authored Oct 5, 2024
2 parents c133f13 + 82bb3c2 commit 5cb498e
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 20 deletions.
21 changes: 21 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
url = "github:bandithedoge/nixpkgs-firefox-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};

disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs =
Expand All @@ -43,7 +48,7 @@
{
darwinConfigurations = import ./darwinConfigurations { inherit inputs nix-darwin home-manager; };

nixosConfigurations = import ./nixosConfigurations { inherit nixpkgs; };
nixosConfigurations = import ./nixosConfigurations { inherit inputs nixpkgs; };
}
// flake-utils.lib.eachDefaultSystem (
system:
Expand Down
36 changes: 17 additions & 19 deletions nixosConfigurations/default.nix
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
{ nixpkgs, ... }:
{ inputs, nixpkgs, ... }:
let
lib = nixpkgs.lib;
hostConfigurations = lib.filesystem.listFilesRecursive ./hosts;
inherit (nixpkgs.lib) nixosSystem;

defaultArgs = {
specialArgs = {
make-disk-image = import "${nixpkgs}/nixos/lib/make-disk-image.nix";
inherit inputs;
};
};

in
lib.mergeAttrsList (
builtins.map (
hostConfiguration:
let
nixosConfiguration = nixpkgs.lib.nixosSystem {
modules = [ hostConfiguration ];
specialArgs = {
make-disk-image = import "${nixpkgs}/nixos/lib/make-disk-image.nix";
};
};
in
{
${nixosConfiguration.config.networking.hostName} = nixosConfiguration;
}
) hostConfigurations
)
{
h2946065 = nixosSystem (defaultArgs // { modules = [ ./hosts/h2946065/configuration.nix ]; });

rack-01-k8s-master-nuc-01 = nixosSystem (
defaultArgs // { modules = [ ./hosts/rack-01/k8s-master-nuc-01.nix ]; }
);
}
38 changes: 38 additions & 0 deletions nixosConfigurations/hosts/h2946065/configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{ pkgs, ... }:
{
imports = [
../../modules
../../modules/hardware/libvirtd.nix
./virtual-disk-MBR.nix
];

networking.hostName = "h2946065";

nixpkgs.hostPlatform = "x86_64-linux";

services.openssh = {
enable = true;
ports = [ 22 ];
settings = {
PasswordAuthentication = false;
PermitRootLogin = "no";
};
};

boot.kernel.sysctl = {
"net.ipv4.ip_unprivileged_port_start" = 80;

};

users.users.michael.extraGroups = [ "docker" ];

virtualisation.docker.enable = true;

networking.firewall.enable = false;

environment.systemPackages = [ pkgs.docker-compose ];

time.timeZone = "Europe/Berlin";

system.stateVersion = "25.11";
}
37 changes: 37 additions & 0 deletions nixosConfigurations/hosts/h2946065/virtual-disk-MBR.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{ inputs, ... }:
{
imports = [ inputs.disko.nixosModules.disko ];

disko.devices = {
disk = {
main = {
device = "/dev/vda";
type = "disk";
content = {
type = "gpt";
partitions = {
boot = {
size = "1M";
type = "EF02"; # for grub MBR
# content = {
# mountpoint = "/boot";
# };
};
root = {
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ]; # Override existing partition
mountpoint = "/";
mountOptions = [
"compress=zstd"
"noatime"
];
};
};
};
};
};
};
};
}
20 changes: 20 additions & 0 deletions nixosConfigurations/modules/hardware/libvirtd.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];

boot.initrd.availableKernelModules = [
"ata_piix"
"uhci_hcd"
"virtio_pci"
"sr_mod"
"virtio_blk"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];

boot.kernelParams = [
"console=tty1"
"console=ttyS0,115200"
];
}

0 comments on commit 5cb498e

Please sign in to comment.