-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit dcdeeff
Showing
15 changed files
with
455 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use nix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
flake.lock linguist-generated=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: ["master"] | ||
pull_request: | ||
branches: ["develop"] | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Nix | ||
uses: DeterminateSystems/nix-installer-action@v4 | ||
- name: Run the Magic Nix Cache | ||
uses: DeterminateSystems/magic-nix-cache-action@v2 | ||
- name: Build | ||
run: | | ||
nix build .# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/target | ||
/result-bin |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# This file was @generated by cargo2nix 0.11.0. | ||
# It is not intended to be manually edited. | ||
|
||
args@{ | ||
release ? true, | ||
rootFeatures ? [ | ||
"utils/default" | ||
"cli/default" | ||
], | ||
rustPackages, | ||
buildRustPackages, | ||
hostPlatform, | ||
hostPlatformCpu ? null, | ||
hostPlatformFeatures ? [], | ||
target ? null, | ||
codegenOpts ? null, | ||
profileOpts ? null, | ||
cargoUnstableFlags ? null, | ||
rustcLinkFlags ? null, | ||
rustcBuildFlags ? null, | ||
mkRustCrate, | ||
rustLib, | ||
lib, | ||
workspaceSrc, | ||
ignoreLockHash, | ||
}: | ||
let | ||
nixifiedLockHash = "e1174dd2490db7bebb5095bd9a33dae53aa22730bb5a9f6514c4cebc093fd14e"; | ||
workspaceSrc = if args.workspaceSrc == null then ./. else args.workspaceSrc; | ||
currentLockHash = builtins.hashFile "sha256" (workspaceSrc + /Cargo.lock); | ||
lockHashIgnored = if ignoreLockHash | ||
then builtins.trace "Ignoring lock hash" ignoreLockHash | ||
else ignoreLockHash; | ||
in if !lockHashIgnored && (nixifiedLockHash != currentLockHash) then | ||
throw ("Cargo.nix ${nixifiedLockHash} is out of sync with Cargo.lock ${currentLockHash}") | ||
else let | ||
inherit (rustLib) fetchCratesIo fetchCrateLocal fetchCrateGit fetchCrateAlternativeRegistry expandFeatures decideProfile genDrvsByProfile; | ||
profilesByName = { | ||
}; | ||
rootFeatures' = expandFeatures rootFeatures; | ||
overridableMkRustCrate = f: | ||
let | ||
drvs = genDrvsByProfile profilesByName ({ profile, profileName }: mkRustCrate ({ inherit release profile hostPlatformCpu hostPlatformFeatures target profileOpts codegenOpts cargoUnstableFlags rustcLinkFlags rustcBuildFlags; } // (f profileName))); | ||
in { compileMode ? null, profileName ? decideProfile compileMode release }: | ||
let drv = drvs.${profileName}; in if compileMode == null then drv else drv.override { inherit compileMode; }; | ||
in | ||
{ | ||
cargo2nixVersion = "0.11.0"; | ||
workspace = { | ||
utils = rustPackages.unknown.utils."0.1.0"; | ||
cli = rustPackages.unknown.cli."0.1.0"; | ||
}; | ||
"unknown".cli."0.1.0" = overridableMkRustCrate (profileName: rec { | ||
name = "cli"; | ||
version = "0.1.0"; | ||
registry = "unknown"; | ||
src = fetchCrateLocal workspaceSrc; | ||
dependencies = { | ||
utils = (rustPackages."unknown".utils."0.1.0" { inherit profileName; }).out; | ||
}; | ||
}); | ||
|
||
"unknown".utils."0.1.0" = overridableMkRustCrate (profileName: rec { | ||
name = "utils"; | ||
version = "0.1.0"; | ||
registry = "unknown"; | ||
src = fetchCrateLocal workspaceSrc; | ||
}); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[workspace] | ||
members = [ | ||
"crates/utils", | ||
"apps/cli", | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "cli" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
utils = { path = "../../crates/utils" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
use utils::add; | ||
|
||
fn main() { | ||
println!("Hello, world! {}", add(1, 2)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[package] | ||
name = "utils" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
pub fn add(left: usize, right: usize) -> usize { | ||
left + right | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[test] | ||
fn it_works() { | ||
let result = add(2, 2); | ||
assert_eq!(result, 4); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.