From 7946912c2c12a84c5db3b57df8092baed3052604 Mon Sep 17 00:00:00 2001 From: L-Nafaryus Date: Tue, 21 Jan 2025 21:14:06 +0500 Subject: [PATCH] fix: nixosConfigurations: deprecations new: nixosConfigurations/common: future place of preconfigured modules --- nixosConfigurations/astora/users.nix | 71 +---------------- .../catarina/services/metrics.nix | 2 +- nixosConfigurations/common/hm/helix.nix | 72 +++++++++++++++++ nixosConfigurations/common/hm/nushell.nix | 79 +++++++++++++++++++ nixosConfigurations/vinheim/hardware.nix | 2 +- 5 files changed, 156 insertions(+), 70 deletions(-) create mode 100644 nixosConfigurations/common/hm/helix.nix create mode 100644 nixosConfigurations/common/hm/nushell.nix diff --git a/nixosConfigurations/astora/users.nix b/nixosConfigurations/astora/users.nix index 1ce91dd..c75492d 100644 --- a/nixosConfigurations/astora/users.nix +++ b/nixosConfigurations/astora/users.nix @@ -17,7 +17,7 @@ in { group = "users"; uid = 1000; initialPassword = "nixos"; - shell = pkgs.fish; + shell = pkgs.nushell; openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG1YGp8AI48hJUSQBZpuKLpbj2+3Q09vq64NxFr0N1MS" ]; @@ -40,6 +40,8 @@ in { inputs.catppuccin.homeManagerModules.catppuccin inputs.ags.homeManagerModules.default #bonLib.preconfiguredModules.homeManager.hyprland + ../common/hm/helix.nix + ../common/hm/nushell.nix ]; home.packages = with pkgs; [ @@ -149,73 +151,6 @@ in { accent = "green"; }; - programs = { - nushell = { - enable = true; - # The config.nu can be anywhere you want if you like to edit your Nushell with Nu - #configFile.source = ./.../config.nu; - # for editing directly to config.nu - extraConfig = '' - let carapace_completer = {|spans| - carapace $spans.0 nushell ...$spans | from json - } - $env.config = { - show_banner: false, - completions: { - case_sensitive: false # case-sensitive completions - quick: true # set to false to prevent auto-selecting completions - partial: true # set to false to prevent partial filling of the prompt - algorithm: "fuzzy" - external: { - enable: true - max_results: 100 - completer: $carapace_completer - } - } - } - ''; - }; - carapace = { - enable = true; - enableNushellIntegration = true; - enableBashIntegration = true; - }; - - starship = { - enable = true; - enableNushellIntegration = true; - enableBashIntegration = true; - settings = { - add_newline = true; - format = '' - $all $fill $time - $character - ''; - fill = { - symbol = " "; - }; - line_break = { - disabled = true; - }; - directory = { - truncate_to_repo = false; - }; - time = { - disabled = false; - use_12hr = true; - }; - character = { - success_symbol = "[❯](bold green)"; - error_symbol = "[❯](bold red)"; - }; - nix_shell = { - symbol = " "; - heuristic = true; - }; - }; - }; - }; - programs = { # General fish = { diff --git a/nixosConfigurations/catarina/services/metrics.nix b/nixosConfigurations/catarina/services/metrics.nix index 229f8ab..ba3f5db 100644 --- a/nixosConfigurations/catarina/services/metrics.nix +++ b/nixosConfigurations/catarina/services/metrics.nix @@ -115,7 +115,7 @@ forceSSL = true; useACMEHost = "elnafo.ru"; locations."/" = { - proxyPass = "http://127.0.0.1:${toString config.services.grafana.port}"; + proxyPass = "http://127.0.0.1:${toString config.services.grafana.settings.server.http_port}"; proxyWebsockets = true; }; }; diff --git a/nixosConfigurations/common/hm/helix.nix b/nixosConfigurations/common/hm/helix.nix new file mode 100644 index 0000000..761b005 --- /dev/null +++ b/nixosConfigurations/common/hm/helix.nix @@ -0,0 +1,72 @@ +{ + pkgs, + lib, + config, + hmConfig, + ... +}: { + programs.helix = { + enable = true; + extraPackages = with pkgs; [wl-clipboard pyright ruff alejandra]; + + settings = { + theme = "gruvbox"; + editor.cursor-shape = { + normal = "block"; + insert = "bar"; + select = "underline"; + }; + }; + + languages = { + language = [ + { + name = "nix"; + auto-format = true; + formatter.command = "alejandra"; + } + + { + name = "python"; + language-id = "python"; + roots = ["pyproject.toml" "setup.py" "poetry.lock" "uv.lock" "pdm.lock"]; + language-servers = ["ruff" "pyright"]; + auto-format = true; + formatter = { + command = "ruff"; + args = ["format" "-"]; + }; + file-types = ["py"]; + comment-token = "#"; + shebangs = ["python"]; + } + ]; + + language-server = { + pyright = { + command = "pyright-langserver"; + args = ["--stdio"]; + config.python.analysis = { + venvPath = "."; + venv = ".venv"; + lint = true; + inlayHint.enable = true; + autoSearchPaths = true; + diagnosticMode = "workspace"; + useLibraryCodeForType = true; + logLevel = "Error"; + typeCheckingMode = "off"; + autoImoprtCompletion = true; + reportOptionalSubscript = false; + reportOptionalMemberAccess = false; + }; + }; + ruff = { + command = "ruff"; + args = ["server"]; + environment = {RUFF_TRACE = "messages";}; + }; + }; + }; + }; +} diff --git a/nixosConfigurations/common/hm/nushell.nix b/nixosConfigurations/common/hm/nushell.nix new file mode 100644 index 0000000..ff8fae8 --- /dev/null +++ b/nixosConfigurations/common/hm/nushell.nix @@ -0,0 +1,79 @@ +{ + pkgs, + lib, + config, + hmConfig, + ... +}: { + programs.nushell = { + enable = true; + # The config.nu can be anywhere you want if you like to edit your Nushell with Nu + #configFile.source = ./.../config.nu; + # for editing directly to config.nu + extraConfig = '' + let carapace_completer = {|spans| + carapace $spans.0 nushell $spans | from json + } + $env.config = { + show_banner: false, + completions: { + case_sensitive: false # case-sensitive completions + quick: true # set to false to prevent auto-selecting completions + partial: true # set to false to prevent partial filling of the prompt + algorithm: "fuzzy" + external: { + enable: true + max_results: 100 + completer: $carapace_completer + } + } + } + ''; + + environmentVariables = { + GNUPGHOME = hmConfig.programs.gpg.homedir; + }; + }; + + # completion + programs.carapace = { + enable = true; + enableNushellIntegration = true; + enableBashIntegration = true; + }; + + # prompt + programs.starship = { + enable = true; + enableNushellIntegration = true; + enableBashIntegration = true; + settings = { + add_newline = true; + format = '' + $all $fill $time + $character + ''; + fill = { + symbol = " "; + }; + line_break = { + disabled = true; + }; + directory = { + truncate_to_repo = false; + }; + time = { + disabled = false; + use_12hr = true; + }; + character = { + success_symbol = "[❯](bold green)"; + error_symbol = "[❯](bold red)"; + }; + nix_shell = { + symbol = " "; + heuristic = true; + }; + }; + }; +} diff --git a/nixosConfigurations/vinheim/hardware.nix b/nixosConfigurations/vinheim/hardware.nix index adec540..99835f0 100644 --- a/nixosConfigurations/vinheim/hardware.nix +++ b/nixosConfigurations/vinheim/hardware.nix @@ -94,7 +94,7 @@ networkmanager = { enable = true; enableStrongSwan = true; - packages = with pkgs; [ + plugins = with pkgs; [ networkmanager-l2tp ]; };