mirror of
https://github.com/mitchellh/zig-overlay.git
synced 2025-02-05 17:02:48 +02:00
nix fmt and support aarch64-darwin
This commit is contained in:
parent
941ed4d57e
commit
c4a460a991
2 changed files with 77 additions and 55 deletions
34
default.nix
34
default.nix
|
@ -1,12 +1,17 @@
|
||||||
{ pkgs ? import <nixpkgs> {},
|
{
|
||||||
system ? builtins.currentSystem }:
|
pkgs ? import <nixpkgs> {},
|
||||||
|
system ? builtins.currentSystem,
|
||||||
let
|
}: let
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
sources = builtins.fromJSON (lib.strings.fileContents ./sources.json);
|
sources = builtins.fromJSON (lib.strings.fileContents ./sources.json);
|
||||||
|
|
||||||
# mkBinaryInstall makes a derivation that installs Zig from a binary.
|
# mkBinaryInstall makes a derivation that installs Zig from a binary.
|
||||||
mkBinaryInstall = { url, version, sha256 }: pkgs.stdenv.mkDerivation {
|
mkBinaryInstall = {
|
||||||
|
url,
|
||||||
|
version,
|
||||||
|
sha256,
|
||||||
|
}:
|
||||||
|
pkgs.stdenv.mkDerivation {
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
pname = "zig";
|
pname = "zig";
|
||||||
|
@ -24,19 +29,28 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
# The packages that are tagged releases
|
# The packages that are tagged releases
|
||||||
taggedPackages = lib.attrsets.mapAttrs
|
taggedPackages =
|
||||||
|
lib.attrsets.mapAttrs
|
||||||
(k: v: mkBinaryInstall {inherit (v.${system}) version url sha256;})
|
(k: v: mkBinaryInstall {inherit (v.${system}) version url sha256;})
|
||||||
(lib.attrsets.filterAttrs
|
(lib.attrsets.filterAttrs
|
||||||
(k: v: (builtins.hasAttr system v) && (v.${system}.url != null))
|
(k: v: (builtins.hasAttr system v) && (v.${system}.url != null))
|
||||||
(builtins.removeAttrs sources ["master"]));
|
(builtins.removeAttrs sources ["master"]));
|
||||||
|
|
||||||
# The master packages
|
# The master packages
|
||||||
masterPackages = lib.attrsets.mapAttrs'
|
masterPackages =
|
||||||
(k: v: lib.attrsets.nameValuePair
|
lib.attrsets.mapAttrs' (
|
||||||
(if k == "latest" then "master" else ("master-" + k))
|
k: v:
|
||||||
|
lib.attrsets.nameValuePair
|
||||||
|
(
|
||||||
|
if k == "latest"
|
||||||
|
then "master"
|
||||||
|
else ("master-" + k)
|
||||||
|
)
|
||||||
(mkBinaryInstall {inherit (v.${system}) version url sha256;})
|
(mkBinaryInstall {inherit (v.${system}) version url sha256;})
|
||||||
)
|
)
|
||||||
sources.master;
|
(lib.attrsets.filterAttrs
|
||||||
|
(k: v: (builtins.hasAttr system v) && (v.${system}.url != null))
|
||||||
|
sources.master);
|
||||||
|
|
||||||
# This determines the latest /released/ version.
|
# This determines the latest /released/ version.
|
||||||
latest = lib.lists.last (
|
latest = lib.lists.last (
|
||||||
|
|
22
flake.nix
22
flake.nix
|
@ -6,12 +6,15 @@
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, flake-utils, ... }:
|
outputs = {
|
||||||
# List of systems where binaries are provided.
|
self,
|
||||||
let
|
nixpkgs,
|
||||||
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
|
flake-utils,
|
||||||
outputs = flake-utils.lib.eachSystem systems (system:
|
...
|
||||||
let pkgs = nixpkgs.legacyPackages.${system};
|
}: let
|
||||||
|
systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
|
||||||
|
outputs = flake-utils.lib.eachSystem systems (system: let
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
in rec {
|
in rec {
|
||||||
# The packages exported by the Flake:
|
# The packages exported by the Flake:
|
||||||
# - default - latest /released/ version
|
# - default - latest /released/ version
|
||||||
|
@ -26,8 +29,13 @@
|
||||||
default = apps.zig;
|
default = apps.zig;
|
||||||
zig = flake-utils.lib.mkApp {drv = packages.default;};
|
zig = flake-utils.lib.mkApp {drv = packages.default;};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# nix fmt
|
||||||
|
formatter = pkgs.alejandra;
|
||||||
});
|
});
|
||||||
in outputs // {
|
in
|
||||||
|
outputs
|
||||||
|
// {
|
||||||
# Overlay that can be imported so you can access the packages
|
# Overlay that can be imported so you can access the packages
|
||||||
# using zigpkgs.master.latest or whatever you'd like.
|
# using zigpkgs.master.latest or whatever you'd like.
|
||||||
overlays.default = final: prev: {
|
overlays.default = final: prev: {
|
||||||
|
|
Loading…
Add table
Reference in a new issue