diff --git a/flake.lock b/flake.lock index d651973..c86583c 100644 --- a/flake.lock +++ b/flake.lock @@ -279,26 +279,6 @@ } }, "home-manager": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1730633670, - "narHash": "sha256-ZFJqIXpvVKvzOVFKWNRDyIyAo+GYdmEPaYi1bZB6uf0=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "8f6ca7855d409aeebe2a582c6fd6b6a8d0bf5661", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, - "home-manager_2": { "inputs": { "nixpkgs": [ "schizofox", @@ -749,7 +729,6 @@ "root": { "inputs": { "helix": "helix", - "home-manager": "home-manager", "hyprland": "hyprland", "hyprland-plugins": "hyprland-plugins", "hyprsplit": "hyprsplit", @@ -787,7 +766,7 @@ "inputs": { "flake-compat": "flake-compat_2", "flake-parts": "flake-parts", - "home-manager": "home-manager_2", + "home-manager": "home-manager", "nixpak": "nixpak", "nixpkgs": [ "nixpkgs" diff --git a/flake.nix b/flake.nix index 90dc764..dc208e6 100644 --- a/flake.nix +++ b/flake.nix @@ -30,10 +30,6 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - home-manager = { - url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; - }; # Hyprland, my main compositor hyprland.url = "github:hyprwm/Hyprland"; diff --git a/hosts/temperance/configuration.nix b/hosts/temperance/configuration.nix index 8726e76..2e52b34 100644 --- a/hosts/temperance/configuration.nix +++ b/hosts/temperance/configuration.nix @@ -99,9 +99,6 @@ in { username = "cr"; }; - home-manager = { - enable = true; - }; }; programs = { ssh.enable = true; diff --git a/hosts/temperance/programs.nix b/hosts/temperance/programs.nix index dbc5ed9..5c468e3 100644 --- a/hosts/temperance/programs.nix +++ b/hosts/temperance/programs.nix @@ -9,6 +9,7 @@ difftastic distrobox element-desktop + equibop evince eza gcc diff --git a/modules/homix/module.nix b/modules/homix/module.nix deleted file mode 100644 index 1ed5f1b..0000000 --- a/modules/homix/module.nix +++ /dev/null @@ -1,95 +0,0 @@ -# This is 1:1 copied from https://github.com/sioodmy/homix. -# I simply put it here because it's not changing in any way anymore and i save myself a flake input this way. -{ - config, - lib, - pkgs, - ... -}: let - inherit (lib) mkOption mkEnableOption types filterAttrs attrValues mkIf mkDerivedConfig; - - inherit (builtins) map listToAttrs attrNames; -in { - options = { - homix = mkOption { - default = {}; - type = types.attrsOf (types.submodule ({ - name, - config, - options, - ... - }: { - options = { - path = mkOption { - type = types.str; - description = '' - Path to the file relative to the $HOME directory. - If not defined, name of attribute set will be used. - ''; - }; - source = mkOption { - type = types.path; - description = "Path of the source file or directory."; - }; - text = mkOption { - default = null; - type = types.nullOr types.lines; - description = "Text of the file."; - }; - }; - config = { - path = lib.mkDefault name; - source = mkIf (config.text != null) ( - let - name' = "homix-" + lib.replaceStrings ["/"] ["-"] name; - in - mkDerivedConfig options.text (pkgs.writeText name') - ); - }; - })); - }; - users.users = mkOption { - type = types.attrsOf (types.submodule { - options.homix = mkEnableOption "Enable homix for selected user"; - }); - }; - }; - - config = let - # list of users managed by homix - users = attrNames (filterAttrs (name: user: user.homix) config.users.users); - - homix-link = let - files = map (f: '' - FILE=$HOME/${f.path} - mkdir -p $(dirname $FILE) - ln -sf ${f.source} $FILE - '') (attrValues config.homix); - in - pkgs.writeShellScript "homix-link" '' - #!/bin/sh - ${builtins.concatStringsSep "\n" files} - ''; - - mkService = user: { - name = "homix-${user}"; - value = { - wantedBy = ["multi-user.target"]; - description = "Setup homix environment for ${user}."; - serviceConfig = { - Type = "oneshot"; - User = "${user}"; - ExecStart = "${homix-link}"; - }; - environment = { - # epic systemd momento - HOME = config.users.users.${user}.home; - }; - }; - }; - - services = listToAttrs (map mkService users); - in { - systemd.services = services; - }; -} diff --git a/modules/other/module.nix b/modules/other/module.nix index 7c23bd0..78869c7 100644 --- a/modules/other/module.nix +++ b/modules/other/module.nix @@ -2,7 +2,7 @@ _: { imports = [ # ./home-manager.nix ./system.nix - ./xdg.nix + # ./xdg.nix ./git.nix ./users.nix ]; diff --git a/modules/other/users.nix b/modules/other/users.nix index d21d160..6c6bd95 100644 --- a/modules/other/users.nix +++ b/modules/other/users.nix @@ -19,7 +19,6 @@ in { "audio" "nix" ]; - homix = true; shell = self.packages.${pkgs.stdenv.system}.fish; # hashedPasswordFile = "/etc/passwords/cr"; }; diff --git a/modules/programs/editors/helix/languages.nix b/modules/programs/editors/helix/languages.nix index 01ed9b4..d1b1fec 100644 --- a/modules/programs/editors/helix/languages.nix +++ b/modules/programs/editors/helix/languages.nix @@ -186,16 +186,6 @@ in { hostInfo = "helix"; }; }; - - # vscode-css-language-server = { - # command = "${pkgs.nodePackages.vscode-langservers-extracted}/bin/vscode-css-languageserver"; - # args = ["--stdio"]; - # config = { - # provideFormatter = true; - # css.validate.enable = true; - # scss.validate.enable = true; - # }; - # }; }; }; }; diff --git a/modules/programs/editors/helix/module.nix b/modules/programs/editors/helix/module.nix index 532f833..3b1afb5 100644 --- a/modules/programs/editors/helix/module.nix +++ b/modules/programs/editors/helix/module.nix @@ -6,14 +6,245 @@ ... }: let cfg = config.modules.system.programs.editors.helix; - inherit (config.modules.other.system) username; inherit (lib) mkIf getExe; inherit (inputs.helix.packages.${pkgs.stdenv.system}) helix; + toml = pkgs.formats.toml {}; + helix-config = { + theme = "catppuccin_mocha"; + editor = { + cursorline = false; + color-modes = true; + indent-guides.render = true; + lsp = { + display-inlay-hints = true; + display-messages = true; + }; + line-number = "relative"; + true-color = true; + auto-format = true; + completion-timeout = 5; + mouse = true; + bufferline = "multiple"; + soft-wrap.enable = true; + cursor-shape = { + insert = "bar"; + normal = "block"; + select = "underline"; + }; + statusline = { + left = ["spinner" "version-control" "diagnostics" "file-name"]; + right = ["file-base-name" "file-type" "position" "file-encoding"]; + }; + gutters.layout = ["diff" "diagnostics" "line-numbers" "spacer"]; + inline-diagnostics = { + cursor-line = "hint"; + other-lines = "error"; + }; + }; + keys = { + normal = { + space.g = [":new" ":insert-output XDG_CONFIG_HOME=~/.config ${getExe pkgs.lazygit}" ":buffer-close!" ":redraw"]; + esc = ["collapse_selection" "keep_primary_selection" "normal_mode"]; + A-H = "goto_previous_buffer"; + A-L = "goto_next_buffer"; + A-w = ":buffer-close"; + A-f = ":format"; + A-r = ":reload"; + A-x = "extend_to_line_bounds"; + X = ["extend_line_up" "extend_to_line_bounds"]; + }; + select = { + A-x = "extend_to_line_bounds"; + X = ["extend_line_up" "extend_to_line_bounds"]; + }; + }; + }; + helix-languages = { + language = let + extraFormatter = lang: { + command = getExe pkgs.deno; + args = ["fmt" "-" "--ext" lang]; + }; + in [ + { + name = "bash"; + auto-format = true; + formatter = { + command = getExe pkgs.shfmt; + args = ["-i" "2"]; + }; + } + { + name = "clojure"; + injection-regex = "(clojure|clj|edn|boot|yuck)"; + file-types = ["clj" "cljs" "cljc" "clje" "cljr" "cljx" "edn" "boot" "yuck"]; + } + { + name = "cmake"; + auto-format = true; + language-servers = ["cmake-language-server"]; + formatter = { + command = getExe pkgs.cmake-format; + args = ["-"]; + }; + } + { + name = "javascript"; + auto-format = true; + language-servers = ["dprint" "typescript-language-server"]; + } + { + name = "json"; + formatter = extraFormatter "json"; + } + { + name = "markdown"; + auto-format = true; + formatter = extraFormatter "md"; + } + { + name = "python"; + language-servers = ["pyright"]; + formatter = { + command = getExe pkgs.black; + args = ["-" "--quiet" "--line-length 100"]; + }; + } + { + name = "typescript"; + auto-format = true; + language-servers = ["dprint" "typescript-language-server"]; + } + { + name = "rust"; + debugger = { + command = "${pkgs.lldb_19}/bin/lldb-dap"; + name = "lldb"; + transport = "stdio"; + templates = [ + { + name = "binary"; + request = "launch"; + completion = [ + { + name = "binary"; + completion = "filename"; + } + ]; + args = { + program = "{0}"; + runInTerminal = true; + }; + } + ]; + }; + } + { + name = "c"; + debugger = { + name = "gdb"; + command = "${pkgs.gdb}/bin/gdb"; + transport = "stdio"; + templates = [ + { + name = "binary"; + request = "launch"; + completion = [ + { + name = "binary"; + completion = "filename"; + } + ]; + args = { + program = "{0}"; + runInTerminal = true; + }; + } + ]; + }; + } + ]; + + language-server = { + bash-language-server = { + command = getExe pkgs.bash-language-server; + args = ["start"]; + }; + + clangd = { + command = "${pkgs.clang-tools}/bin/clangd"; + clangd.fallbackFlags = ["-std=c++2b"]; + }; + + cmake-language-server = { + command = getExe pkgs.cmake-language-server; + }; + + dprint = { + command = getExe pkgs.dprint; + args = ["lsp"]; + }; + + nil = { + command = getExe pkgs.nil; + # alejandro + config.nil.formatting.command = ["${getExe pkgs.alejandra}" "-q"]; + }; + + qmlls = { + command = "${pkgs.kdePackages.full}/bin/qmlls"; + }; + + pyright = { + command = "${pkgs.pyright}/bin/pyright-langserver"; + args = ["--stdio"]; + config = { + reportMissingTypeStubs = false; + analysis = { + typeCheckingMode = "basic"; + autoImportCompletions = true; + }; + }; + }; + + typescript-language-server = { + command = getExe pkgs.typescript-language-server; + args = ["--stdio"]; + config = let + inlayHints = { + includeInlayEnumMemberValueHints = true; + includeInlayFunctionLikeReturnTypeHints = true; + includeInlayFunctionParameterTypeHints = true; + includeInlayParameterNameHints = "all"; + includeInlayParameterNameHintsWhenArgumentMatchesName = true; + includeInlayPropertyDeclarationTypeHints = true; + includeInlayVariableTypeHints = true; + }; + in { + typescript-language-server.source = { + addMissingImports.ts = true; + fixAll.ts = true; + organizeImports.ts = true; + removeUnusedImports.ts = true; + sortImports.ts = true; + }; + + typescript = {inherit inlayHints;}; + javascript = {inherit inlayHints;}; + + hostInfo = "helix"; + }; + }; + }; + }; wrapped-helix = pkgs.symlinkJoin { name = "helix-wrapped"; paths = with pkgs; [ helix + # typst lsp + tinymist + # C/C++ clang-tools @@ -29,66 +260,19 @@ # Shell shellcheck ]; + buildInputs = [pkgs.makeWrapper]; + postBuild = '' + mkdir -p $out/config/helix + cp "${toml.generate "config.toml" helix-config}" $out/config/helix/config.toml + cp "${toml.generate "languages.toml" helix-languages}" $out/config/helix/languages.toml + wrapProgram $out/bin/hx --set \ + XDG_CONFIG_HOME $out/config + ''; }; in { - imports = [./languages.nix]; config = mkIf cfg.enable { - home-manager.users.${username} = { - programs.helix = { - enable = true; - package = wrapped-helix; - - settings = { - theme = "catppuccin_mocha"; - editor = { - cursorline = false; - color-modes = true; - indent-guides.render = true; - lsp = { - display-inlay-hints = true; - display-messages = true; - }; - line-number = "relative"; - true-color = true; - auto-format = true; - completion-timeout = 5; - mouse = true; - bufferline = "multiple"; - soft-wrap.enable = true; - cursor-shape = { - insert = "bar"; - normal = "block"; - select = "underline"; - }; - statusline = { - left = ["spinner" "version-control" "diagnostics" "file-name"]; - right = ["file-base-name" "file-type" "position" "file-encoding"]; - }; - gutters.layout = ["diff" "diagnostics" "line-numbers" "spacer"]; - inline-diagnostics = { - cursor-line = "hint"; - other-lines = "error"; - }; - }; - keys = { - normal = { - space.g = [":new" ":insert-output ${getExe pkgs.lazygit}" ":buffer-close!" ":redraw"]; - esc = ["collapse_selection" "keep_primary_selection" "normal_mode"]; - A-H = "goto_previous_buffer"; - A-L = "goto_next_buffer"; - A-w = ":buffer-close"; - A-f = ":format"; - A-r = ":reload"; - A-x = "extend_to_line_bounds"; - X = ["extend_line_up" "extend_to_line_bounds"]; - }; - select = { - A-x = "extend_to_line_bounds"; - X = ["extend_line_up" "extend_to_line_bounds"]; - }; - }; - }; - }; - }; + environment.systemPackages = [ + wrapped-helix + ]; }; } diff --git a/modules/programs/launchers/fuzzel/module.nix b/modules/programs/launchers/fuzzel/module.nix index 07fb3c0..66aa2dd 100644 --- a/modules/programs/launchers/fuzzel/module.nix +++ b/modules/programs/launchers/fuzzel/module.nix @@ -9,21 +9,21 @@ cfg = config.modules.usrEnv.programs.launchers.fuzzel; in { config = mkIf cfg.enable { - home-manager.users.${username} = { - programs.fuzzel = { - enable = true; - package = pkgs.fuzzel; - settings = { - main = { - terminal = "${pkgs.foot}/bin/foot -e"; - # make fuzzel appear on fullscreen windows - layer = "overlay"; - icon-theme = "Papirus-Dark"; - font = "Lexend:weight=regular:size=14"; - }; - # background = "000000"; - }; - }; - }; + # home-manager.users.${username} = { + # programs.fuzzel = { + # enable = true; + # package = pkgs.fuzzel; + # settings = { + # main = { + # terminal = "${pkgs.foot}/bin/foot -e"; + # # make fuzzel appear on fullscreen windows + # layer = "overlay"; + # icon-theme = "Papirus-Dark"; + # font = "Lexend:weight=regular:size=14"; + # }; + # # background = "000000"; + # }; + # }; + # }; }; } diff --git a/modules/services/dunst.nix b/modules/services/dunst.nix index 7beb8b4..05e690a 100644 --- a/modules/services/dunst.nix +++ b/modules/services/dunst.nix @@ -14,7 +14,7 @@ in { config = mkIf cfg.enable { home-manager.users.${username} = { services.dunst = { - enable = true; + enable = false; package = pkgs.dunst; settings = { global = {