first commit

This commit is contained in:
2026-05-29 20:56:07 +08:00
parent a6d0c3a4b0
commit 198868e7c9
7 changed files with 142 additions and 70 deletions
+12 -6
View File
@@ -8,6 +8,7 @@
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./programs/clash.nix
];
@@ -18,6 +19,15 @@
networking.hostName = "nixos"; # Define your hostname.
programs.nix-ld.enable = true;
services.flatpak.enable = true;
services.flatpak.remotes = [{
name = "flathub";
location = "https://dl.flathub.org/repo/flathub.flatpakrepo";
}];
services.flatpak.packages = [
# "com.obsproject.Studio"
];
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
@@ -82,13 +92,9 @@
i18n.inputMethod = {
enable = true;
type = "fcitx5";
fcitx5.waylandFrontend = true;
fcitx5.addons = with pkgs; [
# 注入 rime-ice,并补齐中文输入与 KDE/Qt 集成组件。
(fcitx5-rime.override {
rimeDataPkgs = [
pkgs.rime-ice
];
})
# 使用 Fcitx5 拼音(由 fcitx5-chinese-addons 提供),并补齐 KDE/Qt 集成组件。
qt6Packages.fcitx5-chinese-addons
fcitx5-gtk
kdePackages.fcitx5-qt
Generated
+92 -7
View File
@@ -1,5 +1,42 @@
{
"nodes": {
"claude-code": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1780023606,
"narHash": "sha256-kLRVx7T+9ETF26prUsMA9Nm0LidSFN08oPLkXK5V2CA=",
"owner": "sadjow",
"repo": "claude-code-nix",
"rev": "879750a6fc504c9eafbab781798cb85e1b39242f",
"type": "github"
},
"original": {
"owner": "sadjow",
"repo": "claude-code-nix",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@@ -7,11 +44,11 @@
]
},
"locked": {
"lastModified": 1774738535,
"narHash": "sha256-2jfBEZUC67IlnxO5KItFCAd7Oc+1TvyV/jQlR+2ykGQ=",
"lastModified": 1779969295,
"narHash": "sha256-HwIJ3tOcwSMiV75L7KqJXciXR9UfT+d7rwOZMX7cTnA=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "769e07ef8f4cf7b1ec3b96ef015abec9bc6b1e2a",
"rev": "61e2c9659324181e0f0ed911958c536333b1d4f6",
"type": "github"
},
"original": {
@@ -20,13 +57,44 @@
"type": "github"
}
},
"nix-flatpak": {
"locked": {
"lastModified": 1779998907,
"narHash": "sha256-8CSkdFNkAF49pmhFneEFNAO4UX9/0FnoMwXMY3yyvi0=",
"owner": "gmodena",
"repo": "nix-flatpak",
"rev": "744221c2aef17f1f2a13278abfeabd9bd5e40180",
"type": "github"
},
"original": {
"owner": "gmodena",
"repo": "nix-flatpak",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1774386573,
"narHash": "sha256-4hAV26quOxdC6iyG7kYaZcM3VOskcPUrdCQd/nx8obc=",
"lastModified": 1779877693,
"narHash": "sha256-NOF9NAREhxr50bbBfVcVOq+ArCMSoe8dP79Pk2uyARk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "46db2e09e1d3f113a13c0d7b81e2f221c63b8ce9",
"rev": "4100e830e085863741bc69b156ec4ccd53ab5be0",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1779560665,
"narHash": "sha256-tpyBcxPpcQb8ukyNF7DoCwfSY3VPsxHoYwj00Cayv5o=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "64c08a7ca051951c8eae34e3e3cb1e202fe36786",
"type": "github"
},
"original": {
@@ -38,8 +106,25 @@
},
"root": {
"inputs": {
"claude-code": "claude-code",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
"nix-flatpak": "nix-flatpak",
"nixpkgs": "nixpkgs_2"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
+9 -9
View File
@@ -11,10 +11,13 @@
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs"; # 保证 Home Manager 用的软件版本和系统一致
};
claude-code.url = "github:sadjow/claude-code-nix";
nix-flatpak.url = "github:gmodena/nix-flatpak";
};
# 输出(最终建成的系统)
outputs = { self, nixpkgs, home-manager, ... }@inputs: {
outputs = { self, nixpkgs, home-manager, claude-code, nix-flatpak, ... }@inputs: {
nixosConfigurations = {
# 这里的 "nixos" 是你的系统主机名 (hostname)。
# 如果你在安装系统时改过主机名,请把这里的 "nixos" 换成你的实际主机名。
@@ -24,14 +27,9 @@
# 1. 引入系统底层的硬件和全局配置
./configuration.nix
({ config, pkgs, ... }: {
nixpkgs.overlays = [
(final: prev: {
# 调用我们之前写的 derivation,并将其命名为 claude-code
claude-code = final.callPackage ./pkgs/claude.nix { };
})
];
})
({ ... }: {
nixpkgs.overlays = [ claude-code.overlays.default ];
})
# 2. 把 Home Manager 作为系统模块请进来
home-manager.nixosModules.home-manager
@@ -42,6 +40,8 @@
# ⚠️ 极其重要:把这里的 "luodh" 替换成你在 NixOS 里登录的实际系统用户名
home-manager.users.test = import ./home.nix;
}
nix-flatpak.nixosModules.nix-flatpak
];
};
};
+20 -5
View File
@@ -5,17 +5,32 @@
home.username = "test";
home.homeDirectory = "/home/test";
# 允许安装闭源软件(比如 QQ
nixpkgs.config.allowUnfree = true;
# 你的个人日常软件全写在这里!
home.packages = with pkgs; [
qq
fastfetch
claude-code
# 你还可以加上其他软件,比如网易云、微信等
jetbrains-toolbox
];
# 用 Home Manager 固定 Fcitx5 输入法配置,仅保留拼音
home.file.".config/fcitx5/profile".text = ''
[Groups/0]
Name=Default
Default Layout=us
DefaultIM=pinyin
[Groups/0/Items/0]
Name=keyboard-us
Layout=
[Groups/0/Items/1]
Name=pinyin
Layout=
[GroupOrder]
0=Default
'';
# 以后你的 niri、KDE 等 dotfiles 配置都可以通过这种方式管理
# home.file.".config/niri/config.kdl".source = ./niri-config.kdl;
-42
View File
@@ -1,42 +0,0 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.stdenv.mkDerivation rec {
pname = "claude-code";
# 根据您之前的截图,我们锁定该版本以保证可复现性
version = "2.1.87";
# 直接从 GCS Bucket 抓取二进制文件,绕过 bash 脚本
src = pkgs.fetchurl {
url = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/${version}/linux-x64/claude";
# 提示:首次构建时,您可以将 hash 填为 lib.fakeHash
# Nix 会报错并告诉您正确的 SHA-256 哈希值,然后将其填入此处即可
hash = "sha256-saW4lGmGKt7g5NwoyrWoMUvE0BF+Gasmp7f/fOm1m9U=";
};
# 引入 autoPatchelfHook 自动修复 ELF 文件的动态链接
nativeBuildInputs = [ pkgs.autoPatchelfHook ];
# 添加运行该二进制所需的常见 C 标准库
# 如果运行后提示缺失某些 .so 文件,可在此处追加对应的依赖包
buildInputs = with pkgs; [
stdenv.cc.cc.lib
zlib
];
# 因为下载的是单一二进制文件,不需要解压源码
dontUnpack = true;
# 安装阶段:将其放入 Nix 标准的 bin 目录下
installPhase = ''
mkdir -p $out/bin
cp $src $out/bin/claude
chmod +x $out/bin/claude
'';
meta = with pkgs.lib; {
description = "Claude Code CLI";
homepage = "https://claude.ai";
platforms = platforms.linux;
};
}
+9
View File
@@ -0,0 +1,9 @@
{pkgs, ...}: {
programs.clash-verge = {
enable = true;
package = pkgs.clash-verge-rev;
autoStart = false;
tunMode = true;
serviceMode = true;
};
}
-1
View File
@@ -1 +0,0 @@
/nix/store/h9sb3rxf7as2i8wgnqam6nfhsci5kg87-nixos-system-nixos-25.11.8023.4590696c8693