Skip to content

Commit

Permalink
Add flake to build lemurs
Browse files Browse the repository at this point in the history
  • Loading branch information
coastalwhite committed Apr 6, 2024
1 parent a2d8547 commit 465566f
Show file tree
Hide file tree
Showing 2 changed files with 180 additions and 0 deletions.
129 changes: 129 additions & 0 deletions flake.lock

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

51 changes: 51 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
description = "A flake to build a Rust project to WASM";

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

rust-overlay.url = "github:oxalica/rust-overlay";
};

outputs = { self, nixpkgs, utils, rust-overlay }:
utils.lib.eachDefaultSystem (system:
let
packageName = "lemurs";

pkgs = import nixpkgs {
inherit system;
overlays = [ rust-overlay.overlays.default ];
};

rustToolchain = pkgs.rust-bin.stable.latest.default;

rustPlatform = pkgs.makeRustPlatform {
cargo = rustToolchain;
rustc = rustToolchain;
};
in {
packages.default = rustPlatform.buildRustPackage {
name = packageName;
src = ./.;

postPatch = ''
substituteInPlace extra/config.toml \
--replace-fail "/usr/sh" "${pkgs.bash}/bin/bash"
substituteInPlace extra/config.toml \
--replace-fail "/usr/bin/X" "${pkgs.xorg.xorgserver}/bin/X"
substituteInPlace extra/config.toml \
--replace-fail "/usr/bin/xauth" "${pkgs.xorg.xauth}/bin/xauth"
'';

buildInputs = [
pkgs.linux-pam
];

cargoLock.lockFile = ./Cargo.lock;
};
}
);
}

0 comments on commit 465566f

Please sign in to comment.