-
I used to use I'm in the middle of nixifying a project I'd like to contribute. The In particular:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
By default, if you call For example, your flake can be simplified to: {
description = "MyCitadel Wallet app for Linux, Windows & MacOS desktop made with GTK+ ";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
crane.url = "github:ipetkov/crane";
crane.inputs.nixpkgs.follows = "nixpkgs";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, naersk, nixpkgs, flake-utils, flake-compat, fenix, crane }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
fenix-pkgs = fenix.packages.${system};
fenix-channel = (fenix-pkgs.stable);
craneLib = (crane.mkLib pkgs).overrideScope' (final: prev: {
cargo = fenix-channel.cargo;
rustc = fenix-channel.rustc;
});
mycitadel = craneLib.buildPackage {
src = ./.;
pname = "mycitadel";
buildInputs = [
pkgs.pango
pkgs.atk
pkgs.gtk3
];
nativeBuildInputs = [
pkgs.pkgconfig
fenix-channel.rustc
];
};
in {
defaultPackage = mycitadel;
devShell = pkgs.mkShell {
inputsFrom = [ mycitadel ];
nativeBuildInputs = [
fenix-pkgs.rust-analyzer
fenix-channel.rustfmt
fenix-channel.rustc
fenix-channel.cargo
];
RUST_SRC_PATH = "${fenix-channel.rust-src}/lib/rustlib/src/rust/library";
};
});
}
There's definitely room for improvement for plugging in different toolchains, especially since they all have slightly different initialization flows. That said, But if anyone has other ideas, please open an issue! |
Beta Was this translation helpful? Give feedback.
By default, if you call
buildPackage
orcargoBuild
without specifying a value forcargoArtifacts
, they will automatically setcargoArtifacts = buildDepsOnly args
whereargs
is whatever you passed intobuildPackage
/cargoBuild
.For example, your flake can be simplified to: