From cb918b25fbc13a1d3619a811cafaa2313b70d4bf Mon Sep 17 00:00:00 2001 From: Random936 Date: Sun, 8 Sep 2024 10:33:33 -0700 Subject: [PATCH] Added logging config for new logging VM --- config/logging.nix | 25 +++++++++++++++++++ flake.nix | 57 +++++++++++++++++++++++++++++++------------- hardware/logging.nix | 31 ++++++++++++++++++++++++ 3 files changed, 97 insertions(+), 16 deletions(-) create mode 100644 config/logging.nix create mode 100644 hardware/logging.nix diff --git a/config/logging.nix b/config/logging.nix new file mode 100644 index 0000000..6f518b4 --- /dev/null +++ b/config/logging.nix @@ -0,0 +1,25 @@ +{ config, pkgs, inputs, ... }: { + + imports = [ + ../hardware/logging.nix + ./headless.nix + ]; + + users.users.logging = import ./user.nix; + networking.hostName = "r330-logging"; + + # Conigure a static IP address. + networking.defaultGateway = "192.168.8.1"; + networking.nameservers = [ "192.168.8.1" ]; + #networking.firewall.allowedTCPPorts = [ ]; + networking.interfaces.ens18.ipv4.addresses = [ + { + address = "192.168.8.8"; + prefixLength = 24; + } + ]; + + environment.systemPackages = with pkgs; [ + suricata + ]; +} diff --git a/flake.nix b/flake.nix index f5404c8..29bd418 100644 --- a/flake.nix +++ b/flake.nix @@ -15,6 +15,9 @@ }; outputs = { self, nixpkgs, nix-darwin, home-manager, ... } @ inputs: { + + # Nixos Configurations + nixosConfigurations.randomctf = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { inherit inputs; }; @@ -24,14 +27,6 @@ ]; }; - homeConfigurations.random = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages."x86_64-linux"; - extraSpecialArgs.user = "random"; - modules = [ - ./home/headful-nixos.nix - ]; - }; - nixosConfigurations."r330-media" = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { inherit inputs; }; @@ -40,14 +35,6 @@ ]; }; - homeConfigurations.sampledb = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages."x86_64-linux"; - extraSpecialArgs.user = "sampledb"; - modules = [ - ./home/headless-nixos.nix - ]; - }; - nixosConfigurations."sampledb-dev" = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { inherit inputs; }; @@ -56,6 +43,25 @@ ]; }; + nixosConfigurations."r330-logging" = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ + ./config/logging.nix + ]; + }; + + + # Home-Manager Configurations + + homeConfigurations.random = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages."x86_64-linux"; + extraSpecialArgs.user = "random"; + modules = [ + ./home/headful-nixos.nix + ]; + }; + homeConfigurations.media = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages."x86_64-linux"; extraSpecialArgs.user = "media"; @@ -64,6 +70,25 @@ ]; }; + homeConfigurations.sampledb = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages."x86_64-linux"; + extraSpecialArgs.user = "sampledb"; + modules = [ + ./home/headless-nixos.nix + ]; + }; + + homeConfigurations.logging = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages."x86_64-linux"; + extraSpecialArgs.user = "logging"; + modules = [ + ./home/headless-nixos.nix + ]; + }; + + + # Darwin Configuration + darwinConfigurations."Jadens-MacBook-Air" = nix-darwin.lib.darwinSystem { system = "aarch64-darwin"; specialArgs = { inherit inputs; }; diff --git a/hardware/logging.nix b/hardware/logging.nix new file mode 100644 index 0000000..394f3bb --- /dev/null +++ b/hardware/logging.nix @@ -0,0 +1,31 @@ +# 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 = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/4b91f41b-e619-41e1-a602-c60862cd6fb9"; + fsType = "ext4"; + }; + + swapDevices = [ ]; + + # 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.ens18.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +}