Skip to content

Commit

Permalink
add flake.nix
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sjkelly committed Mar 26, 2024
1 parent 61c09c4 commit 7b1db7a
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 0 deletions.
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
description = "Julia installer and version multiplexer";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
version = cargoToml.package.version;
buildInputs = with pkgs; [
openssl
] ++ (if pkgs.stdenv.isDarwin then [
darwin.apple_sdk.frameworks.SystemConfiguration
] else []);
in {
packages.juliaup = pkgs.rustPlatform.buildRustPackage {
pname = "juliaup";
inherit version;

src = ./.;

cargoLock = {
lockFile = ./Cargo.lock;
};

nativeBuildInputs = with pkgs; [
pkg-config
];

inherit buildInputs;

doCheck = false; # Disable tests

meta = with pkgs.lib; {
description = "Julia installer and version multiplexer";
homepage = "https://github.com/JuliaLang/juliaup";
license = licenses.mit;
maintainers = with maintainers; [ sjkelly ];
};
};

defaultPackage = self.packages.${system}.juliaup;

apps.juliaup = flake-utils.lib.mkApp {
drv = self.packages.${system}.juliaup;
};

defaultApp = self.apps.${system}.juliaup;
}
);
}

0 comments on commit 7b1db7a

Please sign in to comment.