Restructed directories; added second config for nixos-dev vm.

This commit is contained in:
Random936 2024-07-02 23:24:16 -07:00
parent 3baf1801e2
commit 69d199a0b0
7 changed files with 111 additions and 44 deletions

50
config/omen.nix Normal file
View File

@ -0,0 +1,50 @@
# 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, inputs, ... }:
{
imports = [
../hardware/omen.nix
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Set hostname
networking.hostName = "randomctf";
# Enable Nvidia drivers
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
modesetting.enable = true;
# Power management is experimental and known to cause issues.
powerManagement.enable = false;
powerManagement.finegrained = false;
open = false; # Don't use open source kernel.
nvidiaSettings = true;
prime = {
offload = {
enable = true;
enableOffloadCmd = true;
};
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
};
# Fix issue with Nvidia display scaling.
services.xserver.dpi = 96;
environment.variables.GDK_SCALE = "0.5";
# Enable VMWare Workstation
virtualisation.vmware.host.enable = true;
system.stateVersion = "24.05";
}

View File

@ -1,23 +1,10 @@
# 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, inputs, ... }: { config, pkgs, inputs, ... }:
{ {
imports = [
./hardware-configuration.nix
];
# Enable experimental nix features. # Enable experimental nix features.
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Networking # Networking
networking.hostName = "randomctf"; # Define your hostname.
networking.wireless.iwd.enable = true; networking.wireless.iwd.enable = true;
networking.networkmanager = { networking.networkmanager = {
enable = true; enable = true;
@ -39,33 +26,6 @@
LC_TIME = "en_US.UTF-8"; LC_TIME = "en_US.UTF-8";
}; };
# Enable Nvidia drivers
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
modesetting.enable = true;
# Power management is experimental and known to cause issues.
powerManagement.enable = false;
powerManagement.finegrained = false;
open = false; # Don't use open source kernel.
nvidiaSettings = true;
prime = {
offload = {
enable = true;
enableOffloadCmd = true;
};
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
};
# Fix issue with Nvidia display scaling.
services.xserver.dpi = 96;
environment.variables.GDK_SCALE = "0.5";
# Enable the X11 windowing system and i3 window manager. # Enable the X11 windowing system and i3 window manager.
environment.pathsToLink = [ "/libexec" ]; environment.pathsToLink = [ "/libexec" ];
services.xserver = { services.xserver = {
@ -131,9 +91,8 @@
services.openssh.enable = true; services.openssh.enable = true;
services.tailscale.enable = true; services.tailscale.enable = true;
# Enable virtualization features # Enable docker service.
virtualisation.docker.enable = true; virtualisation.docker.enable = true;
virtualisation.vmware.host.enable = true;
system.stateVersion = "24.05"; system.stateVersion = "24.05";
} }

21
config/vm.nix Normal file
View File

@ -0,0 +1,21 @@
# 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, inputs, ... }:
{
imports = [
../hardware/vm.nix
];
# Bootloader.
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
boot.loader.grub.useOSProber = true;
# Set hostname
networking.hostName = "nixos-dev";
system.stateVersion = "24.05";
}

View File

@ -18,7 +18,13 @@
nixosConfigurations.randomctf = nixpkgs.lib.nixosSystem { nixosConfigurations.randomctf = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };
modules = [ ./nixos/configuration.nix ]; modules = [ ./config/shared.nix ./config/omen.nix ];
};
nixosConfigurations.nixos-dev = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [ ./config/shared.nix ./config/vm.nix ];
}; };
homeConfigurations.random = home-manager.lib.homeManagerConfiguration { homeConfigurations.random = home-manager.lib.homeManagerConfiguration {
@ -32,7 +38,7 @@
system = "aarch64-darwin"; system = "aarch64-darwin";
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };
modules = [ modules = [
./nixos/darwin-configuration.nix ./config/darwin-configuration.nix
home-manager.darwinModules.home-manager { home-manager.darwinModules.home-manager {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;

31
hardware/vm.nix Normal file
View File

@ -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/80be06c6-fafe-43de-a0e5-90464bdd0666";
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.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.ens18.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}