Commit Graph

47 Commits

Author SHA1 Message Date
[eureka@nixos]
96fd12c710
Add taploFmt TOML format function to mkLib (#674)
---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2024-08-31 17:27:30 +00:00
Ivan Petkov
6f7504ad93
Drop dependency on nixpkgs (#692)
Callers should use `mkLib` with an instantiation of `pkgs` instead of
using `crane.lib.${system}` directly
2024-08-29 23:29:16 +00:00
Sebastian Rutofski
17e5109bb1
Add build-std and quick-start-workspace as flake templates (#665)
---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2024-07-15 15:49:38 +00:00
Ivan Petkov
9787dc25b2
lib: use makeScopeWithSplicing' instead of makeScope (#634) 2024-06-03 02:48:19 +00:00
Ivan Petkov
a7146b0440
flake: deprecate crane.lib.${system} (#617) 2024-05-19 01:07:07 +00:00
Ivan Petkov
f2926e34a1
chore: replace overrideScope' with overrideScope (#517) 2024-02-08 03:38:28 +00:00
Ivan Petkov
960d350770
vendorCargoDeps: manually splice packages to avoid cross build issues (#507)
* Source vendoring is passed as a standalone attribute to
  `mkCargoDerivation`, meaning it does not automagically get spliced
  with the correct local/cross system inputs (i.e. what would happen if
  it was a `depsBuildBuild` entry)
* To fix this we need to make sure that `vendorCargoDeps` and all of its
  transitive dependencies always use `runCommand` (and friends) from
  their `pkgsBuildBuild` equivalent. This should always be safe to do
  (even for cross-builds) since this amounts to building up a bunch of
  sources which will be read by the build system
* Unfortunately I had to manually specify `pkgsBuildBuild.whatever` in
  multiple places as I could not get things to work by messing with the
  `callPackage` definition. Perhaps we should be using
  `makeScopeWithSplicing'` instead of `makeScope` when constructing the
  library, but I couldn't get it working (and I couldn't find any decent
  docs on how to use it online) so this will make do for the time being.
2024-01-28 19:08:44 +00:00
Ivan Petkov
514cd663e5
examples: add sqlx template (#467) 2023-11-29 01:08:21 +00:00
Ivan Petkov
85e31d408a
examples: avoid re-instantiating nixpkgs where possible (#460)
* i.e. if we neither set localSystem/crossSystem, nor add overlays, we
  can directly utilize `nixpkgs.legacyPackages.${system}` directly and
  avoid re-evaluating nixpkgs an additional time
2023-11-26 18:37:43 +00:00
Ivan Petkov
61cfec4d84
chore: drop all public dependencies except for nixpkgs (#437) 2023-10-19 00:57:24 +00:00
Ivan Petkov
e5ec5d9e10
ci: only build uncached derivations (#426) 2023-10-15 20:07:14 +00:00
Leonardo Eugênio
88b2a5fc4e
Add example of E2E testing (#368) 2023-10-12 18:59:36 -07:00
Graham Christensen
681ad00166 flake: add a description
Crane is one of the most popular libraries on FlakeHub, but it won't appear as "featured" on the homepage because there is no description. I thought I'd help fix that if you want it!
2023-09-18 16:53:35 -07:00
Ivan Petkov
a0d1df4631
Fix alt-registry example (#343)
* crates.io uses the sparse registry by default, and trying to
  explicitly register a sparse registry for it results in errors
* Also set nixConfig to include binary cache
2023-06-18 23:16:45 +00:00
Leonardo Eugênio
db21a44eb0
Trunk support (#299)
[Trunk](https://trunkrs.dev) is a tool that allow you to build web apps
using Rust and webassembly, including compiling scss, and distributing
other assets.

Adds `craneLib.buildTrunkPackage`, a function that builds a Trunk
project returning a directory with the resulting dist files for that
project

---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2023-04-29 12:34:39 -07:00
figsoda
475de74fa2
feat: add cargoLlvmCov (#267)
* feat: add cargoLlvmCov
* cargoHelperFunctionsHook: prefer `--release` over `--profile release`
Some tools (e.g. cargo-llvm-cov) don't understand `--profile release` as
an alias for `--release`, so `cargoWithProfile` should prefer passing
`--release` when `$CARGO_PROFILE` == "release"

---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2023-03-19 23:44:14 +00:00
Ivan Petkov
00564437f3
Properly handle workspace inheritance in git dependencies (#224)
Crates from git repos are vendored in a flattened directory where each crate shows up at the root of the vendor directory. Since the vendoring step effectively breaks workspace structures, any crates which use workspace inheritance (e.g. package.version.workspace = true will fail to resolve.

To work around this we inspect the crate's workspace manifest (if it exists) and attempt to manually merge the values while copying the contents to the vendor directory.
2023-01-21 16:46:32 -08:00
Ivan Petkov
ea3a813939
examples: add cross-windows (#218)
* ci: disable running examples
2023-01-07 01:11:42 +00:00
Ivan Petkov
a4d70a26e7
Add Crane book (#199) 2022-12-26 14:27:13 -08:00
Ivan Petkov
35fd8fcbb0
Run nixpkgs-fmt 2022-11-20 16:28:49 -08:00
Ivan Petkov
2ce1a3313e
Eliminate dead code (#148) 2022-10-23 23:20:22 +00:00
Roman Volosatovs
097afacc53
mkDummySrc: support freestanding targets (#126)
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2022-10-19 02:13:38 +00:00
Ivan Petkov
1020bbe7dd Remove deprecated package bindings 2022-10-09 11:33:57 -10:00
Ivan Petkov
0017a8da68
flake: deprecate the packages flake output (#130)
Even though the setup hooks can be thought of as "packages", it makes
things much more simple to access everything from the same place
2022-10-09 10:28:48 -07:00
adisbladis
5d5803ff75 flake: Remove nix-std dependency
The only thing used from this library was the toTOML which is now
handled directly in the TOML writer.
2022-06-03 02:01:02 +08:00
adisbladis
a1e56fba69 Stop passing around fromTOML
It's a builtin that we can just use directly.
2022-06-03 02:01:02 +08:00
adisbladis
2491382d63 Remove internal dependency on toTOML 2022-06-03 02:01:02 +08:00
Ivan Petkov
57825c24da
Update all flake attributes to follow the new .default format 2022-06-01 17:09:29 -07:00
Ivan Petkov
e0fbad205b
Add extra tests for mkDummySrc inputs 2022-05-29 15:43:58 -07:00
Tristan Cacqueray
092dac897e flake: fix cross-musl path 2022-05-11 21:37:47 +00:00
Ivan Petkov
766c87f404
flake: rename utils input to flake-utils for consistency 2022-04-27 19:59:59 -07:00
Ivan Petkov
d3efda535f
Remove superfluous follows declaration for flake-utils 2022-04-27 18:10:22 -07:00
Ivan Petkov
99551f1707
Add cross compilation example for static binaries using musl 2022-02-16 20:51:57 -08:00
Ivan Petkov
7f2824d555
Add cross compilation example with rust-overlay 2022-02-15 18:42:59 -08:00
Ivan Petkov
5c8e7f732f
Fix callPackage scopes for build hooks so cross compiling works
* Previously all build hooks were instantiated in a single
  `callPackages` call which led to several issues:
  - changes via `lib.overrideScope'` were ignored because the build
    hooks were only ever instantiated with the nixpkgs instance of our
    flake (not whatever overlays the caller may have made)
  - the pkgs splicing was not done quite right, meaning when we pull in
    the build hooks as nativeBuildInputs the splicing wasn't picking up
    the overridden versions of `cargo` but was instead trying to
    recompile the nixpkgs version each time
2022-02-14 18:31:45 -08:00
Ivan Petkov
0444351677
Add the alt-registry example as a template 2022-02-15 18:43:49 -08:00
Ivan Petkov
e457182093
Add quick-start template with a clippy check
* Also rename `hello-world` to `quick-start-simple`
2022-01-16 16:56:30 -08:00
Ivan Petkov
e2cc10bb60
Inline template definition in flake.nix 2022-01-16 16:11:11 -08:00
Ivan Petkov
1ab55bba74
Add hello-world example/template 2022-01-16 14:33:47 -08:00
Ivan Petkov
7f392394e7
Add mkLib function 2022-01-15 20:29:39 -08:00
Ivan Petkov
0f3e3e9a9b
Bring all tests back under nix flake check
* Seems like whatever issue was preventing us from evaluating
  derivations for other architectures (without actually building them)
  has been resolved, and now we can nicely test everything with a single
  invocation of `nix flake check`
2022-01-04 12:55:36 -08:00
Ivan Petkov
6925af0d0b
Move all tests (except for formatting) out of flake checks
* `nix flake check` insists on evaluating all outputs for all systems,
  which seems to include evaluating build inputs needed for other
  systems (which gives us errors like `a 'aarch64-darwin' with features
  {} is required to build '...', but I am a 'x86_64-linux'`)
* To work around this we'll move all tests to their own directory
  outside of the flake's outputs, and manually invoke a test script to
  build them
2021-12-30 17:18:17 -08:00
Ivan Petkov
cf1c6eb0e8
Add checks for cleanCargoToml 2021-12-29 19:26:55 -08:00
Ivan Petkov
a286fe1ff5
Add cleanCargoToml 2021-12-29 16:03:39 -08:00
Ivan Petkov
e1b7cea23c
Add buildWithCargo as a thin wrapper around mkDerivation 2021-12-26 16:27:09 -08:00
Ivan Petkov
83632355d2
Add configureCargoVendoredDepsHook 2021-12-26 16:21:08 -08:00
Ivan Petkov
2cec871d53
Initial commit 2021-12-26 11:47:59 -08:00