commit d307dc9186d7cd747df88a9b0a97c8f6faec209f Author: Uzair Mohammed Date: Tue Nov 12 14:29:05 2024 -0800 Initial commit diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e701a1f --- /dev/null +++ b/flake.lock @@ -0,0 +1,253 @@ +{ + "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1719994518, + "narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_2" + }, + "locked": { + "lastModified": 1717285511, + "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1731235328, + "narHash": "sha256-NjavpgE9/bMe/ABvZpyHIUeYF1mqR5lhaep3wB79ucs=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "60bb110917844d354f3c18e05450606a435d2d10", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "master", + "repo": "home-manager", + "type": "github" + } + }, + "nixos-cli": { + "inputs": { + "flake-compat": "flake-compat", + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "zig-deps-fod": "zig-deps-fod" + }, + "locked": { + "lastModified": 1724973941, + "narHash": "sha256-P4phJQjwMhxSxpdQN1PRJMo5ZRsOtt1zCcs0ocvTDFE=", + "owner": "water-sucks", + "repo": "nixos", + "rev": "0f1ba045c8029fd7c54e65e399b826fd119f0a34", + "type": "github" + }, + "original": { + "owner": "water-sucks", + "repo": "nixos", + "type": "github" + } + }, + "nixos-hardware": { + "locked": { + "lastModified": 1731332224, + "narHash": "sha256-0ctfVp27ingWtY7dbP5+QpSQ98HaOZleU0teyHQUAw0=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "184687ae1a3139faa4746168baf071f60d0310c8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixos-hardware", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1721970117, + "narHash": "sha256-Hwm46lggqtihMaRuxbNaC1ACcU2a0jO/HXqrdjMatXk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "733453ac54a40997a6a690b60f3942d79560247c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1719876945, + "narHash": "sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz" + } + }, + "nixpkgs-lib_2": { + "locked": { + "lastModified": 1717284937, + "narHash": "sha256-lIbdfCsf8LMFloheeE6N31+BMIeixqyQWbSr2vk79EQ=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/eb9ceca17df2ea50a250b6b27f7bf6ab0186f198.tar.gz" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1718428119, + "narHash": "sha256-WdWDpNaq6u1IPtxtYHHWpl5BmabtpmLnMAx0RdJ/vo8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e6cea36f83499eb4e9cd184c8a8e823296b50ad5", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1731139594, + "narHash": "sha256-IigrKK3vYRpUu+HEjPL/phrfh7Ox881er1UEsZvw9Q4=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "76612b17c0ce71689921ca12d9ffdc9c23ce40b2", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixos-cli": "nixos-cli", + "nixos-hardware": "nixos-hardware", + "nixpkgs": "nixpkgs_3", + "spicetify-nix": "spicetify-nix" + } + }, + "spicetify-nix": { + "inputs": { + "flake-compat": "flake-compat_2", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1731298576, + "narHash": "sha256-l2m0LcSohbU7FXhdlJC/jbxt9PEvFfIcdEXQdSzbvL4=", + "owner": "Gerg-L", + "repo": "spicetify-nix", + "rev": "c503d1e7521af93013b6253a5f4899ea62a3c5a3", + "type": "github" + }, + "original": { + "owner": "Gerg-L", + "repo": "spicetify-nix", + "type": "github" + } + }, + "zig-deps-fod": { + "inputs": { + "flake-parts": "flake-parts_2", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1720999842, + "narHash": "sha256-9G/mlNIbamhnTs1VGB0RlU+JcJGHw5bN0D9BcnQf+DM=", + "owner": "water-sucks", + "repo": "zig-deps-fod", + "rev": "f0a57cdf06f2100d7a045a4062592aeb89468868", + "type": "github" + }, + "original": { + "owner": "water-sucks", + "repo": "zig-deps-fod", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..2aa7f9b --- /dev/null +++ b/flake.nix @@ -0,0 +1,72 @@ +{ + description = "NixOS Configuration"; + + inputs = { + nixpkgs = { + url = "github:nixos/nixpkgs?ref=nixos-unstable"; + }; + + spicetify-nix = { + url = "github:Gerg-L/spicetify-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + home-manager = { + url = "github:nix-community/home-manager/master"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + #minegrub-world-sel-theme = { + # url = "github:Lxtharia/minegrub-world-sel-theme"; + #}; + + nixos-hardware = { + url = "github:NixOS/nixos-hardware/master"; + }; + + nixos-cli = { + url = "github:water-sucks/nixos"; + }; + }; + + outputs = { + self, + nixpkgs, + home-manager, + spicetify-nix, + nixos-hardware, + nixos-cli, + ... + } @ inputs: let + lib = nixpkgs.lib; + in { + nixosConfigurations = { + nixos = lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = {inherit inputs;}; + modules = [ + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.backupFileExtension = "backup"; + + home-manager.users.uzair = { + imports = [ + ./home/home.nix + ]; + }; + } + + #inputs.minegrub-world-sel-theme.nixosModules.default + + nixos-hardware.nixosModules.dell-precision-5530 + + nixos-cli.nixosModules.nixos-cli + + ./system + ]; + }; + }; + }; +} diff --git a/home/desktop/default.nix b/home/desktop/default.nix new file mode 100644 index 0000000..75819d0 --- /dev/null +++ b/home/desktop/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./edge.nix + ./spotify.nix + ]; +} diff --git a/home/desktop/edge.nix b/home/desktop/edge.nix new file mode 100644 index 0000000..30952e7 --- /dev/null +++ b/home/desktop/edge.nix @@ -0,0 +1,11 @@ +{ + # Override Edge entry to always launch with Wayland + xdg.desktopEntries.microsoft-edge = { + name = "Microsoft Edge"; + genericName = "Web Browser"; + exec = "microsoft-edge --enable-features=UseOzonePlatform --ozone-platform=wayland %U"; + categories = [ "Network" "WebBrowser" ]; + mimeType = ["application/pdf" "application/rdf+xml" "application/rss+xml" "application/xhtml+xml" "application/xhtml_xml" "application/xml" "image/gif" "image/jpeg" "image/png" "image/webp" "text/html" "text/xml" "x-scheme-handler/http" "x-scheme-handler/https"]; + icon = "microsoft-edge"; + }; +} diff --git a/home/desktop/spotify.nix b/home/desktop/spotify.nix new file mode 100644 index 0000000..664b500 --- /dev/null +++ b/home/desktop/spotify.nix @@ -0,0 +1,12 @@ +{ + # Override Spotify entry to always launch with Wayland + xdg.desktopEntries.spotify = { + name = "Spotify"; + genericName = "Music Player"; + icon = "spotify-client"; + exec = "spotify --enable-features=UseOzonePlatform --ozone-platform=wayland %U"; + terminal = false; + mimeType = [ "x-scheme-handler/spotify" ]; + categories = [ "Audio" "Music" "Player" "AudioVideo" ]; + }; +} diff --git a/home/home.nix b/home/home.nix new file mode 100644 index 0000000..eb0bc73 --- /dev/null +++ b/home/home.nix @@ -0,0 +1,85 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ./modules/default.nix + ./desktop/default.nix + ]; + + # Home Manager needs a bit of information about you and the paths it should + # manage. + home.username = "uzair"; + home.homeDirectory = "/home/uzair"; + + # This value determines the Home Manager release that your configuration is + # compatible with. This helps avoid breakage when a new Home Manager release + # introduces backwards incompatible changes. + # + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + home.stateVersion = "23.11"; # Please read the comment before changing. + + # The home.packages option allows you to install Nix packages into your + # environment. + home.packages = [ + # # Adds the 'hello' command to your environment. It prints a friendly + # # "Hello, world!" when run. + # pkgs.hello + + # # It is sometimes useful to fine-tune packages, for example, by applying + # # overrides. You can do that directly here, just don't forget the + # # parentheses. Maybe you want to install Nerd Fonts with a limited number of + # # fonts? + # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) + + # # You can also create simple shell scripts directly inside your + # # configuration. For example, this adds a command 'my-hello' to your + # # environment: + # (pkgs.writeShellScriptBin "my-hello" '' + # echo "Hello, ${config.home.username}!" + # '') + ]; + + # Home Manager is pretty good at managing dotfiles. The primary way to manage + # plain files is through 'home.file'. + home.file = { + # # 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 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/uzair/etc/profile.d/hm-session-vars.sh + # + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + # Stuff for virtualization + dconf.settings = { + "org/virt-manager/virt-manager/connections" = { + autoconnect = ["qemu:///system"]; + uris = ["qemu:///system"]; + }; + }; +} diff --git a/home/modules/browsers.nix b/home/modules/browsers.nix new file mode 100644 index 0000000..d2923a1 --- /dev/null +++ b/home/modules/browsers.nix @@ -0,0 +1,7 @@ + { pkgs, ... }: + { + home.packages = with pkgs; [ + firefox-bin + microsoft-edge + ]; + } diff --git a/home/modules/default.nix b/home/modules/default.nix new file mode 100644 index 0000000..4743603 --- /dev/null +++ b/home/modules/default.nix @@ -0,0 +1,12 @@ +{ + imports = [ + ./git.nix + ./shellConfig.nix + ./devStuff.nix + ./socials.nix + ./misc.nix + ./browsers.nix + ./productivity.nix + ./media.nix + ]; +} diff --git a/home/modules/devStuff.nix b/home/modules/devStuff.nix new file mode 100644 index 0000000..a9114e3 --- /dev/null +++ b/home/modules/devStuff.nix @@ -0,0 +1,128 @@ +{pkgs, ...}: { + home.sessionVariables = { + EDITOR = "hx"; + ELECTRON_OZONE_PLATFORM_HINT = "wayland"; + NIXOS_CONFIG = "/home/uzair/Documents/nixos-config"; + }; + + programs.neovim = let + toLua = str: "lua << EOF\n${str}\nEOF\n"; + toLuaFile = file: "lua << EOF\n${builtins.readFile file}\nEOF\n"; + in { + enable = true; + plugins = with pkgs.vimPlugins; [ + nvim-cmp + neoformat + rustaceanvim + telescope-fzf-native-nvim + cmp_luasnip + cmp-nvim-lsp + luasnip + friendly-snippets + nvim-web-devicons + vim-nix + copilot-vim + + { + plugin = nvim-lspconfig; + config = toLuaFile ./nvimPlugins/lsp.lua; + } + + { + plugin = comment-nvim; + config = toLua "require(\"Comment\").setup()"; + } + + { + plugin = catppuccin-nvim; + config = "colorscheme catppuccin-mocha"; + } + + { + plugin = telescope-nvim; + config = toLuaFile ./nvimPlugins/telescope.lua; + } + + { + plugin = nvim-cmp; + config = toLuaFile ./nvimPlugins/cmp.lua; + } + + { + plugin = lualine-nvim; + config = toLuaFile ./nvimPlugins/lualine.lua; + } + + { + plugin = trouble-nvim; + # config = toLuaFile ./nvimPlugins/trouble.lua; + } + + { + plugin = nvim-tree-lua; + config = toLuaFile ./nvimPlugins/tree.lua; + } + + { + plugin = nvim-treesitter.withPlugins (p: [ + p.tree-sitter-nix + p.tree-sitter-vim + p.tree-sitter-bash + p.tree-sitter-json + p.tree-sitter-yaml + p.tree-sitter-typescript + p.tree-sitter-toml + p.tree-sitter-sql + p.tree-sitter-rust + p.tree-sitter-markdown + p.tree-sitter-make + p.tree-sitter-java + p.tree-sitter-kotlin + p.tree-sitter-html + p.tree-sitter-fish + p.tree-sitter-css + p.tree-sitter-cpp + p.tree-sitter-cmake + p.tree-sitter-c-sharp + p.tree-sitter-c + ]); + config = toLuaFile ./nvimPlugins/treesitter.lua; + } + ]; + + extraLuaConfig = '' + ${builtins.readFile ./nvimPlugins/other.lua} + ''; + + extraPackages = with pkgs; [ + wl-clipboard + ripgrep + ]; + }; + + programs.helix = { + enable = true; + }; + + home.packages = with pkgs; [ + # GUI code editors + kdePackages.kate + vscode.fhs + + # Utilities + wget + unzip + + # IDE + jetbrains.idea-ultimate + + # nix language server + nixd + + # nix formatter + alejandra + + # something for fish lol + fasd + ]; +} diff --git a/home/modules/git.nix b/home/modules/git.nix new file mode 100644 index 0000000..f1a13fe --- /dev/null +++ b/home/modules/git.nix @@ -0,0 +1,21 @@ +{ pkgs, ... }: +{ + # Enable and configure Git + programs.git = { + enable = true; + aliases = { + s = "status"; + }; + userName = "Uzair Mohammed"; + userEmail = "uzair.hamed@gmail.com"; + extraConfig = { +# credential.helper = "oauth"; + credential.credentialStore = "cache"; + init.defaultBranch = "master"; + }; + }; + + programs.git-credential-oauth = { + enable = true; + }; +} diff --git a/home/modules/media.nix b/home/modules/media.nix new file mode 100644 index 0000000..ee416bc --- /dev/null +++ b/home/modules/media.nix @@ -0,0 +1,18 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + nicotine-plus + ]; + + programs.mpv.enable = true; + + programs.obs-studio = { + enable = true; + plugins = with pkgs; [ + obs-studio-plugins.obs-pipewire-audio-capture + obs-studio-plugins.obs-backgroundremoval + obs-studio-plugins.input-overlay + obs-studio-plugins.obs-vaapi + ]; + }; +} diff --git a/home/modules/misc.nix b/home/modules/misc.nix new file mode 100644 index 0000000..6d07f81 --- /dev/null +++ b/home/modules/misc.nix @@ -0,0 +1,20 @@ +{pkgs, ...}: { + home.packages = with pkgs; [ + kdePackages.kdenlive + kdePackages.kget + kdePackages.kalgebra + + keepassxc + + pciutils + glxinfo + clinfo + wayland-utils + aha + fwupd + glaxnimate + ddcutil + + galaxy-buds-client + ]; +} diff --git a/home/modules/nvimPlugins/cmp.lua b/home/modules/nvimPlugins/cmp.lua new file mode 100644 index 0000000..cf2b7a7 --- /dev/null +++ b/home/modules/nvimPlugins/cmp.lua @@ -0,0 +1,46 @@ +local cmp = require('cmp') +local luasnip = require('luasnip') + +require('luasnip.loaders.from_vscode').lazy_load() +luasnip.config.setup {} + +cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert { + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete {}, + [''] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }), + }, + sources = { + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + }, +} diff --git a/home/modules/nvimPlugins/lsp.lua b/home/modules/nvimPlugins/lsp.lua new file mode 100644 index 0000000..3297e12 --- /dev/null +++ b/home/modules/nvimPlugins/lsp.lua @@ -0,0 +1,49 @@ +local on_attach = function(_, bufnr) + + local bufmap = function(keys, func) + vim.keymap.set('n', keys, func, { buffer = bufnr }) + end + + bufmap('r', vim.lsp.buf.rename) + bufmap('a', vim.lsp.buf.code_action) + + bufmap('gd', vim.lsp.buf.definition) + bufmap('gD', vim.lsp.buf.declaration) + bufmap('gI', vim.lsp.buf.implementation) + bufmap('D', vim.lsp.buf.type_definition) + + bufmap('gr', require('telescope.builtin').lsp_references) + bufmap('s', require('telescope.builtin').lsp_document_symbols) + bufmap('S', require('telescope.builtin').lsp_dynamic_workspace_symbols) + + bufmap('K', vim.lsp.buf.hover) + + vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) + vim.lsp.buf.format() + end, {}) +end + +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) + +require('lspconfig').lua_ls.setup { + on_attach = on_attach, + capabilities = capabilities, + root_dir = function() + return vim.loop.cwd() + end, + cmd = { "lua-lsp" }, + settings = { + Lua = { + workspace = { checkThirdParty = false }, + telemetry = { enable = false }, + }, + } +} + +require('lspconfig').nixd.setup { + on_attach = on_attach, + capabilities = capabilities, + cmd = { "nixd" }, + filetypes = { "nix" } +} diff --git a/home/modules/nvimPlugins/lualine.lua b/home/modules/nvimPlugins/lualine.lua new file mode 100644 index 0000000..fe2f701 --- /dev/null +++ b/home/modules/nvimPlugins/lualine.lua @@ -0,0 +1,41 @@ +require('lualine').setup { + options = { + icons_enabled = true, + theme = 'auto', + component_separators = { left = '', right = ''}, + section_separators = { left = '', right = ''}, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + always_show_tabline = true, + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + } + }, + sections = { + lualine_a = {'mode'}, + lualine_b = {'branch', 'diff', 'diagnostics'}, + lualine_c = {'filename'}, + lualine_x = {'encoding', 'fileformat', 'filetype'}, + lualine_y = {'progress'}, + lualine_z = {'location'} + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {'filename'}, + lualine_x = {'location'}, + lualine_y = {}, + lualine_z = {} + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {} +} diff --git a/home/modules/nvimPlugins/other.lua b/home/modules/nvimPlugins/other.lua new file mode 100644 index 0000000..ce30311 --- /dev/null +++ b/home/modules/nvimPlugins/other.lua @@ -0,0 +1,18 @@ +-- Change leader key to space +vim.g.mapleader = ' ' + +vim.o.clipboard = 'unnamedplus' + +vim.o.tabstop = 4 +vim.o.shiftwidth = 4 + +vim.o.termguicolors = true + +-- vim.cmd.colorscheme "catppuccin" +require("Comment").setup() + +local builtin = require('telescope.builtin') +vim.keymap.set('n', 'ff', builtin.find_files, { desc = 'Telescope find files' }) +vim.keymap.set('n', 'fg', builtin.live_grep, { desc = 'Telescope live grep' }) +vim.keymap.set('n', 'fb', builtin.buffers, { desc = 'Telescope buffers' }) +vim.keymap.set('n', 'fh', builtin.help_tags, { desc = 'Telescope help tags' }) diff --git a/home/modules/nvimPlugins/telescope.lua b/home/modules/nvimPlugins/telescope.lua new file mode 100644 index 0000000..28eb998 --- /dev/null +++ b/home/modules/nvimPlugins/telescope.lua @@ -0,0 +1,16 @@ +require("telescope").setup( + { + extensions = { + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, -- override the generic sorter + override_file_sorter = true, -- override the file sorter + case_mode = "smart_case" -- or "ignore_case" or "respect_case" + -- the default case_mode is "smart_case" + } + } + } +) + +require("telescope").load_extension("fzf") + diff --git a/home/modules/nvimPlugins/tree.lua b/home/modules/nvimPlugins/tree.lua new file mode 100644 index 0000000..bc49de0 --- /dev/null +++ b/home/modules/nvimPlugins/tree.lua @@ -0,0 +1,25 @@ +-- disable netrw at the very start of your init.lua +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + +-- optionally enable 24-bit colour +vim.opt.termguicolors = true + +-- empty setup using defaults +-- require("nvim-tree").setup() + +-- OR setup with some options +require("nvim-tree").setup({ + sort = { + sorter = "case_sensitive", + }, + view = { + width = 30, + }, + renderer = { + group_empty = true, + }, + filters = { + dotfiles = true, + }, +}) diff --git a/home/modules/nvimPlugins/treesitter.lua b/home/modules/nvimPlugins/treesitter.lua new file mode 100644 index 0000000..2edb953 --- /dev/null +++ b/home/modules/nvimPlugins/treesitter.lua @@ -0,0 +1,9 @@ +require('nvim-treesitter.configs').setup { + ensure_installed = {}, + + auto_install = false, + + highlight = { enable = true }, + + indent = { enable = true }, +} diff --git a/home/modules/nvimPlugins/trouble.lua b/home/modules/nvimPlugins/trouble.lua new file mode 100644 index 0000000..3741f30 --- /dev/null +++ b/home/modules/nvimPlugins/trouble.lua @@ -0,0 +1,37 @@ +return { + "folke/trouble.nvim", + opts = {}, -- for default options, refer to the configuration section for custom setup. + cmd = "Trouble", + keys = { + { + "xx", + "Trouble diagnostics toggle", + desc = "Diagnostics (Trouble)", + }, + { + "xX", + "Trouble diagnostics toggle filter.buf=0", + desc = "Buffer Diagnostics (Trouble)", + }, + { + "cs", + "Trouble symbols toggle focus=false", + desc = "Symbols (Trouble)", + }, + { + "cl", + "Trouble lsp toggle focus=false win.position=right", + desc = "LSP Definitions / references / ... (Trouble)", + }, + { + "xL", + "Trouble loclist toggle", + desc = "Location List (Trouble)", + }, + { + "xQ", + "Trouble qflist toggle", + desc = "Quickfix List (Trouble)", + }, + }, +} diff --git a/home/modules/productivity.nix b/home/modules/productivity.nix new file mode 100644 index 0000000..1787324 --- /dev/null +++ b/home/modules/productivity.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + kdePackages.arianna + obsidian + libreoffice-qt6-fresh + ]; +} diff --git a/home/modules/shellConfig.nix b/home/modules/shellConfig.nix new file mode 100644 index 0000000..77e7b5f --- /dev/null +++ b/home/modules/shellConfig.nix @@ -0,0 +1,74 @@ +{pkgs, ...}: { + # Nvm lol - Enable ZSH instead of BASH + programs.zsh = { + enable = false; + autosuggestion.enable = true; + enableCompletion = true; + }; + + # Enable Fish instead of others + programs.fish = { + enable = true; + functions = { + gitignore = "touch .gitignore && curl -sL https://www.gitignore.io/api/$argv >> .gitignore"; + finit = "nix flake init --template \"https://flakehub.com/f/the-nix-way/dev-templates/*#$argv\""; + }; + + generateCompletions = true; + + plugins = [ + { + name = "z"; + src = pkgs.fetchFromGitHub { + owner = "jethrokuan"; + repo = "z"; + rev = "ddeb28a7b6a1f0ec6dae40c636e5ca4908ad160a"; + sha256 = "0c5i7sdrsp0q3vbziqzdyqn4fmp235ax4mn4zslrswvn8g3fvdyh"; + }; + } + + { + name = "fasd"; + src = pkgs.fetchFromGitHub { + owner = "oh-my-fish"; + repo = "plugin-fasd"; + rev = "38a5b6b6011106092009549e52249c6d6f501fba"; + sha256 = "06v37hqy5yrv5a6ssd1p3cjd9y3hnp19d3ab7dag56fs1qmgyhbs"; + }; + } + ]; + + shellAbbrs = { + gs = "git status"; + ga = "git add"; + gc = "git commit -m"; + }; + + shellInit = "set -g fish_greeting"; + }; + + # Enable a better ls replacement + programs.eza = { + enable = true; + enableFishIntegration = true; + }; + + # Enable the starship prompt and use the default config + programs.starship = { + enable = true; + enableFishIntegration = true; + }; + + # Set aliases to replace ls with eza + home.shellAliases = { + ls = "eza --long --icons --git --git-repos --hyperlink --time-style relative --color --header"; + tree = "eza --long --icons --git --git-repos --hyperlink --time-style relative --color --header --tree"; + }; + + # Enable direnv + programs.direnv = { + enable = true; + enableZshIntegration = true; + nix-direnv.enable = true; + }; +} diff --git a/home/modules/socials.nix b/home/modules/socials.nix new file mode 100644 index 0000000..138730b --- /dev/null +++ b/home/modules/socials.nix @@ -0,0 +1,7 @@ +{pkgs, ...}: { + home.packages = with pkgs; [ + zoom-us + vesktop + thunderbird + ]; +} diff --git a/system/default.nix b/system/default.nix new file mode 100644 index 0000000..6fa08dd --- /dev/null +++ b/system/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ./modules + ]; +} diff --git a/system/modules/bootloader.nix b/system/modules/bootloader.nix new file mode 100644 index 0000000..dfb75cb --- /dev/null +++ b/system/modules/bootloader.nix @@ -0,0 +1,38 @@ +{pkgs, ...}: { + # Disable systemd boot to enable Grub + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Copied from default configuration file + boot.initrd.luks.devices."luks-9b26825f-f463-4199-830b-7176055d5fe2".device = "/dev/disk/by-uuid/9b26825f-f463-4199-830b-7176055d5fe2"; + + # GRUB and MC theme disabled due to an issue - "nixos.png not found" + # Enable Grub and set required parameters to make system bootable + boot.loader.grub = { + enable = false; + # efiSupport = true; + # device = "nodev"; + # + # # This does not work for some reason + # gfxmodeEfi = "1920x1080"; + # gfxmodeBios = "1920x1080"; + # + # # Enable the Minecraft world selection screen theme + # minegrub-world-sel = { + # enable = true; + # customIcons = [ + # { + # name = "nixos"; + # lineTop = "NixOS Vicuna (24/11/2024, 1:23)"; + # lineBottom = "Survival Mode, No Cheats, Version: 24.11"; + # # Icon: you can use an icon from the remote repo, or load from a local file + # imgName = "nixLogo"; + # customImg = builtins.path { + # path = ./nixLogo.png; + # name = "nixLogo"; + # }; + # } + # ]; + # }; + }; +} diff --git a/system/modules/default.nix b/system/modules/default.nix new file mode 100644 index 0000000..c7cee69 --- /dev/null +++ b/system/modules/default.nix @@ -0,0 +1,21 @@ +{ + imports = [ + ./bootloader.nix + ./graphics.nix + ./powerManagement.nix + ./wireless.nix + #./hyprland.nix + ./syncthing.nix + ./kdePlasma.nix + ./pulseAudio.nix + ./suspendThenHibernate.nix + ./spicetify.nix + ./hardware-configuration.nix + ./tzLocale.nix + ./users.nix + ./virt.nix + ./miscNixStuff.nix + ./nerdFonts.nix + ./nixos-cli.nix + ]; +} diff --git a/system/modules/graphics.nix b/system/modules/graphics.nix new file mode 100644 index 0000000..08f828c --- /dev/null +++ b/system/modules/graphics.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: +{ + # Enable OpenGL + hardware.graphics = { + enable = true; + extraPackages = with pkgs; [ + intel-media-sdk + intel-ocl + intel-compute-runtime + ]; + }; +} diff --git a/system/modules/hardware-configuration.nix b/system/modules/hardware-configuration.nix new file mode 100644 index 0000000..0609cff --- /dev/null +++ b/system/modules/hardware-configuration.nix @@ -0,0 +1,42 @@ +# 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" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/cf584cc6-1bdb-4270-85d3-02a2dbc7c8f8"; + fsType = "ext4"; + }; + + boot.initrd.luks.devices."luks-6b99e05a-5ac8-4326-9f16-f5fe7db0bde4".device = "/dev/disk/by-uuid/6b99e05a-5ac8-4326-9f16-f5fe7db0bde4"; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/C134-D637"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/f08e1ad3-7ab7-4c60-ae91-508bb0f55b66"; } + ]; + + # 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.wlp59s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/system/modules/hyprland.nix b/system/modules/hyprland.nix new file mode 100644 index 0000000..208a5f2 --- /dev/null +++ b/system/modules/hyprland.nix @@ -0,0 +1,60 @@ +{pkgs, ...}: { + programs.hyprland = { + enable = true; + xwayland.enable = true; + }; + + environment.sessionVariables = { + WLR_NO_HARDWARE_CURSORS = "1"; + NIXOS_OZONE_WL = "1"; + QT_QPA_PLATFORMTHEME = "qt5ct"; + }; + + xdg.portal = { + enable = true; + extraPortals = [ pkgs.xdg-desktop-portal-hyprland ]; + }; + + environment.systemPackages = with pkgs; [ + # Default Hyprland terminal + kitty + alacritty + + waybar + + # Notification things + mako + libnotify + + # For wallpapers + hyprpaper + + # App launcher + rofi-wayland + + networkmanagerapplet + + playerctl + brightnessctl + + # Screenshot and copy stuff + grim + slurp + wl-clipboard + + # Needed to display workspaces in Waybar + hyprland-workspaces + + # For night light + wlsunset + + kdePackages.qt6ct + libsForQt5.qt5ct + catppuccin-qt5ct + + wlogout + + xfce.thunar + blueman + ]; +} diff --git a/system/modules/kdePlasma.nix b/system/modules/kdePlasma.nix new file mode 100644 index 0000000..4463bd3 --- /dev/null +++ b/system/modules/kdePlasma.nix @@ -0,0 +1,21 @@ +{pkgs, ...}: { + # Enable the X11 windowing system. + # You can disable this if you're only using the Wayland session. + services.xserver.enable = false; + + # Enable the KDE Plasma Desktop Environment. + services.displayManager.sddm.enable = true; + services.desktopManager.plasma6.enable = true; + + services.displayManager.sddm.wayland.enable = true; + + environment.systemPackages = with pkgs; [ + kdePackages.xdg-desktop-portal-kde + kdePackages.kdeconnect-kde + kdePackages.plasma-nm + kdePackages.qtwebsockets + kdePackages.qtmultimedia + plasmusic-toolbar + plasma-browser-integration + ]; +} diff --git a/system/modules/miscNixStuff.nix b/system/modules/miscNixStuff.nix new file mode 100644 index 0000000..799e462 --- /dev/null +++ b/system/modules/miscNixStuff.nix @@ -0,0 +1,17 @@ +{ + environment.sessionVariables = { + ELECTRON_OZONE_PLATFORM_HINT = "wayland"; + }; + + nix.settings.experimental-features = ["nix-command" "flakes"]; + nixpkgs.config.allowUnfree = 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.05"; # Did you read the comment? + +} diff --git a/system/modules/nerdFonts.nix b/system/modules/nerdFonts.nix new file mode 100644 index 0000000..c570b6c --- /dev/null +++ b/system/modules/nerdFonts.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + fonts.packages = with pkgs; [ + (nerdfonts.override {fonts = [ "JetBrainsMono" "CascadiaCode" ]; }) + ]; +} diff --git a/system/modules/nixLogo.png b/system/modules/nixLogo.png new file mode 100644 index 0000000..a4c2950 Binary files /dev/null and b/system/modules/nixLogo.png differ diff --git a/system/modules/nixos-cli.nix b/system/modules/nixos-cli.nix new file mode 100644 index 0000000..77b89c3 --- /dev/null +++ b/system/modules/nixos-cli.nix @@ -0,0 +1,19 @@ +{ + services.nixos-cli = { + enable = true; + config = { + aliases = { + genlist = ["generation" "list"]; + switch = ["generation" "switch"]; + rollback = ["generation" "rollback"]; + gendel = ["generation" "delete"]; + gendelall = ["generation" "delete" "--all"]; + build = ["apply" "--no-activate" "--no-boot" "--output" "result"]; + }; + + apply = { + imply_impure_with_tag = true; + }; + }; + }; +} diff --git a/system/modules/powerManagement.nix b/system/modules/powerManagement.nix new file mode 100644 index 0000000..b3bc8c4 --- /dev/null +++ b/system/modules/powerManagement.nix @@ -0,0 +1,39 @@ +{ + powerManagement = { + enable = true; + powertop.enable = true; + }; + + services = { + # Conflict with auto-cpufreq + power-profiles-daemon.enable = false; + + thermald.enable = true; + + # List of governors: + # - performance + # - powersave + # - userspace + # - ondemand + # - conservative + # - schedutil + # cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors + # https://github.com/AdnanHodzic/auto-cpufreq/blob/v2.3.0/auto-cpufreq.conf-example + + auto-cpufreq = { + enable = true; + settings = { + battery = { + governor = "powersave"; + turbo = "never"; + }; + + charger = { + governor = "performance"; + # always, auto, never + turbo = "auto"; + }; + }; + }; + }; +} diff --git a/system/modules/pulseAudio.nix b/system/modules/pulseAudio.nix new file mode 100644 index 0000000..9134b21 --- /dev/null +++ b/system/modules/pulseAudio.nix @@ -0,0 +1,17 @@ +{ + # Enable sound with pipewire. + 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; + }; +} diff --git a/system/modules/spicetify.nix b/system/modules/spicetify.nix new file mode 100644 index 0000000..5d4dddf --- /dev/null +++ b/system/modules/spicetify.nix @@ -0,0 +1,29 @@ +{ + pkgs, + lib, + inputs, + ... +}: let + unstable = import {config = {allowUnfree = true;};}; + spicetify-nix = inputs.spicetify-nix; + spicePkgs = spicetify-nix.packages.${pkgs.system}.default; +in { + imports = [ + inputs.spicetify-nix.nixosModules.default + ]; + + programs.spicetify = let + spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.system}; + in { + enable = true; + enabledExtensions = with spicePkgs.extensions; [ + adblock + beautifulLyrics + ]; + theme = spicePkgs.themes.catppuccin; + colorScheme = "mocha"; + enabledCustomApps = with spicePkgs.apps; [ + lyricsPlus + ]; + }; +} diff --git a/system/modules/suspendThenHibernate.nix b/system/modules/suspendThenHibernate.nix new file mode 100644 index 0000000..95f2881 --- /dev/null +++ b/system/modules/suspendThenHibernate.nix @@ -0,0 +1,6 @@ +{ + systemd.sleep.extraConfig = '' + HibernateDelaySec=30s # very low value to test suspend-then-hibernate + SuspendState=mem # suspend2idle is buggy :( + ''; +} diff --git a/system/modules/syncthing.nix b/system/modules/syncthing.nix new file mode 100644 index 0000000..089c391 --- /dev/null +++ b/system/modules/syncthing.nix @@ -0,0 +1,31 @@ +{pkgs, ...}: { + # Enable and set up Syncthing + services.syncthing = { + enable = true; + user = "uzair"; + dataDir = "/home/uzair/Documents/syncthing"; + configDir = "/home/uzair/Documents/syncthing/config"; + overrideDevices = true; + overrideFolders = true; + settings = { + gui = { + user = "uzair"; + password = "welcome@123"; + }; + devices = { + "uzairPhone" = {id = "NA6LMLH-LWJ3L4L-PMVSSCH-BFUHRUU-B7TXBGU-746NUWZ-P5F5DFK-QJQM2QD";}; + "macMiniServer" = {id = "QC24M4F-TRQWXMF-NLRPLAI-LLELUIW-S7ISMPM-K5CPKX5-HSNUBEL-HIMNUAG";}; + }; + folders = { + "Music" = { + path = "/home/uzair/Music"; + devices = ["macMiniServer"]; + }; + "Secrets" = { + path = "/home/uzair/shhSecret"; + devices = ["macMiniServer"]; + }; + }; + }; + }; +} diff --git a/system/modules/tzLocale.nix b/system/modules/tzLocale.nix new file mode 100644 index 0000000..40b8e35 --- /dev/null +++ b/system/modules/tzLocale.nix @@ -0,0 +1,25 @@ +{ + # Set your time zone. + time.timeZone = "America/Los_Angeles"; + + # 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"; + }; + + # Configure keymap in X11 + services.xserver.xkb = { + layout = "us"; + variant = ""; + }; +} diff --git a/system/modules/users.nix b/system/modules/users.nix new file mode 100644 index 0000000..eeaf9a9 --- /dev/null +++ b/system/modules/users.nix @@ -0,0 +1,7 @@ +{ + users.users.uzair = { + isNormalUser = true; + description = "Uzair Mohammed"; + extraGroups = ["networkmanager" "wheel"]; + }; +} diff --git a/system/modules/virt.nix b/system/modules/virt.nix new file mode 100644 index 0000000..9c04261 --- /dev/null +++ b/system/modules/virt.nix @@ -0,0 +1,8 @@ +{pkgs, ...}: { + users.users.uzair = { + extraGroups = ["libvirtd"]; + }; + + virtualisation.libvirtd.enable = true; + programs.virt-manager.enable = true; +} diff --git a/system/modules/wireless.nix b/system/modules/wireless.nix new file mode 100644 index 0000000..bae05f8 --- /dev/null +++ b/system/modules/wireless.nix @@ -0,0 +1,49 @@ +{ + networking.hostName = "nixos"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Enable CUPS to print documents. + services.printing.enable = true; + + # 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; + + # Enable Bluetooth + hardware.bluetooth.enable = true; + hardware.bluetooth.powerOnBoot = true; + + # Syncthing network config + networking.firewall = { + allowedTCPPorts = [22000]; + allowedUDPPorts = [22000 21027]; + }; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + networking.firewall = { + enable = true; + allowedTCPPortRanges = [ + { + from = 1714; + to = 1764; + } # KDE Connect + ]; + allowedUDPPortRanges = [ + { + from = 1714; + to = 1764; + } # KDE Connect + ]; + }; + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; +}