From 445dfe6543f4710bdf9abddc60671d98b9f5798e Mon Sep 17 00:00:00 2001 From: Ulic-youthlic Date: Fri, 10 Jan 2025 16:33:08 +0800 Subject: [PATCH] move helix as home module, provide option youthlic.programs.helix. --- .../configurations/Tytonidae/default.nix | 13 ++--- .../Tytonidae/helix/default.nix | 13 ----- home/modules/default.nix | 1 + .../Tytonidae => modules}/helix/config.toml | 0 home/modules/helix/default.nix | 56 +++++++++++++++++++ 5 files changed, 63 insertions(+), 20 deletions(-) delete mode 100644 home/david/configurations/Tytonidae/helix/default.nix rename home/{david/configurations/Tytonidae => modules}/helix/config.toml (100%) create mode 100644 home/modules/helix/default.nix diff --git a/home/david/configurations/Tytonidae/default.nix b/home/david/configurations/Tytonidae/default.nix index 22b6bc1..143a994 100644 --- a/home/david/configurations/Tytonidae/default.nix +++ b/home/david/configurations/Tytonidae/default.nix @@ -3,12 +3,12 @@ config, rootPath, inputs, + unixName, ... }: { imports = [ ./starship - ./helix ./fish ./rime-ice.nix ./firefox.nix @@ -17,6 +17,9 @@ ./niri ./zed.nix ]; + + youthlic.programs.helix.enable = true; + xdg.userDirs = { enable = true; download = "${config.home.homeDirectory}/dls"; @@ -29,8 +32,8 @@ desktop = "${config.home.homeDirectory}/dsk"; createDirectories = true; }; - home.username = "david"; - home.homeDirectory = "/home/david"; + home.username = "${unixName}"; + home.homeDirectory = "/home/${unixName}"; home.stateVersion = "24.11"; programs.home-manager.enable = true; programs.git = { @@ -61,13 +64,9 @@ dust qq telegram-desktop - taplo ghostty sops scrcpy - markdown-oxide - deno - taplo ast-grep lazygit dig diff --git a/home/david/configurations/Tytonidae/helix/default.nix b/home/david/configurations/Tytonidae/helix/default.nix deleted file mode 100644 index f242381..0000000 --- a/home/david/configurations/Tytonidae/helix/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ ... }: -{ - programs.helix = { - enable = true; - defaultEditor = true; - settings = - let - config-file = builtins.readFile ./config.toml; - config = builtins.fromTOML config-file; - in - config; - }; -} diff --git a/home/modules/default.nix b/home/modules/default.nix index 767f377..9a8a2c7 100644 --- a/home/modules/default.nix +++ b/home/modules/default.nix @@ -6,6 +6,7 @@ ]) ++ [ ./nix.nix + ./helix ]; options = { diff --git a/home/david/configurations/Tytonidae/helix/config.toml b/home/modules/helix/config.toml similarity index 100% rename from home/david/configurations/Tytonidae/helix/config.toml rename to home/modules/helix/config.toml diff --git a/home/modules/helix/default.nix b/home/modules/helix/default.nix new file mode 100644 index 0000000..813aaf4 --- /dev/null +++ b/home/modules/helix/default.nix @@ -0,0 +1,56 @@ +{ + lib, + pkgs, + config, + ... +}: +{ + options = { + youthlic.programs.helix = { + enable = lib.mkOption { + type = lib.types.bool; + default = true; + example = false; + description = '' + enable helix editor + ''; + }; + extraPackages = lib.mkOption { + type = lib.types.listOf lib.types.package; + default = with pkgs; [ + taplo + markdown-oxide + nixd + deno + nixfmt-rfc-style + ]; + example = ( + with pkgs; + [ + deno + ] + ); + description = '' + extra packages for helix lsp and formatter + ''; + }; + }; + }; + config = + let + cfg = config.youthlic.programs.helix; + in + { + programs.helix = lib.mkIf cfg.enable { + enable = true; + defaultEditor = true; + settings = + let + config-file = builtins.readFile ./config.toml; + config = builtins.fromTOML config-file; + in + config; + }; + home.packages = cfg.extraPackages; + }; +}