Skip to content

Commit 7f42562

Browse files
committed
update flake.nix
1 parent 2f8dd00 commit 7f42562

3 files changed

Lines changed: 59 additions & 130 deletions

File tree

flake.lock

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

flake.nix

Lines changed: 19 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,29 @@
11
{
22
inputs = {
3-
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; # Or your preferred channel
3+
utils.url = "github:numtide/flake-utils";
44
};
5-
65
outputs =
7-
inputs@{ self, nixpkgs, ... }:
8-
let
9-
10-
forAllSystems =
11-
function:
12-
nixpkgs.lib.genAttrs
13-
[
14-
"x86_64-linux"
15-
"aarch64-linux"
16-
"x86_64-darwin"
17-
"aarch64-darwin"
18-
]
19-
(
20-
system:
21-
function (
22-
import nixpkgs {
23-
inherit system;
24-
# overlays = [ ... ]; # You can add overlays here if needed
25-
# config = { ... }; # Or pkgs configuration
26-
}
27-
)
28-
);
29-
30-
in
31-
rec {
32-
devShell = forAllSystems (
33-
pkgs:
34-
pkgs.mkShell {
35-
name = "my-dev-environment";
6+
{
7+
self,
8+
nixpkgs,
9+
utils,
10+
}:
11+
utils.lib.eachDefaultSystem (
12+
system:
13+
let
14+
pkgs = nixpkgs.legacyPackages.${system};
15+
in
16+
{
17+
devShell = pkgs.mkShell {
3618
buildInputs = with pkgs; [
19+
efm-langserver
20+
nil
3721
nodejs_latest
38-
nodePackages_latest.typescript-language-server
39-
nodePackages_latest.prettier
22+
typescript-language-server
23+
prettier
4024
vscode-langservers-extracted
4125
];
42-
# You can add shell hooks or environment variables here too
43-
# shellHook = ''
44-
# echo "Welcome to the development shell!"
45-
# export MY_VAR="hello"
46-
# '';
47-
}
48-
);
49-
50-
devShells = devShell;
51-
52-
packages = forAllSystems (pkgs: {
53-
dockerImage = pkgs.dockerTools.buildImage {
54-
name = "cf-workers-telegram-bot";
55-
tag = "latest";
56-
fromImage = pkgs.dockerTools.pullImage {
57-
imageName = "jacoblincool/workerd";
58-
imageDigest = "sha256:9ef73cacee85040a3c742b22ca0b8ee527d20465af58d4408f024cec1caf347c";
59-
sha256 = "sha256-7Ee5kG8qvGIzk3uyE/35fojl/qbsBvuBquJBWZGIqvA=";
60-
};
61-
copyToRoot = pkgs.buildEnv {
62-
name = "image-root";
63-
paths = [
64-
(pkgs.stdenv.mkDerivation {
65-
name = "docker-root";
66-
buildCommand = ''
67-
mkdir -p $out/worker
68-
cp ${./worker.capnp} $out/worker/worker.capnp
69-
cp -r ${self.packages.${pkgs.system}.default}/* $out/
70-
'';
71-
})
72-
];
73-
};
74-
config = {
75-
Cmd = [
76-
"/workerd"
77-
"serve"
78-
"/worker/worker.capnp"
79-
];
80-
WorkingDir = "/";
81-
};
8226
};
83-
default = pkgs.buildNpmPackage {
84-
name = "cf-workers-telegram-bot";
85-
src = ./.;
86-
npmDepsHash = "sha256-tlxWjtGMnTTMS4or/hZuWEoe+DI6eZRHbOKLsXx/LIY=";
87-
installPhase = ''
88-
runHook preInstall
89-
mkdir -p $out/worker
90-
cp -r dist/* $out/worker
91-
runHook postInstall
92-
'';
93-
};
94-
});
95-
96-
apps = forAllSystems (pkgs: {
97-
default = {
98-
type = "app";
99-
program = "${pkgs.writeScriptBin "run-worker" ''
100-
#!/bin/sh
101-
workerd serve ${self.packages.${pkgs.system}.default}/worker.mjs "$@"
102-
''}/bin/run-worker";
103-
};
104-
});
105-
};
27+
}
28+
);
10629
}

worker.capnp

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)