feat: home server configuration

This commit is contained in:
Gustavo "Guz" L. de Mello
2024-01-23 17:34:04 -03:00
parent c3696a6ae8
commit 25660d75cf
6 changed files with 103 additions and 1 deletions

View File

@@ -71,6 +71,7 @@
nixosConfigurations = (create-host [ nixosConfigurations = (create-host [
"desktop@default" "desktop@default"
"desktop@work" "desktop@work"
"homex"
]); ]);
}; };
} }

View File

@@ -2,7 +2,6 @@
{ {
imports = [ imports = [
inputs.sops-nix.nixosModules.sops
../../modules/nixos/config/host.nix ../../modules/nixos/config/host.nix
../../modules/nixos/systems/set-user.nix ../../modules/nixos/systems/set-user.nix
# Include the results of the hardware scan. # Include the results of the hardware scan.

View File

@@ -0,0 +1,41 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
{
imports = [
../../modules/nixos/systems/set-user.nix
../../modules/nixos/config/host.nix
./hardware-configuration.nix
];
host.networking.hostName = "homex";
networking = {
dhcpcd.enable = true;
interfaces.eno1.ipv4.addresses = [{
address = "192.168.1.10";
prefixLength = 28;
}];
defaultGateway = "192.168.1.1";
nameservers = [ "1.1.1.1" "8.8.8.8" ];
};
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
set-user.users = [{
username = "guz";
shell = pkgs.zsh;
home = import ./home.nix;
}];
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# Enable the OpenSSH daemon.
services.openssh.enable = true;
}

View File

@@ -0,0 +1,39 @@
# 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 + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "usbhid" "usb_storage" "sd_mod" "sdhci_acpi" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/26878c61-60d2-4ac9-967f-30faffc0f21f";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/ACCB-816C";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/878a189a-e5df-4e1c-92d5-df6f77ff53bb"; }
];
# 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.eno1.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

21
hosts/homex/home.nix Normal file
View File

@@ -0,0 +1,21 @@
{ config, pkgs, inputs, ... }:
{
imports = [
../../modules/home-manager/programs/starship.nix
../../modules/home-manager/programs/tmux.nix
../../modules/home-manager/programs/zsh.nix
];
starship.enable = true;
starship.enableZsh = true;
tmux.enable = true;
tmux.shell = "\${pkgs.zsh}/bin/zsh";
zsh.enable = true;
zsh.extraConfig.init = ''
export GPG_TTY=$(tty)
'';
}

View File

@@ -7,6 +7,7 @@ in
{ {
imports = [ imports = [
inputs.home-manager.nixosModules.default inputs.home-manager.nixosModules.default
inputs.sops-nix.nixosModules.sops
../systems/localization.nix ../systems/localization.nix
]; ];
options.host = { options.host = {