From 6a6070431d784f20f3a42bfc2d419e7ebd3677fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Sun, 21 Apr 2024 14:15:40 +0100 Subject: [PATCH] re-add helix, adding its cache --- nixos/boxes/foryog/default.nix | 33 ++++++++++++------- nixos/helix/default.nix | 16 +++++++++ nixos/helix/home.nix | 60 ++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+), 12 deletions(-) create mode 100644 nixos/helix/default.nix create mode 100644 nixos/helix/home.nix diff --git a/nixos/boxes/foryog/default.nix b/nixos/boxes/foryog/default.nix index df4df977..2f2c38e3 100644 --- a/nixos/boxes/foryog/default.nix +++ b/nixos/boxes/foryog/default.nix @@ -1,4 +1,11 @@ -{ config, pkgs, inputs, lib, system, ... }: { +{ + config, + pkgs, + inputs, + lib, + system, + ... +}: { networking.hostName = "foryog"; imports = [ @@ -8,20 +15,20 @@ ../../git ../../gnome ../../gui + ../../helix ../../mercurial ../../vim ../../zsh ]; - fileSystems."/" = { options = [ "compress=zstd" ]; }; + fileSystems."/" = {options = ["compress=zstd"];}; services.restic.backups.home-to-b2 = { repository = lib.mkForce "b2:cyplo-restic-foureighty:/"; }; - boot.kernelParams = - [ "initcall_debug" ''dyndbg="file suspend.c +p"'' "no_console_suspend" ]; + boot.kernelParams = ["initcall_debug" ''dyndbg="file suspend.c +p"'' "no_console_suspend"]; boot.tmp.cleanOnBoot = true; - boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; + boot.binfmt.emulatedSystems = ["aarch64-linux"]; boot.plymouth = { enable = true; logo = ./boot.png; @@ -37,17 +44,19 @@ hardware.trackpoint.enable = true; hardware.keyboard.qmk.enable = true; - services.udev.packages = [ pkgs.qmk-udev-rules ]; + services.udev.packages = [pkgs.qmk-udev-rules]; programs.ccache.enable = true; - hardware.opengl.extraPackages = with pkgs; [ libva ]; + hardware.opengl.extraPackages = with pkgs; [libva]; programs.steam.enable = true; nixpkgs.config.allowUnfree = true; - home-manager.users.cyryl = { ... }: { - imports = [ ../../home-manager/programs/kitty.nix ]; + home-manager.users.cyryl = {...}: { + imports = [ + ../../home-manager/programs/kitty.nix + ]; home.packages = - (with inputs.nixpkgs-master.legacyPackages."${system}"; [ bisq-desktop ]) - ++ (with pkgs; [ lutris ]) - ++ (with inputs.endless-sky.legacyPackages."${system}"; [ endless-sky ]); + (with inputs.nixpkgs-master.legacyPackages."${system}"; [bisq-desktop]) + ++ (with pkgs; [lutris]) + ++ (with inputs.endless-sky.legacyPackages."${system}"; [endless-sky]); }; } diff --git a/nixos/helix/default.nix b/nixos/helix/default.nix new file mode 100644 index 00000000..63fbac2c --- /dev/null +++ b/nixos/helix/default.nix @@ -0,0 +1,16 @@ +{ + config, + pkgs, + lib, + ... +}: { + nix.settings = { + trusted-substituters = [ + "https://helix.cachix.org" + ]; + extra-trusted-public-keys = [ + "helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs=" + ]; + }; + home-manager.users.cyryl = {...}: {imports = [./home.nix];}; +} diff --git a/nixos/helix/home.nix b/nixos/helix/home.nix new file mode 100644 index 00000000..6b09ba7f --- /dev/null +++ b/nixos/helix/home.nix @@ -0,0 +1,60 @@ +{ + lib, + inputs, + system, + ... +}: let + alejandra = lib.getExe inputs.alejandra.packages.${system}.default; + nil = lib.getExe inputs.nil.packages.${system}.default; + helixPackage = inputs.helix.packages.${system}.default; + helix = lib.getExe helixPackage; +in { + home.sessionVariables = { + EDITOR = lib.mkForce helix; + VISUAL = lib.mkForce helix; + }; + programs.zsh.sessionVariables = { + EDITOR = lib.mkForce helix; + VISUAL = lib.mkForce helix; + }; + systemd.user.sessionVariables = { + EDITOR = lib.mkForce helix; + VISUAL = lib.mkForce helix; + }; + + programs.helix = { + enable = true; + package = helixPackage; + languages = { + language = [ + { + name = "nix"; + auto-format = true; + language-servers = ["nil"]; + formatter = { + command = alejandra; + args = ["-q"]; + }; + } + ]; + language-server.nil = { + command = nil; + config.nil.nix = { + maxMemoryMB = 8192; + flake.autoEvalInputs = true; + }; + }; + }; + settings = { + theme = "solarized_dark"; + editor = { + auto-save = true; + auto-pairs = false; + file-picker.hidden = false; + lsp.display-messages = true; + line-number = "relative"; + soft-wrap.enable = true; + }; + }; + }; +}