Commit Graph

21 Commits

Author SHA1 Message Date
Ivan Petkov
92d2b4b64a
Use resolver = 2 in all Cargo.tomls (#608) 2024-05-04 19:56:00 +00:00
Simon Žlender
9b32adff97
mkDummySrc: ignore clippy warnings in dummyrs (#587)
---------

Co-authored-by: Ivan Petkov <ivanppetkov@gmail.com>
2024-04-21 03:57:27 +00:00
Adam Curtis
751290c945
fix: add #[allow(unused_extern_crates)] to dummy.rs (#501) 2024-01-27 02:36:30 +00:00
Dawid Ciężarkiewicz
0da36bc7dd
fix: cargo docs breaking in buildDepsOnly of workspaces (#410) 2023-10-03 18:59:04 -07:00
Ivan Petkov
66303545d7
Update flake.lock (#382)
Flake lock file updates:

• Updated input 'flake-utils':
    'github:numtide/flake-utils/919d646de7be200f3bf08cb76ae1f09402b6f9b4' (2023-07-11)
  → 'github:numtide/flake-utils/f9e7cf818399d17d347f847525c5a5a8032e4e44' (2023-08-23)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/5068bc8fe943bde3c446326da8d0ca9c93d5a682' (2023-08-07)
  → 'github:NixOS/nixpkgs/e7f35e03abd06a2faef6684d0de813370e13bda8' (2023-09-02)
• Updated input 'rust-overlay':
    'github:oxalica/rust-overlay/b520a3889b24aaf909e287d19d406862ced9ffc9' (2023-08-07)
  → 'github:oxalica/rust-overlay/98ccb73e6eefc481da6039ee57ad8818d1ca8d56' (2023-09-03)

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-03 12:04:55 -07:00
Roman Volosatovs
5291dd0aa7
feat: add support for bindeps feature (#258)
Write a `main.rs` to `src/bin/dummy` within the generated dummy source,
rather than `src/main.rs` to account for `illegalBin` test case

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
2023-03-06 17:24:21 -08:00
Ivan Petkov
2b0be4c1c4
mkDummySrc: work with uefi targets by default, and allow downstream customization (#174)
* mkDummySrc: also include `no_std` attrs for target_os = uefi
* buildDepsOnly: only check with `--all-targets` if doCheck enabled
* mkDummySrc: allow customizing dummy Rust file contents
2022-11-28 03:23:35 +00:00
Ivan Petkov
c61d98aaea
mkDummySrc: properly import core (#172) 2022-11-21 01:12:39 +00:00
Ivan Petkov
2ce1a3313e
Eliminate dead code (#148) 2022-10-23 23:20:22 +00:00
Ivan Petkov
6b864957e1
checks: add tests for building crates using workspace inheritance (#147) 2022-10-23 22:56:18 +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
22f971a126
mkDummySrc: fix handling of build scripts (#122)
* Instead of injecting our own dummy `build.rs` file, we will patch the
  `Cargo.toml` files to specify a build script in the Nix store
* This allow cargo to notice the difference (i.e. changed build script
  path) where it could not before (due to nix enforcing that all sources
  always have the same timestamp)
2022-09-28 02:05:06 +00:00
Ivan Petkov
21e627606c
mkDummySrc: allow running a custom script after dummification is done (#116) 2022-09-27 06:25:09 +00:00
Ivan Petkov
b9b1c322a5
mkDummySrc: fix handling when src is already filtered 2022-06-29 20:49:12 -07:00
adisbladis
c097eedd6b checks: Regenerate expected output for failing checks
Having changed the way of writing TOML there are some differences in output ordering.
2022-06-03 02:01:02 +08:00
Kayla Firestack
e908c1afea fix(nix-relative-paths): quote relative paths to allow for external sources
when trying to use crane with a non local src (eg, not `./.`) we get the error
```
$ nix flake show
<...>
error: access to absolute path '/Cargo.toml' is forbidden in pure eval mode (use '--impure' to override)
(use '--show-trace' to show detailed location information)
```

To fix this, we quote the relative paths so to properly append them to the base path.

https://nixos.wiki/wiki/Nix_Expression_Language#Coercing_a_relative_path_with_interpolated_variables_to_an_absolute_path_.28for_imports.29

## Reproduction flake
```
{
  description = "Build a cargo project without extra checks";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

    crane = {
      url = "github:ipetkov/crane";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    external-crate-source = {
      url = "github:ray-kast/empress";
      flake = false;
    };

    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = { self, nixpkgs, crane, flake-utils, external-crate-source, ... }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = nixpkgs.legacyPackages.${system};

        test-crate = crane.lib.${system}.buildPackage {
          src = external-crate-source.outPath;
        };
      in
      {
        packages.default = test-crate;
      });
}
```
2022-05-10 10:00:00 -04:00
Ivan Petkov
05c8945db7
tests: switch back to runCommand from runCommandLocal
* Seems like cachix is still pushing the results up to the cache, we
  might as well get use of downloading the (empty) results rather than
  having to pull down the intermediary binaries and running them each
  time
2022-02-17 18:15:09 -08:00
Ivan Petkov
d4b5f8abe6
chore: switch to runCommandLocal to reduce network pressure 2022-01-30 16:10:41 -08:00
Ivan Petkov
abc2c8c418
mkDummySrc: drop dummy lib.rs by default, not main.rs
* There are some edge cases where cargo will allow a lib.rs file to be
  present but not a main.rs (e.g. a binary cannot be called "examples",
  which will happen if the crate is called that and a main.rs file is
  present)
2022-01-07 20:42:24 -08:00
Ivan Petkov
1c8034c0d9
Update mkDummySrc to support cargo workspaces 2022-01-07 17:36:31 -08:00
Ivan Petkov
791f1b2241
Add tests for mkDummySrc
* Also fix a bug with copying over .cargo/config files
2022-01-05 20:46:05 -08:00