From 89f7260d4dbeca51c62b17379a15fcb791b93a13 Mon Sep 17 00:00:00 2001
From: TeAmo <93769000+Jetiaime@users.noreply.github.com>
Date: Thu, 16 Jan 2025 00:32:14 +0800
Subject: [PATCH] =?UTF-8?q?feat(nix)=EF=BC=9A=E6=B7=BB=E5=8A=A0=E5=88=9D?=
=?UTF-8?q?=E5=A7=8B=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E5=92=8C=E4=BE=9D?=
=?UTF-8?q?=E8=B5=96=E9=A1=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 创建 .gitignore 以排除不必要的文件和目录。
- 使用新的依赖项更新了 flake.lock,包括“deploy-rs”和各种“flake-compat”版本。
- 添加 flake.nix,其中包含核心系统、库和应用程序配置。
- 引入了各种系统的部署检查和默认配置。
- 为 aarch64-darwin 系统实现了用户和主配置。
- 添加了 GUI 应用程序和 CLI 工具配置,包括编辑器和终端设置。
- 建立了用于启用/禁用各种程序和服务的选项。
---
.gitignore | 3 +
checks/deploy/default.nix | 6 +
flake.lock | 126 +++++++++++++++---
flake.nix | 36 ++++-
homes/aarch64-darwin/teamo@blaze/default.nix | 45 +++++++
lib/deploy/defautl.nix | 41 ++++++
modules/common/programs/cli/default.nix | 10 +-
modules/darwin/home/default.nix | 29 +++-
.../programs/gui/browser/zen/default.nix | 20 +++
.../programs/gui/editor/cursor/default.nix | 19 +++
.../darwin/services/nix-daemon/default.nix | 20 +++
modules/darwin/user/default.nix | 13 +-
modules/home/home/deafult.nix | 28 ++++
modules/home/host/default.nix | 12 ++
.../programs/cli/editor/helix/default.nix | 22 +++
.../programs/cli/editor/neovim/default.nix | 23 ++++
.../cli/shell/prompt/starship/default.nix | 22 +++
.../programs/gui/editor/obsidian/default.nix | 28 ++++
.../programs/gui/editor/vscode/default.nix | 25 ++++
.../home/programs/gui/terminal/default.nix | 22 +--
.../gui/windows.launcher/raycast/default.nix | 22 +++
modules/home/user/user.nix | 42 ++++++
systems/aarch64-darwin/blaze/default.nix | 8 +-
23 files changed, 564 insertions(+), 58 deletions(-)
create mode 100644 .gitignore
create mode 100644 checks/deploy/default.nix
create mode 100644 homes/aarch64-darwin/teamo@blaze/default.nix
create mode 100644 lib/deploy/defautl.nix
create mode 100644 modules/darwin/programs/gui/browser/zen/default.nix
create mode 100644 modules/darwin/programs/gui/editor/cursor/default.nix
create mode 100644 modules/darwin/services/nix-daemon/default.nix
create mode 100644 modules/home/home/deafult.nix
create mode 100644 modules/home/host/default.nix
create mode 100644 modules/home/programs/cli/editor/helix/default.nix
create mode 100644 modules/home/programs/cli/editor/neovim/default.nix
create mode 100644 modules/home/programs/cli/shell/prompt/starship/default.nix
create mode 100644 modules/home/programs/gui/editor/vscode/default.nix
create mode 100644 modules/home/programs/gui/windows.launcher/raycast/default.nix
create mode 100644 modules/home/user/user.nix
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e5968bf
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+.DS_Store
+./vscode
+./idea
\ No newline at end of file
diff --git a/checks/deploy/default.nix b/checks/deploy/default.nix
new file mode 100644
index 0000000..a99eafe
--- /dev/null
+++ b/checks/deploy/default.nix
@@ -0,0 +1,6 @@
+{
+ inputs,
+ ...
+}: builtins.mapAttrs (
+ system: deploy-lib: deploy-lib.deployChecks inputs.self.deploy
+) inputs.deploy-rs.lib
\ No newline at end of file
diff --git a/flake.lock b/flake.lock
index 07816e2..5b12287 100644
--- a/flake.lock
+++ b/flake.lock
@@ -37,6 +37,26 @@
"type": "github"
}
},
+ "deploy-rs": {
+ "inputs": {
+ "flake-compat": "flake-compat",
+ "nixpkgs": "nixpkgs",
+ "utils": "utils"
+ },
+ "locked": {
+ "lastModified": 1727447169,
+ "narHash": "sha256-3KyjMPUKHkiWhwR91J1YchF6zb6gvckCAY1jOE+ne0U=",
+ "owner": "serokell",
+ "repo": "deploy-rs",
+ "rev": "aa07eb05537d4cd025e2310397a6adcedfe72c76",
+ "type": "github"
+ },
+ "original": {
+ "owner": "serokell",
+ "repo": "deploy-rs",
+ "type": "github"
+ }
+ },
"flake-compat": {
"flake": false,
"locked": {
@@ -49,12 +69,28 @@
},
"original": {
"owner": "edolstra",
- "ref": "v1.0.1",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_2": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1696426674,
+ "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
+ "owner": "edolstra",
+ "repo": "flake-compat",
+ "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
+ "type": "github"
+ },
+ "original": {
+ "owner": "edolstra",
+ "ref": "v1.0.1",
+ "repo": "flake-compat",
+ "type": "github"
+ }
+ },
+ "flake-compat_3": {
"flake": false,
"locked": {
"lastModified": 1650374568,
@@ -70,7 +106,7 @@
"type": "github"
}
},
- "flake-compat_3": {
+ "flake-compat_4": {
"flake": false,
"locked": {
"lastModified": 1650374568,
@@ -141,7 +177,7 @@
},
"flake-utils_2": {
"inputs": {
- "systems": "systems"
+ "systems": "systems_2"
},
"locked": {
"lastModified": 1694529238,
@@ -159,7 +195,7 @@
},
"flake-utils_3": {
"inputs": {
- "systems": "systems_2"
+ "systems": "systems_3"
},
"locked": {
"lastModified": 1731533236,
@@ -249,7 +285,7 @@
},
"nix-darwin": {
"inputs": {
- "nixpkgs": "nixpkgs"
+ "nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1716329735,
@@ -269,7 +305,7 @@
"inputs": {
"brew-src": "brew-src",
"nix-darwin": "nix-darwin",
- "nixpkgs": "nixpkgs_2"
+ "nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1736041957,
@@ -287,15 +323,18 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1687274257,
- "narHash": "sha256-TutzPriQcZ8FghDhEolnHcYU2oHIG5XWF+/SUBNnAOE=",
- "path": "/nix/store/22qgs3skscd9bmrxv9xv4q5d4wwm5ppx-source",
- "rev": "2c9ecd1f0400076a4d6b2193ad468ff0a7e7fdc5",
- "type": "path"
+ "lastModified": 1702272962,
+ "narHash": "sha256-D+zHwkwPc6oYQ4G3A1HuadopqRwUY/JkMwHz1YF7j4Q=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "e97b3e4186bcadf0ef1b6be22b8558eab1cdeb5d",
+ "type": "github"
},
"original": {
- "id": "nixpkgs",
- "type": "indirect"
+ "owner": "NixOS",
+ "ref": "nixpkgs-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
}
},
"nixpkgs-unstable": {
@@ -315,6 +354,19 @@
}
},
"nixpkgs_2": {
+ "locked": {
+ "lastModified": 1687274257,
+ "narHash": "sha256-TutzPriQcZ8FghDhEolnHcYU2oHIG5XWF+/SUBNnAOE=",
+ "path": "/nix/store/22qgs3skscd9bmrxv9xv4q5d4wwm5ppx-source",
+ "rev": "2c9ecd1f0400076a4d6b2193ad468ff0a7e7fdc5",
+ "type": "path"
+ },
+ "original": {
+ "id": "nixpkgs",
+ "type": "indirect"
+ }
+ },
+ "nixpkgs_3": {
"locked": {
"lastModified": 1716330097,
"narHash": "sha256-8BO3B7e3BiyIDsaKA0tY8O88rClYRTjvAp66y+VBUeU=",
@@ -330,7 +382,7 @@
"type": "github"
}
},
- "nixpkgs_3": {
+ "nixpkgs_4": {
"locked": {
"lastModified": 1736200483,
"narHash": "sha256-JO+lFN2HsCwSLMUWXHeOad6QUxOuwe9UOAF/iSl1J4I=",
@@ -346,7 +398,7 @@
"type": "github"
}
},
- "nixpkgs_4": {
+ "nixpkgs_5": {
"locked": {
"lastModified": 1735821806,
"narHash": "sha256-cuNapx/uQeCgeuhUhdck3JKbgpsml259sjUQnWM7zW8=",
@@ -365,9 +417,10 @@
"root": {
"inputs": {
"darwin": "darwin",
+ "deploy-rs": "deploy-rs",
"home-manager": "home-manager",
"nix-homebrew": "nix-homebrew",
- "nixpkgs": "nixpkgs_3",
+ "nixpkgs": "nixpkgs_4",
"nixpkgs-unstable": "nixpkgs-unstable",
"snowfall-flake": "snowfall-flake",
"snowfall-lib": "snowfall-lib_2",
@@ -397,7 +450,7 @@
},
"snowfall-flake": {
"inputs": {
- "flake-compat": "flake-compat",
+ "flake-compat": "flake-compat_2",
"nixpkgs": [
"nixpkgs"
],
@@ -419,7 +472,7 @@
},
"snowfall-lib": {
"inputs": {
- "flake-compat": "flake-compat_2",
+ "flake-compat": "flake-compat_3",
"flake-utils-plus": "flake-utils-plus",
"nixpkgs": [
"snowfall-flake",
@@ -443,7 +496,7 @@
},
"snowfall-lib_2": {
"inputs": {
- "flake-compat": "flake-compat_3",
+ "flake-compat": "flake-compat_4",
"flake-utils-plus": "flake-utils-plus_2",
"nixpkgs": [
"nixpkgs"
@@ -493,13 +546,46 @@
"type": "github"
}
},
+ "systems_3": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ },
+ "utils": {
+ "inputs": {
+ "systems": "systems"
+ },
+ "locked": {
+ "lastModified": 1701680307,
+ "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
"wezterm": {
"inputs": {
"flake-utils": "flake-utils_3",
"freetype2": "freetype2",
"harfbuzz": "harfbuzz",
"libpng": "libpng",
- "nixpkgs": "nixpkgs_4",
+ "nixpkgs": "nixpkgs_5",
"rust-overlay": "rust-overlay",
"zlib": "zlib"
},
diff --git a/flake.nix b/flake.nix
index 8276476..4988172 100644
--- a/flake.nix
+++ b/flake.nix
@@ -2,6 +2,11 @@
description = "TeAmo's Nix Darwin Configuration";
inputs = {
+
+ #########################################################
+ # Core Systems #
+ #########################################################
+
# Nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
@@ -23,6 +28,13 @@
inputs.nixpkgs.follows = "nixpkgs";
};
+ #########################################################
+ # Core Libs #
+ #########################################################
+
+ # Deployment
+ deploy-rs.url = "github:serokell/deploy-rs";
+
# Snowfall Lib
snowfall-lib = {
url = "github:snowfallorg/lib";
@@ -35,6 +47,10 @@
inputs.nixpkgs.follows = "nixpkgs";
};
+ #########################################################
+ # Applications #
+ #########################################################
+
# WezTerm
wezterm.url = "github:wez/wezterm?dir=nix";
};
@@ -56,7 +72,7 @@
};
};
};
- in lib.mkFlake {
+ in with lib; mkFlake {
channels-config = {
allowUnfree = true;
permittedInsecurePackages = [];
@@ -65,6 +81,22 @@
overlays = [];
- systems = {};
+ systems = {
+ modules = {
+ nixos = with inputs; [
+ home-manager.nixosModules.home-manager
+ ];
+
+ darwin = with inputs; [
+ home-manager.darwinModules.home-manager
+ ];
+ };
+
+ hosts = {};
+ };
+
+ deploy = mkDeploy {
+ inherit inputs;
+ };
};
}
diff --git a/homes/aarch64-darwin/teamo@blaze/default.nix b/homes/aarch64-darwin/teamo@blaze/default.nix
new file mode 100644
index 0000000..031f077
--- /dev/null
+++ b/homes/aarch64-darwin/teamo@blaze/default.nix
@@ -0,0 +1,45 @@
+{
+ lib,
+ namespace,
+ ...
+}: let
+ inherit (lib.${namespace}) enabled;
+in {
+ ${namespace} = {
+ home = {
+ enable = true;
+ stateVersion = "24.11";
+ };
+
+ user = {
+ enable = true;
+ email = "1157757077@qq.com";
+ };
+
+ programs = {
+ cli = {
+ editor = {
+ neovim = enabled;
+ helix = enabled;
+ };
+
+ shell = {
+ prompt = {
+ starship = enabled;
+ };
+ };
+ };
+
+ gui = {
+ editor = {
+ obsidian = enabled;
+ vscode = enabled;
+ };
+
+ terminal.wezterm = enabled;
+
+ windows.launcher.raycast = enabled;
+ };
+ };
+ };
+}
diff --git a/lib/deploy/defautl.nix b/lib/deploy/defautl.nix
new file mode 100644
index 0000000..929017b
--- /dev/null
+++ b/lib/deploy/defautl.nix
@@ -0,0 +1,41 @@
+{
+ lib,
+ inputs,
+ namespace,
+ ...
+}: let
+ inherit (inputs) deploy-rs;
+in {
+ mkDeploy = {
+ self,
+ overrides ? {},
+ }: let
+ inherit (lib) foldl optionalAttrs;
+
+ hosts = self.nixosConfigurations or { };
+
+ names = builtins.attrNames hosts;
+
+ nodes = foldl ( result: name: let
+ host = hosts.${name};
+ user = host.config.${namespace}.user.name;
+ in
+ result // {
+ ${name} = (overrides.${name} or { }) // {
+ hostname = overrides.hostname or "${name}";
+ profiles = (overrides.profiles or { }) // {
+ system = (overrides.${name}.profiles.system or { }) // {
+ path = deploy-rs.lib.${name}.activate.nixos host;
+ } // optionalAttrs (user != "") {
+ user = "root";
+ sshUser = user;
+ };
+ };
+ };
+ }
+
+ ) { } names;
+ in {
+ inherit nodes;
+ };
+}
\ No newline at end of file
diff --git a/modules/common/programs/cli/default.nix b/modules/common/programs/cli/default.nix
index bd908b9..89b68c6 100644
--- a/modules/common/programs/cli/default.nix
+++ b/modules/common/programs/cli/default.nix
@@ -25,11 +25,11 @@ in {
git # Git
jq # jq is a lightweight and flexible command-line JSON processor
lsof # List open files
- nixd
- nil
- unzip
- wget
- vim
+ nixd # Nix development tool
+ nil # Nix Language Server
+ unzip # Unzip
+ wget # Wget
+ vim # Vim
];
};
}
\ No newline at end of file
diff --git a/modules/darwin/home/default.nix b/modules/darwin/home/default.nix
index 22cdad9..1ab4685 100644
--- a/modules/darwin/home/default.nix
+++ b/modules/darwin/home/default.nix
@@ -1,25 +1,42 @@
{
lib,
+ config,
+ options,
namespace,
...
}: let
inherit (lib.${namespace}) mkAttrsOpt;
+in
+{
-in {
options.${namespace}.home = {
- file = mkAttrsOpt {} "A set of files to be managed by home-manager's .";
- configFile = mkAttrsOpt {} "A set of config files to be managed by home-manager's .";
- extraConfig = mkAttrsOpt {} "Options to pass directly to home-manager.";
- homeConfig = mkAttrsOpt {} "Final configuration for home-manager.";
+ file = mkAttrsOpt { } "A set of files to be managed by home-manager's .";
+ configFile =
+ mkAttrsOpt { }
+ "A set of files to be managed by home-manager's .";
+ extraOptions = mkAttrsOpt { } "Options to pass directly to home-manager.";
+ homeConfig = mkAttrsOpt { } "Final config for home-manager.";
};
config = {
+ ${namespace}.home.extraOptions = {
+ home.file = lib.mkAliasDefinitions options.${namespace}.home.file;
+ xdg.enable = true;
+ xdg.configFile = lib.mkAliasDefinitions options.${namespace}.home.configFile;
+ };
+
+ snowfallorg.users.${config.${namespace}.user.name}.home.config =
+ lib.mkAliasDefinitions
+ options.${namespace}.home.extraOptions;
home-manager = {
+ # enables backing up existing files instead of erroring if conflicts exist
backupFileExtension = "hm.old";
+
useGlobalPkgs = true;
useUserPackages = true;
+
verbose = true;
};
};
-}
+}
\ No newline at end of file
diff --git a/modules/darwin/programs/gui/browser/zen/default.nix b/modules/darwin/programs/gui/browser/zen/default.nix
new file mode 100644
index 0000000..3792de4
--- /dev/null
+++ b/modules/darwin/programs/gui/browser/zen/default.nix
@@ -0,0 +1,20 @@
+{
+ lib,
+ config,
+ namespace,
+ ...
+}: let
+ inherit (lib) mkIf;
+ inherit (lib.${namespace}) mkBoolOpt;
+
+ cfg = config.${namespace}.programs.gui.browser.zen;
+in {
+ options.${namespace}.programs.gui.browser.zen = {
+ enabled = mkBoolOpt false "Whether to enable Browser Zen.";
+ };
+
+ config = mkIf cfg.enabled {
+ homebrew.casks = [ "zen-browser" ];
+ };
+}
+
diff --git a/modules/darwin/programs/gui/editor/cursor/default.nix b/modules/darwin/programs/gui/editor/cursor/default.nix
new file mode 100644
index 0000000..8538390
--- /dev/null
+++ b/modules/darwin/programs/gui/editor/cursor/default.nix
@@ -0,0 +1,19 @@
+{
+ lib,
+ config,
+ namespace,
+ ...
+}: let
+ inherit (lib) mkIf;
+ inherit (lib.${namespace}) mkBoolOpt;
+
+ cfg = config.${namespace}.programs.gui.editor.cursor;
+in {
+ options.${namespace}.programs.gui.editor.cursor = {
+ enabled = mkBoolOpt false "Whether to enable Cursor.";
+ };
+
+ config = mkIf cfg.enabled {
+ homebrew.casks = [ "cursor" ];
+ };
+}
diff --git a/modules/darwin/services/nix-daemon/default.nix b/modules/darwin/services/nix-daemon/default.nix
new file mode 100644
index 0000000..17cf86d
--- /dev/null
+++ b/modules/darwin/services/nix-daemon/default.nix
@@ -0,0 +1,20 @@
+{
+ lib,
+ config,
+ namespace,
+ ...
+}: let
+ inherit (lib) mkIf;
+ inherit (lib.${namespace}) mkBoolOpt;
+
+ cfg = config.${namespace}.services.nix-daemon;
+in {
+
+ options.${namespace}.services.nix-daemon = {
+ enable = mkBoolOpt false "Whether or not enable nix-daemon service.";
+ };
+
+ config = mkIf cfg.enable {
+ services.nix-daemon.enable = true;
+ };
+}
\ No newline at end of file
diff --git a/modules/darwin/user/default.nix b/modules/darwin/user/default.nix
index 8f3ad41..785473b 100644
--- a/modules/darwin/user/default.nix
+++ b/modules/darwin/user/default.nix
@@ -11,13 +11,20 @@
cfg = config.${namespace}.user;
in {
options.${namespace}.user = {
- name = mkStrOpt "teamo" "The user name.";
- email = mkStrOpt "1157757077@qq.com" "The user email.";
- fullName = mkStrOpt "Teamo" "The user full name.";
+ name = mkStrOpt "" "The user name.";
+ email = mkStrOpt "" "The user email.";
+ fullName = mkStrOpt "" "The user full name.";
uid = mkOpt (types.nullOr types.int) 1000 "The user uid.";
};
config = {
+ assertions = [
+ {
+ assertion = cfg.name != "";
+ message = "The name of the user is required.";
+ }
+ ];
+
users.users.${cfg.name} = {
uid = mkIf (cfg.uid != null) cfg.uid;
shell = pkgs.zsh;
diff --git a/modules/home/home/deafult.nix b/modules/home/home/deafult.nix
new file mode 100644
index 0000000..5cb9f69
--- /dev/null
+++ b/modules/home/home/deafult.nix
@@ -0,0 +1,28 @@
+{
+ lib,
+ config,
+ namespace,
+ ...
+}: let
+ inherit (lib) mkIf;
+ inherit (lib.${namespace}) mkStrOpt mkBoolOpt enabled;
+
+ cfg = config.${namespace}.home;
+in {
+ options.${namespace}.home = {
+ enable = mkBoolOpt false "Whether or not enable home configuration.";
+ stateVersion = mkStrOpt "" "The state version of the home configuration.";
+ };
+
+ config = mkIf cfg.enable {
+ assertions = [
+ {
+ assertion = cfg.stateVersion != "";
+ message = "The state version of the home configuration is required.";
+ }
+ ];
+
+ programs.home-manager = enabled;
+ home.stateVersion = cfg.stateVersion;
+ };
+}
diff --git a/modules/home/host/default.nix b/modules/home/host/default.nix
new file mode 100644
index 0000000..a7e41f1
--- /dev/null
+++ b/modules/home/host/default.nix
@@ -0,0 +1,12 @@
+{
+ lib,
+ host,
+ namespace,
+ ...
+}: let
+ inherit (lib.${namespace}) mkStrOpt;
+in {
+ options.${namespace}.host = {
+ name = mkStrOpt host "The name of the host.";
+ };
+}
diff --git a/modules/home/programs/cli/editor/helix/default.nix b/modules/home/programs/cli/editor/helix/default.nix
new file mode 100644
index 0000000..68442be
--- /dev/null
+++ b/modules/home/programs/cli/editor/helix/default.nix
@@ -0,0 +1,22 @@
+{
+ lib,
+ pkgs,
+ config,
+ namespace,
+ ...
+}: let
+ inherit (lib) mkIf;
+ inherit (lib.${namespace}) mkBoolOption;
+
+ cfg = config.${namespace}.programs.cli.editor.helix;
+in {
+ options.${namespace}.programs.cli.editor.helix = {
+ enable = mkBoolOption "Whether to enable helix";
+ };
+
+ config = mkIf cfg.enable {
+ home.packages = with pkgs; [
+ helix
+ ];
+ };
+}
diff --git a/modules/home/programs/cli/editor/neovim/default.nix b/modules/home/programs/cli/editor/neovim/default.nix
new file mode 100644
index 0000000..d0cff1b
--- /dev/null
+++ b/modules/home/programs/cli/editor/neovim/default.nix
@@ -0,0 +1,23 @@
+{
+ lib,
+ pkgs,
+ config,
+ namespace,
+ ...
+}: let
+ inherit (lib) mkIf;
+ inherit (lib.${namespace}) mkBoolOption;
+
+ cfg = config.${namespace}.programs.cli.editor.neovim;
+in {
+ options.${namespace}.programs.cli.editor.neovim = {
+ enable = mkBoolOption "Whether to enable neovim";
+ };
+
+ config = mkIf cfg.enable {
+ home.packages = with pkgs; [
+ neovim
+ ];
+ };
+}
+
diff --git a/modules/home/programs/cli/shell/prompt/starship/default.nix b/modules/home/programs/cli/shell/prompt/starship/default.nix
new file mode 100644
index 0000000..a937125
--- /dev/null
+++ b/modules/home/programs/cli/shell/prompt/starship/default.nix
@@ -0,0 +1,22 @@
+{
+ lib,
+ pkgs,
+ config,
+ namespace,
+ ...
+}: let
+ inherit (lib) mkIf;
+ inherit (lib.${namespace}) mkBoolOption;
+
+ cfg = config.${namespace}.programs.cli.shell.prompt.starship;
+in {
+ options.${namespace}.programs.cli.shell.prompt.starship = {
+ enable = mkBoolOption "Whether to enable starship";
+ };
+
+ config = mkIf cfg.enable {
+ home.packages = with pkgs; [
+ starship
+ ];
+ };
+}
diff --git a/modules/home/programs/gui/editor/obsidian/default.nix b/modules/home/programs/gui/editor/obsidian/default.nix
index e69de29..b68d16d 100644
--- a/modules/home/programs/gui/editor/obsidian/default.nix
+++ b/modules/home/programs/gui/editor/obsidian/default.nix
@@ -0,0 +1,28 @@
+{
+ lib,
+ pkgs,
+ config,
+ system,
+ namespace,
+ ...
+}: let
+ inherit (lib) mkIf;
+ inherit (lib.snowfall.systems) isDarwin;
+ inherit (lib.${namespace}) mkBoolOpt;
+
+ cfg = config.${namespace}.programs.gui.editor.obsidian;
+in {
+ options.${namespace}.programs.gui.editor.obsidian = {
+ enable = mkBoolOpt false "Whether or not enable obsidian.";
+ };
+
+ config = mkIf cfg.enable (
+ if isDarwin system
+ then {
+ homebrew.casks = [ "obsidian" ];
+ }
+ else {
+ home.packages = with pkgs; [ obsidian ];
+ }
+ );
+}
diff --git a/modules/home/programs/gui/editor/vscode/default.nix b/modules/home/programs/gui/editor/vscode/default.nix
new file mode 100644
index 0000000..d56e660
--- /dev/null
+++ b/modules/home/programs/gui/editor/vscode/default.nix
@@ -0,0 +1,25 @@
+{
+ lib,
+ pkgs,
+ config,
+ namespace,
+ ...
+}: let
+ inherit (lib) mkIf;
+ inherit (lib.${namespace}) mkBoolOpt;
+
+ cfg = config.${namespace}.programs.gui.editor.vscode;
+in {
+ options.programs.gui.editor.vscode = {
+ enable = mkBoolOpt false "Whether or not to enable vscode.";
+ };
+
+ config = mkIf cfg.enable {
+ programs.vscode = {
+ enable = true;
+ enableUpdateCheck = true;
+ package = pkgs.vscode;
+ };
+ };
+}
+
diff --git a/modules/home/programs/gui/terminal/default.nix b/modules/home/programs/gui/terminal/default.nix
index f97e86c..a6dbe75 100644
--- a/modules/home/programs/gui/terminal/default.nix
+++ b/modules/home/programs/gui/terminal/default.nix
@@ -12,7 +12,7 @@
cfg = config.${namespace}.programs.gui.terminal.wezterm;
in {
options.${namespace}.programs.gui.terminal.wezterm = {
- enable = mkBoolOpt false "Whether or not to manage WezTerm.";
+ enable = mkBoolOpt false "Whether or not to enable WezTerm.";
};
config = mkIf cfg.enable {
@@ -21,26 +21,6 @@ in {
enableZshIntegration = true;
enableBashIntegration = true;
package = inputs.wezterm.packages.${system}.default;
- extraConfig = ''
- -- 添加当前配置目录到 Lua 的搜索路径
- package.path = string.format(
- "%s/extraConfig/?.lua;%s",
- debug.getinfo(1).source:match("@?(.*/)"),
- package.path
- )
-
- -- 导入主配置模块
- local config = require('wezterm')
- return config
- '';
- };
-
- # 复制配置文件到 home-manager 管理的位置
- home.file = {
- ".config/wezterm/" = {
- source = ./extraConfig;
- recursive = true; # 确保复制整个目录及其内容
- };
};
};
}
diff --git a/modules/home/programs/gui/windows.launcher/raycast/default.nix b/modules/home/programs/gui/windows.launcher/raycast/default.nix
new file mode 100644
index 0000000..4bbda7b
--- /dev/null
+++ b/modules/home/programs/gui/windows.launcher/raycast/default.nix
@@ -0,0 +1,22 @@
+{
+ lib,
+ pkgs,
+ config,
+ namespace,
+ ...
+}: let
+ inherit (lib) mkIf;
+ inherit (lib.${namespace}) mkBoolOpt;
+
+ cfg = config.${namespace}.programs.gui.windows.launcher.raycast;
+in {
+ options.programs.gui.windows.launcher.raycast = {
+ enable = mkBoolOpt false "Whether or not enable raycast.";
+ };
+
+ config = mkIf cfg.enable {
+ home.packages = with pkgs; [
+ raycast
+ ];
+ };
+}
diff --git a/modules/home/user/user.nix b/modules/home/user/user.nix
new file mode 100644
index 0000000..b12d5cb
--- /dev/null
+++ b/modules/home/user/user.nix
@@ -0,0 +1,42 @@
+{
+ lib,
+ config,
+ system,
+ namespace,
+ ...
+}: let
+ inherit (lib) mkIf;
+ inherit (lib.${namespace}) mkStrOpt mkBoolOpt;
+ inherit (lib.snowfall.systems) isDarwin;
+
+ cfg = config.${namespace}.user;
+in {
+ options.${namespace}.user = {
+ enable = mkBoolOpt false "Whether or not enable user configuration.";
+ email = mkStrOpt "" "The email address of the user.";
+ name = mkStrOpt config.snowfall.user.name "The name of the user.";
+ home = mkStrOpt (
+ if isDarwin system
+ then "/Users/${cfg.name}"
+ else "/home/${cfg.name}"
+ ) "The home directory of the user.";
+ };
+
+ config = mkIf cfg.enable {
+ assertions = [
+ {
+ assertion = cfg.name != "";
+ message = "The name of the user is required.";
+ }
+ {
+ assertion = cfg.home != "";
+ message = "The home directory of the user is required.";
+ }
+ ];
+
+ home = {
+ username = cfg.name;
+ homeDirectory = cfg.home;
+ };
+ };
+}
diff --git a/systems/aarch64-darwin/blaze/default.nix b/systems/aarch64-darwin/blaze/default.nix
index 3ae4bb5..3ae04f4 100644
--- a/systems/aarch64-darwin/blaze/default.nix
+++ b/systems/aarch64-darwin/blaze/default.nix
@@ -6,6 +6,12 @@
inherit (lib.${namespace}) enabled;
in {
${namespace} = {
+ user = {
+ name = "teamo";
+ email = "1157757077@qq.com";
+ fullName = "Te Amo";
+ };
+
system = {
enable = true;
stateVersion = 5;
@@ -35,4 +41,4 @@ in {
};
};
};
-}
+}
\ No newline at end of file