Skip to content

Commit

Permalink
add nix flake
Browse files Browse the repository at this point in the history
  • Loading branch information
rszyma committed Jun 1, 2024
1 parent e2216cb commit a6892cc
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 2 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ yarn-error.log
*.vsix

# A symbolic link to a local development kanata repo for testing changes.
kanata-local
kanata-local
.direnv
86 changes: 86 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
# testing flake: nix develop --unset PATH

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";

rust-overlay.url = "github:oxalica/rust-overlay/stable";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
rust-overlay.inputs.flake-utils.follows = "flake-utils";
};

outputs = { self, nixpkgs, flake-utils, rust-overlay }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
target = "wasm32-unknown-unknown";
targetUpperSnake = pkgs.lib.toUpper (builtins.replaceStrings [ "-" ] [ "_" ] target);
toolchainOverride = {
extensions = [ "rust-src" ];
targets = [ target ];
};
in
{
devShells.default = pkgs.mkShell {
RUSTC_WRAPPER = "${pkgs.sccache}/bin/sccache";
"CARGO_TARGET_${targetUpperSnake}_LINKER" = "${pkgs.lld_18}/bin/lld";
RUSTFLAGS = nixpkgs.lib.strings.concatStringsSep " " [
# "-C link-arg=-fuse-ld=${pkgs.mold}"
# "-C link-arg=--ld-path=${pkgs.mold}"
# "-Zlinker-features=-lld"
];
nativeBuildInputs = with pkgs; [
# (rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override toolchainOverride))
(rust-bin.stable.latest.default.override toolchainOverride)
# (rust-bin.stable."1.73.0".default.override toolchainOverride)
just
git
yarn
wasm-pack
];
};
}
);
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"license": "LGPL-3.0",
"engines": {
"node": "^21.1.0",
"node": "^20.12.2",
"vscode": "^1.80.0"
},
"main": "./out/client.js",
Expand Down

0 comments on commit a6892cc

Please sign in to comment.