Skip to content

Commit

Permalink
feat: Bootstrap new config for Oracle cloud server
Browse files Browse the repository at this point in the history
- Fix ACME issues causing DNS challenges to fail
- Move agenix import to homelab module
- Add initial password to main user
  • Loading branch information
nikitawootten committed Sep 25, 2024
1 parent 856d615 commit 3566d19
Show file tree
Hide file tree
Showing 12 changed files with 106 additions and 14 deletions.
4 changes: 4 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs-stable.follows = "nixpkgs-stable";
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = { self, nixpkgs, home-manager, darwin, flake-utils, pre-commit-hooks
Expand Down
2 changes: 0 additions & 2 deletions hostModules/homelab/acme.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ in {

certs.${config.homelab.domain} = {
extraDomainNames = [ "*.${config.homelab.domain}" ];
# This is intended to be used on a local network
dnsPropagationCheck = false;
};
};

Expand Down
1 change: 1 addition & 0 deletions hostModules/homelab/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ in {
./homepage.nix
./samba.nix
inputs.nix-topology.nixosModules.default
inputs.agenix.nixosModules.default
];

options.homelab = {
Expand Down
2 changes: 1 addition & 1 deletion hostModules/homelab/media/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ in {
};
}];

services.samba.shares = lib.mkIf cfg.enableSambaShare {
services.samba.settings = lib.mkIf cfg.enableSambaShare {
media = {
path = cfg.storageRoot;
writable = true;
Expand Down
8 changes: 4 additions & 4 deletions hostModules/homelab/samba.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ in {
enable = true;
package = pkgs.samba4Full;
openFirewall = true;
extraConfig = ''
server smb encrypt = required
settings.global = {
"server smb encrypt" = "required";
# ^^ Note: Breaks `smbclient -L <ip/host> -U%` by default, might require the client to set `client min protocol`?
server min protocol = SMB3_00
'';
"server min protocol" = "SMB3_00";
};
};

services.avahi = {
Expand Down
2 changes: 2 additions & 0 deletions hostModules/personal/user.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ in {
shell = lib.mkForce pkgs.zsh;
description = lib.mkDefault "Nikita";
isNormalUser = lib.mkDefault true;
initialHashedPassword =
"$y$j9T$3DxK1nrBp3Xl2DHN8X97y0$19IRZEIoDdq.owYAW9MFataPDunzsyfWXS25aT3Am77";
};

home-manager = {
Expand Down
5 changes: 5 additions & 0 deletions hosts/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@
inherit specialArgs;
modules = [ ./iris ];
};
hermes = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
inherit specialArgs;
modules = [ ./hermes ];
};
}
5 changes: 1 addition & 4 deletions hosts/hades/default.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{ self, inputs, config, secrets, ... }: {
{ self, config, secrets, ... }: {
imports = [
./hardware-configuration.nix
inputs.agenix.nixosModules.default
inputs.nix-topology.nixosModules.default

self.nixosModules.personal
self.nixosModules.homelab
];
Expand Down
16 changes: 16 additions & 0 deletions hosts/hermes/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Bootstrapped via the following command:
# $ nix run github:nix-community/nixos-anywhere -- --flake .#hermes <user@host> --build-on-remote
{ self, inputs, ... }: {
imports = [
self.nixosModules.personal
inputs.disko.nixosModules.disko
./hardware-configuration.nix
./disk-config.nix
];
networking.hostName = "hermes";

services.tailscale.useRoutingFeatures = "server";

boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
}
50 changes: 50 additions & 0 deletions hosts/hermes/disk-config.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
disko.devices = {
disk = {
main = {
device = "/dev/sda";
type = "disk";
content = {
type = "gpt";
partitions = {
ESP = {
end = "4G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
name = "root";
end = "-12G";
content = {
type = "filesystem";
format = "bcachefs";
mountpoint = "/";
};
};
encryptedSwap = {
size = "6G";
content = {
type = "swap";
randomEncryption = true;
priority =
100; # prefer to encrypt as long as we have space for it
};
};
plainSwap = {
size = "100%";
content = {
type = "swap";
discardPolicy = "both";
resumeDevice = true; # resume from hiberation from this device
};
};
};
};
};
};
};
}
21 changes: 21 additions & 0 deletions hosts/hermes/hardware-configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }: {
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];

boot.initrd.availableKernelModules = [ "xhci_pci" "virtio_scsi" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
boot.tmp.useTmpfs = false;

# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp0s6.useDHCP = lib.mkDefault true;

nixpkgs.hostPlatform = lib.mkForce "aarch64-linux";
}
4 changes: 1 addition & 3 deletions hosts/iris/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{ self, inputs, config, lib, secrets, ... }: {
{ self, config, lib, secrets, ... }: {
imports = [
inputs.agenix.nixosModules.default

self.nixosModules.raspi4sd
self.nixosModules.personal
self.nixosModules.homelab
Expand Down

0 comments on commit 3566d19

Please sign in to comment.