From c36e55e90f9bdcf2c080a874b947632fb3d56202 Mon Sep 17 00:00:00 2001 From: Nantha Sorubakanthan Date: Sun, 7 Jun 2026 00:15:20 +0200 Subject: add nixos dotfiles --- nixos/config/git/config | 10 ++ nixos/config/hypr/.luarc.json | 7 ++ nixos/config/hypr/hyprland.lua | 171 +++++++++++++++++++++++++++++++++ nixos/config/nvim/init.lua | 201 +++++++++++++++++++++++++++++++++++++++ nixos/config/waybar/config.jsonc | 93 ++++++++++++++++++ nixos/config/waybar/style.css | 94 ++++++++++++++++++ 6 files changed, 576 insertions(+) create mode 100644 nixos/config/git/config create mode 100644 nixos/config/hypr/.luarc.json create mode 100644 nixos/config/hypr/hyprland.lua create mode 100644 nixos/config/nvim/init.lua create mode 100644 nixos/config/waybar/config.jsonc create mode 100644 nixos/config/waybar/style.css (limited to 'nixos/config') diff --git a/nixos/config/git/config b/nixos/config/git/config new file mode 100644 index 0000000..a3596b3 --- /dev/null +++ b/nixos/config/git/config @@ -0,0 +1,10 @@ +[user] + email = nantha@mielota.com + name = Nantha Sorubakanthan +[init] + defaultBranch = main +[core] + editor = nvim + autocrlf = input +[color] + ui = true diff --git a/nixos/config/hypr/.luarc.json b/nixos/config/hypr/.luarc.json new file mode 100644 index 0000000..b4ecec0 --- /dev/null +++ b/nixos/config/hypr/.luarc.json @@ -0,0 +1,7 @@ +{ + "workspace": { + "library": [ + "/usr/share/hypr/stubs" + ] + } +} diff --git a/nixos/config/hypr/hyprland.lua b/nixos/config/hypr/hyprland.lua new file mode 100644 index 0000000..1b55bb7 --- /dev/null +++ b/nixos/config/hypr/hyprland.lua @@ -0,0 +1,171 @@ +hl.config({ + input = { + kb_layout = "fr", + follow_mouse = 1, + sensitivity = 0, -- -1.0 - 1.0, 0 means no modification. + touchpad = { + natural_scroll = true, + }, + }, +}) + +if false then + hl.monitor({ output = "HDMI-A-1", mode = "2560x1440@100", position = "0x0", scale = "1", }) +else + hl.monitor({ output = "eDP-1", mode = "1920x1080@60", position = "0x0", scale = "1", }) + hl.monitor({ output = "HDMI-A-1", mode = "preferred", position = "auto", scale = "1", mirror = "eDP-1" }) +end + + +local terminal = "alacritty" +local browser = "firefox" +local menu = "exec $(tofi-drun -c ~/.config/tofi.ini)" + +hl.on("hyprland.start", function() + hl.exec_cmd("dunst") + hl.exec_cmd("waybar") + hl.exec_cmd("~/.config/hypr/xdg-portal-hyprland") + hl.exec_cmd("/usr/lib/hyprpolkitagent/hyprpolkitagent") + hl.exec_cmd("gsettings set org.gnome.desktop.interface gtk-theme \"Adwaita-dark\"") + hl.exec_cmd("gsettings set org.gnome.desktop.interface color-scheme \"prefer-dark\"") +end) + +hl.env("GDK_BACKEND", "wayland,x11,*") +hl.env("XDG_CURRENT_DESKTOP", "Hyprland") +hl.env("XDG_SESSION_TYPE", "wayland") +hl.env("XDG_SESSION_DESKTOP", "Hyprland") + +hl.config({ + general = { + gaps_in = 0, + gaps_out = 0, + border_size = 0, + col = { + active_border = { colors = { "rgba(33ccffee)", "rgba(00ff99ee)" }, angle = 45 }, + inactive_border = "rgba(595959aa)", + }, + resize_on_border = false, + allow_tearing = false, + layout = "dwindle", + }, + + decoration = { + rounding = 0, + rounding_power = 0, + active_opacity = 1.0, + inactive_opacity = 1.0, + shadow = { enabled = false, }, + blur = { enabled = false, }, + }, + + animations = { enabled = false, }, +}) + +hl.config({ dwindle = { preserve_split = true, }, }) +hl.config({ master = { new_status = "master", }, }) +hl.config({ scrolling = { fullscreen_on_one_column = true, }, }) + +hl.config({ + misc = { + force_default_wallpaper = 0, + disable_hyprland_logo = true, + disable_splash_rendering = true, + --background_color = "#000000" + background_color = "#1a1b26" + }, +}) + +hl.gesture({ + fingers = 3, + direction = "horizontal", + action = "workspace" +}) + +hl.device({ + name = "epic-mouse-v1", + sensitivity = -0.5, +}) + + +local mainMod = "SUPER" + +hl.bind(mainMod .. " + A", hl.dsp.window.fullscreen()) +hl.bind(mainMod .. " + C", hl.dsp.window.close()) +hl.bind(mainMod .. " + D", hl.dsp.exec_cmd("hyprpicker -naq")) +hl.bind(mainMod .. " + F", hl.dsp.exec_cmd(browser)) +hl.bind(mainMod .. " + J", hl.dsp.layout("togglesplit")) +hl.bind(mainMod .. " + M", + hl.dsp.exec_cmd("command -v hyprshutdown >/dev/null 2>&1 && hyprshutdown || hyprctl dispatch 'hl.dsp.exit()'")) +hl.bind(mainMod .. " + P", hl.dsp.window.pseudo()) +hl.bind(mainMod .. " + Q", hl.dsp.exec_cmd(terminal)) +hl.bind(mainMod .. " + return", hl.dsp.exec_cmd("~/.local/bin/spawn-alacritty-cwd")) +hl.bind(mainMod .. " + R", hl.dsp.exec_cmd(menu)) +hl.bind(mainMod .. " + U", hl.dsp.exec_cmd("pkill waybar ; waybar")) +hl.bind(mainMod .. " + V", hl.dsp.window.float({ action = "toggle" })) + +hl.bind(mainMod .. " + h", hl.dsp.focus({ direction = "left" })) +hl.bind(mainMod .. " + j", hl.dsp.focus({ direction = "right" })) +hl.bind(mainMod .. " + k", hl.dsp.focus({ direction = "up" })) +hl.bind(mainMod .. " + l", hl.dsp.focus({ direction = "down" })) + +hl.bind("print", hl.dsp.exec_cmd("grim -g \"$(slurp)\" - | wl-copy")) +hl.bind(mainMod .. " + print", hl.dsp.exec_cmd("grim - | wl-copy")) + +for i = 1, 10 do + local key = i % 11 + hl.bind(mainMod .. " + code:" .. key + 9, hl.dsp.focus({ workspace = i })) + hl.bind(mainMod .. " + SHIFT + code:" .. key + 9, hl.dsp.window.move({ workspace = i })) +end + +hl.bind(mainMod .. " + S", hl.dsp.workspace.toggle_special("magic")) +hl.bind(mainMod .. " + SHIFT + S", hl.dsp.window.move({ workspace = "special:magic" })) + +hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true }) +hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true }) + +hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"), + { locked = true, repeating = true }) +hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"), + { locked = true, repeating = true }) +hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), + { locked = true, repeating = true }) +hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), + { locked = true, repeating = true }) +hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%+"), { locked = true, repeating = true }) +hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl -e4 -n2 set 5%-"), { locked = true, repeating = true }) +hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl next"), { locked = true }) +hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true }) +hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true }) +hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), { locked = true }) + + +local suppressMaximizeRule = hl.window_rule({ + -- Ignore maximize requests from all apps. You'll probably like this. + name = "suppress-maximize-events", + match = { class = ".*" }, + suppress_event = "maximize", +}) + +-- suppressMaximizeRule:set_enabled(false) + +hl.window_rule({ + name = "fix-xwayland-drags", + match = { + class = "^$", + title = "^$", + xwayland = true, + float = true, + fullscreen = false, + pin = false, + }, + + no_focus = true, +}) + +hl.window_rule({ + name = "move-hyprland-run", + match = { class = "hyprland-run" }, + + move = "20 monitor_h-120", + float = true, +}) diff --git a/nixos/config/nvim/init.lua b/nixos/config/nvim/init.lua new file mode 100644 index 0000000..8e19474 --- /dev/null +++ b/nixos/config/nvim/init.lua @@ -0,0 +1,201 @@ +-- GLOBALS + +vim.g.mapleader = " " + +vim.o.number = true +vim.o.relativenumber = false + +vim.o.undofile = true +vim.o.ignorecase = true + +vim.o.expandtab = false +vim.o.shiftwidth = 4 +vim.o.tabstop = 4 +vim.o.softtabstop = 4 +vim.o.smartindent = true +vim.o.autoindent = true + +vim.o.signcolumn = "yes" +vim.o.winborder = 'single' +vim.o.showmode = true +vim.o.guicursor = "" + +vim.o.swapfile = false + +vim.o.cursorline = true + +-- •⏎.·○◦ +--vim.o.list = true +vim.o.listchars = "tab:🡪 ,trail:·,eol:⏎,space:·,multispace:·,lead:·,leadmultispace:·" + +vim.o.completeopt = "fuzzy,menuone,noselect" +vim.diagnostic.config({ virtual_text = true }) + +-- AUTOCOMPLETION + +vim.o.autocomplete = false +vim.o.completeopt = 'menu,menuone,noselect' + +-- STATUSBAR + +vim.diagnostic.status() +vim.lsp.status() + +-- FRENCH SPELLS + +local spell_path = vim.fn.stdpath("data") .. "/site/spell" +if not (vim.uv.fs_stat(spell_path .. "/fr.utf-8.spl") and vim.uv.fs_stat(spell_path .. "/fr.utf-8.sug")) then + print("Installing french spells") + -- Other mirrors can be found on https://www.vim.org/mirrors.php + local mirror = "https://vim.mirror.garr.it/pub/vim/" .. "runtime/spell/" + local files = { "fr.utf-8.spl", "fr.utf-8.sug" } + vim.fn.mkdir(spell_path, "p") + for _, file in ipairs(files) do + vim.fn.system(string.format("curl -L %s%s -o %s/%s", mirror, file, spell_path, file)) + end +end + +vim.cmd [[set spelllang=en,fr]] +vim.cmd [[set spell]] + +-- PLUGINS + +vim.pack.add({ + { src = "https://github.com/neovim/nvim-lspconfig" }, + { src = "https://github.com/ibhagwan/fzf-lua" }, + { src = "https://github.com/mfussenegger/nvim-jdtls" }, + { src = "https://github.com/lewis6991/gitsigns.nvim" }, + { src = "https://github.com/stevearc/oil.nvim" }, + { src = "https://github.com/sphamba/smear-cursor.nvim" }, + { src = "https://github.com/saghen/blink.cmp" }, + { src = "https://github.com/saghen/blink.lib" }, + { src = "https://github.com/folke/tokyonight.nvim" }, + { src = "https://github.com/windwp/nvim-autopairs" } +}) + +vim.cmd [[colorscheme tokyonight-night]] + + +require("blink.cmp").setup({ keymap = { preset = "enter" } }) +require('blink.cmp').build():wait(60000) +require("nvim-autopairs").setup({}) +require("gitsigns").setup({}) +require("oil").setup({ + default_file_explorer = true, + lsp_file_methods = { + enabled = true, + timeout_ms = 1000, + autosave_changes = true, + }, + columns = { + "permissions", + "size", + }, + float = { + max_width = 0.7, + max_height = 0.6, + border = vim.o.winborder, + }, + buf_options = { + buflisted = false, + bufhidden = "hide", + }, + view_options = { + show_hidden = true, + }, +}) + +require("smear_cursor").setup({ + smear_insert_mode = true, + stiffness = 0.7, + trailing_stiffness = 0.3, + stiffness_insert_mode = 0.7, + trailing_stiffness_insert_mode = 0.7, + damping = 0.67, + damping_insert_mode = 0.67, + distance_stop_animating = 0.4, +}) + +vim.cmd [[Gitsigns toggle_current_line_blame]] + +-- MAPPING + +local map = vim.keymap.set + +map("n", "", "zz") +map("n", "", "zz") +map("v", "J", ":m '>+1gv=gv") +map("v", "K", ":m '<-2gv=gv") +map("n", "n", "nzzzv") +map("n", "N", "Nzzzv") +map("n", "s", [[%s/\<\>//gI]]) +map("n", "e", [[:Oil]]) +map("n", "", vim.lsp.buf.format) + +local fzf = require("fzf-lua") -- blazing fast + +map("n", "F", ":FzfLua") +map("n", "f", fzf.files) +map("n", "t", fzf.treesitter) +map("n", "/", fzf.live_grep) + +-- Configure lua_ls to use neovim runtime or all of lua_ls lib. +-- We put way much load on the cpu if we open both. +local lua_ls_lib = {} +local neovim_config_path = vim.fn.expand("~/code/dox/artix/home/.config/nvim/init.lua") + +if vim.api.nvim_buf_get_name(0) == neovim_config_path then + lua_ls_lib = vim.api.nvim_get_runtime_file("", true) +end + +vim.lsp.config("lua_ls", { + settings = { + Lua = { + workspace = { + library = lua_ls_lib + } + } + } +}) + +-- do not enable jdtls here, we let the nvim-jdtls plugin do everything +vim.lsp.enable({ + "lua_ls", "cssls", "html", "jsonls", "clangd", "ts_ls", "nil", + "tinymist", "marksman", "lemminx", "rust_analyzer", "pyright" +}) + +-- AUTOCMDS + +vim.api.nvim_create_autocmd("TextYankPost", { + callback = function() vim.hl.on_yank() end +}) + +vim.api.nvim_create_autocmd("BufWritePost", { + pattern = "*.tex", + callback = function() vim.cmd [[! pdflatex % ]] end +}) + +vim.api.nvim_create_autocmd("FileType", { + pattern = "java", + callback = function(args) + local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t") + local workspace_dir = vim.fn.stdpath("data") + .. package.config:sub(1, 1) + .. "jdtls-workspace" + .. package.config:sub(1, 1) + .. project_name + + local config = { + name = "jdtls", + cmd = { + "jdtls", + "-data", + workspace_dir, + }, + root_dir = vim.fs.root(0, { ".git", "meta", "gradlew", "mvnw" }), + settings = { java = {} }, + init_options = { bundles = {} }, + } + require('jdtls').start_or_attach(config) + end +}) diff --git a/nixos/config/waybar/config.jsonc b/nixos/config/waybar/config.jsonc new file mode 100644 index 0000000..a60a949 --- /dev/null +++ b/nixos/config/waybar/config.jsonc @@ -0,0 +1,93 @@ +{ + //"margin-top": 15, + //"margin-right": 15, + //"margin-left": 15, + "margin-top": 0, + "margin-right": 0, + "margin-left": 0, + "layer": "top", + "position": "top", + "spacing": 3, + // All modules : battery, pulseaudio, tray, hyprland/workspaces, clock, cpu, memory, network + "modules-left": [ + "hyprland/workspaces", + "hyprland/window" + ], + "modules-center": [ + "clock" + ], + "modules-right": [ + "tray", + "battery", + "pulseaudio", + "temperature", + "cpu", + "memory", + "network" + ], + "temperature": { + "format": "TEMP: {temperatureC}°C", + "hwmon-path": [ + "/sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon2/temp1_input" + ], + "critical-threshold": 65, + "interval": 3 + }, + "hyprland/workspaces": { + "format": "{id}", + "show-special": true + }, + "hyprland/window": { + "format": "{initialTitle}", + "tooltip": false, + "icon": true + }, + "network": { + "format": "{ifname}", + "format-disconnected": "NULL", + "interval": 5, + "tooltip": true, + "tooltip-format": "{essid}" + }, + "cpu": { + "format": "CPU: {usage}%", + "interval": 3, + "states": { + "warning": 40, + "urgent": 60, + "critical": 80 + } + }, + "memory": { + "format": "MEM: {percentage}%", + "format-alt": "MEM: {used} GiB", + "interval": 3, + "states": { + "warning": 40, + "urgent": 60, + "critical": 80 + }, + "tooltip": true, + "tooltip-format": "{used}/{total} GiB" + }, + "pulseaudio": { + "format": "VOL: {volume}%", + "format-bluetooth": "VOL: {volume}%", + "format-muted": "MUTED", + "on-click": "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + }, + "battery": { + "format": "BAT: {capacity}%", + "interval": 5, + "states": { + "warning": 60, + "urgent": 35, + "critical": 20 + } + }, + "clock": { + "format": "{:%H:%M:%S - %a %d %B %Y}", + "tooltip": false, + "interval": 1 + } +} diff --git a/nixos/config/waybar/style.css b/nixos/config/waybar/style.css new file mode 100644 index 0000000..4e7b6e8 --- /dev/null +++ b/nixos/config/waybar/style.css @@ -0,0 +1,94 @@ +* { + font-family: "monospace"; + font-weight: bold; +} + +#waybar { + background: #1a1b26; + color: #fff; +} + +#workspaces button { + color: #fff; + border-radius: 0; +} + +#workspaces button.active { + background: #ad8ee6; +} + +#workspaces button.special { + background: #7aa2f7; +} + +#workspaces button.urgent { + background: #f7768e; +} + +#workspaces button:hover { + box-shadow: none; + text-shadow: none; + background: #32344a; + border: none; + transition: none; + color: #7aa2f7; +} + +#battery, +#cpu, +#memory, +#pulseaudio, +#network, +#clock, +#tray, +#temperature, +#workspaces button { + padding: 7 7; +} + +#network { + background: #449dab; +} + +#pulseaudio { + background: #ad8ee6; +} + +#pulseaudio.bluetooth { + background: #7aa2f7; +} + +#battery, +#cpu, +#memory, +#temperature { + background: #9ece6a; +} + +#battery.warning, +#cpu.warning, +#memory.warning { + background: #e0af68; +} + +#battery.urgent, +#cpu.urgent, +#memory.urgent, +#network.disabled { + background: #ff9e64; +} + +#battery.critical, +#cpu.critical, +#pulseaudio.muted, +#memory.critical, +#network.disconnected, +#temperature.critical { + background: #f7768e +} + +#window { + margin-left: 10px; + background: #32344a; + padding: 7; +} -- cgit v1.2.3