Skip to content

Commit 0198a3c

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 0198a3c

File tree

2 files changed

+118
-0
lines changed

2 files changed

+118
-0
lines changed

flake.lock

Lines changed: 61 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: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+
{
22+
packages.juliaup = pkgs.rustPlatform.buildRustPackage {
23+
pname = "juliaup";
24+
inherit version;
25+
26+
src = ./.;
27+
28+
cargoLock = {
29+
lockFile = ./Cargo.lock;
30+
};
31+
32+
nativeBuildInputs = with pkgs; [
33+
pkg-config
34+
];
35+
36+
inherit buildInputs;
37+
38+
doCheck = false; # Disable tests
39+
40+
meta = with pkgs.lib; {
41+
description = "Julia installer and version multiplexer";
42+
homepage = "https://github.com/JuliaLang/juliaup";
43+
license = licenses.mit;
44+
maintainers = with maintainers; [ sjkelly ];
45+
};
46+
};
47+
48+
defaultPackage = self.packages.${system}.juliaup;
49+
50+
apps.juliaup = flake-utils.lib.mkApp {
51+
drv = self.packages.${system}.juliaup;
52+
};
53+
54+
defaultApp = self.apps.${system}.juliaup;
55+
}
56+
);
57+
}

0 commit comments

Comments
 (0)