diff --git a/README.md b/README.md index 67fb7ad8..59041a8c 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,49 @@ Linux 应用的数量相对有限,Wine 软件的可获取性也颇为困难。 1. `paru -S spark-store` +### Nix / NixOS + +仓库提供 `x86_64-linux` 和 `aarch64-linux` 的 Flake 软件包。在仓库根目录构建和运行: + +```bash +nix build . +nix run . +``` + +Flake 复用 `nix/package.nix` 从源码构建,版本读取自 `package.json`,npm 依赖由 `package-lock.json` 固定。`flake.lock` 固定 Nixpkgs 和 `github:Melorise/amber-pm/nixos` 的版本,APM 与商店共用 Nixpkgs 输入。 + +在 NixOS Flake 的 `inputs` 中加入商店和 APM: + +```nix +spark-store = { + url = "git+https://gitee.com/Melorise/spark-store.git?ref=nixos"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.amber-pm.follows = "amber-pm"; +}; +amber-pm = { + url = "github:Melorise/amber-pm/nixos"; + inputs.nixpkgs.follows = "nixpkgs"; +}; +``` + +在通过 `specialArgs` 接收 `inputs` 的系统配置模块中引用软件包,并启用 APM 模块管理容器状态、字体和桌面入口: + +```nix +{ inputs, pkgs, ... }: +{ + imports = [ inputs.amber-pm.nixosModules.default ]; + + environment.systemPackages = [ + inputs.spark-store.packages.${pkgs.stdenv.hostPlatform.system}.default + ]; + + programs.amber-pm = { + enable = true; + package = inputs.amber-pm.packages.${pkgs.stdenv.hostPlatform.system}.default; + }; +} +``` + ---
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 00000000..ac15b0d5
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,49 @@
+{
+ "nodes": {
+ "amber-pm": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1791444935,
+ "narHash": "sha256-Hbb+ygOFitT1g6eFhc3VLE6CoszGNNccniQQMexN19o=",
+ "owner": "Melorise",
+ "repo": "amber-pm",
+ "rev": "44aa06b3e8f0750cc62727816a823005886b2358",
+ "type": "github"
+ },
+ "original": {
+ "owner": "Melorise",
+ "ref": "nixos",
+ "repo": "amber-pm",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1792502884,
+ "narHash": "sha256-IoNisKcGbUjdd45qCqywGMCYmZ5EnkxezvLII0FWwNA=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "02c087f3fe673c9e317f206a627cb6b910336dbe",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "amber-pm": "amber-pm",
+ "nixpkgs": "nixpkgs"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 00000000..429b2338
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,32 @@
+{
+ description = "星火应用商店";
+
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+ amber-pm = {
+ url = "github:Melorise/amber-pm/nixos";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ };
+
+ outputs =
+ { nixpkgs, amber-pm, ... }:
+ {
+ packages = nixpkgs.lib.genAttrs [
+ "x86_64-linux"
+ "aarch64-linux"
+ ] (
+ system:
+ let
+ pkgs = nixpkgs.legacyPackages.${system};
+ spark-store = pkgs.callPackage ./nix/package.nix {
+ apm = amber-pm.packages.${system}.default;
+ };
+ in
+ {
+ inherit spark-store;
+ default = spark-store;
+ }
+ );
+ };
+}