init
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
.direnv
|
||||
test
|
||||
result
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 Kilari Teja
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
116
README.md
Normal file
116
README.md
Normal file
@@ -0,0 +1,116 @@
|
||||
# T-Packs T 老师精选软件
|
||||
|
||||
T-Packs 是一个使用 Nix 构建系统管理的精选软件包集合,旨在提供高质量、实用的开发工具和实用程序。
|
||||
|
||||
## 🚀 项目特点
|
||||
|
||||
- 使用 Nix Flakes 管理依赖和构建过程
|
||||
- 包含精选的开发工具和实用程序
|
||||
- 提供统一的配置和安装方式
|
||||
- 支持 NixOS 模块集成
|
||||
|
||||
## 📦 包含的软件包
|
||||
|
||||
### ut - 开发者工具盒
|
||||
|
||||
`ut` 是一个基于 Rust 开发的开发者工具盒,灵感来自 [it-tools.tech](https://it-tools.tech)。
|
||||
|
||||
- 轻量级、高性能的命令行工具
|
||||
- 提供多种实用功能
|
||||
- 开源 (MIT 许可证)
|
||||
|
||||
## 🛠️ 快速开始
|
||||
|
||||
### 前提条件
|
||||
|
||||
确保您已安装 Nix 包管理器,并启用了 Flakes 支持。
|
||||
|
||||
### 使用方法
|
||||
|
||||
#### 作为依赖引入
|
||||
|
||||
在您的 flake.nix 中添加:
|
||||
|
||||
```nix
|
||||
{ inputs.t-packs.url = "github:your-username/t-packs";
|
||||
|
||||
outputs = { self, nixpkgs, t-packs }: {
|
||||
# 使用 t-packs 中的包
|
||||
yourPackage = t-packs.packages.${system}.com.github.ksdme.ut;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
#### 在 NixOS 中使用
|
||||
|
||||
在您的 NixOS 配置中导入模块:
|
||||
|
||||
```nix
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
t-packs.nixosModules.default
|
||||
];
|
||||
|
||||
# 配置相关服务
|
||||
}
|
||||
```
|
||||
|
||||
#### 开发环境
|
||||
|
||||
进入开发环境:
|
||||
|
||||
```bash
|
||||
nix develop
|
||||
```
|
||||
|
||||
这将提供以下开发工具:
|
||||
- `tokei` - 代码统计工具
|
||||
- `nil` - Nix 语言服务器
|
||||
|
||||
## 📋 项目结构
|
||||
|
||||
```
|
||||
├── com/ # 软件包定义
|
||||
│ └── github/ # GitHub 来源的包
|
||||
│ └── ksdme/ # 作者 ksdme 的包
|
||||
│ └── ut/ # ut 工具包
|
||||
├── default.nix # 默认包定义
|
||||
├── flake.nix # Flake 配置
|
||||
├── flake.lock # 依赖锁定文件
|
||||
├── treefmt.nix # 代码格式化配置
|
||||
└── README.md # 项目说明文档
|
||||
```
|
||||
|
||||
## 📝 开发指南
|
||||
|
||||
### 格式化代码
|
||||
|
||||
使用 treefmt 格式化项目代码:
|
||||
|
||||
```bash
|
||||
nix fmt
|
||||
```
|
||||
|
||||
### 添加新软件包
|
||||
|
||||
1. 在适当的目录下创建新的 Nix 文件
|
||||
2. 在 default.nix 或 flake.nix 中添加相应的导入和配置
|
||||
3. 运行 `nix flake update` 更新依赖
|
||||
|
||||
## 📄 许可证
|
||||
|
||||
[MIT License](LICENSE)
|
||||
|
||||
## 👨🏫 关于 T 老师
|
||||
|
||||
T 老师精选软件 (T-Packs) 是由 T 老师精心挑选和维护的实用软件集合,旨在为开发者提供高质量、易于使用的工具。
|
||||
|
||||
## 🤝 贡献指南
|
||||
|
||||
欢迎提交 Issue 和 Pull Request 来改进这个项目!
|
||||
|
||||
---
|
||||
|
||||
*使用 Nix,让软件管理更简单!*
|
||||
|
||||
4
com/default.nix
Normal file
4
com/default.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
github = import ./github { inherit pkgs; };
|
||||
}
|
||||
4
com/github/default.nix
Normal file
4
com/github/default.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
ksdme = import ./ksdme { inherit pkgs; };
|
||||
}
|
||||
4
com/github/ksdme/default.nix
Normal file
4
com/github/ksdme/default.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
ut = pkgs.callPackage ./ut/package.nix { };
|
||||
}
|
||||
26
com/github/ksdme/ut/package.nix
Normal file
26
com/github/ksdme/ut/package.nix
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
rustPlatform,
|
||||
fetchFromGitHub,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "ut";
|
||||
version = "0.2.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ksdme";
|
||||
repo = "ut";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-+dKDLBgmwhc9LnXTDgtqGxcFxgu4cdkauY6X5FpE3+8=";
|
||||
};
|
||||
|
||||
cargoHash = "sha256-jWSp0NzeXQu38fAaZ8eTqVN+uvpn6v5xgoi3N5SCQoc=";
|
||||
|
||||
meta = with lib; {
|
||||
description = "A Rust based utilty toolbox for developers. Inspired from https://it-tools.tech";
|
||||
homepage = "https://github.com/ksdme/ut";
|
||||
license = licenses.mit;
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
||||
1
default.nix
Normal file
1
default.nix
Normal file
@@ -0,0 +1 @@
|
||||
{ }
|
||||
62
flake.lock
generated
Normal file
62
flake.lock
generated
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1759917807,
|
||||
"narHash": "sha256-WoSazth5EXIJmveWf0zbTMycrgpbLYOth6KhmltMuv0=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "fb5cf53218b987f2703a5bbc292a030c0fe33443",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1754340878,
|
||||
"narHash": "sha256-lgmUyVQL9tSnvvIvBp7x1euhkkCho7n3TMzgjdvgPoU=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "cab778239e705082fe97bb4990e0d24c50924c04",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1758728421,
|
||||
"narHash": "sha256-ySNJ008muQAds2JemiyrWYbwbG+V7S5wg3ZVKGHSFu8=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "5eda4ee8121f97b218f7cc73f5172098d458f1d1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
47
flake.nix
Normal file
47
flake.nix
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
treefmt-nix.url = "github:numtide/treefmt-nix";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
treefmt-nix,
|
||||
...
|
||||
}:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
|
||||
inherit (pkgs) mkShell;
|
||||
in
|
||||
{
|
||||
formatter.${system} = treefmtEval.config.build.wrapper;
|
||||
devShell."${system}" = mkShell {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
tokei
|
||||
nil
|
||||
];
|
||||
};
|
||||
|
||||
packages."${system}" = {
|
||||
com = import ./com { inherit pkgs; };
|
||||
};
|
||||
|
||||
nixosModules =
|
||||
let
|
||||
t-packs = self.packages."${system}";
|
||||
in
|
||||
rec {
|
||||
t-packs =
|
||||
{ config, lib, ... }:
|
||||
{
|
||||
imports = [];
|
||||
};
|
||||
|
||||
default = t-packs;
|
||||
};
|
||||
};
|
||||
}
|
||||
4
treefmt.nix
Normal file
4
treefmt.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
projectRootFile = "flake.nix";
|
||||
programs.nixfmt.enable = true;
|
||||
}
|
||||
Reference in New Issue
Block a user