summaryrefslogtreecommitdiffstats
path: root/nixos/modules
diff options
context:
space:
mode:
authorAndrey01892024-04-17 05:52:14 +0500
committerAndrey01892024-04-17 05:52:14 +0500
commitb51f9bc1014ce350abe73f2c419e0bf6512194c2 (patch)
tree404799cc86717de0a7115bbcec32ce0d8851241b /nixos/modules
downloadnixos-config-b51f9bc1014ce350abe73f2c419e0bf6512194c2.tar.gz
nixos-config-b51f9bc1014ce350abe73f2c419e0bf6512194c2.tar.bz2
nixos-config-b51f9bc1014ce350abe73f2c419e0bf6512194c2.zip
Initial commit
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/bootloader.nix6
-rw-r--r--nixos/modules/bundle.nix15
-rw-r--r--nixos/modules/env.nix8
-rw-r--r--nixos/modules/hyprland.nix3
-rw-r--r--nixos/modules/nixvim/autocmds.nix10
-rw-r--r--nixos/modules/nixvim/keymaps.nix15
-rw-r--r--nixos/modules/nixvim/nixvim.nix16
-rw-r--r--nixos/modules/nixvim/opts.nix64
-rw-r--r--nixos/modules/nixvim/plugins/barbar.nix12
-rw-r--r--nixos/modules/nixvim/plugins/cmp.nix32
-rw-r--r--nixos/modules/nixvim/plugins/comment.nix10
-rw-r--r--nixos/modules/nixvim/plugins/floaterm.nix12
-rw-r--r--nixos/modules/nixvim/plugins/lsp.nix46
-rw-r--r--nixos/modules/nixvim/plugins/lualine.nix47
-rw-r--r--nixos/modules/nixvim/plugins/mini.nix20
-rw-r--r--nixos/modules/nixvim/plugins/neotree.nix7
-rw-r--r--nixos/modules/nixvim/plugins/nix.nix3
-rw-r--r--nixos/modules/nixvim/plugins/plugins-bundle.nix15
-rw-r--r--nixos/modules/nixvim/plugins/telescope.nix29
-rw-r--r--nixos/modules/nixvim/plugins/transparent.nix3
-rw-r--r--nixos/modules/nm.nix3
-rw-r--r--nixos/modules/sound.nix18
-rw-r--r--nixos/modules/trim.nix3
-rw-r--r--nixos/modules/user.nix17
-rw-r--r--nixos/modules/virtmanager.nix8
-rw-r--r--nixos/modules/xserver.nix26
-rw-r--r--nixos/modules/zram.nix8
27 files changed, 456 insertions, 0 deletions
diff --git a/nixos/modules/bootloader.nix b/nixos/modules/bootloader.nix
new file mode 100644
index 0000000..4134e89
--- /dev/null
+++ b/nixos/modules/bootloader.nix
@@ -0,0 +1,6 @@
+{
+ boot.loader.systemd-boot.enable = true;
+ boot.loader.efi.canTouchEfiVariables = true;
+ boot.initrd.kernelModules = [ "amdgpu" ];
+ boot.kernelParams = [ "psmouse.synaptics_intertouch=0" ];
+}
diff --git a/nixos/modules/bundle.nix b/nixos/modules/bundle.nix
new file mode 100644
index 0000000..642194f
--- /dev/null
+++ b/nixos/modules/bundle.nix
@@ -0,0 +1,15 @@
+{
+ imports = [
+ ./bootloader.nix
+ ./sound.nix
+ ./zram.nix
+ ./env.nix
+ ./user.nix
+ ./xserver.nix
+ ./nm.nix
+ ./virtmanager.nix
+ ./hyprland.nix
+ ./trim.nix
+ ./nixvim/nixvim.nix
+ ];
+}
diff --git a/nixos/modules/env.nix b/nixos/modules/env.nix
new file mode 100644
index 0000000..0353b25
--- /dev/null
+++ b/nixos/modules/env.nix
@@ -0,0 +1,8 @@
+{
+ environment.variables = {
+ EDITOR = "nvim";
+ RANGER_LOAD_DEFAULT_RC = "FALSE";
+ QT_QPA_PLATFORMTHEME = "qt5ct";
+ GSETTINGS_BACKEND = "keyfile";
+ };
+}
diff --git a/nixos/modules/hyprland.nix b/nixos/modules/hyprland.nix
new file mode 100644
index 0000000..98dfe35
--- /dev/null
+++ b/nixos/modules/hyprland.nix
@@ -0,0 +1,3 @@
+{
+ programs.hyprland.enable = true;
+}
diff --git a/nixos/modules/nixvim/autocmds.nix b/nixos/modules/nixvim/autocmds.nix
new file mode 100644
index 0000000..4fca334
--- /dev/null
+++ b/nixos/modules/nixvim/autocmds.nix
@@ -0,0 +1,10 @@
+{
+ programs.nixvim = {
+ autoCmd = [
+ {
+ event = [ "VimEnter" ];
+ command = ":TransparentEnable";
+ }
+ ];
+ };
+}
diff --git a/nixos/modules/nixvim/keymaps.nix b/nixos/modules/nixvim/keymaps.nix
new file mode 100644
index 0000000..e792ea0
--- /dev/null
+++ b/nixos/modules/nixvim/keymaps.nix
@@ -0,0 +1,15 @@
+{
+ programs.nixvim = {
+ globals = {
+ mapleader = "\\";
+ maplocalleader = "\\";
+ };
+
+ keymaps = [
+ {
+ key = "<leader>n";
+ action = "<cmd>Neotree<CR>";
+ }
+ ];
+ };
+}
diff --git a/nixos/modules/nixvim/nixvim.nix b/nixos/modules/nixvim/nixvim.nix
new file mode 100644
index 0000000..df97be1
--- /dev/null
+++ b/nixos/modules/nixvim/nixvim.nix
@@ -0,0 +1,16 @@
+{
+
+ imports = [
+ ./opts.nix
+ ./keymaps.nix
+ ./autocmds.nix
+ ./plugins/plugins-bundle.nix
+ ];
+
+ programs.nixvim = {
+ enable = true;
+
+ defaultEditor = true;
+ colorschemes.oxocarbon.enable = true;
+ };
+}
diff --git a/nixos/modules/nixvim/opts.nix b/nixos/modules/nixvim/opts.nix
new file mode 100644
index 0000000..d3d7822
--- /dev/null
+++ b/nixos/modules/nixvim/opts.nix
@@ -0,0 +1,64 @@
+{
+ programs.nixvim = {
+
+ clipboard = {
+ register = "unnamedplus";
+ providers.wl-copy.enable = true;
+ };
+
+ opts = {
+ updatetime = 100; # Faster completion
+
+ relativenumber = true; # Relative line numbers
+ number = true; # Display the absolute line number of the current line
+
+ hidden = true; # Keep closed buffer open in the background
+
+ mouse = "a"; # Enable mouse control
+ mousemodel = "extend"; # Mouse right-click extends the current selection
+
+ splitbelow = true; # A new window is put below the current one
+ splitright = true; # A new window is put right of the current one
+
+ swapfile = false; # Disable the swap file
+
+ modeline = true; # Tags such as 'vim:ft=sh'
+ modelines = 100; # Sets the type of modelines
+
+ undofile = true; # Automatically save and restore undo history
+
+ incsearch = true; # Incremental search: show match for partly typed search command
+
+ inccommand = "split"; # Search and replace: preview changes in quickfix list
+ ignorecase = true; # When the search query is lower-case, match both lower and upper-case
+ smartcase = true; # Override the 'ignorecase' option if the search pattern contains upper
+
+ scrolloff = 12; # Number of screen lines to show around the cursor
+
+ cursorline = false; # Highlight the screen line of the cursor
+ cursorcolumn = false; # Highlight the screen column of the cursor
+ signcolumn = "yes"; # Whether to show the signcolumn
+ colorcolumn = "100"; # Columns to highlight
+
+ laststatus = 3; # When to use a status line for the last window
+
+ fileencoding = "utf-8"; # File-content encoding for the current buffer
+
+ termguicolors = false; # Disables 24-bit RGB color in the |TUI|
+
+ spell = false; # Highlight spelling mistakes (local to window)
+ wrap = false; # Prevent text from wrapping
+
+ tabstop = 2; # Number of spaces a <Tab> in the text stands for (local to buffer)
+ shiftwidth = 2; # Number of spaces used for each step of (auto)indent (local to buffer)
+ expandtab = true; # Expand <Tab> to spaces in Insert mode (local to buffer)
+ autoindent = true; # Do clever autoindenting
+
+ textwidth = 0; # Maximum width of text that is being inserted. A longer line will be
+
+ foldlevel = 99; # Folds with a level higher than this number will be closed
+
+ completeopt = ["menu" "menuone" "noselect"]; # For CMP plugin
+ };
+ };
+}
diff --git a/nixos/modules/nixvim/plugins/barbar.nix b/nixos/modules/nixvim/plugins/barbar.nix
new file mode 100644
index 0000000..516ec13
--- /dev/null
+++ b/nixos/modules/nixvim/plugins/barbar.nix
@@ -0,0 +1,12 @@
+{
+ programs.nixvim.plugins.barbar = {
+ enable = true;
+ keymaps = {
+ silent = true;
+
+ next = "<TAB>";
+ previous = "<S-TAB>";
+ close = "<C-q>";
+ };
+ };
+}
diff --git a/nixos/modules/nixvim/plugins/cmp.nix b/nixos/modules/nixvim/plugins/cmp.nix
new file mode 100644
index 0000000..66afc03
--- /dev/null
+++ b/nixos/modules/nixvim/plugins/cmp.nix
@@ -0,0 +1,32 @@
+{
+ programs.nixvim.plugins.cmp = {
+ enable = true;
+
+ settings = {
+ snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
+
+ mapping = {
+ "<C-d>" = "cmp.mapping.scroll_docs(-4)";
+ "<C-f>" = "cmp.mapping.scroll_docs(4)";
+ "<C-Space>" = "cmp.mapping.complete()";
+ "<C-e>" = "cmp.mapping.close()";
+ "<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
+ "<S-Tab>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
+ "<CR>" = "cmp.mapping.confirm({ select = true })";
+ };
+
+ sources = [
+ {name = "path";}
+ {name = "nvim_lsp";}
+ {name = "cmp_tabby";}
+ {name = "luasnip";}
+ {
+ name = "buffer";
+ # Words from other open buffers can also be suggested.
+ option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
+ }
+ {name = "neorg";}
+ ];
+ };
+ };
+}
diff --git a/nixos/modules/nixvim/plugins/comment.nix b/nixos/modules/nixvim/plugins/comment.nix
new file mode 100644
index 0000000..5aa38ad
--- /dev/null
+++ b/nixos/modules/nixvim/plugins/comment.nix
@@ -0,0 +1,10 @@
+{
+ programs.nixvim.plugins.comment = {
+ enable = true;
+
+ settings = {
+ opleader.line = "gcc";
+ toggler.line = "gcc";
+ };
+ };
+}
diff --git a/nixos/modules/nixvim/plugins/floaterm.nix b/nixos/modules/nixvim/plugins/floaterm.nix
new file mode 100644
index 0000000..7185d66
--- /dev/null
+++ b/nixos/modules/nixvim/plugins/floaterm.nix
@@ -0,0 +1,12 @@
+{
+ programs.nixvim.plugins.floaterm = {
+ enable = true;
+
+ width = 0.8;
+ height = 0.8;
+
+ title = "";
+
+ keymaps.toggle = "<C-b>";
+ };
+}
diff --git a/nixos/modules/nixvim/plugins/lsp.nix b/nixos/modules/nixvim/plugins/lsp.nix
new file mode 100644
index 0000000..045f7ed
--- /dev/null
+++ b/nixos/modules/nixvim/plugins/lsp.nix
@@ -0,0 +1,46 @@
+{
+ programs.nixvim.plugins = {
+
+ treesitter = {
+ enable = true;
+ nixvimInjections = true;
+ folding = true;
+ indent = true;
+ };
+
+ treesitter-refactor = {
+ enable = true;
+ highlightDefinitions = {
+ enable = true;
+ # Set to false if you have an `updatetime` of ~100.
+ clearOnCursorMove = false;
+ };
+ };
+
+ hmts.enable = true;
+
+ # lspkind = {
+ # enable = true;
+ #
+ # cmp = {
+ # enable = true;
+ # menu = {
+ # nvim_lsp = "[LSP]";
+ # nvim_lua = "[api]";
+ # path = "[path]";
+ # luasnip = "[snip]";
+ # buffer = "[buffer]";
+ # neorg = "[neorg]";
+ # cmp_tabby = "[Tabby]";
+ # };
+ # };
+ # };
+
+ lsp = {
+ enable = true;
+ servers = {
+ nil_ls.enable = true;
+ };
+ };
+ };
+}
diff --git a/nixos/modules/nixvim/plugins/lualine.nix b/nixos/modules/nixvim/plugins/lualine.nix
new file mode 100644
index 0000000..4fa95d7
--- /dev/null
+++ b/nixos/modules/nixvim/plugins/lualine.nix
@@ -0,0 +1,47 @@
+{
+ programs.nixvim.plugins.lualine = {
+
+ enable = true;
+ globalstatus = true;
+
+ # +-------------------------------------------------+
+ # | A | B | C X | Y | Z |
+ # +-------------------------------------------------+
+
+ sections = {
+ lualine_a = ["mode"];
+ lualine_b = ["branch"];
+ lualine_c = ["filename" "diff"];
+
+ lualine_x = [
+ "diagnostics"
+
+ # Show active language server
+ {
+ name.__raw = ''
+ function()
+ local msg = ""
+ local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
+ local clients = vim.lsp.get_active_clients()
+ if next(clients) == nil then
+ return msg
+ end
+ for _, client in ipairs(clients) do
+ local filetypes = client.config.filetypes
+ if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
+ return client.name
+ end
+ end
+ return msg
+ end
+ '';
+ icon = " ";
+ # color.fg = "#ffffff";
+ }
+ "encoding"
+ "fileformat"
+ "filetype"
+ ];
+ };
+ };
+}
diff --git a/nixos/modules/nixvim/plugins/mini.nix b/nixos/modules/nixvim/plugins/mini.nix
new file mode 100644
index 0000000..bd41a68
--- /dev/null
+++ b/nixos/modules/nixvim/plugins/mini.nix
@@ -0,0 +1,20 @@
+{
+ programs.nixvim.plugins.mini = {
+ enable = true;
+
+ modules = {
+ align = {};
+ basics = {
+ options.extra_ui = true;
+ };
+ clue = {};
+ cursorword = {};
+ doc = {};
+ extra = {};
+ indentscope = {};
+ trailspace = {};
+ misc = {};
+ surround = {};
+ };
+ };
+}
diff --git a/nixos/modules/nixvim/plugins/neotree.nix b/nixos/modules/nixvim/plugins/neotree.nix
new file mode 100644
index 0000000..b0c19be
--- /dev/null
+++ b/nixos/modules/nixvim/plugins/neotree.nix
@@ -0,0 +1,7 @@
+{
+ programs.nixvim.plugins.neo-tree = {
+ enable = true;
+ filesystem.followCurrentFile.enabled = true;
+ closeIfLastWindow = true;
+ };
+}
diff --git a/nixos/modules/nixvim/plugins/nix.nix b/nixos/modules/nixvim/plugins/nix.nix
new file mode 100644
index 0000000..295695a
--- /dev/null
+++ b/nixos/modules/nixvim/plugins/nix.nix
@@ -0,0 +1,3 @@
+{
+ programs.nixvim.plugins.nix.enable = true;
+}
diff --git a/nixos/modules/nixvim/plugins/plugins-bundle.nix b/nixos/modules/nixvim/plugins/plugins-bundle.nix
new file mode 100644
index 0000000..9dd1140
--- /dev/null
+++ b/nixos/modules/nixvim/plugins/plugins-bundle.nix
@@ -0,0 +1,15 @@
+{
+ imports = [
+ ./lualine.nix
+ ./transparent.nix
+ ./neotree.nix
+ ./mini.nix
+ ./comment.nix
+ ./floaterm.nix
+ ./telescope.nix
+ ./barbar.nix
+ ./nix.nix
+ ./lsp.nix
+ ./cmp.nix
+ ];
+}
diff --git a/nixos/modules/nixvim/plugins/telescope.nix b/nixos/modules/nixvim/plugins/telescope.nix
new file mode 100644
index 0000000..1309eca
--- /dev/null
+++ b/nixos/modules/nixvim/plugins/telescope.nix
@@ -0,0 +1,29 @@
+{
+ programs.nixvim.plugins.telescope = {
+ enable = true;
+
+ keymaps = {
+ "<leader>ff" = "find_files";
+ "<leader>b" = "buffers";
+ "<leader>fh" = "help_tags";
+ "<leader>gf" = "git_files";
+ "<leader>of" = "oldfiles";
+ # "<leader>fg" = "live_grep";
+ # "<leader>fd" = "diagnostics";
+ };
+
+ keymapsSilent = true;
+
+ settings.defaults = {
+ file_ignore_patterns = [
+ "^.git/"
+ "^.mypy_cache/"
+ "^__pycache__/"
+ "^output/"
+ "^data/"
+ "%.ipynb"
+ ];
+ set_env.COLORTERM = "truecolor";
+ };
+ };
+}
diff --git a/nixos/modules/nixvim/plugins/transparent.nix b/nixos/modules/nixvim/plugins/transparent.nix
new file mode 100644
index 0000000..d2139ee
--- /dev/null
+++ b/nixos/modules/nixvim/plugins/transparent.nix
@@ -0,0 +1,3 @@
+{
+ programs.nixvim.plugins.transparent.enable = true;
+}
diff --git a/nixos/modules/nm.nix b/nixos/modules/nm.nix
new file mode 100644
index 0000000..f29d881
--- /dev/null
+++ b/nixos/modules/nm.nix
@@ -0,0 +1,3 @@
+{
+ networking.networkmanager.enable = true;
+}
diff --git a/nixos/modules/sound.nix b/nixos/modules/sound.nix
new file mode 100644
index 0000000..21a7a28
--- /dev/null
+++ b/nixos/modules/sound.nix
@@ -0,0 +1,18 @@
+{
+ hardware.pulseaudio.enable = false;
+ sound.enable = true;
+
+ # rtkit is optional but recommended
+ 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;
+ };
+}
diff --git a/nixos/modules/trim.nix b/nixos/modules/trim.nix
new file mode 100644
index 0000000..84d7613
--- /dev/null
+++ b/nixos/modules/trim.nix
@@ -0,0 +1,3 @@
+{
+ services.fstrim.enable = true;
+}
diff --git a/nixos/modules/user.nix b/nixos/modules/user.nix
new file mode 100644
index 0000000..ea59b78
--- /dev/null
+++ b/nixos/modules/user.nix
@@ -0,0 +1,17 @@
+{ pkgs, ... }: {
+ programs.zsh.enable = true;
+
+ users = {
+ defaultUserShell = pkgs.zsh;
+
+ users.amper = {
+ isNormalUser = true;
+ description = "Ampersand";
+ extraGroups = [ "networkmanager" "wheel" "input" "libvirtd" ];
+ packages = with pkgs; [];
+ };
+ };
+
+ # Enable automatic login for the user.
+ services.getty.autologinUser = "amper";
+}
diff --git a/nixos/modules/virtmanager.nix b/nixos/modules/virtmanager.nix
new file mode 100644
index 0000000..a86f94b
--- /dev/null
+++ b/nixos/modules/virtmanager.nix
@@ -0,0 +1,8 @@
+{ pkgs-stable, ... }: {
+ virtualisation.libvirtd.enable = true;
+ programs.virt-manager = {
+ enable = true;
+ package = pkgs-stable.virt-manager;
+ };
+}
+
diff --git a/nixos/modules/xserver.nix b/nixos/modules/xserver.nix
new file mode 100644
index 0000000..9011cc2
--- /dev/null
+++ b/nixos/modules/xserver.nix
@@ -0,0 +1,26 @@
+{
+ services.xserver = {
+ enable = true;
+ windowManager.herbstluftwm.enable = true;
+
+ # displayManager = {
+ # autoLogin.enable = true;
+ # autoLogin.user = "amper";
+ # lightdm.enable = true;
+ # };
+
+ layout = "us";
+ xkbVariant = "";
+
+ libinput = {
+ enable = true;
+ mouse.accelProfile = "flat";
+ touchpad.accelProfile = "flat";
+ };
+
+ videoDrivers = [ "amdgpu" ];
+ deviceSection = ''Option "TearFree" "True"'';
+ #displayManager.gdm.enable = true;
+ #desktopManager.gnome.enable = true;
+ };
+}
diff --git a/nixos/modules/zram.nix b/nixos/modules/zram.nix
new file mode 100644
index 0000000..33c9e07
--- /dev/null
+++ b/nixos/modules/zram.nix
@@ -0,0 +1,8 @@
+{
+ zramSwap = {
+ enable = true;
+ algorithm = "lz4";
+ memoryPercent = 100;
+ priority = 999;
+ };
+}