Add simple Rust Crane project
The Nix code is taken from the Crane docs, and adapted for merging with the existing Haskell.Nix flake. The other files are from `cargo init`, with minor modifications, and `cargo generate-lockfile`. The default dev shell contains tools for both languages. We can now run `nix build .#rust` and `nix build .#haskell`, where the latter was previously `nix build .#aoc:exe:aoc`.
This commit is contained in:
parent
83b994965d
commit
2950ff778e
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
dist*/
|
||||
result
|
||||
/target
|
||||
|
||||
7
Cargo.lock
generated
Normal file
7
Cargo.lock
generated
Normal file
@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "aoc"
|
||||
version = "0.1.0"
|
||||
6
Cargo.toml
Normal file
6
Cargo.toml
Normal file
@ -0,0 +1,6 @@
|
||||
[package]
|
||||
name = "aoc"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
16
flake.lock
generated
16
flake.lock
generated
@ -83,6 +83,21 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"crane": {
|
||||
"locked": {
|
||||
"lastModified": 1763938834,
|
||||
"narHash": "sha256-j8iB0Yr4zAvQLueCZ5abxfk6fnG/SJ5JnGUziETjwfg=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "d9e753122e51cee64eb8d2dddfe11148f339f5a2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
@ -588,6 +603,7 @@
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"crane": "crane",
|
||||
"flake-utils": "flake-utils",
|
||||
"haskellNix": "haskellNix",
|
||||
"nixpkgs": [
|
||||
|
||||
17
flake.nix
17
flake.nix
@ -2,7 +2,8 @@
|
||||
inputs.haskellNix.url = "github:input-output-hk/haskell.nix";
|
||||
inputs.nixpkgs.follows = "haskellNix/nixpkgs-unstable";
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
outputs = { self, nixpkgs, flake-utils, haskellNix }:
|
||||
inputs.crane.url = "github:ipetkov/crane";
|
||||
outputs = { self, nixpkgs, flake-utils, haskellNix, crane }:
|
||||
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
|
||||
let
|
||||
overlays = [
|
||||
@ -17,7 +18,19 @@
|
||||
];
|
||||
pkgs = import nixpkgs { inherit system overlays; inherit (haskellNix) config; };
|
||||
haskell = pkgs.hixProject.flake { };
|
||||
rust = crane.mkLib pkgs;
|
||||
in
|
||||
haskell
|
||||
{
|
||||
devShells.default = pkgs.mkShell {
|
||||
inputsFrom = [
|
||||
haskell.devShells.default
|
||||
(rust.devShell { })
|
||||
];
|
||||
};
|
||||
packages = {
|
||||
haskell = haskell.packages."aoc:exe:aoc";
|
||||
rust = rust.buildPackage { src = rust.cleanCargoSource ./.; };
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
3
src/main.rs
Normal file
3
src/main.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user