Skip to content

Commit 7b1db7a

Browse files
committed
add flake.nix
This adds a flake.nix which can be used to build and retrieve `juliaup` from the nix package manager. It uses the `rustPlatform.buildRustPackage` function from nixpkgs to build the Rust package, and the 23.11 pkg distribution. Nix makes it easy to build and install `juliaup`, either by running `nix build` or `nix run` in the project directory or by referencing the flake from another nix configuration.
1 parent 61c09c4 commit 7b1db7a

File tree

2 files changed

+117
-0
lines changed

2 files changed

+117
-0
lines changed

Diff for: flake.lock

+61
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: flake.nix

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
description = "Julia installer and version multiplexer";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs = { self, nixpkgs, flake-utils }:
10+
flake-utils.lib.eachDefaultSystem (system:
11+
let
12+
pkgs = nixpkgs.legacyPackages.${system};
13+
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
14+
version = cargoToml.package.version;
15+
buildInputs = with pkgs; [
16+
openssl
17+
] ++ (if pkgs.stdenv.isDarwin then [
18+
darwin.apple_sdk.frameworks.SystemConfiguration
19+
] else []);
20+
in {
21+
packages.juliaup = pkgs.rustPlatform.buildRustPackage {
22+
pname = "juliaup";
23+
inherit version;
24+
25+
src = ./.;
26+
27+
cargoLock = {
28+
lockFile = ./Cargo.lock;
29+
};
30+
31+
nativeBuildInputs = with pkgs; [
32+
pkg-config
33+
];
34+
35+
inherit buildInputs;
36+
37+
doCheck = false; # Disable tests
38+
39+
meta = with pkgs.lib; {
40+
description = "Julia installer and version multiplexer";
41+
homepage = "https://github.com/JuliaLang/juliaup";
42+
license = licenses.mit;
43+
maintainers = with maintainers; [ sjkelly ];
44+
};
45+
};
46+
47+
defaultPackage = self.packages.${system}.juliaup;
48+
49+
apps.juliaup = flake-utils.lib.mkApp {
50+
drv = self.packages.${system}.juliaup;
51+
};
52+
53+
defaultApp = self.apps.${system}.juliaup;
54+
}
55+
);
56+
}

0 commit comments

Comments
 (0)