Compare commits
4 Commits
b4b9f54727
...
44ece1a06c
Author | SHA1 | Date |
---|---|---|
|
44ece1a06c | |
|
8a234dc1ed | |
|
5ebaff36c4 | |
|
dab4d66124 |
37
flake.nix
37
flake.nix
|
@ -14,7 +14,7 @@
|
|||
{ self, nixpkgs, ... }@inputs:
|
||||
let
|
||||
outputs = self.outputs;
|
||||
utils = import ./utils.nix { inherit nixpkgs inputs outputs; };
|
||||
utils = import ./utils.nix { inherit inputs; };
|
||||
|
||||
homelabConfig = import ./config.nix;
|
||||
roles = import ./roles { inherit utils; };
|
||||
|
@ -22,21 +22,38 @@
|
|||
inherit homelabConfig roles;
|
||||
lib = nixpkgs.lib;
|
||||
};
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
in
|
||||
{
|
||||
nixosConfigurations =
|
||||
(nixpkgs.lib.mapAttrs (
|
||||
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 (
|
||||
_: value:
|
||||
(utils.mkSystem {
|
||||
inherit hosts;
|
||||
hostConfig = value;
|
||||
})
|
||||
) hosts)
|
||||
// {
|
||||
template = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [ ./systems/template/configuration.nix ];
|
||||
};
|
||||
) hosts);
|
||||
nixosConfigurations = {
|
||||
template = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs; };
|
||||
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,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
{
|
||||
nixpkgs.hostPlatform = "x86_64-linux";
|
||||
imports = [
|
||||
(modulesPath + "/profiles/qemu-guest.nix")
|
||||
./../base/configuration.nix
|
||||
inputs.sops-nix.nixosModules.sops
|
||||
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;
|
||||
|
@ -70,41 +39,5 @@
|
|||
- btrfs filesystem resize max /nix
|
||||
'';
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
};
|
||||
|
||||
system.stateVersion = "24.05";
|
||||
}
|
||||
|
|
24
utils.nix
24
utils.nix
|
@ -1,23 +1,17 @@
|
|||
{
|
||||
nixpkgs,
|
||||
inputs,
|
||||
outputs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
mkSystem =
|
||||
{ hostConfig, hosts }:
|
||||
nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = {
|
||||
inherit
|
||||
inputs
|
||||
outputs
|
||||
hostConfig
|
||||
hosts
|
||||
;
|
||||
{ hostConfig }:
|
||||
{
|
||||
deployment = {
|
||||
targetHost = hostConfig.ip;
|
||||
targetUser = "maintenance";
|
||||
};
|
||||
modules = [
|
||||
|
||||
imports = [
|
||||
inputs.impermanence.nixosModules.impermanence
|
||||
inputs.sops-nix.nixosModules.sops
|
||||
|
||||
|
@ -32,7 +26,7 @@
|
|||
|
||||
networking = {
|
||||
hostName = hostConfig.hostname;
|
||||
interfaces.ens18.ipv4.addresses = [
|
||||
interfaces.eth0.ipv4.addresses = [
|
||||
{
|
||||
address = hostConfig.ip;
|
||||
prefixLength = 24;
|
||||
|
@ -41,7 +35,7 @@
|
|||
nameservers = [ "192.168.10.1" ];
|
||||
defaultGateway = {
|
||||
address = "192.168.10.1";
|
||||
interface = "ens18";
|
||||
interface = "eth0";
|
||||
};
|
||||
};
|
||||
system.stateVersion = hostConfig.stateVersion;
|
||||
|
|
Loading…
Reference in New Issue