From d519bc624b9a5edece78f6130f2eec49ff9df426 Mon Sep 17 00:00:00 2001 From: cnst Date: Fri, 6 Sep 2024 18:38:30 +0200 Subject: [PATCH] some housecleaning --- flake.nix | 36 +++++++++------- home/modules/devtools/helix/default.nix | 55 +++++++++++++++++++++++-- home/modules/devtools/helix/lang.nix | 18 +++++++- hosts/cnix/default.nix | 7 +--- secrets/helix-gpt.age | 9 ++++ secrets/secrets.nix | 1 + system/dev/default.nix | 1 + system/modules/utils/agenix/default.nix | 5 +++ 8 files changed, 107 insertions(+), 25 deletions(-) create mode 100644 secrets/helix-gpt.age diff --git a/flake.nix b/flake.nix index 5364a724..fab95f43 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "My (i.e. fufexan's) NixOS flake configuration"; + description = "Flake config, _heavily_ influenced by fufexan's"; outputs = inputs: inputs.flake-parts.lib.mkFlake {inherit inputs;} { @@ -23,12 +23,13 @@ }; inputs = { - # nix environs + # Nix environment nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs-small.url = "github:NixOS/nixpkgs/nixos-unstable-small"; systems.url = "github:nix-systems/default-linux"; hardware.url = "github:nixos/nixos-hardware"; lanzaboote.url = "github:nix-community/lanzaboote"; + nixpak = { url = "github:nixpak/nixpak"; inputs = { @@ -36,31 +37,30 @@ flake-parts.follows = "flake-parts"; }; }; + flake-utils = { url = "github:numtide/flake-utils"; inputs.systems.follows = "systems"; }; flake-compat.url = "github:edolstra/flake-compat"; + hm = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; + flake-parts = { url = "github:hercules-ci/flake-parts"; inputs.nixpkgs-lib.follows = "nixpkgs"; }; - # cachyos - chaotic.url = "https://flakehub.com/f/chaotic-cx/nyx/*.tar.gz"; - #hmm - helix.url = "github:SoraTenshi/helix/new-daily-driver"; - - # hyprland environ + # Hyprland environment hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; hyprland-contrib = { url = "github:hyprwm/contrib"; inputs.nixpkgs.follows = "hyprland/nixpkgs"; }; + hyprlock = { url = "github:hyprwm/hyprlock"; inputs = { @@ -70,6 +70,7 @@ systems.follows = "hyprland/systems"; }; }; + hypridle = { url = "github:hyprwm/hypridle"; inputs = { @@ -79,6 +80,7 @@ systems.follows = "hyprland/systems"; }; }; + hyprpaper = { url = "github:hyprwm/hyprpaper"; inputs = { @@ -88,6 +90,12 @@ systems.follows = "hyprland/systems"; }; }; + + # Cachyos + chaotic.url = "https://flakehub.com/f/chaotic-cx/nyx/*.tar.gz"; + + # Miscellaneous + helix.url = "github:SoraTenshi/helix/new-daily-driver"; nix-gaming = { url = "github:fufexan/nix-gaming"; inputs = { @@ -95,30 +103,30 @@ flake-parts.follows = "flake-parts"; }; }; + firefox-nightly = { url = "github:nix-community/flake-firefox-nightly"; inputs.nixpkgs.follows = "nixpkgs"; }; - # Third party programs, packaged with nix + firefox-addons = { url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; inputs.nixpkgs.follows = "nixpkgs"; }; + anyrun.url = "github:anyrun-org/anyrun"; microfetch.url = "github:NotAShelf/microfetch"; agenix.url = "github:ryantm/agenix"; - # rust toolchain + + # Rust toolchain fenix = { url = "github:nix-community/fenix"; inputs.nixpkgs.follows = "nixpkgs"; }; + wezterm = { url = "github:wez/wezterm/main?dir=nix"; inputs.nixpkgs.follows = "nixpkgs"; }; - # naersk = { - # url = "github:nix-community/naersk"; - # inputs.nixpkgs.follows = "nixpkgs"; - # }; }; } diff --git a/home/modules/devtools/helix/default.nix b/home/modules/devtools/helix/default.nix index fa2cb6dd..9c374972 100644 --- a/home/modules/devtools/helix/default.nix +++ b/home/modules/devtools/helix/default.nix @@ -28,6 +28,7 @@ in { color-modes = true; scrolloff = 0; cursorline = true; + completion-replace = true; cursor-shape = { insert = "bar"; normal = "block"; @@ -38,8 +39,36 @@ in { cursor-line = "hint"; other-lines = "error"; }; - lsp.display-inlay-hints = true; - statusline.center = ["position-percentage"]; + lsp = { + display-messages = true; + display-inlay-hints = true; + }; + gutters = ["diagnostics" "line-numbers" "spacer" "diff"]; + statusline = { + separator = "of"; + left = [ + "mode" + "selections" + "file-type" + "register" + "spinner" + "diagnostics" + ]; + center = ["file-name"]; + right = [ + "file-encoding" + "file-line-ending" + "position-percentage" + "spacer" + "separator" + "total-line-numbers" + ]; + mode = { + normal = "NOR"; + insert = "INS"; + select = "SEL"; + }; + }; true-color = true; whitespace.characters = { newline = "↴"; @@ -70,8 +99,17 @@ in { }; in { normal = { - y = "yank_to_clipboard"; - p = "paste_clipboard_after"; + d = { + d = ["extend_to_line_bounds" "yank_main_selection_to_clipboard" "delete_selection"]; + s = ["surround_delete"]; + }; + x = "delete_selection"; + y = { + y = ["extend_to_line_bounds" "yank_main_selection_to_clipboard" "normal_mode" "collapse_selection"]; + }; + Y = ["extend_to_line_end" "yank_main_selection_to_clipboard" "collapse_selection"]; + P = ["paste_clipboard_before" "collapse_selection"]; + p = ["paste_clipboard_after" "collapse_selection"]; C-a = "select_all"; del = "delete_selection"; space = spaceMode; @@ -79,9 +117,18 @@ in { insert = { C-v = "paste_clipboard_after"; C-c = "yank_to_clipboard"; + C-x = "completion"; + del = "delete_selection"; + esc = ["collapse_selection" "normal_mode"]; }; select = { space = spaceMode; + d = ["yank_main_selection_to_clipboard" "delete_selection"]; + x = ["yank_main_selection_to_clipboard" "delete_selection"]; + y = ["yank_main_selection_to_clipboard" "normal_mode" "flip_selections" "collapse_selection"]; + Y = ["extend_to_line_bounds" "yank_main_selection_to_clipboard" "goto_line_start" "collapse_selection" "normal_mode"]; + p = ["replace_selections_with_clipboard"]; + P = ["paste_clipboard_before"]; }; }; }; diff --git a/home/modules/devtools/helix/lang.nix b/home/modules/devtools/helix/lang.nix index 0c7d83f7..35ccc68f 100644 --- a/home/modules/devtools/helix/lang.nix +++ b/home/modules/devtools/helix/lang.nix @@ -56,6 +56,16 @@ auto-format = true; language-servers = ["dprint" "typescript-language-server"]; } + { + name = "nix"; + auto-format = true; + file-types = ["nix"]; + language-servers = ["nil"]; + formatter = { + command = lib.getExe pkgs.alejandra; + args = ["-q"]; + }; + } { name = "json"; formatter = deno "json"; @@ -67,7 +77,7 @@ } { name = "python"; - language-servers = ["pyright"]; + language-servers = ["pylsp"]; formatter = { command = lib.getExe pkgs.black; args = ["-" "--quiet" "--line-length 100"]; @@ -100,6 +110,11 @@ ++ prettierLangs langs; language-server = { + gpt = { + command = "helix-gpt"; + args = ["--copilotApiKey" "cat /run/agenix/helix-gpt"]; + }; + bash-language-server = { command = lib.getExe pkgs.bash-language-server; args = ["start"]; @@ -148,7 +163,6 @@ nil = { command = lib.getExe pkgs.nil; - config.nil.formatting.command = ["${lib.getExe pkgs.alejandra}" "-q"]; }; pyright = { diff --git a/hosts/cnix/default.nix b/hosts/cnix/default.nix index 1d333b09..f39021ef 100644 --- a/hosts/cnix/default.nix +++ b/hosts/cnix/default.nix @@ -10,11 +10,6 @@ in { isNormalUser = true; # hashedPasswordFile = config.age.secrets.openai.path; shell = pkgs.zsh; - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPTdWHnYsr+sWg1tMSPRUaQhB8msdCoanaJOtP8v1ZBX root@cnix" - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCtk/N0vZIangyccQoDq1e+k+t9gdymaYvjIs+Xh6TIMuDEO2piaiAs5PvIPQI3FPlPG4rQKgJwE3RwTCM1XXX/euhXzzmae32E/eLBF7fOtT0YjA07sXAW+vjKI7xhEdh+3D2Vi59taV/sw8QsNwTYFo1BQjjwqSHN+xhM3myFKEMquTxo6LqfFMR8oLSTyC4qUwk+H2w/6kmVFJa/7qGVhbEpryM/Oj+LMqzG6PYfmWzZ2qPFJ4FWHLTLVstBxpvT4p91lm0Z6aC+4KyYo52vwzEk2U/GGwzzc5DbXgyAzhaU8BM8IWkaRiE7RU8PNM1vRQ05L1JJ1T2o9a92QeZiJxz+3cgV/yZUYOKdZNrfskKpOzdm00yfhznVpI8y1lfgyvd+eJRLLpeOkGnAO3fW7RLLcwVKX6st8gBWf2SKWNFyuWdTU9SJC/sgttiBrsCiBTItKYLE8ihdJLrJn+cIxUoFe6WjZa9bv0WWetiW3g1WgiJeIWnlWERdDsxKfatwkE8mfPJtt6mZio/cLyC16HN57fNkqMqelca9deaXu2hwWBuE0dsOsL6HlhY8lFwQ5P+x7D3gZGpYWMZl35uqDt2AzFGje3Rrzv0NO7UUixeIit6c5BWhSxIpSgpl6065Uo5+jfeQlbaO1Kri4wwCR6VvQ/F0v+4IQZLSzOC3Gw== root@cnix" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJMWwiz9YWBMUKFtAmF3xTEdBW27zkBH8UYaqWWcs70d cnst@cnix" - ]; extraGroups = ifTheyExist [ "wheel" "networkmanager" @@ -51,6 +46,8 @@ in { ]; }; + # environment.variables.COPILOT_API_KEY = config.age.secrets.cnstcopilot.path; + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion system.stateVersion = lib.mkDefault "23.11"; } diff --git a/secrets/helix-gpt.age b/secrets/helix-gpt.age new file mode 100644 index 00000000..c5f25658 --- /dev/null +++ b/secrets/helix-gpt.age @@ -0,0 +1,9 @@ +age-encryption.org/v1 +-> ssh-ed25519 13OpUQ pp2AqYbrvBHQuDxP0vwYHqXGEfROAZyps5PJDRXxuFI +T6eZEJkyAhhjxCLOmNRQxi5810m714gLOjOhJmQbJKw +-> ssh-ed25519 /lVW0g amS6bihZ4oqY1Pbih6i95c8xMCZzhb905YgmNNWJWzI +l/hJ7Smi1lXELNSAiFR/5cBpttwaLi6IJ0oHMvlXbOk +--- 5hrzVRt5StWSeQvk1hrMEi+ReC2HqWDJFOOFkqNwAkE + {.`D4e/X +$[ 74S{ +6O VV?-vI챒7:i@ոא" \ No newline at end of file diff --git a/secrets/secrets.nix b/secrets/secrets.nix index 6df1c668..21e8adcc 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -5,4 +5,5 @@ let in { "cnstssh.age".publicKeys = [cnst cnix]; "cnixssh.age".publicKeys = [cnst cnix]; + "helix-gpt.age".publicKeys = [cnst cnix]; } diff --git a/system/dev/default.nix b/system/dev/default.nix index 4cd5cd5f..6a3ef092 100644 --- a/system/dev/default.nix +++ b/system/dev/default.nix @@ -38,6 +38,7 @@ marksman pyright nodePackages_latest.intelephense + helix-gpt # Formatters alejandra diff --git a/system/modules/utils/agenix/default.nix b/system/modules/utils/agenix/default.nix index 82659485..5ec80982 100644 --- a/system/modules/utils/agenix/default.nix +++ b/system/modules/utils/agenix/default.nix @@ -36,6 +36,11 @@ in { secrets = { cnstssh.file = "${self}/secrets/cnstssh.age"; cnixssh.file = "${self}/secrets/cnixssh.age"; + helix-gpt = { + file = "${self}/secrets/helix-gpt.age"; + owner = "cnst"; + group = "users"; + }; }; }) (mkIf cfg.toothpc.enable {