203 lines
6.9 KiB
Nix
203 lines
6.9 KiB
Nix
# Serene Programming Language
|
|
#
|
|
# Copyright (c) 2019-2023 Sameer Rahmani <lxsameer@gnu.org>
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, version 2.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
{
|
|
description = "Serene programming language";
|
|
|
|
inputs.nixpkgs.url = "/home/lxsameer/src/nixpkgs/";
|
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
outputs = inputs@{ self, nixpkgs, flake-utils, ... }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
zshDir = ./scripts/zsh;
|
|
llvm = {
|
|
url = "https://devheroes.codes/Serene/llvm-project.git";
|
|
major = "16";
|
|
version = "16.0.6";
|
|
rev = "b2c0361bcc08afdf466a605a23924bcd64fa2b86";
|
|
hash = "sha256-wUKHwWYYlKa0v5zEJXxndleYtK7wzJKi0vqr3lNkGMI=";
|
|
rev-version = "17-disable-shared-1";
|
|
};
|
|
|
|
|
|
overlays = [
|
|
# (self: super:
|
|
# {
|
|
# serene_toolchain = (super.callPackage (super.path + "/pkgs/development/compilers/llvm/${llvm.major}") ({
|
|
# inherit (super.stdenvAdapters) overrideCC;
|
|
# buildLlvmTools = super.buildPackages.serene_toolchain.tools;
|
|
# targetLlvmLibraries = self.targetPackages.serene_toolchain.libraries or self.serene_toolchain.libraries;
|
|
# targetLlvm = self.targetPackages.serene_toolchain.llvm or self.serene_toolchain.llvm;
|
|
# monorepoSrc = super.fetchgit {
|
|
# url = llvm.url;
|
|
# rev = llvm.rev;
|
|
# hash = llvm.hash;
|
|
# };
|
|
# officialRelease = null;
|
|
# gitRelease = {
|
|
# version = llvm.version;
|
|
# rev = llvm.rev;
|
|
# rev-version = llvm.rev-version;
|
|
# };
|
|
# }));
|
|
# })
|
|
(final: prev: {
|
|
p11-kit = prev.p11-kit.overrideAttrs (old: {
|
|
patches = [
|
|
./scripts/patches/p11-kit_skip_test.patch
|
|
];
|
|
});
|
|
|
|
cpio = prev.cpio.overrideAttrs (old: {
|
|
nativeBuildInputs = [ prev.autoreconfHook ];
|
|
NIX_CFLAGS_COMPILE = "-Wno-implicit-function-declaration";
|
|
});
|
|
|
|
libedit = prev.libedit.overrideAttrs (old: {
|
|
# Musl is ISO 10646 compliant but doesn't define __STDC_ISO_10646__ we need to do it ourselves
|
|
NIX_CFLAGS_COMPILE = "-D__STDC_ISO_10646__=201103L";
|
|
});
|
|
|
|
elfutils = prev.elfutils.overrideAttrs (old: {
|
|
# libcxx does not have __cxa_demangle
|
|
configureFlags = old.configureFlags ++ [ "--disable-demangler" ];
|
|
});
|
|
|
|
ccache = prev.ccache.overrideAttrs (old: {
|
|
nativeBuildInputs = old.nativeBuildInputs ++ [ final.elfutils ];
|
|
});
|
|
|
|
# We don't need systemd at all
|
|
util-linux = prev.util-linux.override { systemdSupport = false; };
|
|
|
|
# iwyu = (prev.include-what-you-use.overrideAttrs (old:
|
|
# let
|
|
# version = "0.20";
|
|
# in {
|
|
# inherit version;
|
|
|
|
# src = prev.fetchurl {
|
|
# url = "${old.meta.homepage}/downloads/${old.pname}-${version}.src.tar.gz";
|
|
# hash = "sha256-dfzh5khfKA+PE/TC0JCxHS/SECtQhXUHyEE6kZt6+Jk=";
|
|
# };
|
|
# cmakeFlags = [ "-DCMAKE_PREFIX_PATH=${prev.llvmPackages_16.llvm.dev}" ];
|
|
|
|
# })).override {
|
|
# llvmPackages = prev.__splicedPackages.llvmPackages_16;
|
|
# };
|
|
|
|
})
|
|
];
|
|
|
|
get_pkgs = system:
|
|
if system == "x86_64-linux"
|
|
then import nixpkgs {
|
|
inherit system overlays;
|
|
crossSystem = nixpkgs.lib.systems.examples.musl64 // { useLLVM = true; };
|
|
config.replaceCrossStdenv = { buildPackages, baseStdenv }:
|
|
buildPackages.stdenvAdapters.overrideCC baseStdenv buildPackages.llvmPackages_16.clangUseLLVM;
|
|
}
|
|
else import nixpkgs {
|
|
inherit system overlays;
|
|
};
|
|
|
|
|
|
pkgs = get_pkgs system;
|
|
|
|
#with pkgs;
|
|
native_build_inputs =
|
|
let
|
|
filterCmakeFlags = xs: builtins.filter
|
|
(x: !(x == "-DCMAKE_CROSSCOMPILING=True" || pkgs.lib.hasPrefix "-DLLVM_TABLEGEN=" x))
|
|
xs;
|
|
|
|
git' = pkgs.git.overrideAttrs (old: {
|
|
preInstallCheck =
|
|
pkgs.lib.replaceStrings [ ''disable_test t0201-gettext-fallbacks'' ]
|
|
[ ''
|
|
disable_test t0201-gettext-fallbacks
|
|
disable_test t2082-parallel-checkout-attributes
|
|
'' ]
|
|
old.preInstallCheck;
|
|
});
|
|
# iwyu = (pkgs.include-what-you-use.overrideAttrs (old:
|
|
# let
|
|
# version = "0.20";
|
|
# in {
|
|
# inherit version;
|
|
|
|
# src = pkgs.fetchurl {
|
|
# url = "${old.meta.homepage}/downloads/${old.pname}-${version}.src.tar.gz";
|
|
# hash = "sha256-dfzh5khfKA+PE/TC0JCxHS/SECtQhXUHyEE6kZt6+Jk=";
|
|
# };
|
|
|
|
|
|
# })).override {
|
|
# llvmPackages = pkgs.__splicedPackages.llvmPackages_16;# .overrideAttrs (oldLLVM: {
|
|
# # cmakeFlags = builtins.trace ">> ${toString(filterCmakeFlags oldLLVM.cmakeFlags)}" filterCmakeFlags oldLLVM.cmakeFlags;
|
|
# # });
|
|
# };
|
|
# mlir_16' = pkgs.mlir_16.overrideAttrs (old: {
|
|
|
|
# });
|
|
in with pkgs; [
|
|
cmake
|
|
ninja
|
|
ccache
|
|
git'
|
|
zsh
|
|
zsh-autosuggestions
|
|
zsh-autocomplete
|
|
zsh-syntax-highlighting
|
|
python3
|
|
# iwyu
|
|
];
|
|
|
|
build_inputs = with pkgs; [
|
|
boehmgc
|
|
# llvm_16
|
|
# llvm_16
|
|
# mlir_16
|
|
|
|
gtest
|
|
gmock
|
|
# zlib-ng
|
|
# zstd
|
|
];
|
|
|
|
in {
|
|
inherit pkgs;
|
|
devShells.default = pkgs.mkShell {
|
|
nativeBuildInputs = native_build_inputs;
|
|
buildInputs = build_inputs;
|
|
shellHook =
|
|
''
|
|
ZDOTDIR=${zshDir} zsh -d && exit
|
|
'';
|
|
};
|
|
|
|
packages.cmake = pkgs.cmake;
|
|
packages.blah = pkgs.stdenv.mkDerivation {
|
|
pname = "blah";
|
|
version = "0.1";
|
|
nativeBuildInputs = native_build_inputs;
|
|
buildInputs = build_inputs;
|
|
};
|
|
packages.mlir = pkgs.mlir_16;
|
|
}
|
|
);
|
|
}
|