From c959a3aea84fffc788ffb5ed9e60b9ce36841876 Mon Sep 17 00:00:00 2001 From: uttarayan21 Date: Thu, 14 Aug 2025 19:34:20 +0530 Subject: [PATCH] chore: Formatting --- home/default.nix | 12 ++- home/programs/default.nix | 10 +- modules/default.nix | 3 +- neovim/default.nix | 162 ++++++++++++++-------------- nixos/deoxys/deoxys.nix | 40 +++---- nixos/mirai/services/default.nix | 3 +- nixos/mirai/services/gitea.nix | 67 ++++++------ nixos/mirai/services/grafana.nix | 19 ++-- nixos/mirai/services/llama.nix | 5 +- nixos/ryu/services/default.nix | 3 +- nixos/ryu/services/monitoring.nix | 5 +- nixos/ryu/services/openrgb.nix | 3 +- nixos/ryu/vms/win11.nix | 1 - nixos/tsuba/services/default.nix | 3 +- nixos/tsuba/services/monitoring.nix | 5 +- 15 files changed, 164 insertions(+), 177 deletions(-) diff --git a/home/default.nix b/home/default.nix index c70ffd8e..19e86175 100644 --- a/home/default.nix +++ b/home/default.nix @@ -5,8 +5,7 @@ lib, device, ... -}: -{ +}: { imports = [ inputs.nix-index-database.homeModules.nix-index ../modules @@ -34,7 +33,9 @@ home = { username = device.user; homeDirectory = - if device.isDarwin then lib.mkForce "/Users/${device.user}" else lib.mkForce "/home/${device.user}"; + if device.isDarwin + then lib.mkForce "/Users/${device.user}" + else lib.mkForce "/home/${device.user}"; file = { ".config/fish/themes".source = pkgs.catppuccinThemes.fish + "/themes"; @@ -60,7 +61,10 @@ EDITOR = "nvim"; SHELL = "${pkgs.bash}/bin/bash"; CARGO_TARGET_DIR = "${config.xdg.cacheHome}/cargo/target"; - BROWSER = if device.isDarwin then "open" else "xdg-open"; + BROWSER = + if device.isDarwin + then "open" + else "xdg-open"; }; sessionPath = [ "${config.home.homeDirectory}/.cargo/bin" diff --git a/home/programs/default.nix b/home/programs/default.nix index dd1fd5e5..55245f2f 100644 --- a/home/programs/default.nix +++ b/home/programs/default.nix @@ -2,8 +2,7 @@ pkgs, device, ... -}: -{ +}: { imports = [ ../../modules ./aichat.nix @@ -48,8 +47,7 @@ # ./template.nix # ./zellij.nix ]; - home.packages = - with pkgs; + home.packages = with pkgs; [ _1password-cli alejandra @@ -85,6 +83,6 @@ nerd-fonts.hasklug nerd-fonts.symbols-only ] - ++ lib.optionals device.isLinux [ ] - ++ lib.optionals device.isDarwin [ ]; + ++ lib.optionals device.isLinux [] + ++ lib.optionals device.isDarwin []; } diff --git a/modules/default.nix b/modules/default.nix index 8a1c624b..10947807 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -2,8 +2,7 @@ pkgs, lib, ... -}: -{ +}: { imports = [ ./goread.nix ./hyprpaper.nix diff --git a/neovim/default.nix b/neovim/default.nix index 7d6275cd..26ba944d 100644 --- a/neovim/default.nix +++ b/neovim/default.nix @@ -2,23 +2,21 @@ pkgs, # config, ... -}: -let - mkMappings = - mappings: - [ ] +}: let + mkMappings = mappings: + [] ++ (pkgs.lib.optionals (builtins.hasAttr "normal" mappings) (mkMode mappings.normal "n")) ++ (pkgs.lib.optionals (builtins.hasAttr "terminal" mappings) (mkMode mappings.terminal "t")) ++ (pkgs.lib.optionals (builtins.hasAttr "insert" mappings) (mkMode mappings.insert "i")) ++ (pkgs.lib.optionals (builtins.hasAttr "visual" mappings) (mkMode mappings.visual "v")) ++ (pkgs.lib.optionals (builtins.hasAttr "global" mappings) (mkMode mappings.global "")); - mkMode = - mappings: mode: + mkMode = mappings: mode: pkgs.lib.mapAttrsToList (key: value: { key = key; action = rawLua value; mode = mode; - }) mappings; + }) + mappings; border = [ "╭" "─" @@ -34,8 +32,7 @@ let ${lua} ''; }; -in -{ +in { opts = { completeopt = "menu,menuone,popup,noselect"; expandtab = true; @@ -137,12 +134,12 @@ in # command = "nnoremap F :Sqlfmt"; # } { - event = [ "BufWinLeave" ]; + event = ["BufWinLeave"]; pattern = "?*"; command = "mkview!"; } { - event = [ "BufWinEnter" ]; + event = ["BufWinEnter"]; pattern = "?*"; command = "silent! loadview!"; } @@ -172,10 +169,10 @@ in end ''; formatters_by_ft = { - d2 = [ "d2" ]; - sql = [ "sleek" ]; - toml = [ "taplo" ]; - nix = [ "alejandra" ]; + d2 = ["d2"]; + sql = ["sleek"]; + toml = ["taplo"]; + nix = ["alejandra"]; }; }; }; @@ -217,8 +214,8 @@ in mini = { enable = true; modules = { - ai = { }; - starter = { }; + ai = {}; + starter = {}; }; }; @@ -394,28 +391,28 @@ in server = { on_attach = rawLua - # lua - '' - function(client, bufnr) - vim.keymap.set( - "n", - "a", - function() - vim.cmd.RustLsp('codeAction') -- supports rust-analyzer's grouping - -- or vim.lsp.buf.codeAction() if you don't want grouping. - end, - { silent = true, buffer = bufnr } - ) - vim.keymap.set( - "n", - "K", -- Override Neovim's built-in hover keymap with rustaceanvim's hover actions - function() - vim.cmd.RustLsp({'hover', 'actions'}) - end, - { silent = true, buffer = bufnr } - ) - end - ''; + # lua + '' + function(client, bufnr) + vim.keymap.set( + "n", + "a", + function() + vim.cmd.RustLsp('codeAction') -- supports rust-analyzer's grouping + -- or vim.lsp.buf.codeAction() if you don't want grouping. + end, + { silent = true, buffer = bufnr } + ) + vim.keymap.set( + "n", + "K", -- Override Neovim's built-in hover keymap with rustaceanvim's hover actions + function() + vim.cmd.RustLsp({'hover', 'actions'}) + end, + { silent = true, buffer = bufnr } + ) + end + ''; default_settings = { rust-analyzer = { inlayHints = { @@ -447,28 +444,25 @@ in }; }; }; - dap = - let - vscode-lldb = pkgs.vscode-extensions.vadimcn.vscode-lldb; - liblldb = - if pkgs.stdenv.isLinux then - "${vscode-lldb.lldb}/lib/liblldb.so" - else if pkgs.stdenv.isDarwin then - "${vscode-lldb.lldb}/lib/liblldb.dylib" - else - null; - codelldb = "${vscode-lldb.adapter}/bin/codelldb"; - in - { - autoload_configurations = false; - # adapter = - # /* - # lua - # */ - # '' - # require('rustaceanvim.config').get_codelldb_adapter("${codelldb}", "${liblldb}") - # ''; - }; + dap = let + vscode-lldb = pkgs.vscode-extensions.vadimcn.vscode-lldb; + liblldb = + if pkgs.stdenv.isLinux + then "${vscode-lldb.lldb}/lib/liblldb.so" + else if pkgs.stdenv.isDarwin + then "${vscode-lldb.lldb}/lib/liblldb.dylib" + else null; + codelldb = "${vscode-lldb.adapter}/bin/codelldb"; + in { + autoload_configurations = false; + # adapter = + # /* + # lua + # */ + # '' + # require('rustaceanvim.config').get_codelldb_adapter("${codelldb}", "${liblldb}") + # ''; + }; tools = { float_win_config = { border = "rounded"; @@ -516,7 +510,7 @@ in typeHints.enable = false; }; check = { - features = [ "default" ]; + features = ["default"]; }; files.exclude = [ ".cargo/" @@ -575,26 +569,26 @@ in settings = { autoEnableSources = true; sources = [ - { name = "buffer"; } - { name = "buffer"; } - { name = "cmdline"; } - { name = "cmp-clippy"; } - { name = "cmp-cmdline-history"; } - { name = "crates"; } - { name = "dap"; } + {name = "buffer";} + {name = "buffer";} + {name = "cmdline";} + {name = "cmp-clippy";} + {name = "cmp-cmdline-history";} + {name = "crates";} + {name = "dap";} # {name = "dictionary";} - { name = "fish"; } - { name = "git"; } - { name = "luasnip"; } - { name = "nvim_lsp"; } - { name = "nvim_lua"; } - { name = "nvim_lsp_signature_help"; } - { name = "nvim_lsp_document_symbol"; } - { name = "path"; } - { name = "rg"; } - { name = "spell"; } - { name = "tmux"; } - { name = "treesitter"; } + {name = "fish";} + {name = "git";} + {name = "luasnip";} + {name = "nvim_lsp";} + {name = "nvim_lua";} + {name = "nvim_lsp_signature_help";} + {name = "nvim_lsp_document_symbol";} + {name = "path";} + {name = "rg";} + {name = "spell";} + {name = "tmux";} + {name = "treesitter";} ]; view = { entries = { @@ -788,8 +782,8 @@ in pkgs.tree-sitter-grammars.tree-sitter-norg-meta pkgs.tree-sitter-grammars.tree-sitter-nu ]; - extraLuaPackages = - luaPkgs: with luaPkgs; [ + extraLuaPackages = luaPkgs: + with luaPkgs; [ lua-utils-nvim nvim-nio pathlib-nvim diff --git a/nixos/deoxys/deoxys.nix b/nixos/deoxys/deoxys.nix index 32d31c7c..a5d39fc1 100644 --- a/nixos/deoxys/deoxys.nix +++ b/nixos/deoxys/deoxys.nix @@ -1,29 +1,33 @@ # 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") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["xhci_pci" "nvme" "usb_storage" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; - fileSystems."/" = - { device = "/dev/disk/by-uuid/1f72dde1-a713-4e69-a272-39a8324368c2"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/1f72dde1-a713-4e69-a272-39a8324368c2"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/2CFD-2F25"; - fsType = "vfat"; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/2CFD-2F25"; + fsType = "vfat"; + }; - swapDevices = [ ]; + 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 diff --git a/nixos/mirai/services/default.nix b/nixos/mirai/services/default.nix index 233446d1..bc857ce7 100644 --- a/nixos/mirai/services/default.nix +++ b/nixos/mirai/services/default.nix @@ -1,5 +1,4 @@ -{ ... }: -{ +{...}: { imports = [ ./atuin.nix ./authelia.nix diff --git a/nixos/mirai/services/gitea.nix b/nixos/mirai/services/gitea.nix index e964197f..8ea5a327 100644 --- a/nixos/mirai/services/gitea.nix +++ b/nixos/mirai/services/gitea.nix @@ -3,12 +3,11 @@ config, pkgs, ... -}: -{ +}: { virtualisation.docker.enable = true; sops = { # secrets."gitea/registration".owner = config.systemd.services.gitea-actions-mirai.serviceConfig.User; - secrets."gitea/registration" = { }; + secrets."gitea/registration" = {}; secrets."authelia/oidc/gitea/client_secret" = { owner = config.systemd.services.authelia-darksailor.serviceConfig.User; mode = "0440"; @@ -128,8 +127,8 @@ "email" "profile" ]; - response_types = [ "code" ]; - grant_types = [ "authorization_code" ]; + response_types = ["code"]; + grant_types = ["authorization_code"]; userinfo_signed_response_alg = "none"; token_endpoint_auth_method = "client_secret_post"; } @@ -141,35 +140,33 @@ }; }; - systemd.services.gitea-oauth-setup = - let - name = "authelia"; - gitea_oauth_script = pkgs.writeShellApplication { - name = "gitea_oauth2_script"; - runtimeInputs = [ config.services.gitea.package ]; - text = '' - gitea admin auth delete --id "$(gitea admin auth list | grep "${name}" | cut -d "$(printf '\t')" -f1)" - gitea admin auth add-oauth --provider=openidConnect --name=${name} --key="$CLIENT_ID" --secret="$CLIENT_SECRET" --auto-discover-url=https://auth.darksailor.dev/.well-known/openid-configuration --scopes='openid email profile' - ''; - }; - in - { - description = "Configure Gitea OAuth with Authelia"; - after = [ "gitea.service" ]; - wants = [ "gitea.service" ]; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - Type = "oneshot"; - User = config.services.gitea.user; - Group = config.services.gitea.group; - RemainAfterExit = true; - ExecStart = "${lib.getExe gitea_oauth_script}"; - WorkingDirectory = config.services.gitea.stateDir; - EnvironmentFile = config.sops.templates."GITEA_OAUTH_SETUP.env".path; - }; - environment = { - GITEA_WORK_DIR = config.services.gitea.stateDir; - GITEA_CUSTOM = config.services.gitea.customDir; - }; + systemd.services.gitea-oauth-setup = let + name = "authelia"; + gitea_oauth_script = pkgs.writeShellApplication { + name = "gitea_oauth2_script"; + runtimeInputs = [config.services.gitea.package]; + text = '' + gitea admin auth delete --id "$(gitea admin auth list | grep "${name}" | cut -d "$(printf '\t')" -f1)" + gitea admin auth add-oauth --provider=openidConnect --name=${name} --key="$CLIENT_ID" --secret="$CLIENT_SECRET" --auto-discover-url=https://auth.darksailor.dev/.well-known/openid-configuration --scopes='openid email profile' + ''; }; + in { + description = "Configure Gitea OAuth with Authelia"; + after = ["gitea.service"]; + wants = ["gitea.service"]; + wantedBy = ["multi-user.target"]; + serviceConfig = { + Type = "oneshot"; + User = config.services.gitea.user; + Group = config.services.gitea.group; + RemainAfterExit = true; + ExecStart = "${lib.getExe gitea_oauth_script}"; + WorkingDirectory = config.services.gitea.stateDir; + EnvironmentFile = config.sops.templates."GITEA_OAUTH_SETUP.env".path; + }; + environment = { + GITEA_WORK_DIR = config.services.gitea.stateDir; + GITEA_CUSTOM = config.services.gitea.customDir; + }; + }; } diff --git a/nixos/mirai/services/grafana.nix b/nixos/mirai/services/grafana.nix index 9d6be3e5..f9bfe8b1 100644 --- a/nixos/mirai/services/grafana.nix +++ b/nixos/mirai/services/grafana.nix @@ -1,5 +1,4 @@ -{ config, ... }: -{ +{config, ...}: { services = { grafana = { enable = true; @@ -112,7 +111,7 @@ settings.process_names = [ { name = "{{.Comm}}"; - cmdline = [ ".*" ]; + cmdline = [".*"]; } ]; }; @@ -122,14 +121,14 @@ job_name = "node"; static_configs = [ { - targets = [ "127.0.0.1:9100" ]; + targets = ["127.0.0.1:9100"]; labels = { device = "mirai"; type = "server"; }; } { - targets = [ "tsuba:9100" ]; + targets = ["tsuba:9100"]; labels = { device = "tsuba"; type = "server"; @@ -137,7 +136,7 @@ }; } { - targets = [ "ryu:9100" ]; + targets = ["ryu:9100"]; labels = { device = "ryu"; type = "desktop"; @@ -150,14 +149,14 @@ job_name = "process"; static_configs = [ { - targets = [ "127.0.0.1:9256" ]; + targets = ["127.0.0.1:9256"]; labels = { device = "mirai"; type = "server"; }; } { - targets = [ "tsuba:9256" ]; + targets = ["tsuba:9256"]; labels = { device = "tsuba"; type = "server"; @@ -165,7 +164,7 @@ }; } { - targets = [ "ryu:9256" ]; + targets = ["ryu:9256"]; labels = { device = "ryu"; type = "desktop"; @@ -178,7 +177,7 @@ job_name = "prometheus"; static_configs = [ { - targets = [ "127.0.0.1:9090" ]; + targets = ["127.0.0.1:9090"]; labels = { device = "mirai"; }; diff --git a/nixos/mirai/services/llama.nix b/nixos/mirai/services/llama.nix index 78c17c62..054ede6b 100644 --- a/nixos/mirai/services/llama.nix +++ b/nixos/mirai/services/llama.nix @@ -3,12 +3,11 @@ pkgs, inputs, ... -}: -{ +}: { sops = { secrets."llama/api_key".owner = config.services.caddy.user; secrets."llama/user".owner = config.services.caddy.user; - secrets."openai/api_key" = { }; + secrets."openai/api_key" = {}; templates = { "LLAMA_API_KEY.env".content = '' LLAMA_API_KEY=${config.sops.placeholder."llama/api_key"} diff --git a/nixos/ryu/services/default.nix b/nixos/ryu/services/default.nix index b03b1d3e..f429166f 100644 --- a/nixos/ryu/services/default.nix +++ b/nixos/ryu/services/default.nix @@ -1,5 +1,4 @@ -{ ... }: -{ +{...}: { imports = [ # ./rsyncd.nix # ./sunshine.nix diff --git a/nixos/ryu/services/monitoring.nix b/nixos/ryu/services/monitoring.nix index 1be5aa31..9d8e1863 100644 --- a/nixos/ryu/services/monitoring.nix +++ b/nixos/ryu/services/monitoring.nix @@ -1,5 +1,4 @@ -{ ... }: -{ +{...}: { services = { prometheus = { exporters = { @@ -24,7 +23,7 @@ settings.process_names = [ { name = "{{.Comm}}"; - cmdline = [ ".*" ]; + cmdline = [".*"]; } ]; }; diff --git a/nixos/ryu/services/openrgb.nix b/nixos/ryu/services/openrgb.nix index a48c0498..c0b73381 100644 --- a/nixos/ryu/services/openrgb.nix +++ b/nixos/ryu/services/openrgb.nix @@ -1,5 +1,4 @@ -{ ... }: -{ +{...}: { services = { hardware.openrgb.enable = true; }; diff --git a/nixos/ryu/vms/win11.nix b/nixos/ryu/vms/win11.nix index 9ac04f98..f96a1ea1 100644 --- a/nixos/ryu/vms/win11.nix +++ b/nixos/ryu/vms/win11.nix @@ -83,4 +83,3 @@ # Optional: Enable looking glass for low-latency VM display } - diff --git a/nixos/tsuba/services/default.nix b/nixos/tsuba/services/default.nix index 795a267b..bc76e24d 100644 --- a/nixos/tsuba/services/default.nix +++ b/nixos/tsuba/services/default.nix @@ -1,5 +1,4 @@ -{ ... }: -{ +{...}: { imports = [ ./tailscale.nix ./samba.nix diff --git a/nixos/tsuba/services/monitoring.nix b/nixos/tsuba/services/monitoring.nix index 1be5aa31..9d8e1863 100644 --- a/nixos/tsuba/services/monitoring.nix +++ b/nixos/tsuba/services/monitoring.nix @@ -1,5 +1,4 @@ -{ ... }: -{ +{...}: { services = { prometheus = { exporters = { @@ -24,7 +23,7 @@ settings.process_names = [ { name = "{{.Comm}}"; - cmdline = [ ".*" ]; + cmdline = [".*"]; } ]; };