diff --git a/boxes/copernicus/default.nix b/boxes/copernicus/default.nix new file mode 100644 index 0000000..649ffc1 --- /dev/null +++ b/boxes/copernicus/default.nix @@ -0,0 +1,86 @@ +{ lib, config, pkgs, ...}: + +{ + imports = [ + ./hardware-configuration.nix + ./nvidia.nix + ../../modules/ssh-phone-home.nix + ../../modules/hosts.nix + ../../modules/bootstrap.nix + ../../modules/common.nix + ../../modules/x11.nix + ../../modules/discord.nix +# ../../modules/gaming.nix + ../../modules/rbw.nix + ]; + + virtualisation.docker.enable = true; + + + users.users.usr.extraGroups = [ + "docker" + ]; + + environment.systemPackages = with pkgs; [ + wine + xdotool + + qemu + virt-manager + libreoffice + nomacs + vscodium + thunderbird + libreoffice + texliveMedium + ledger + ]; + + services.hardware.bolt.enable = true; # thunderbolt support + hardware.bluetooth = { + enable = true; + settings = { + General = { + Enable = "Source,Sink,Media,Socket"; + ControllerMode = "bredr"; + }; + }; + }; + + boot.loader = { + efi = { + canTouchEfiVariables = true; + efiSysMountPoint = "/boot"; + }; + grub = { + efiSupport = true; + device = "nodev"; + }; + }; + + services.printing.enable = true; + services.avahi.enable = true; # runs the Avahi daemon + services.avahi.nssmdns4 = true; # enables the mDNS NSS plug-in + services.avahi.openFirewall = true; # opens the firewall for UDP port 5353 + + powerManagement.cpuFreqGovernor = "performance"; + + nixpkgs.config.allowUnfree = true; + networking = { + hostName = "copernicus"; + firewall = { + enable = true; + allowedTCPPorts = [ 6000 ]; + allowedTCPPortRanges = [ + { from = 1714; to = 1764; } # KDE Connect + ]; + allowedUDPPortRanges = [ + { from = 1714; to = 1764; } # KDE Connect + ]; + }; + }; + + programs.kdeconnect.enable = true; + + system.stateVersion = "24.05"; # don't change this, lol +} diff --git a/boxes/copernicus/hardware-configuration.nix b/boxes/copernicus/hardware-configuration.nix new file mode 100644 index 0000000..8758230 --- /dev/null +++ b/boxes/copernicus/hardware-configuration.nix @@ -0,0 +1,40 @@ +# 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 = [ "vmd" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/8182bde6-7213-4108-9dbf-951f76870207"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/0D21-265A"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/fc5366cc-2cec-415e-85dd-7c01a4e4fb4f"; } + ]; + + # 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.eno1.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/boxes/copernicus/home.nix b/boxes/copernicus/home.nix new file mode 100644 index 0000000..8c118a1 --- /dev/null +++ b/boxes/copernicus/home.nix @@ -0,0 +1,10 @@ +{ lib, inputs, config, pkgs, home, ... }: + +{ + imports = [ + ../../home/x11.nix + ../../home/chromium + ]; + + home.stateVersion = "23.11"; +} diff --git a/boxes/copernicus/nvidia.nix b/boxes/copernicus/nvidia.nix new file mode 100644 index 0000000..dbde58e --- /dev/null +++ b/boxes/copernicus/nvidia.nix @@ -0,0 +1,39 @@ +{ config, lib, pkgs, ... }: +{ + # Make sure opengl is enabled + hardware.opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; + + environment.systemPackages = with pkgs; [ + glxinfo + ]; + + # Tell Xorg to use the nvidia driver (also valid for Wayland) + services.xserver.videoDrivers = ["nvidia"]; + + hardware.nvidia = { + + # Modesetting is needed for most Wayland compositors + modesetting.enable = true; + + # Use the open source version of the kernel module + # Only available on driver 515.43.04+ + open = false; + + # Enable the nvidia settings menu + nvidiaSettings = true; + + # Optionally, you may need to select the appropriate driver version for your specific GPU. + package = config.boot.kernelPackages.nvidiaPackages.stable; + + prime = { + sync.enable = true; + + intelBusId = "PCI:0:2:0"; + nvidiaBusId = "PCI:1:0:0"; + }; + }; +} diff --git a/builds/utils.nix b/builds/utils.nix index a6f766f..232bf97 100644 --- a/builds/utils.nix +++ b/builds/utils.nix @@ -20,6 +20,7 @@ , xkbset , rbw , xclip +, xmessage }: stdenv.mkDerivation rec { @@ -29,7 +30,7 @@ stdenv.mkDerivation rec { src = ./utils; nativeBuildInputs = [ makeWrapper ]; - buildInputs = [ bash feh xrandr jq curl fzy ytfzf sshuttle svkbd scrcpy rbw xclip ffcast xkbset ]; + buildInputs = [ bash feh xrandr jq curl fzy ytfzf sshuttle svkbd scrcpy rbw xclip ffcast xkbset xmessage ]; installPhase = '' mkdir -p $out/bin @@ -37,7 +38,7 @@ stdenv.mkDerivation rec { for i in $(ls $src/); do cp $src/$i $out/bin ln -sf $out/bin/tmenu_run $out/bin/regenerate - wrapProgram $out/bin/$i --prefix PATH : ${lib.makeBinPath [ sxhkd bash feh xrandr jq figlet curl fzy xkbset ytfzf sshuttle svkbd scrcpy xrectsel ffcast ]} + wrapProgram $out/bin/$i --prefix PATH : ${lib.makeBinPath [ sxhkd bash feh xrandr jq figlet curl fzy xkbset ytfzf sshuttle svkbd scrcpy xrectsel ffcast xmessage ]} done ''; } diff --git a/builds/utils/disp b/builds/utils/disp index 62735f2..03a5b5b 100755 --- a/builds/utils/disp +++ b/builds/utils/disp @@ -142,6 +142,23 @@ case "$(hostname)" in ;; esac ;; + "copernicus") + xinput set-prop 'INSTANT USB GAMING MOUSE ' 'libinput Accel Speed' -1 + xrandr --output HDMI-0 --primary --mode 1920x1080 --rate 180 --pos 1920x0 --rotate normal \ + --output DP-0 --mode 1920x1080 --pos 0x0 --rate 180 --rotate normal \ + --output DP-1 --off \ + --output DP-2 --off \ + --output DP-3 --off \ + --output DP-4 --off \ + --output DP-5 --off \ + --output DP-1-1 --off \ + --output HDMI-1-1 --off \ + --output HDMI-1-2 --off \ + --output DP-1-2 --mode 1920x1080 --pos 3840x0 --rotate normal + bspc monitor DP-0 -d 1 3 5 7 + bspc monitor HDMI-0 -d 2 4 6 8 + bspc monitor DP-1-2 -d 9 + ;; esac # initial post-wm setup @@ -149,4 +166,3 @@ keyboard statusbar start_statusbars set_walls screensaver - diff --git a/builds/utils/tmenu_run b/builds/utils/tmenu_run index 695e6b5..7884659 100755 --- a/builds/utils/tmenu_run +++ b/builds/utils/tmenu_run @@ -9,10 +9,11 @@ tmenu_path () { done } -if [ "$1" = "-g" ] || [ "$(basename $0)" = "regenerate" ]; then +if [ "$(basename $0)" = "regenerate" ]; then mkdir -p $HOME/.local/share tmenu_path > $HOME/.local/share/tmenu_cache xmessage "regeneration complete" + exit else cat $HOME/.local/share/tmenu_cache | tmenu | ${SHELL:-"/bin/sh"} & fi diff --git a/flake.nix b/flake.nix index 8e01315..aac774c 100644 --- a/flake.nix +++ b/flake.nix @@ -94,6 +94,20 @@ } ]; }; + copernicus = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ + ./boxes/copernicus + + home-manager.nixosModules.home-manager { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { inherit inputs; }; + home-manager.users.usr = import ./boxes/copernicus/home.nix; + } + ]; + }; virtbox = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { inherit inputs; };