add suggested changes via NixOS discord

This commit is contained in:
randomuser 2023-07-08 16:22:38 -05:00
parent c7b00fac22
commit 11deac87c5
3 changed files with 198 additions and 227 deletions

View File

@ -1,16 +1,9 @@
{ lib, config, pkgs, ... }: { lib, config, pkgs, ... }:
let
hostname = "virtbox";
isVirtbox = hostname == "virtbox";
isNetbox = hostname == "netbox";
in
{ {
imports = imports =
[ [
./hardware-configuration.nix # include the results of the hardware scan ./hardware-configuration.nix # include the results of the hardware scan
./virtbox.nix
./netbox.nix
]; ];
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
@ -35,13 +28,4 @@ in
system.copySystemConfiguration = true; system.copySystemConfiguration = true;
system.stateVersion = "23.05"; # don't change this, lol system.stateVersion = "23.05"; # don't change this, lol
# branch and enable different capabilities based on the system
test = lib.mkIf isVirtbox {
services.virtbox.enable = true;
};
test_ = lib.mkIf isNetbox {
services.netbox.enable = true;
};
} }

View File

@ -1,18 +1,12 @@
{ lib, config, pkgs, ... }: { lib, config, pkgs, ... }:
let {
cfg = config.services.netbox;
in {
options.serviecs.netbox = {
enable = lib.mkEnableOption "netbox configs";
};
imports = imports =
[ [
./mail.nix ./mail.nix
./configuration.nix
]; ];
config = lib.mkIf cfg.enable {
boot.loader.grub.enable = true; boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/vda"; boot.loader.grub.device = "/dev/vda";
@ -130,5 +124,4 @@ in {
# Open ports in the firewall. # Open ports in the firewall.
networking.firewall.enable = false; networking.firewall.enable = false;
networking.firewall.allowedTCPPorts = [ 55555 80 443 ]; networking.firewall.allowedTCPPorts = [ 55555 80 443 ];
};
} }

View File

@ -1,21 +1,16 @@
{ lib, config, pkgs, ...}: { lib, config, pkgs, ...}:
let let
cfg = config.services.virtbox;
home-manager = builtins.fetchTarball { home-manager = builtins.fetchTarball {
url = "https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz"; url = "https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz";
sha256 = "0dfshsgj93ikfkcihf4c5z876h4dwjds998kvgv7sqbfv0z6a4bc"; sha256 = "0dfshsgj93ikfkcihf4c5z876h4dwjds998kvgv7sqbfv0z6a4bc";
}; };
in { in {
options.services.virtbox = {
enable = lib.mkEnableOption "virtbox configs";
};
imports = [ imports = [
(import "${home-manager}/nixos") (import "${home-manager}/nixos")
./configuration.nix
]; ];
config = lib.mkIf cfg.enable {
boot.loader.grub.enable = true; boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/vda"; boot.loader.grub.device = "/dev/vda";
@ -112,5 +107,4 @@ in {
}; };
}; };
}; };
};
} }