Skip to content

Commit

Permalink
Update flake.nix
Browse files Browse the repository at this point in the history
  • Loading branch information
kings177 authored Mar 10, 2024
1 parent 2841cbf commit e5648e7
Showing 1 changed file with 34 additions and 48 deletions.
82 changes: 34 additions & 48 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,56 +1,42 @@
{
description = "A massively parallel functional runtime.";

inputs = {
flake-compat = {
flake = false;
url = "github:edolstra/flake-compat";
};
nci = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:yusdacra/nix-cargo-integration";
};
nix-filter.url = "github:numtide/nix-filter";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = inputs:
let
name = "hvm";
nix-filter = import inputs.nix-filter;
pkgs = common: packages:
builtins.map (element: common.pkgs.${element}) packages;
in inputs.nci.lib.makeOutputs {
config = common: {
cCompiler = { package = common.pkgs.clang; };
outputs = {
defaults = {
app = name;
package = name;
};
};
runtimeLibs = pkgs common [ "openssl" ];
shell = {
commands =
builtins.map (element: { package = common.pkgs.${element}; }) [
"ghc"
"nodejs"
];

outputs = { self, nixpkgs, flake-utils, rust-overlay }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ rust-overlay.overlay ];
};
};
pkgConfig = common:
let
override = { buildInputs = pkgs common [ "openssl" "pkg-config" ]; };
in {
${name} = {
app = true;
build = true;
depsOverrides = { inherit override; };
overrides = { inherit override; };
profiles = { release = false; };

src = builtins.filterSource
(name: type: builtins.elem (baseNameOf name) [
"src" "Cargo.lock" "Cargo.toml" "rust-toolchain.toml"
])
./.;

in {
packages = {
hvm = pkgs.stdenv.mkDerivation {
pname = "hvm";
version = "0.1.0";
src = pkgs.lib.cleanSource src;
buildInputs = [ pkgs.rustPlatform.rust ];
buildPhase = "cargo build --release";
installPhase = ''
mkdir -p $out/bin
cp target/release/hvm $out/bin/
'';
};
};
root = nix-filter {
root = ./.;
include = [ "src" "Cargo.lock" "Cargo.toml" "rust-toolchain.toml" ];
};
};

defaultPackage = self.packages.${system}.hvm;
}
);
}

0 comments on commit e5648e7

Please sign in to comment.