From 1cc5ff724f938193d30c6f4a8f6e28fc411cda91 Mon Sep 17 00:00:00 2001
From: Sense T <me@sense-t.eu.org>
Date: Sat, 1 Mar 2025 09:47:34 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=9B=AE=E5=BD=95=E7=BB=93?=
 =?UTF-8?q?=E6=9E=84=EF=BC=8C=E7=94=A8=E5=8E=82=E5=95=86=E5=8C=BA=E5=88=86?=
 =?UTF-8?q?=E4=B8=80=E4=B8=8B=E5=8C=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 flake.nix                                        |  4 ++--
 h3c/default.nix                                  |  5 +++++
 .../inode-client}/module.nix                     | 16 +++++++++++-----
 .../inode-client}/package.nix                    |  8 ++++----
 4 files changed, 22 insertions(+), 11 deletions(-)
 create mode 100644 h3c/default.nix
 rename {h3c-inode-client => h3c/inode-client}/module.nix (75%)
 rename {h3c-inode-client => h3c/inode-client}/package.nix (95%)

diff --git a/flake.nix b/flake.nix
index fe818d1..e9043cb 100644
--- a/flake.nix
+++ b/flake.nix
@@ -52,7 +52,7 @@
       };
 
       packages."${system}" = {
-        h3c-inode-client = pkgs.callPackage ./h3c-inode-client/package.nix { };
+        h3c = import ./h3c { inherit pkgs; };
       };
 
       nixosModules =
@@ -64,7 +64,7 @@
             { config, lib, ... }:
             {
               imports = [
-                (import ./h3c-inode-client/module.nix { inherit lib pkgs-chuang config; })
+                (import ./h3c/inode-client/module.nix { inherit lib pkgs-chuang config; })
               ];
             };
 
diff --git a/h3c/default.nix b/h3c/default.nix
new file mode 100644
index 0000000..42e4a84
--- /dev/null
+++ b/h3c/default.nix
@@ -0,0 +1,5 @@
+{ pkgs, ... }:
+{
+  # 导入安装包
+  inode-client = pkgs.callPackage ./inode-client/package.nix { };
+}
diff --git a/h3c-inode-client/module.nix b/h3c/inode-client/module.nix
similarity index 75%
rename from h3c-inode-client/module.nix
rename to h3c/inode-client/module.nix
index 42c7f58..2f52202 100644
--- a/h3c-inode-client/module.nix
+++ b/h3c/inode-client/module.nix
@@ -10,7 +10,13 @@ in
 {
   options.services.h3c-inode-client = {
     enable = lib.mkEnableOption "H3C iNodeClient - ssl vpn client.";
-    package = lib.mkPackageOption pkgs-chuang "h3c-inode-client" { };
+    package = lib.mkPackageOption pkgs-chuang "h3c.inode-client" {
+      pkgsText = "pkgs-chuang";
+      default = [
+        "h3c"
+        "inode-client"
+      ];
+    };
   };
 
   config = lib.mkIf cfg.enable {
@@ -18,10 +24,10 @@ in
     environment.systemPackages = [ cfg.package ];
 
     systemd.services.h3c-inode-client = {
-      wantedBy = [
-        "network-online.target"
-        "graphical.target"
-      ];
+      #wantedBy = [
+      #  "network-online.target"
+      #  "graphical.target"
+      #];
       after = [ "network-online.target" ];
       serviceConfig = {
         Type = "simple";
diff --git a/h3c-inode-client/package.nix b/h3c/inode-client/package.nix
similarity index 95%
rename from h3c-inode-client/package.nix
rename to h3c/inode-client/package.nix
index 71e558e..cbdf04a 100644
--- a/h3c-inode-client/package.nix
+++ b/h3c/inode-client/package.nix
@@ -53,8 +53,8 @@ let
     xorg.libXxf86vm
   ];
 in
-stdenv.mkDerivation {
-  pname = "h3c-inode-client";
+stdenv.mkDerivation rec {
+  pname = "inode-client";
   version = "7.3.0";
 
   src = fetchTarball {
@@ -113,11 +113,11 @@ stdenv.mkDerivation {
 
     # 运行文件
     mkdir -p $out/bin
-    cat > $out/bin/h3c-inode-client <<EOF
+    cat > $out/bin/${pname} <<EOF
     #!/usr/bin/env bash
     $out${install_dir}/.iNode/iNodeClient
     EOF
-    chmod +x $out/bin/h3c-inode-client
+    chmod +x $out/bin/${pname}
 
     cat > $out/bin/setup <<EOF
     #!/usr/bin/env bash