diff options
author | Jon Santmyer <jon@jonsantmyer.com> | 2023-09-29 14:22:24 -0400 |
---|---|---|
committer | Jon Santmyer <jon@jonsantmyer.com> | 2023-09-29 14:22:24 -0400 |
commit | f819e30b03dffcf9e74af4b8552e4a8ab8f54c58 (patch) | |
tree | c05f4f1db738d6cd9d2824b5000c6afc3b1d61d1 /hosts | |
parent | d3bb6cbb4724bc8f18f72fa3fea3e65f73ae8d09 (diff) | |
download | nix-config-f819e30b03dffcf9e74af4b8552e4a8ab8f54c58.tar.gz nix-config-f819e30b03dffcf9e74af4b8552e4a8ab8f54c58.tar.bz2 nix-config-f819e30b03dffcf9e74af4b8552e4a8ab8f54c58.zip |
major reorganizing to seperate modules
Diffstat (limited to 'hosts')
-rw-r--r-- | hosts/config.nix | 128 | ||||
-rw-r--r-- | hosts/default.nix | 32 | ||||
-rw-r--r-- | hosts/jonbox/default.nix | 43 | ||||
-rw-r--r-- | hosts/jonbox/filesystem.nix | 4 | ||||
-rw-r--r-- | hosts/jonbox/hardware.nix | 65 |
5 files changed, 272 insertions, 0 deletions
diff --git a/hosts/config.nix b/hosts/config.nix new file mode 100644 index 0000000..de49a45 --- /dev/null +++ b/hosts/config.nix @@ -0,0 +1,128 @@ +{ inputs, config, lib, pkgs, nurpkgs, user, stateVersion, ... }: +{ + imports = ( + import ../modules/desktop ++ + import ../modules/editor ++ + import ../modules/web ++ + import ../modules/shell ++ + import ../modules/terminal ++ + import ../modules/programs ++ + import ../modules/vpn + ); + + users.users.${user} = { + isNormalUser = true; + extraGroups = [ + "wheel" + "video" + "audio" + "camera" + "networkmanager" + "libvirtd" + ]; + }; + + #Timezone + time.timeZone = "America/New_York"; + + #Locale + i18n.defaultLocale = "en_US.UTF-8"; + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + + #Fonts + fonts.packages = with pkgs; [ + fira-code + fira-code-symbols + font-awesome + liberation_ttf + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + (nerdfonts.override { fonts = [ "FiraCode" ]; } ) + ]; + + #Security + security.rtkit.enable = true; + security.polkit.enable = true; + + #Default Packages + environment.systemPackages = with pkgs; [ + #Terminal utils + btop #Resource monitor + coreutils #GNU Utils + git #VC + pciutils #PCI + usbutils #USB + gnutar + unzip + zip + wget + + #Devtools + binutils + clang-tools + gcc + gnumake + gdb + ]; + + programs = { + dconf.enable = true; + neovim.enable = true; + gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + }; + + services = { + pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + }; + + #SSH + services.openssh.enable = true; + environment.shellInit = '' +gpg-connect-agent /bye +export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) + ''; + + #Nix package manager configs. + nix = { + registry = lib.mapAttrs (_: value: {flake = value;}) inputs; + + nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; + + settings = { + experimental-features = "nix-command flakes"; + auto-optimise-store = true; + }; + + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + }; + + system.stateVersion = stateVersion; + home-manager.users.${user} = { + home.username = user; + home.homeDirectory = "/home/${user}"; + home.stateVersion = stateVersion; + }; +} diff --git a/hosts/default.nix b/hosts/default.nix new file mode 100644 index 0000000..a5aace9 --- /dev/null +++ b/hosts/default.nix @@ -0,0 +1,32 @@ +{ inputs, lib, nixpkgs, nixpkgs-unstable, nurpkgs, home-manager, stateVersion }: +let + system = "x86_64-linux"; + pkgs = import nixpkgs { + inherit system; + }; + + pkgs-unstable = import nixpkgs-unstable { + inherit system; + }; + + lib = nixpkgs.lib; +in +{ + jonbox = lib.nixosSystem { + inherit system; + specialArgs = { + inherit inputs system pkgs-unstable nurpkgs stateVersion; + user = "jon"; + }; + modules = [ + { nixpkgs.overlays = [ nurpkgs.overlay ]; } + ./config.nix + ./jonbox + + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + } + ]; + }; +} diff --git a/hosts/jonbox/default.nix b/hosts/jonbox/default.nix new file mode 100644 index 0000000..ce5f4a3 --- /dev/null +++ b/hosts/jonbox/default.nix @@ -0,0 +1,43 @@ +{ config, lib, pkgs, stateVersion, ... }: + +{ + imports = [ + ./hardware.nix + ../../modules/hardware/bluetooth.nix + ../../modules/virt + ]; + + #Boot options + boot = { + loader = { + systemd-boot = { + enable = true; + configurationLimit = 8; + }; + efi.canTouchEfiVariables = true; + timeout = 5; + }; + kernelPackages = pkgs.linuxPackages_latest; + }; + + #Unfree-packages. + nixpkgs.config.allowUnfreePredicate = pkg: + builtins.elem (lib.getName pkg) [ + "nvidia-x11" + "nvidia-settings" + "nvidia-persistenced" + ]; + + #OpenGL + hardware.opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; + + #X11 Server + services.xserver.videoDrivers = [ "nvidia" ]; + + awesome.enable = true; + mullvad-vpn.enable = true; +} diff --git a/hosts/jonbox/filesystem.nix b/hosts/jonbox/filesystem.nix new file mode 100644 index 0000000..5b8ec2b --- /dev/null +++ b/hosts/jonbox/filesystem.nix @@ -0,0 +1,4 @@ +{ config, lib, pkgs, modulesPath, ... }: + +{ +} diff --git a/hosts/jonbox/hardware.nix b/hosts/jonbox/hardware.nix new file mode 100644 index 0000000..ce734fe --- /dev/null +++ b/hosts/jonbox/hardware.nix @@ -0,0 +1,65 @@ +{ config, lib, pkgs, modulesPath, ... }: +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") ]; + + boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + #Filesystems + fileSystems."/" = + { device = "/dev/disk/by-uuid/83cafaff-8be3-477f-b13c-c47dafdf969d"; + fsType = "btrfs"; + options = [ "subvol=@" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/40EA-5550"; + fsType = "vfat"; + }; + + fileSystems."/mnt/jonshare" = { + device = "homenas:/var/data/jon"; + fsType = "nfs"; + }; + + fileSystems."/mnt/plexshare" = { + device = "homenas:/var/data/plex"; + fsType = "nfs"; + }; + + fileSystems."/mnt/share" = { + device = "homenas:/var/data/shared"; + fsType = "nfs"; + }; + + swapDevices = + [ + { device = "/dev/disk/by-uuid/acfc7ea5-0787-4e05-bcf1-20b7adb0f35c"; } + ]; + + #SSD-optimization + services.fstrim.enable = true; + + #Hardware + hardware.nvidia = { + modesetting.enable = true; + powerManagement.enable = false; + powerManagement.finegrained = false; + open = true; + nvidiaSettings = true; + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + + #Firmware + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + + #Networking + networking.hostName = "jonbox"; + networking.useDHCP = lib.mkDefault true; + networking.networkmanager.enable = true; +} |