Compare commits
4 commits
b4b9f54727
...
44ece1a06c
Author | SHA1 | Date | |
---|---|---|---|
44ece1a06c | |||
8a234dc1ed | |||
5ebaff36c4 | |||
dab4d66124 |
4 changed files with 39 additions and 110 deletions
37
flake.nix
37
flake.nix
|
@ -14,7 +14,7 @@
|
||||||
{ self, nixpkgs, ... }@inputs:
|
{ self, nixpkgs, ... }@inputs:
|
||||||
let
|
let
|
||||||
outputs = self.outputs;
|
outputs = self.outputs;
|
||||||
utils = import ./utils.nix { inherit nixpkgs inputs outputs; };
|
utils = import ./utils.nix { inherit inputs; };
|
||||||
|
|
||||||
homelabConfig = import ./config.nix;
|
homelabConfig = import ./config.nix;
|
||||||
roles = import ./roles { inherit utils; };
|
roles = import ./roles { inherit utils; };
|
||||||
|
@ -22,21 +22,38 @@
|
||||||
inherit homelabConfig roles;
|
inherit homelabConfig roles;
|
||||||
lib = nixpkgs.lib;
|
lib = nixpkgs.lib;
|
||||||
};
|
};
|
||||||
|
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
nixosConfigurations =
|
devShells.x86_64-linux.default = pkgs.mkShell {
|
||||||
(nixpkgs.lib.mapAttrs (
|
buildInputs = [ pkgs.colmena ];
|
||||||
|
};
|
||||||
|
colmena =
|
||||||
|
{
|
||||||
|
meta = {
|
||||||
|
nixpkgs = import nixpkgs {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
};
|
||||||
|
specialArgs = {
|
||||||
|
inherit
|
||||||
|
inputs
|
||||||
|
outputs
|
||||||
|
hosts
|
||||||
|
;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// (nixpkgs.lib.mapAttrs (
|
||||||
_: value:
|
_: value:
|
||||||
(utils.mkSystem {
|
(utils.mkSystem {
|
||||||
inherit hosts;
|
|
||||||
hostConfig = value;
|
hostConfig = value;
|
||||||
})
|
})
|
||||||
) hosts)
|
) hosts);
|
||||||
// {
|
nixosConfigurations = {
|
||||||
template = nixpkgs.lib.nixosSystem {
|
template = nixpkgs.lib.nixosSystem {
|
||||||
specialArgs = { inherit inputs; };
|
specialArgs = { inherit inputs; };
|
||||||
modules = [ ./systems/template/configuration.nix ];
|
modules = [ ./systems/template/configuration.nix ];
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
{
|
|
||||||
roles,
|
|
||||||
hlConfig,
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
hostname = "base";
|
|
||||||
managed = true;
|
|
||||||
ip = "192.168.10.98";
|
|
||||||
|
|
||||||
roles = with roles; [
|
|
||||||
];
|
|
||||||
config = {
|
|
||||||
};
|
|
||||||
stateVersion = "24.05";
|
|
||||||
}
|
|
|
@ -1,50 +1,19 @@
|
||||||
{
|
{
|
||||||
inputs,
|
inputs,
|
||||||
modulesPath,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
nixpkgs.hostPlatform = "x86_64-linux";
|
nixpkgs.hostPlatform = "x86_64-linux";
|
||||||
imports = [
|
imports = [
|
||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
./../base/configuration.nix
|
||||||
|
inputs.sops-nix.nixosModules.sops
|
||||||
inputs.impermanence.nixosModules.impermanence
|
inputs.impermanence.nixosModules.impermanence
|
||||||
];
|
];
|
||||||
|
|
||||||
time.timeZone = "Europe/Amsterdam";
|
|
||||||
i18n.defaultLocale = "en_US.UTF-8";
|
|
||||||
networking.hostName = "nixos-template";
|
networking.hostName = "nixos-template";
|
||||||
networking.dhcpcd.enable = false;
|
networking.dhcpcd.enable = false;
|
||||||
networking.useNetworkd = true;
|
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 = {
|
services.cloud-init = {
|
||||||
enable = true;
|
enable = true;
|
||||||
network.enable = true;
|
network.enable = true;
|
||||||
|
@ -70,41 +39,5 @@
|
||||||
- btrfs filesystem resize max /nix
|
- 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;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
24
utils.nix
24
utils.nix
|
@ -1,23 +1,17 @@
|
||||||
{
|
{
|
||||||
nixpkgs,
|
|
||||||
inputs,
|
inputs,
|
||||||
outputs,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
mkSystem =
|
mkSystem =
|
||||||
{ hostConfig, hosts }:
|
{ hostConfig }:
|
||||||
nixpkgs.lib.nixosSystem {
|
{
|
||||||
system = "x86_64-linux";
|
deployment = {
|
||||||
specialArgs = {
|
targetHost = hostConfig.ip;
|
||||||
inherit
|
targetUser = "maintenance";
|
||||||
inputs
|
|
||||||
outputs
|
|
||||||
hostConfig
|
|
||||||
hosts
|
|
||||||
;
|
|
||||||
};
|
};
|
||||||
modules = [
|
|
||||||
|
imports = [
|
||||||
inputs.impermanence.nixosModules.impermanence
|
inputs.impermanence.nixosModules.impermanence
|
||||||
inputs.sops-nix.nixosModules.sops
|
inputs.sops-nix.nixosModules.sops
|
||||||
|
|
||||||
|
@ -32,7 +26,7 @@
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
hostName = hostConfig.hostname;
|
hostName = hostConfig.hostname;
|
||||||
interfaces.ens18.ipv4.addresses = [
|
interfaces.eth0.ipv4.addresses = [
|
||||||
{
|
{
|
||||||
address = hostConfig.ip;
|
address = hostConfig.ip;
|
||||||
prefixLength = 24;
|
prefixLength = 24;
|
||||||
|
@ -41,7 +35,7 @@
|
||||||
nameservers = [ "192.168.10.1" ];
|
nameservers = [ "192.168.10.1" ];
|
||||||
defaultGateway = {
|
defaultGateway = {
|
||||||
address = "192.168.10.1";
|
address = "192.168.10.1";
|
||||||
interface = "ens18";
|
interface = "eth0";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
system.stateVersion = hostConfig.stateVersion;
|
system.stateVersion = hostConfig.stateVersion;
|
||||||
|
|
Loading…
Add table
Reference in a new issue