Commit Graph

611 Commits

Author SHA1 Message Date
Ivan Petkov
a3a6df2181
Merge pull request #27 from TristanCacqueray/cross-musl-path 2022-05-11 15:52:40 -07:00
Tristan Cacqueray
092dac897e flake: fix cross-musl path 2022-05-11 21:37:47 +00:00
Ivan Petkov
ca0bc628fc
Update changelog 2022-05-10 17:28:31 -07:00
Ivan Petkov
c8b8597ecb
Merge pull request #26 from firestack/fix/relative-paths
fix(nix-relative-paths): quote relative paths to allow for external sources
2022-05-10 17:21:29 -07: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
f7fa3b6d70
Merge pull request #23 from ipetkov/buildDepsOnly-all-targets
buildDepsOnly: add `--all-targets` to default cargoCheckCommand
2022-05-08 20:19:22 -07:00
Ivan Petkov
b47fafa717
buildDepsOnly: add --all-targets to default cargoCheckCommand
This allows caching all artifacts (including from dev-dependencies) such
that tools like clippy don't have to generate them every time they run.
2022-05-08 19:46:58 -07:00
Ivan Petkov
f98c3c7ca7
Merge pull request #22 from ipetkov/dependabot/github_actions/cachix/install-nix-action-17
chore(deps): bump cachix/install-nix-action from 16 to 17
2022-05-01 10:36:15 -07:00
dependabot[bot]
4bd4c72e16
chore(deps): bump cachix/install-nix-action from 16 to 17
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 16 to 17.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](https://github.com/cachix/install-nix-action/compare/v16...v17)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-01 17:00:13 +00:00
Ivan Petkov
b63fe4fd6b
cargo: bump all deps 2022-04-27 20:15:27 -07:00
Ivan Petkov
766c87f404
flake: rename utils input to flake-utils for consistency 2022-04-27 19:59:59 -07:00
Ivan Petkov
83e920dd30
flake.lock: Update
Flake lock file updates:

• Updated input 'flake-compat':
    'github:edolstra/flake-compat/b7547d3eed6f32d06102ead8991ec52ab0a4f1a7' (2022-01-03)
  → 'github:edolstra/flake-compat/b4a34015c698c7793d592d66adbab377907a2be8' (2022-04-19)
• Updated input 'nix-std':
    'github:chessai/nix-std/9ef1cf73948bfad05d370165c7f3011b82c4d679' (2021-06-25)
  → 'github:chessai/nix-std/8b8d32582e298da2c15b4c13ca48ba7994ef96df' (2022-03-18)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/19574af0af3ffaf7c9e359744ed32556f34536bd' (2022-02-16)
  → 'github:NixOS/nixpkgs/d146577610c17d7674a2d3e285fc637c520ad344' (2022-04-27)
• Updated input 'utils':
    'github:numtide/flake-utils/3cecb5b042f7f209c56ffd8371b2711a290ec797' (2022-02-07)
  → 'github:numtide/flake-utils/a4b154ebbdc88c8498a5c7b01589addc9e9cb678' (2022-04-11)
2022-04-27 19:59:32 -07:00
Ivan Petkov
e45196b9f4
Update examples to use {app,package}.default pattern 2022-04-27 19:23:30 -07:00
Ivan Petkov
d3efda535f
Remove superfluous follows declaration for flake-utils 2022-04-27 18:10:22 -07:00
Ivan Petkov
72f078886f
ci: explicitly run default app 2022-04-27 19:38:46 -07:00
Ivan Petkov
f4ceddda25
ci: run on PR updates as well as ci-* branches 2022-04-27 17:17:03 -07:00
Ivan Petkov
39305b3828
Merge pull request #17 from ipetkov/dependabot/github_actions/actions/checkout-3 2022-03-01 15:07:04 -08:00
dependabot[bot]
2e7cbc1a00
chore(deps): bump actions/checkout from 2.4.0 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2.4.0 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2.4.0...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-01 22:18:32 +00:00
Ivan Petkov
8629d56b24
Update changelog 2022-02-24 17:58:59 -08:00
Ivan Petkov
a185f3753a
Update cross compile example
* Sometimes we also need to set the HOST_CC environment variable to
  allow cross compiling crates which also need to build a program to run
  on the build platform itself
2022-02-24 17:49:22 -08:00
Ivan Petkov
48b6c6243c
Merge pull request #16 from ipetkov/groupBy-compat
Add compatibility fallback for builtins.groupBy
2022-02-20 22:42:05 +00:00
Ivan Petkov
5e78d64771
ci: pin Nix install version for latest stable branch 2022-02-20 14:24:07 -08:00
Ivan Petkov
762784a8c5
Add compatibility fallback for builtins.groupBy 2022-02-20 14:20:21 -08:00
Ivan Petkov
b4b51464e8
Update changelog 2022-02-18 18:19:05 -08:00
Ivan Petkov
a2449b5aaf
Merge pull request #14 from ipetkov/git-ref
Fix handling of git repos whose rev is not on the main branch
2022-02-19 02:18:44 +00:00
Ivan Petkov
f8d1e70dfc
Fix handling of git repos whose rev is not on the main branch
* When Nix fetches a git repo it will only look for the specified
  revision only starting from the main branch (apparently fetching
  arbitrary revisions from a repository has some security implications)
* If a ref (i.e. branch or tag) is not specified, Nix will only fetch
  the repo's main branch
* To remedy this we will supply Nix with the branch or tag (if specified
  in the Cargo.lock) to help it find the specified revision
* If cargo does not specify a branch or tag for us, we'll set `allRefs =
  true` so that Nix can try fetching all possible branches and tags
  before trying to check out the locked revision
2022-02-18 18:10:53 -08:00
Ivan Petkov
196ab9d45d
Update changelog 2022-02-17 18:16:34 -08:00
Ivan Petkov
39cb921d43
flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/5efc8ca954272c4376ac929f4c5ffefcc20551d5' (2022-01-28)
  → 'github:NixOS/nixpkgs/19574af0af3ffaf7c9e359744ed32556f34536bd' (2022-02-16)
• Updated input 'utils':
    'github:numtide/flake-utils/846b2ae0fc4cc943637d3d1def4454213e203cba' (2022-01-20)
  → 'github:numtide/flake-utils/3cecb5b042f7f209c56ffd8371b2711a290ec797' (2022-02-07)
2022-02-17 18:15:34 -08: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
da0bbcd1d6
Merge pull request #12 from ipetkov/cross
Fix cross compilation and add examples
2022-02-17 05:04:36 +00:00
Ivan Petkov
e825137b26
Update changelog 2022-02-16 20:53:23 -08: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
fc7a94f841
Merge pull request #11 from ipetkov/abs-path-error
Form paths by concatenating a string suffix not a path
2022-02-13 20:56:39 +00:00
Ivan Petkov
78359792ae
Form paths by concatenating a string suffix not a path
* Seems like Nix can get unhappy if a path fragment is evaluated too
  eagerly, giving errors like
  `error: access to absolute path '/Cargo.toml' is forbidden in pure eval mode (use '--impure' to override)`
* Changing to using string manipulation seems to resolve the issue
2022-02-13 12:50:43 -08:00
Ivan Petkov
9ea3e03efe
Merge pull request #9 from ipetkov/install-by-default
`cargoClippy` and `cargoTarpaulin`: change behavior to install cargo artifacts by default
2022-02-13 17:52:39 +00:00
Ivan Petkov
310ecfe831
Update changelog 2022-02-13 09:49:03 -08:00
Ivan Petkov
a56b6d1c56
cargoTarpaulin: change behavior to install cargo artifacts by default
* This allows potentially chaining `cargoTarpaulin` invocations with other
  derivations
2022-02-13 09:36:31 -08:00
Ivan Petkov
3024283855
cargoClippy: change behavior to install cargo artifacts by default
* This allows potentially chaining `cargoClippy` invocations with other
  derivations
2022-02-13 09:34:26 -08:00
Ivan Petkov
47d47ef5b5
Update changelog and readme 2022-02-11 20:34:44 -08:00
Ivan Petkov
c4ca8704b9
Merge pull request #7 from ipetkov/git-deps
Add support for git dependencies
2022-02-12 04:32:40 +00:00
Ivan Petkov
a9b6806931
ci: don't run twice on push to PR 2022-02-11 19:59:46 -08:00
Ivan Petkov
5fb04403a1
Update changelog 2022-02-11 19:33:17 -08:00
Ivan Petkov
2c61273666
Merge pull request #8 from ipetkov/fmt
cargoFmt: change behavior to install cargo artifacts by default
2022-02-12 03:31:18 +00:00
Ivan Petkov
90d5ad84c4
cargoFmt: change behavior to install cargo artifacts by default
* This allows potentially chaining `cargoFmt` invocations with other
  derivations
2022-02-10 21:02:48 -08:00
Ivan Petkov
472d7ffc99
Handle case where a git repo contains multiple crates 2022-02-10 20:32:31 -08:00
Ivan Petkov
e2c665091e
Add test that source prefix remapping works 2022-02-09 20:54:56 -08:00
Ivan Petkov
469f4a5fde
Fix git dependency handling of overlapping repos 2022-02-09 20:22:07 -08:00