Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 60a9e88

Browse files
authored
Add flake.nix for Nix users (clearloop#59)
This change allows a reproducible build of `leetcode-cli` for all nix users.
1 parent 8b77b91 commit 60a9e88

File tree

2 files changed

+153
-0
lines changed

2 files changed

+153
-0
lines changed

‎flake.lock

Lines changed: 94 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎flake.nix

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
description = "Leet your code in command-line.";
3+
4+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
5+
inputs.rust-overlay.url = "github:oxalica/rust-overlay";
6+
inputs.utils.url = "github:numtide/flake-utils";
7+
8+
outputs = { self, nixpkgs, rust-overlay, utils, ... }:
9+
utils.lib.eachDefaultSystem (system:
10+
let
11+
pkgs = import nixpkgs { inherit system; overlays = [ rust-overlay.overlay ]; };
12+
13+
platform = with pkgs; makeRustPlatform {
14+
rustc = rust-bin.nightly.latest.minimal;
15+
cargo = rust-bin.nightly.latest.minimal;
16+
};
17+
package = with pkgs; platform.buildRustPackage rec {
18+
pname = "leetcode-cli";
19+
version = "0.3.10";
20+
21+
src = fetchCrate {
22+
inherit pname version;
23+
sha256 = "SkJLA49AXNTpiWZByII2saYLyN3bAAJTlCvhamlOEXA=";
24+
};
25+
26+
cargoSha256 = "xhKF4qYOTdt8iCSPY5yT8tH3l54HdkOAIS2SBGzqsdo=";
27+
28+
# a nightly compiler is required unless we use this cheat code.
29+
RUSTC_BOOTSTRAP = 0;
30+
31+
# CFG_RELEASE = "${rustPlatform.rust.rustc.version}-nightly";
32+
CFG_RELEASE_CHANNEL = "ngihtly";
33+
34+
nativeBuildInputs = [
35+
pkg-config
36+
rust-bin.stable.latest.default
37+
];
38+
39+
buildInputs = [
40+
openssl
41+
dbus
42+
sqlite
43+
] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ];
44+
45+
meta = with pkgs.lib; {
46+
description = "Leet your code in command-line.";
47+
homepage = "https://github.com/clearloop/leetcode-cli";
48+
licenses = licenses.mit;
49+
maintainers = with maintainers; [ congee ];
50+
mainProgram = "leetcode";
51+
};
52+
};
53+
in
54+
{
55+
defaultPackage = package;
56+
overlay = final: prev: { leetcode-cli = package; };
57+
}
58+
);
59+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /