Hi there, I’m trying to add a custom package to my home-manager configuration but have been stuck with two problems with the following flake.nix.
{
description = "Leet your code in command-line.";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.rust-overlay.url = "github:oxalica/rust-overlay";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; overlays = [ rust-overlay ]; };
platform = pkgs.makeRustPlatform {
rustc = rust-overlay.rust-bin.nightly.latest.minimal;
cargo = rust-overlay.rust-bin.nightly.latest.minimal;
};
in
with pkgs;
{
defaultPackage.${system} = platform.buildRustPackage rec {
pname = "leetcode-cli";
version = "0.3.9";
src = fetchCrate {
inherit pname version;
sha256 = "1aiksg4iyrhkmwl4djy7bm3xjras4qqfixi6ml8k6pz0s9ynknws";
};
cargoSha256 = "1ldzr2bspy288nydk2lnkc4akc2myk2jk7aw87vr4kmzl0jmh329";
# a nightly compiler is required unless we use this cheat code.
RUSTC_BOOTSTRAP = 0;
# CFG_RELEASE = "${rustPlatform.rust.rustc.version}-nightly";
CFG_RELEASE_CHANNEL = "ngihtly";
nativeBuildInputs = [
pkg-config
rust-bin.nightly."2021-05-16".minimal
];
buildInputs = [
openssl
dbus
sqlite
];
meta = with lib; {
description = "Leet your code in command-line.";
homepage = "https://github.com/clearloop/leetcode-cli";
licenses = licenses.mit;
maintainers = with maintainers; [ congee ];
mainProgram = "leetcode";
};
};
}
);
}
The first issue is an error when I try to nix build .
error: flake output attribute ‘defaultPackage.x86_64-linux’ is not a derivation
How can I get a derivation from nixpkgs.platform.buildRustPackage
?
The second issue is I cannot just add this flake.nix to home.packages
home.packages = [ import ./packages/leetcode-cli/flake.nix ];
# nor can I add it as an overlay
nixpkgs.overlays = [
(self: super: { leetcode-cli = import ../packages/leetcode-cli/default.nix; })
];
I have already searched on the internet, but, unfortunately, could not find any relevant code for help.
Is there any pointers my fellow nix gurus?