Compare commits

..

No commits in common. "44ece1a06c96ae556e8f691d754dcf5a559db9ff" and "b4b9f54727333a5b56e6f9d4219fb0875c08fb98" have entirely different histories.

4 changed files with 110 additions and 39 deletions

View file

@ -14,7 +14,7 @@
{ self, nixpkgs, ... }@inputs:
let
outputs = self.outputs;
utils = import ./utils.nix { inherit inputs; };
utils = import ./utils.nix { inherit nixpkgs inputs outputs; };
homelabConfig = import ./config.nix;
roles = import ./roles { inherit utils; };
@ -22,38 +22,21 @@
inherit homelabConfig roles;
lib = nixpkgs.lib;
};
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in
{
devShells.x86_64-linux.default = pkgs.mkShell {
buildInputs = [ pkgs.colmena ];
};
colmena =
{
meta = {
nixpkgs = import nixpkgs {
system = "x86_64-linux";
};
specialArgs = {
inherit
inputs
outputs
hosts
;
};
};
}
// (nixpkgs.lib.mapAttrs (
nixosConfigurations =
(nixpkgs.lib.mapAttrs (
_: value:
(utils.mkSystem {
inherit hosts;
hostConfig = value;
})
) hosts);
nixosConfigurations = {
template = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [ ./systems/template/configuration.nix ];
) hosts)
// {
template = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [ ./systems/template/configuration.nix ];
};
};
};
};
}

15
hosts/base.nix Normal file
View file

@ -0,0 +1,15 @@
{
roles,
hlConfig,
}:
{
hostname = "base";
managed = true;
ip = "192.168.10.98";
roles = with roles; [
];
config = {
};
stateVersion = "24.05";
}

View file

@ -1,19 +1,50 @@
{
inputs,
modulesPath,
...
}:
{
nixpkgs.hostPlatform = "x86_64-linux";
imports = [
./../base/configuration.nix
inputs.sops-nix.nixosModules.sops
(modulesPath + "/profiles/qemu-guest.nix")
inputs.impermanence.nixosModules.impermanence
];
time.timeZone = "Europe/Amsterdam";
i18n.defaultLocale = "en_US.UTF-8";
networking.hostName = "nixos-template";
networking.dhcpcd.enable = false;
networking.useNetworkd = true;
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
services.qemuGuest.enable = true;
nix.settings.trusted-users = [
"root"
"@wheel"
];
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
users.users."maintenance" = {
isNormalUser = true;
group = "maintenance";
extraGroups = [ "wheel" ];
password = "1234";
openssh.authorizedKeys.keyFiles = [ ../../authorized_keys ];
};
users.groups."maintenance" = { };
security.sudo.wheelNeedsPassword = false;
services.openssh = {
enable = true;
settings.PasswordAuthentication = false;
settings.KbdInteractiveAuthentication = false;
};
programs.ssh.startAgent = true;
services.cloud-init = {
enable = true;
network.enable = true;
@ -39,5 +70,41 @@
- btrfs filesystem resize max /nix
'';
};
system.stateVersion = "24.05";
boot.supportedFilesystems = [ "btrfs" ];
fileSystems = {
"/" = {
device = "none";
fsType = "tmpfs";
options = [
"defaults"
"mode=755"
];
};
"/boot" = {
device = "/dev/disk/by-label/boot";
fsType = "vfat";
};
"/nix" = {
device = "/dev/disk/by-label/btrfs";
fsType = "btrfs";
options = [
"compress=zstd"
"subvol=nix"
"noatime"
];
};
"/persistent" = {
device = "/dev/disk/by-label/btrfs";
fsType = "btrfs";
options = [
"compress=zstd"
"subvol=persistent"
"noatime"
];
autoResize = true;
neededForBoot = true;
};
};
}

View file

@ -1,17 +1,23 @@
{
nixpkgs,
inputs,
outputs,
...
}:
{
mkSystem =
{ hostConfig }:
{
deployment = {
targetHost = hostConfig.ip;
targetUser = "maintenance";
{ hostConfig, hosts }:
nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inherit
inputs
outputs
hostConfig
hosts
;
};
imports = [
modules = [
inputs.impermanence.nixosModules.impermanence
inputs.sops-nix.nixosModules.sops
@ -26,7 +32,7 @@
networking = {
hostName = hostConfig.hostname;
interfaces.eth0.ipv4.addresses = [
interfaces.ens18.ipv4.addresses = [
{
address = hostConfig.ip;
prefixLength = 24;
@ -35,7 +41,7 @@
nameservers = [ "192.168.10.1" ];
defaultGateway = {
address = "192.168.10.1";
interface = "eth0";
interface = "ens18";
};
};
system.stateVersion = hostConfig.stateVersion;