Skip to content

Commit

Permalink
Merge 4efb131 into e2de87d
Browse files Browse the repository at this point in the history
  • Loading branch information
Coutinho de Souza committed Dec 6, 2023
2 parents e2de87d + 4efb131 commit e96473b
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 107 deletions.
28 changes: 28 additions & 0 deletions pkgs/by-name/ha/hare/001-tzdata.patch
@@ -0,0 +1,28 @@
diff --git a/time/chrono/+freebsd.ha b/time/chrono/+freebsd.ha
index 26d78ab1..6861bfe8 100644
--- a/time/chrono/+freebsd.ha
+++ b/time/chrono/+freebsd.ha
@@ -2,7 +2,7 @@
// (c) Hare authors <https://harelang.org>

def LOCALTIME_PATH: str = "/etc/localtime";
-def ZONEINFO_PREFIX: str = "/usr/share/zoneinfo/";
+def ZONEINFO_PREFIX: str = "@tzdata@/share/zoneinfo/";

// The filepath of the system's "leap-seconds.list" file, which contains UTC/TAI
// leap second data.
diff --git a/time/chrono/+linux.ha b/time/chrono/+linux.ha
index 600f606c..8d5617e2 100644
--- a/time/chrono/+linux.ha
+++ b/time/chrono/+linux.ha
@@ -2,8 +2,8 @@
// (c) Hare authors <https://harelang.org>

def LOCALTIME_PATH: str = "/etc/localtime";
-def ZONEINFO_PREFIX: str = "/usr/share/zoneinfo/";
+def ZONEINFO_PREFIX: str = "@tzdata@/share/zoneinfo/";

// The filepath of the system's "leap-seconds.list" file, which contains UTC/TAI
// leap second data.
-export def UTC_LEAPSECS_FILE: str = "/usr/share/zoneinfo/leap-seconds.list";
+export def UTC_LEAPSECS_FILE: str = "@tzdata@/share/zoneinfo/leap-seconds.list";
97 changes: 97 additions & 0 deletions pkgs/by-name/ha/hare/package.nix
@@ -0,0 +1,97 @@
{ lib
, stdenv
, fetchFromSourcehut
, binutils-unwrapped
, harec
, makeWrapper
, qbe
, scdoc
, tzdata
, substituteAll
}:

let
# We use harec's override of qbe until 1.2 is released, but the `qbe` argument
# is kept to avoid breakage.
qbe = harec.qbeUnstable;
# Until #265124 is merged (it's already on staging), this override is needed.
tzdata' = tzdata.overrideAttrs (old: {
postInstall = old.postInstall + ''
cp leap-seconds.list $out/share/zoneinfo
'';
});
# https://harelang.org/platforms/
arch = stdenv.hostPlatform.uname.processor;
platform = lib.strings.toLower stdenv.hostPlatform.uname.system;
in
stdenv.mkDerivation (finalAttrs: {
pname = "hare";
version = "unstable-2023-11-27";

outputs = [ "out" "man" ];

src = fetchFromSourcehut {
owner = "~sircmpwn";
repo = "hare";
rev = "d94f355481a320fb2aec13ef62cb3bfe2416f5e4";
hash = "sha256-Mpl3VO4xvLCKHeYr/FPuS6jl8CkyeqDz18mQ6Zv05oc=";
};

patches = [
# Replace FHS paths with nix store
(substituteAll {
src = ./001-tzdata.patch;
tzdata = tzdata';
})
];

nativeBuildInputs = [
harec
makeWrapper
qbe
scdoc
];

buildInputs = [
binutils-unwrapped
harec
qbe
tzdata'
];

makeFlags = [
"HARECACHE=.harecache"
"PREFIX=${builtins.placeholder "out"}"
"PLATFORM=${platform}"
"ARCH=${arch}"
];

# Append the distribution name to the version
env.LOCALVER = "nixpkgs";

doCheck = true;

strictDeps = true;

enableParallelBuilding = true;

preConfigure = ''
ln -s config.example.mk config.mk
'';

postFixup = ''
wrapProgram $out/bin/hare \
--prefix PATH : ${lib.makeBinPath [binutils-unwrapped harec qbe]}
'';

setupHook = ./setup-hook.sh;

meta = {
homepage = "https://harelang.org/";
description = "Systems programming language designed to be simple, stable, and robust";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ onemoresuza ];
mainProgram = "hare";
inherit (harec.meta) platforms badPlatforms;
};
})
File renamed without changes.
Expand Up @@ -19,13 +19,13 @@ let
in
stdenv.mkDerivation (finalAttrs: {
pname = "harec";
version = "unstable-2023-10-22";
version = "unstable-2023-11-29";

src = fetchFromSourcehut {
owner = "~sircmpwn";
repo = "harec";
rev = "64dea196ce040fbf3417e1b4fb11331688672aca";
hash = "sha256-2Aeb+OZ/hYUyyxx6aTw+Oxiac+p+SClxtg0h68ZBSHc=";
rev = "ec3193e3870436180b0f3df82b769adc57a1c099";
hash = "sha256-HXQIgFC4YVDJjo5xbyg1ea3jWYKLEwKkD1KFzWFz9UI= ";
};

nativeBuildInputs = [
Expand Down
100 changes: 0 additions & 100 deletions pkgs/development/compilers/hare/default.nix

This file was deleted.

4 changes: 0 additions & 4 deletions pkgs/top-level/all-packages.nix
Expand Up @@ -9137,10 +9137,6 @@ with pkgs;
llvmPackages = llvmPackages_16;
};

hare = callPackage ../development/compilers/hare { };

harec = callPackage ../development/compilers/harec { };

hareThirdParty = recurseIntoAttrs (callPackage ./hare-third-party.nix { });

ham = pkgs.perlPackages.ham;
Expand Down

0 comments on commit e96473b

Please sign in to comment.