From 18276927d728725bef4d37a41225f4f61b948f76 Mon Sep 17 00:00:00 2001 From: xbazzi Date: Fri, 31 Jan 2025 20:52:00 -0700 Subject: [PATCH] Add sensible config at the expense of sanity. --- .gitignore | 3 + configuration.nix | 215 -------------------- cuda-fhs.nix => devenv/cuda-fhs.nix | 0 keybindings.json => devenv/keybindings.json | 0 flake.lock | 48 +++++ flake.nix | 81 ++++++++ home/bash.nix | 17 ++ home/default.nix | 17 ++ home/git.nix | 15 ++ home/home.nix | 34 ++++ home/kitty.nix | 42 ++++ home/neovim.nix | 28 +++ home/packages.nix | 11 + home/starship.nix | 21 ++ home/tmux.nix | 39 ++++ home/variables.nix | 27 +++ home/vim.nix | 26 +++ home/vscode.nix | 115 +++++++++++ home/zsh.nix | 59 ++++++ system/cachix.nix | 13 ++ system/cachix/cuda-maintainers.nix | 13 ++ system/configuration.nix | 115 +++++++++++ system/default.nix | 13 ++ system/hardware-configuration.nix | 41 ++++ system/net-drives.nix | 36 ++++ system/network.nix | 43 ++++ system/nvidia.nix | 39 ++++ system/packages.nix | 33 +++ system/services.nix | 7 + 29 files changed, 936 insertions(+), 215 deletions(-) create mode 100644 .gitignore delete mode 100644 configuration.nix rename cuda-fhs.nix => devenv/cuda-fhs.nix (100%) rename keybindings.json => devenv/keybindings.json (100%) create mode 100755 flake.lock create mode 100755 flake.nix create mode 100755 home/bash.nix create mode 100755 home/default.nix create mode 100644 home/git.nix create mode 100755 home/home.nix create mode 100755 home/kitty.nix create mode 100755 home/neovim.nix create mode 100755 home/packages.nix create mode 100755 home/starship.nix create mode 100755 home/tmux.nix create mode 100755 home/variables.nix create mode 100755 home/vim.nix create mode 100755 home/vscode.nix create mode 100755 home/zsh.nix create mode 100755 system/cachix.nix create mode 100755 system/cachix/cuda-maintainers.nix create mode 100755 system/configuration.nix create mode 100755 system/default.nix create mode 100755 system/hardware-configuration.nix create mode 100755 system/net-drives.nix create mode 100755 system/network.nix create mode 100755 system/nvidia.nix create mode 100755 system/packages.nix create mode 100755 system/services.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a04373f --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +nvf-stuff +config-nixvim +result diff --git a/configuration.nix b/configuration.nix deleted file mode 100644 index 9f967f5..0000000 --- a/configuration.nix +++ /dev/null @@ -1,215 +0,0 @@ -# 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/devenv/cuda-fhs.nix similarity index 100% rename from cuda-fhs.nix rename to devenv/cuda-fhs.nix diff --git a/keybindings.json b/devenv/keybindings.json similarity index 100% rename from keybindings.json rename to devenv/keybindings.json diff --git a/flake.lock b/flake.lock new file mode 100755 index 0000000..8f4422f --- /dev/null +++ b/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1738275749, + "narHash": "sha256-PM+cGduJ05EZ+YXulqAwUFjvfKpPmW080mcuN6R1POw=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "a8159195bfaef3c64df75d3b1e6a68d49d392be9", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1738142207, + "narHash": "sha256-NGqpVVxNAHwIicXpgaVqJEJWeyqzoQJ9oc8lnK9+WC4=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "9d3ae807ebd2981d593cddd0080856873139aa40", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100755 index 0000000..507db54 --- /dev/null +++ b/flake.nix @@ -0,0 +1,81 @@ +{ + description = "My system configuration"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + # nixvim = { + # url = "github:xbazzi/nixvim"; + # }; + + # nvf = { + # url = "github:notashelf/nvf"; + # inputs.nixpkgs.follows = "nixpkgs"; + # }; + + #stylix.url = "github:danth/stylix"; + + # nixvim = { + # url = "github:xbazzi/nixvim-config"; + # }; + }; + + outputs = { nixpkgs, ... }@inputs: + let + system = "x86_64-linux"; + pkgs = import nixpkgs { system = "x86_64-linux"; config = { allowUnfree = true; }; }; + # configModule = { + # # Add any custom options (and do feel free to upstream them!) + # # options = { ... }; + + # # config.vim = { + # # theme.enable = true; + # # # and more options as you see fit... + # # }; + # }; + + in + { + devShells.${system}.default = pkgs.mkShell { + buildInputs = [ + pkgs.neovim pkgs.vim + ]; + shellHook = '' + echo "hello" + ''; + }; + + nixosConfigurations = { + nixos = nixpkgs.lib.nixosSystem { + inherit system; + specialArgs = { inherit inputs; }; + modules = [ + ./system/default.nix + ]; + }; + }; + + homeConfigurations = { + "xbazzi@nixos" = inputs.home-manager.lib.homeManagerConfiguration { + inherit pkgs; + extraSpecialArgs = { inherit inputs; }; + modules = [ + ./home/default.nix + ]; + }; + }; + home-manager.useGlobalPkgs = true; + + home-manager.users.xbazzi = { + nixpkgs.config.allowUnfree = true; + #home.packages = [ + #]; + }; + #home-manager.extraSpecialArgs + }; +} diff --git a/home/bash.nix b/home/bash.nix new file mode 100755 index 0000000..e79390f --- /dev/null +++ b/home/bash.nix @@ -0,0 +1,17 @@ +{ + programs.bash = { + enable = true; + shellAliases = + let + flakePath = "~/nixos-config"; + in { + la = "ls -lath"; + lr = "ls -ltr"; + rebuild = "sudo nixos-rebuild switch --flake ${flakePath}"; + hms = "home-manager switch --flake ${flakePath}"; + vi = "vim"; + #config = "nvim ~/nix/configuration.nix"; + #homecfg = "nvim ~/nix/home.nix"; + }; + }; +} diff --git a/home/default.nix b/home/default.nix new file mode 100755 index 0000000..99581a1 --- /dev/null +++ b/home/default.nix @@ -0,0 +1,17 @@ +{ inputs, pkgs, lib, config, ... }: + +{ + imports = [ + ./home.nix + ./bash.nix + ./tmux.nix + ./starship.nix + #./vscode.nix + ./packages.nix + ./git.nix + ./zsh.nix + ./variables.nix + ./kitty.nix + ./neovim.nix + ]; +} diff --git a/home/git.nix b/home/git.nix new file mode 100644 index 0000000..2addd86 --- /dev/null +++ b/home/git.nix @@ -0,0 +1,15 @@ +{ inputs, pkgs, lib, config, ... }: + +{ + programs.git = { + enable = true; + userName = "xbazzi"; + userEmail = "codemaster@xbazzi.com"; + aliases = { + gs = "status"; + pu = "push"; + co = "checkout"; + cm = "commit"; + }; + }; +} diff --git a/home/home.nix b/home/home.nix new file mode 100755 index 0000000..b7d0664 --- /dev/null +++ b/home/home.nix @@ -0,0 +1,34 @@ +{ inputs, pkgs, lib, config, ... }: + +{ + home.username = "xbazzi"; + home.homeDirectory = "/home/xbazzi"; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + gtk = { + enable = true; + theme.name = "adw-gtk3"; + cursorTheme.name = "Bibata-Modern-Ice"; + iconTheme.name = "GruvboxPlus"; + }; + + # Home Manager is pretty good at managing dotfiles. The primary way to manage + # plain files is through 'home.file'. + home.file = { + #".p10k.zsh".text = builtins.readFile ./.p10k.zsh; + + # # Building this configuration will create a copy of 'dotfiles/screenrc' in + # # the Nix store. Activating the configuration will then make '~/.screenrc' a + # # symlink to the Nix store copy. + # ".screenrc".source = dotfiles/screenrc; + + # # You can also set the file content immediately. + # ".gradle/gradle.properties".text = '' + # org.gradle.console=verbose + # org.gradle.daemon.idletimeout=3600000 + # ''; + }; + + home.stateVersion = "24.11"; # Please read the comment before changing. +} diff --git a/home/kitty.nix b/home/kitty.nix new file mode 100755 index 0000000..5671ddf --- /dev/null +++ b/home/kitty.nix @@ -0,0 +1,42 @@ +{ inputs, pkgs, lib, config, ... }: + +{ + programs.kitty = lib.mkForce { + enable = true; + shellIntegration.enableZshIntegration = true; + settings = { + confirm_os_window_close = 0; + dynamic_background_opacity = true; + enable_audio_bell = false; + mouse_hide_wait = "-1.0"; + window_padding_width = 5; + background_opacity = "0.8"; + background_blur = 0; + themeFile = "Alucard"; + symbol_map = + let + mappings = [ + "U+23FB-U+23FE" + "U+2B58" + "U+E200-U+E2A9" + "U+E0A0-U+E0A3" + "U+E0B0-U+E0BF" + "U+E0C0-U+E0C8" + "U+E0CC-U+E0CF" + "U+E0D0-U+E0D2" + "U+E0D4" + "U+E700-U+E7C5" + "U+F000-U+F2E0" + "U+2665" + "U+26A1" + "U+F400-U+F4A8" + "U+F67C" + "U+E000-U+E00A" + "U+F300-U+F313" + "U+E5FA-U+E62B" + ]; + in + (builtins.concatStringsSep "," mappings) + " Symbols Nerd Font"; + }; + }; +} diff --git a/home/neovim.nix b/home/neovim.nix new file mode 100755 index 0000000..ad27643 --- /dev/null +++ b/home/neovim.nix @@ -0,0 +1,28 @@ +{ inputs, pkgs, lib, config, ... }: + +{ + programs.neovim ={ + enable = true; + defaultEditor = true; + #extraConfig = /home/nixxer/.config/nvim-javi/init.lua; + # extraConfig = '' + # set background=dark + # set shiftwidth=4 + # set showmatch + # set ignorecase + # set smartcase + # set incsearch + # set hlsearch + # set expandtab + # set rnu nu + # set tabstop=4 + # set mouse=a + # set laststatus=2 + # set nobackup + # set noswapfile + # set undofile + # let undodir=stdpath('data') .. '/undodir' + # set clipboard=unnamedplus + # ''; + }; +} diff --git a/home/packages.nix b/home/packages.nix new file mode 100755 index 0000000..aaf42e3 --- /dev/null +++ b/home/packages.nix @@ -0,0 +1,11 @@ +{ inputs, pkgs, lib, config, ... }: + +{ + home.packages = with pkgs; [ + hello + tmux + + #zsh-powerlevel10k + #inputs.nixvim.packages.${pkgs.system}.default + ]; +} diff --git a/home/starship.nix b/home/starship.nix new file mode 100755 index 0000000..6f183f6 --- /dev/null +++ b/home/starship.nix @@ -0,0 +1,21 @@ +{ + programs.starship = { + enable = true; + settings = { + username = { + style_user = "blue bold"; + style_root = "red bold"; + format = "[$user]($style) "; + disabled = false; + show_always = true; + }; + hostname = { + ssh_only = false; + ssh_symbol = "🌐 "; + format = "on [$hostname](bold red) "; + trim_at = ".local"; + disabled = false; + }; + }; + }; +} diff --git a/home/tmux.nix b/home/tmux.nix new file mode 100755 index 0000000..686bf0b --- /dev/null +++ b/home/tmux.nix @@ -0,0 +1,39 @@ +{ pkgs, config, ... }: +{ + programs.tmux = { + enable = true; + shortcut = "a"; + # aggressiveResize = true; -- Disabled to be iTerm-friendly + baseIndex = 1; + newSession = true; + # Stop tmux+escape craziness. + escapeTime = 0; + # Force tmux to use /tmp for sockets (WSL2 compat) + secureSocket = false; + + plugins = with pkgs; [ + tmuxPlugins.better-mouse-mode + ]; + + extraConfig = '' + # https://old.reddit.com/r/tmux/comments/mesrci/tmux_2_doesnt_seem_to_use_256_colors/ + set -g default-terminal "xterm-256color" + set -ga terminal-overrides ",*256col*:Tc" + set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q' + set-environment -g COLORTERM "truecolor" + + # Mouse works as expected + set-option -g mouse on + # easy-to-remember split pane commands + bind | split-window -h -c "#{pane_current_path}" + bind - split-window -v -c "#{pane_current_path}" + bind c new-window -c "#{pane_current_path}" + ''; + }; + + programs.tmate = { + enable = true; + # FIXME: This causes tmate to hang. + # extraConfig = config.xdg.configFile."tmux/tmux.conf".text; + }; +} diff --git a/home/variables.nix b/home/variables.nix new file mode 100755 index 0000000..8188257 --- /dev/null +++ b/home/variables.nix @@ -0,0 +1,27 @@ +{ inputs, pkgs, lib, config, ... }: + +{ + # Home Manager can also manage your environment variables through + # 'home.sessionVariables'. These will be explicitly sourced when using a + # shell provided by Home Manager. If you don't want to manage your shell + # through Home Manager then you have to manually source 'hm-session-vars.sh' + # located at either + # + # ~/.nix-profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # /etc/profiles/per-user/nixxer/etc/profile.d/hm-session-vars.sh + # + home.sessionVariables = { + EDITOR = "nvim"; + }; + + home.sessionPath = [ + "$HOME/.local/bin" + ]; +} diff --git a/home/vim.nix b/home/vim.nix new file mode 100755 index 0000000..958b9b1 --- /dev/null +++ b/home/vim.nix @@ -0,0 +1,26 @@ +{ inputs, pkgs, lib, config, ... }: + +{ + programs.vim = { + enable = true; + extraConfig = '' + set background=dark + set shiftwidth=4 + set showmatch + set ignorecase + set smartcase + set incsearch + set hlsearch + set expandtab + set rnu nu + syntax on + set tabstop=4 + set mouse=a + set laststatus=2 + set nobackup + set noswapfile + set undofile + set undodir=~/.vim/undodir + ''; + }; +} diff --git a/home/vscode.nix b/home/vscode.nix new file mode 100755 index 0000000..6f3c8c0 --- /dev/null +++ b/home/vscode.nix @@ -0,0 +1,115 @@ +{ inputs, pkgs, lib, config, ... }: + +{ + programs.vscode = { + enable = true; + #package = pkgs.vscode.fhs; + enableUpdateCheck = false; + enableExtensionUpdateCheck = false; + mutableExtensionsDir = true; + + # VSCode installation and extensions + extensions = (with pkgs.vscode-extensions; [ + golang.go + ms-vscode.cpptools + ms-vsliveshare.vsliveshare + bbenoist.nix + ms-python.python + laravel.vscode-laravel + ms-azuretools.vscode-docker + ms-vscode-remote.remote-ssh + vscodevim.vim + enkia.tokyo-night + + ]); + + # Settings + userSettings = { + # General + "editor.fontSize" = 13; + #"editor.fontFamily" = "'Jetbrains Mono', 'monospace', monospace"; + "terminal.integrated.fontSize" = 14; + "terminal.integrated.fontFamily" = "'JetBrainsMono Nerd Font', 'monospace', monospace"; + "window.zoomLevel" = 1; + "editor.multiCursorModifier" = "ctrlCmd"; + "workbench.startupEditor" = "none"; + "explorer.compactFolders" = false; + # Whitespace + "files.trimTrailingWhitespace" = true; + "files.trimFinalNewlines" = true; + "files.insertFinalNewline" = true; + "diffEditor.ignoreTrimWhitespace" = false; + # Git + "git.enableCommitSigning" = true; + "git-graph.repository.sign.commits" = true; + "git-graph.repository.sign.tags" = true; + "git-graph.repository.commits.showSignatureStatus" = true; + # Styling + "window.autoDetectColorScheme" = true; + "workbench.preferredDarkColorTheme" = "Default Dark Modern"; + "workbench.preferredLightColorTheme" = "Default Light Modern"; + "workbench.iconTheme" = "material-icon-theme"; + "material-icon-theme.activeIconPack" = "none"; + "material-icon-theme.folders.theme" = "classic"; + # Other + "telemetry.telemetryLevel" = "off"; + "update.showReleaseNotes" = false; + # # Gitmoji + # "gitmoji.onlyUseCustomEmoji" = true; + # "gitmoji.addCustomEmoji" = [ + # { + # "emoji" = "📦 NEW:"; + # "code" = ":package: NEW:"; + # "description" = "... Add new code/feature"; + # } + # { + # "emoji" = "👌 IMPROVE:"; + # "code" = ":ok_hand: IMPROVE:"; + # "description" = "... Improve existing code/feature"; + # } + # { + # "emoji" = "❌ REMOVE:"; + # "code" = ":x: REMOVE:"; + # "description" = "... Remove existing code/feature"; + # } + # { + # "emoji" = "🐛 FIX:"; + # "code" = ":bug: FIX:"; + # "description" = "... Fix a bug"; + # } + # { + # "emoji" = "📑 DOC:"; + # "code" = ":bookmark_tabs: DOC:"; + # "description" = "... Anything related to documentation"; + # } + # { + # "emoji" = "🤖 TEST:"; + # "code" = ":robot: TEST:"; + # "description" = "... Anything realted to tests"; + # } + # ]; + }; + # #vscode-extensions.hikarin522.glassit + # ] + # ++ pkgs.vscode-utils.extensionsfromvscodemarketplace [ + # { + # name = "remote-ssh-edit"; + # publisher = "ms-vscode-remote"; + # version = "0.47.2"; + # sha256 = "1hp6gjh4xp2m1xlm1jsdzxw9d8frkiidhph6nvl24d0h8z34w49g"; + # } + # { + # name = "vsliveshare"; + # publisher = "ms-vsliveshare"; + # version = "1.0.5948"; # replace with the latest version + # sha256 = "kou9zf5l6mtlu8z/l4xbwrl2x3uie15yghezjrkshgy="; # replace with the calculated hash + # } + # { + # name = "glassit"; + # publisher = "s-nlf-fh"; + # version = "0.2.6"; + # sha256 = "lcaomgk91hnjwqaw4i0fagtowr8kwv7zhvgcgkokkuy="; + # } + # ]; + }; +} diff --git a/home/zsh.nix b/home/zsh.nix new file mode 100755 index 0000000..756960d --- /dev/null +++ b/home/zsh.nix @@ -0,0 +1,59 @@ + +{ inputs, pkgs, lib, config, ... }: + +{ + programs.zsh = { + enable = true; + enableCompletion = true; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + initExtra = '' + bindkey -e + ''; + history.size = 10000; + history.ignoreAllDups = true; + history.path = "$HOME/.zsh_history"; + history.ignorePatterns = ["rm *" "pkill *" "cp *"]; + + shellAliases = + let + flakePath = "~/nix"; + in + { + ll = "ls -l"; + update = "sudo nixos-rebuild switch"; + la = "ls -lAth"; + lr = "ls -ltr"; + rebuild = "sudo nixos-rebuild switch --flake ${flakePath}"; + hms = "home-manager switch --flake ${flakePath}"; + config = "nvim ~/nix/configuration.nix"; + homecfg = "nvim ~/nix/home.nix"; + }; + # plugins = [ + # #{ + # # name = "powerlevel10k"; + # # src = pkgs.zsh-powerlevel10k; + # # file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; + # #} + # # { + # # name = "powerlevel10k-config"; + # # src = ./p10k-config; + # # file = ".p10k.zsh"; + # # } + # ]; + + #histSize = 10000; + # oh-my-zsh = { + # enable = true; + # plugins = [ "git" "thefuck" ]; + # theme = ""; + # }; + # zplug = { + # enable = true; + # plugins = [ + # { name = "zsh-users/zsh-autosuggestions"; } # Simple plugin installation + # #{ name = "romkatv/powerlevel10k"; tags = [ as:theme depth:1 ]; } # Installations with additional options. For the list of options, please refer to Zplug README. + # ]; + # }; + }; +} diff --git a/system/cachix.nix b/system/cachix.nix new file mode 100755 index 0000000..ecd2d39 --- /dev/null +++ b/system/cachix.nix @@ -0,0 +1,13 @@ + +# WARN: this file will get overwritten by $ cachix use +{ pkgs, lib, ... }: + +let + folder = ./cachix; + toImport = name: value: folder + ("/" + name); + filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key; + imports = lib.mapAttrsToList toImport (lib.filterAttrs filterCaches (builtins.readDir folder)); +in { + inherit imports; + nix.settings.substituters = ["https://cache.nixos.org/"]; +} diff --git a/system/cachix/cuda-maintainers.nix b/system/cachix/cuda-maintainers.nix new file mode 100755 index 0000000..b1d70d6 --- /dev/null +++ b/system/cachix/cuda-maintainers.nix @@ -0,0 +1,13 @@ + +{ + nix = { + settings = { + substituters = [ + "https://cuda-maintainers.cachix.org" + ]; + trusted-public-keys = [ + "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=" + ]; + }; + }; +} diff --git a/system/configuration.nix b/system/configuration.nix new file mode 100755 index 0000000..957fd50 --- /dev/null +++ b/system/configuration.nix @@ -0,0 +1,115 @@ +# 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 = + [ + ./hardware-configuration.nix + ]; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = 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 GNOME Desktop Environment. + services.xserver.displayManager.gdm.enable = true; + services.xserver.desktopManager.gnome.enable = true; + + # Configure keymap in X11 + services.xserver.xkb = { + layout = "us"; + variant = ""; + }; + + # Enable CUPS to print documents. + services.printing.enable = true; + + fonts.packages = with pkgs; [ + noto-fonts + noto-fonts-cjk-sans + noto-fonts-emoji + liberation_ttf + fira-code + fira-code-symbols + mplus-outline-fonts.githubRelease + dina-font + proggyfonts + ]; + + # Enable sound with pipewire. + services.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.libinput.enable = false; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.xbazzi = { + isNormalUser = true; + description = "Xander Bazzi"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; [ + # thunderbird + ]; + }; + + # 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; + + # 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 = "24.11"; # Did you read the comment? + +} diff --git a/system/default.nix b/system/default.nix new file mode 100755 index 0000000..b6dd491 --- /dev/null +++ b/system/default.nix @@ -0,0 +1,13 @@ +{ config, pkgs, ... }: + +{ + imports = + [ + ./configuration.nix + ./nvidia.nix + ./network.nix + ./net-drives.nix + ./packages.nix + ./services.nix + ]; +} diff --git a/system/hardware-configuration.nix b/system/hardware-configuration.nix new file mode 100755 index 0000000..a3dc2fd --- /dev/null +++ b/system/hardware-configuration.nix @@ -0,0 +1,41 @@ +# 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 = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/d1210185-1181-47af-bebc-1b07ce66ad82"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/3438-182C"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + 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.enp5s0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp6s0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp6s0d1.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/system/net-drives.nix b/system/net-drives.nix new file mode 100755 index 0000000..665329b --- /dev/null +++ b/system/net-drives.nix @@ -0,0 +1,36 @@ + +{ config, pkgs, ... }: + +{ + # fileSystems."/mnt/media" = { + # device = "nas.lan.xbazzi.com:/mnt/ALEXANDRIA/media"; + # fsType = "nfs"; + # }; + + fileSystems."/mnt/os-images" = { + device = "nas.lan.xbazzi.com:/mnt/ALEXANDRIA/os-images"; + fsType = "nfs"; + options = [ + "rw" + "vers=4" + ]; + }; + + fileSystems."/mnt/media" = { + device = "nas.lan.xbazzi.com:/mnt/ALEXANDRIA/media"; + fsType = "nfs"; + options = [ + "rw" + "vers=4" + ]; + }; + + fileSystems."/mnt/school" = { + device = "nas.lan.xbazzi.com:/mnt/ALEXANDRIA/school"; + fsType = "nfs"; + options = [ + "rw" + "vers=4" + ]; + }; +} diff --git a/system/network.nix b/system/network.nix new file mode 100755 index 0000000..aa73ef9 --- /dev/null +++ b/system/network.nix @@ -0,0 +1,43 @@ +{ inputs, config, pkgs, ... }: +{ + # Enable networking + networking.networkmanager.enable = true; + + + systemd.services."NetworkManager-wait-online" = { + serviceConfig.TimeoutStartSec = "20s"; + }; + + networking = { + hostName = "nixos"; + wireless.enable = false; + interfaces.enp6s0d1 = { + ipv4.addresses = [{ + address = "10.29.90.110"; + prefixLength = 22; + }]; + }; + nameservers = [ "10.29.90.1" "10.133.7.1" ]; + search = [ "lan.xbazzi.com" ]; + + defaultGateway = { + address = "10.29.90.1"; + interface = "enp6s0d1"; + }; + + hosts = { + "127.0.0.1" = [ "localhost" ]; + "10.29.90.110" = [ "nixos" "nixos.lan.xbazzi.com" ]; + }; + }; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; +} diff --git a/system/nvidia.nix b/system/nvidia.nix new file mode 100755 index 0000000..a1bc5f9 --- /dev/null +++ b/system/nvidia.nix @@ -0,0 +1,39 @@ +{ inputs, config, pkgs, ... }: + +{ + # 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; + }; + + # Nvidia driver for X + services.xserver.videoDrivers = [ "nvidia" ]; +} diff --git a/system/packages.nix b/system/packages.nix new file mode 100755 index 0000000..d18d37e --- /dev/null +++ b/system/packages.nix @@ -0,0 +1,33 @@ +{ config, pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + vim + wget + xournalpp + obsidian + libreoffice-qt + hunspell + hunspellDicts.en_US + kitty + git + fastfetch + wget + discord-canary + cudaPackages_12.cudatoolkit + python3 + gimp + vlc + xclip + gparted + htop + ]; + + # Install firefox. + programs.noisetorch.enable = true; + + # Install firefox. + programs.firefox.enable = true; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; +} diff --git a/system/services.nix b/system/services.nix new file mode 100755 index 0000000..3cbc066 --- /dev/null +++ b/system/services.nix @@ -0,0 +1,7 @@ + +{ config, pkgs, ... }: + +{ + # Enable the OpenSSH daemon. + #services.openssh.enable = true; +}