Skip to content

Commit 8e97068

Browse files
authored
feat: add nix packaging (#480)
* feat: add Nix flake and module for hermes-workspace deployment * chore: modernize Nix build by migrating to generic nodejs/pnpm packages and adding direnv integration
1 parent b69aa34 commit 8e97068

6 files changed

Lines changed: 535 additions & 0 deletions

File tree

.envrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
use flake

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Nix build outputs
2+
result
3+
result-*
4+
.direnv/
5+
16
# Dependencies
27
node_modules
38
.pnp

flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
{
2+
description = "Hermes Workspace — desktop workspace for Hermes Agent";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs =
10+
{
11+
self,
12+
nixpkgs,
13+
flake-utils,
14+
}:
15+
let
16+
# -----------------------------------------------------------------------
17+
# NixOS module — available on all systems
18+
# -----------------------------------------------------------------------
19+
nixosModules.default = import ./nix/module.nix;
20+
nixosModules.hermes-workspace = nixosModules.default;
21+
22+
# Overlay that adds hermes-workspace into any nixpkgs instance
23+
overlays.default = final: _prev: {
24+
hermes-workspace = final.callPackage ./nix/package.nix { };
25+
};
26+
overlays.hermes-workspace = overlays.default;
27+
in
28+
# -----------------------------------------------------------------------
29+
# Per-system outputs
30+
# -----------------------------------------------------------------------
31+
flake-utils.lib.eachDefaultSystem (
32+
system:
33+
let
34+
pkgs = import nixpkgs {
35+
inherit system;
36+
overlays = [ overlays.default ];
37+
};
38+
in
39+
{
40+
# -----------------------------------------------------------------
41+
# Packages
42+
# -----------------------------------------------------------------
43+
packages = {
44+
default = pkgs.hermes-workspace;
45+
hermes-workspace = pkgs.hermes-workspace;
46+
};
47+
48+
# -----------------------------------------------------------------
49+
# Apps (nix run . or nix run .#hermes-workspace)
50+
# -----------------------------------------------------------------
51+
apps =
52+
let
53+
app = {
54+
type = "app";
55+
program = "${pkgs.hermes-workspace}/bin/hermes-workspace";
56+
};
57+
in
58+
{
59+
default = app;
60+
hermes-workspace = app;
61+
};
62+
63+
# -----------------------------------------------------------------
64+
# Dev shell (nix develop)
65+
# -----------------------------------------------------------------
66+
devShells.default = pkgs.mkShell {
67+
name = "hermes-workspace-dev";
68+
69+
packages = with pkgs; [
70+
# Node / JS toolchain
71+
nodejs
72+
pnpm
73+
typescript
74+
75+
# Python for pty-helper and build scripts
76+
python3
77+
78+
# Nix tooling
79+
nil # Nix LSP
80+
nixfmt-rfc-style
81+
];
82+
83+
shellHook = ''
84+
echo ""
85+
echo " 🚀 hermes-workspace dev shell"
86+
echo " node $(node --version)"
87+
echo " pnpm $(pnpm --version)"
88+
echo " python $(python3 --version)"
89+
echo ""
90+
echo " Quick start:"
91+
echo " pnpm install"
92+
echo " pnpm dev # Vite dev server on :3000"
93+
echo " pnpm build # Production build → dist/"
94+
echo " node server-entry.js # Serve production build"
95+
echo ""
96+
'';
97+
};
98+
99+
# -----------------------------------------------------------------
100+
# Formatter (nix fmt)
101+
# -----------------------------------------------------------------
102+
formatter = pkgs.nixfmt-rfc-style;
103+
104+
# -----------------------------------------------------------------
105+
# Checks (nix flake check)
106+
# -----------------------------------------------------------------
107+
checks = {
108+
# Verify the package evaluates without building it
109+
package-eval = pkgs.runCommand "hermes-workspace-pkg-eval" { } ''
110+
echo "Package evaluated: ${pkgs.hermes-workspace.name}" > $out
111+
'';
112+
};
113+
}
114+
)
115+
// {
116+
# Expose module + overlay at the top level (system-agnostic)
117+
inherit nixosModules overlays;
118+
};
119+
}

0 commit comments

Comments
 (0)