From f0a58a383c00733d183a22d82e460a92215e891f Mon Sep 17 00:00:00 2001 From: Xander Bazzi Date: Tue, 21 May 2024 18:44:51 -0600 Subject: [PATCH] Initial commit :rocket: --- README.md | 2 +- configuration.nix | 215 ++++++++++++++++++++++++++++++++++++++++++++++ cuda-fhs.nix | 34 ++++++++ keybindings.json | 158 ++++++++++++++++++++++++++++++++++ 4 files changed, 408 insertions(+), 1 deletion(-) create mode 100644 configuration.nix create mode 100644 cuda-fhs.nix create mode 100644 keybindings.json diff --git a/README.md b/README.md index 8981548..bbfdf74 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # nixos-config -My NixOS declarative configuration files. +Public repo to host my NixOS declarative configuration files. I might also throw in the occasional FHS environments for development. \ No newline at end of file diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..9f967f5 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,215 @@ +# 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, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ./cachix.nix + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "nixos"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "America/Denver"; + + # Select internationalisation properties. + 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"; + }; + + # Enable the X11 windowing system. + services.xserver.enable = true; + + # Enable the KDE Plasma Desktop Environment. + services.xserver.displayManager.sddm.enable = true; + services.xserver.desktopManager.plasma5.enable = true; + + # Configure keymap in X11 + services.xserver = { + layout = "us"; + xkbVariant = ""; + }; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound with pipewire. + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # If you want to use JACK applications, uncomment this + #jack.enable = true; + + # use the example session manager (no others are packaged yet so this is enabled by default, + # no need to redefine it in your config for now) + #media-session.enable = true; + }; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.nixxer = { + isNormalUser = true; + description = "nixxer"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; [ + kate + # thunderbird + ]; + }; + + + # Install firefox. + programs.firefox.enable = true; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + programs.steam = { + enable = true; + remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play + dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server + }; + + # List packages installed in system profile. To search, run: + # $ nix _12_3search wget + environment.systemPackages = with pkgs; [ + git + neovim + fastfetch + wget + discord-canary + pavucontrol + cudaPackages_12.cudatoolkit + python3 + + + # VSCode installation and extensions + (vscode-with-extensions.override { + vscodeExtensions = with vscode-extensions; [ + ms-vscode.cpptools + bbenoist.nix + ms-python.python + ms-azuretools.vscode-docker + ms-vscode-remote.remote-ssh + vscode-extensions.vscodevim.vim + vscode-extensions.enkia.tokyo-night + + #vscode-extensions.hikarin522.glassit + ] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [ + { + name = "remote-ssh-edit"; + publisher = "ms-vscode-remote"; + version = "0.47.2"; + sha256 = "1hp6gjh4xp2m1xlm1jsdzxw9d8frkiidhph6nvl24d0h8z34w49g"; + } + { + name = "glassit"; + publisher = "s-nlf-fh"; + version = "0.2.6"; + sha256 = "LcAomgK91hnJWqAW4I0FAgTOwr8Kwv7ZhvGCgkokKuY="; + } + ]; + }) + ]; + + # NVIDIA stuff + hardware.nvidia = { + + # Modesetting is required. + modesetting.enable = true; + + # Nvidia power management. Experimental, and can cause sleep/suspend to fail. + # Enable this if you have graphical corruption issues or application crashes after waking + # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead + # of just the bare essentials. + powerManagement.enable = false; + + # Fine-grained power management. Turns off GPU when not in use. + # Experimental and only works on modern Nvidia GPUs (Turing or newer). + powerManagement.finegrained = false; + + # Use the NVidia open source kernel module (not to be confused with the + # independent third-party "nouveau" open source driver). + # Support is limited to the Turing and later architectures. Full list of + # supported GPUs is at: + # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus + # Only available from driver 515.43.04+ + # Currently alpha-quality/buggy, so false is currently the recommended setting. + open = false; + + # Enable the Nvidia settings menu, + # accessible via `nvidia-settings`. + nvidiaSettings = true; + + # Optionally, you may need to select the appropriate driver version for your specific GPU. + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + + hardware.pulseaudio.package = pkgs.pulseaudioFull; + hardware.pulseaudio.extraModules = [ pkgs.pulseaudio-modules-bt ]; + + # Nvidia driver for X + services.xserver.videoDrivers = [ "nvidia" ]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "23.11"; # Did you read the comment? + +} diff --git a/cuda-fhs.nix b/cuda-fhs.nix new file mode 100644 index 0000000..d0a9f9e --- /dev/null +++ b/cuda-fhs.nix @@ -0,0 +1,34 @@ +# Run with `nix-shell cuda-fhs.nix` +{ pkgs ? import {} }: +(pkgs.buildFHSUserEnv { + name = "cuda-env"; + targetPkgs = pkgs: with pkgs; [ + git + gitRepo + gnupg + autoconf + curl + procps + gnumake + util-linux + m4 + gperf + unzip + cudaPackages_12.cudatoolkit + linuxPackages.nvidia_x11 + libGLU libGL + xorg.libXi xorg.libXmu freeglut + xorg.libXext xorg.libX11 xorg.libXv xorg.libXrandr zlib + ncurses5 + stdenv.cc + binutils + ]; + multiPkgs = pkgs: with pkgs; [ zlib ]; + runScript = "bash"; + profile = '' + export CUDA_PATH=${pkgs.cudatoolkit} + # export LD_LIBRARY_PATH=${pkgs.linuxPackages.nvidia_x11}/lib + export EXTRA_LDFLAGS="-L/lib -L${pkgs.linuxPackages.nvidia_x11}/lib" + export EXTRA_CCFLAGS="-I/usr/include" + ''; +}).env \ No newline at end of file diff --git a/keybindings.json b/keybindings.json new file mode 100644 index 0000000..5b2f30c --- /dev/null +++ b/keybindings.json @@ -0,0 +1,158 @@ +// Place your key bindings in this file to override the defaults +[// Place your key bindings in this file to override the defaults + + { + + "key": "ctrl+shift+alt+k", + + "command": "workbench.action.terminal.resizePaneUp" + + }, + + { + + "key": "ctrl+shift+alt+j", + + "command": "workbench.action.terminal.resizePaneDown" + + }, + + { + + "key": "ctrl+p", + + "command": "-workbench.action.quickOpen" + + }, + + { + + "key": "ctrl+shift+w", + + "command": "-workbench.action.closeWindow" + + }, + + { + + "key": "ctrl+shift+alt+down", + + "command": "workbench.action.terminal.switchTerminal" + + }, + + { + + "key": "ctrl+f", + + "command": "-actions.find", + + "when": "editorFocus || editorIsOpen" + + }, + + { + + "key": "ctrl+shift+f", + + "command": "-workbench.action.terminal.searchWorkspace", + + "when": "terminalFocus && terminalProcessSupported && terminalTextSelected" + + }, + + { + + "key": "ctrl+shift+f", + + "command": "workbench.action.terminal.focusFind", + + "when": "terminalFindFocused && terminalHasBeenCreated || terminalFindFocused && terminalProcessSupported || terminalFocusInAny && terminalHasBeenCreated || terminalFocusInAny && terminalProcessSupported" + + }, + + { + + "key": "ctrl+f", + + "command": "-workbench.action.terminal.focusFind", + + "when": "terminalFindFocused && terminalHasBeenCreated || terminalFindFocused && terminalProcessSupported || terminalFocusInAny && terminalHasBeenCreated || terminalFocusInAny && terminalProcessSupported" + + }, + + { + + "key": "ctrl+e", + + "command": "workbench.action.quickOpen", + + "when": "editorTextFocus" + + }, + + { + + "key": "ctrl+e", + + "command": "-workbench.action.quickOpen" + + }, + + { + + "key": "ctrl+shift+left", + + "command": "workbench.action.decreaseViewSize" + + }, + + { + + "key": "ctrl+shift+right", + + "command": "workbench.action.increaseViewSize" + + }, + + { + + "key": "alt+h", + + "command": "workbench.action.terminal.focusPreviousPane", + + "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" + + }, + + { + + "key": "alt+left", + + "command": "-workbench.action.terminal.focusPreviousPane", + + "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" + + }, + + { + + "key": "alt+l", + + "command": "workbench.action.terminal.focusNextPane", + + "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" + + }, + + { + + "key": "alt+right", + + "command": "-workbench.action.terminal.focusNextPane", + + "when": "terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" + + } + +] \ No newline at end of file