Compare commits
3 Commits
8f46ca7744
...
f377e0d4d5
Author | SHA1 | Date |
---|---|---|
Sameer Rahmani | f377e0d4d5 | |
Sameer Rahmani | b59e4ab315 | |
Sameer Rahmani | 45b2a7805b |
|
@ -31,3 +31,6 @@ docs/spec.pdf
|
||||||
.tex
|
.tex
|
||||||
.pdf
|
.pdf
|
||||||
docs/overall_picture.png
|
docs/overall_picture.png
|
||||||
|
.direnv/
|
||||||
|
.pre-commit-config.yaml
|
||||||
|
.envrc
|
|
@ -1,39 +0,0 @@
|
||||||
# Apply to all files without commiting:
|
|
||||||
# pre-commit run --all-files
|
|
||||||
# Update this file:
|
|
||||||
# pre-commit autoupdate
|
|
||||||
fail_fast: false
|
|
||||||
repos:
|
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
||||||
rev: v4.3.0
|
|
||||||
hooks:
|
|
||||||
- id: check-added-large-files
|
|
||||||
- id: check-symlinks
|
|
||||||
- id: check-case-conflict
|
|
||||||
- id: check-docstring-first
|
|
||||||
- id: check-executables-have-shebangs
|
|
||||||
- id: forbid-new-submodules
|
|
||||||
- id: end-of-file-fixer
|
|
||||||
- id: trailing-whitespace
|
|
||||||
- id: mixed-line-ending
|
|
||||||
- id: fix-byte-order-marker
|
|
||||||
|
|
||||||
- repo: local
|
|
||||||
hooks:
|
|
||||||
- id: include-fixer py
|
|
||||||
name: Fixing local includes
|
|
||||||
language: python
|
|
||||||
entry: ./scripts/include-fixer.py
|
|
||||||
files: ".*.(h|cpp)"
|
|
||||||
|
|
||||||
- repo: https://github.com/pocc/pre-commit-hooks
|
|
||||||
rev: v1.3.5
|
|
||||||
hooks:
|
|
||||||
- id: clang-format
|
|
||||||
- id: cppcheck
|
|
||||||
args: ['--project=compile_commands.json']
|
|
||||||
- repo: https://github.com/detailyang/pre-commit-shell
|
|
||||||
rev: 1.0.5
|
|
||||||
hooks:
|
|
||||||
- id: shell-lint
|
|
||||||
args: ['-x']
|
|
141
flake.lock
141
flake.lock
|
@ -1,15 +1,31 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1696426674,
|
||||||
|
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1701680307,
|
"lastModified": 1710146030,
|
||||||
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
|
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
|
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -18,26 +34,120 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"flake-utils_2": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems_2"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1710146030,
|
||||||
|
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"git-hooks": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"flake-utils": "flake-utils_2",
|
||||||
|
"gitignore": "gitignore",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"nixpkgs-stable": "nixpkgs-stable"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1712055707,
|
||||||
|
"narHash": "sha256-4XLvuSIDZJGS17xEwSrNuJLL7UjDYKGJSbK1WWX2AK8=",
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "git-hooks.nix",
|
||||||
|
"rev": "e35aed5fda3cc79f88ed7f1795021e559582093a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "git-hooks.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gitignore": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"git-hooks",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1709087332,
|
||||||
|
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1705092417,
|
"lastModified": 1710765496,
|
||||||
"narHash": "sha256-01pTqprf3NvQijvxkQjwx2c6uevB4MZKooIcf+RTYHA=",
|
"narHash": "sha256-p7ryWEeQfMwTB6E0wIUd5V2cFTgq+DRRBz2hYGnJZyA=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "e367f7a1fb93137af22a3908f00b9a35e2d286a7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-stable": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1710695816,
|
||||||
|
"narHash": "sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "614b4613980a522ba49f0d194531beddbb7220d3",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-23.11",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1712525377,
|
||||||
|
"narHash": "sha256-TbfZDd8NN6gx7eU5XQWgF/ojnnkTvn7cPXWdY4PVTMU=",
|
||||||
"owner": "lxsameer",
|
"owner": "lxsameer",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "e1f7865bce4d52d30dd1d61e79798ee2765cc2b0",
|
"rev": "c738ee8ad1c35383037c20fa13eaac17c8ae98c5",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "lxsameer",
|
"owner": "lxsameer",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "e1f7865bce4d52d30dd1d61e79798ee2765cc2b0",
|
"rev": "c738ee8ad1c35383037c20fa13eaac17c8ae98c5",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs"
|
"git-hooks": "git-hooks",
|
||||||
|
"nixpkgs": "nixpkgs_2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systems": {
|
"systems": {
|
||||||
|
@ -54,6 +164,21 @@
|
||||||
"repo": "default",
|
"repo": "default",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"systems_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|
253
flake.nix
253
flake.nix
|
@ -16,119 +16,29 @@
|
||||||
{
|
{
|
||||||
description = "Serene programming language";
|
description = "Serene programming language";
|
||||||
|
|
||||||
#inputs.nixpkgs.url = "github:NixOS/nixpkgs/bcb1a9c7e1d8568c5e58316fe3254eb8f4455439";
|
inputs.nixpkgs.url =
|
||||||
inputs.nixpkgs.url = "github:lxsameer/nixpkgs/e1f7865bce4d52d30dd1d61e79798ee2765cc2b0";
|
"github:lxsameer/nixpkgs/c738ee8ad1c35383037c20fa13eaac17c8ae98c5";
|
||||||
#inputs.nixpkgs.url = "/home/lxsameer/src/nixpkgs/";
|
#inputs.nixpkgs.url = "/home/lxsameer/src/nixpkgs/";
|
||||||
|
inputs.git-hooks.url = "github:cachix/git-hooks.nix";
|
||||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
|
||||||
outputs = inputs@{ self, nixpkgs, flake-utils, ... }:
|
outputs = { self, nixpkgs, git-hooks, flake-utils, ... }:
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
let
|
let
|
||||||
# Out zsh configuration directory. mkShell will pick up the .zshrc
|
version = "1.0.0";
|
||||||
# from this directory.
|
|
||||||
zshDir = ./scripts;
|
|
||||||
|
|
||||||
# Most of these overlays are do to bugs and problems
|
|
||||||
# in upstream nixpkgs. But thanks to their design
|
|
||||||
# We can fix them using these overlays and contribuete
|
|
||||||
# them upstream little by little.
|
|
||||||
overlays = [
|
|
||||||
(final: prev: {
|
|
||||||
p11-kit = prev.p11-kit.overrideAttrs (old: {
|
|
||||||
patches = [
|
|
||||||
./nix/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; };
|
|
||||||
|
|
||||||
# libpam exmaples use glibc. We need to disable them
|
|
||||||
linux-pam = prev.linux-pam.overrideAttrs (old: {
|
|
||||||
postConfigure = ''
|
|
||||||
sed 's/examples//' -i Makefile
|
|
||||||
'';
|
|
||||||
});
|
|
||||||
|
|
||||||
#=============================================================
|
|
||||||
# Since we're using lld-17, and --no-undefined-version is the
|
|
||||||
# default in lld-17. We need to explicitely turn it off for
|
|
||||||
# these problematic packages untill they fix it upstream.
|
|
||||||
libgcrypt = prev.libgcrypt.overrideAttrs (old: {
|
|
||||||
NIX_LDFLAGS = if prev.stdenv.cc.isClang
|
|
||||||
then [ "--undefined-version" ]
|
|
||||||
else [];
|
|
||||||
});
|
|
||||||
libxcrypt = prev.libxcrypt.overrideAttrs (old: {
|
|
||||||
NIX_LDFLAGS = if prev.stdenv.cc.isClang
|
|
||||||
then [ "--undefined-version" ]
|
|
||||||
else [];
|
|
||||||
});
|
|
||||||
ncurses = prev.ncurses.overrideAttrs (old: {
|
|
||||||
NIX_LDFLAGS = if prev.stdenv.cc.isClang
|
|
||||||
then [ "--undefined-version" ]
|
|
||||||
else [];
|
|
||||||
});
|
|
||||||
|
|
||||||
libbsd = prev.libbsd.overrideAttrs (old: { #old.NIX_LDFLAGS ++
|
|
||||||
NIX_LDFLAGS = if prev.stdenv.cc.isClang
|
|
||||||
then [ "--undefined-version" ]
|
|
||||||
else [];
|
|
||||||
});
|
|
||||||
libidn2 = prev.libidn2.overrideAttrs (old: { #old.NIX_LDFLAGS ++
|
|
||||||
NIX_LDFLAGS = if prev.stdenv.cc.isClang
|
|
||||||
then [ "--undefined-version" ]
|
|
||||||
else [];
|
|
||||||
});
|
|
||||||
#==============================================================
|
|
||||||
|
|
||||||
iwyu = (prev.include-what-you-use.overrideAttrs (old:
|
|
||||||
let
|
|
||||||
version = "0.21";
|
|
||||||
in {
|
|
||||||
inherit version;
|
|
||||||
|
|
||||||
src = prev.fetchurl {
|
|
||||||
url = "${old.meta.homepage}/downloads/${old.pname}-${version}.src.tar.gz";
|
|
||||||
hash = "sha256-ajUZGf+JvafJXIlUcmAYaNs9qrlqlYs44DYokNWHYLY=";
|
|
||||||
};
|
|
||||||
cmakeFlags = [ "-DCMAKE_PREFIX_PATH=${prev.llvmPackages_17.llvm.dev}" ];
|
|
||||||
|
|
||||||
})).override {
|
|
||||||
llvmPackages = prev.__splicedPackages.llvmPackages_17;
|
|
||||||
};
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
|
overlays = [ (import ./nix/overlays.nix { }).muslComp ];
|
||||||
|
|
||||||
utils = import ./nix/utils.nix { inherit nixpkgs; };
|
utils = import ./nix/utils.nix { inherit nixpkgs; };
|
||||||
|
|
||||||
# Create a package set based on the build system
|
# Create a package set based on the build system
|
||||||
pkgs = utils.get_pkgs system overlays;
|
pkgs_set = utils.get_pkgs system overlays;
|
||||||
|
hostPkgs = pkgs_set.host;
|
||||||
|
pkgs = pkgs_set.target;
|
||||||
|
|
||||||
nativePkgs = import nixpkgs { inherit system overlays; };
|
# Create a stdenv based on LLVM
|
||||||
|
stdenv = pkgs.stdenvAdapters.overrideCC pkgs.stdenv
|
||||||
# Create a stdenv based on LLVM 17
|
pkgs.llvmPackages_18.clangUseLLVM;
|
||||||
stdenv = pkgs.stdenvAdapters.overrideCC pkgs.stdenv pkgs.llvmPackages_17.clangUseLLVM;
|
|
||||||
|
|
||||||
gc = pkgs.callPackage ./nix/boehmgc.nix { inherit stdenv; };
|
gc = pkgs.callPackage ./nix/boehmgc.nix { inherit stdenv; };
|
||||||
|
|
||||||
|
@ -147,121 +57,66 @@
|
||||||
# is not static), We can't statically link to it. So, we just replace
|
# is not static), We can't statically link to it. So, we just replace
|
||||||
# that zlib with our override of zlib-ng
|
# that zlib with our override of zlib-ng
|
||||||
clang' = stdenv.cc.overrideAttrs (old: {
|
clang' = stdenv.cc.overrideAttrs (old: {
|
||||||
propagatedBuildInputs = [ stdenv.cc.bintools ] ++ [ zlib' ];
|
propagatedBuildInputs = [ stdenv.cc.bintools ]
|
||||||
});
|
++ [ pkgs.zlib.static ];
|
||||||
llvm = pkgs.llvmPackages_17.llvm.overrideAttrs (old: {
|
|
||||||
propagatedBuildInputs = [ zlib' ];
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
llvm = pkgs.llvmPackages_18.llvm.overrideAttrs
|
||||||
|
(old: { propagatedBuildInputs = [ pkgs.zlib.static ]; });
|
||||||
|
|
||||||
# This is the actual stdenv that we need to use anywhere else
|
# This is the actual stdenv that we need to use anywhere else
|
||||||
stdenv' = pkgs.stdenvAdapters.overrideCC pkgs.stdenv clang';
|
stdenv' = pkgs.stdenvAdapters.overrideCC pkgs.stdenv clang';
|
||||||
|
|
||||||
# Just disabling the tests that fails under musl
|
nativeBuildToolsDeps = (with hostPkgs; [ cmake ninja ccache ]);
|
||||||
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;
|
|
||||||
});
|
|
||||||
|
|
||||||
buildToolsDeps = (with pkgs; [
|
buildToolsDeps =
|
||||||
cmake
|
(with pkgs; [ llvm llvmPackages_18.mlir llvmPackages_18.clang iwyu ]);
|
||||||
ninja
|
|
||||||
llvm
|
|
||||||
llvmPackages_17.mlir
|
|
||||||
llvmPackages_17.clang
|
|
||||||
iwyu
|
|
||||||
]);
|
|
||||||
|
|
||||||
shellTools = (with pkgs; [
|
|
||||||
zsh
|
|
||||||
zsh-autosuggestions
|
|
||||||
zsh-autocomplete
|
|
||||||
zsh-syntax-highlighting
|
|
||||||
]);
|
|
||||||
|
|
||||||
buildDevToolsDeps = (with pkgs; [
|
|
||||||
ccache
|
|
||||||
git'
|
|
||||||
python3
|
|
||||||
]);
|
|
||||||
|
|
||||||
buildDeps = (with pkgs; [
|
buildDeps = (with pkgs; [
|
||||||
gc
|
gc
|
||||||
zlib'
|
zlib'
|
||||||
llvm
|
llvm
|
||||||
llvmPackages_17.mlir
|
llvmPackages_18.mlir
|
||||||
llvmPackages_17.clang
|
llvmPackages_18.clang
|
||||||
]);
|
|
||||||
|
|
||||||
testDeps = (with pkgs; [
|
|
||||||
gtest
|
|
||||||
gmock
|
|
||||||
gbenchmark
|
|
||||||
]);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tex = nativePkgs.texlive.combine {
|
|
||||||
inherit (nativePkgs.texlive)
|
|
||||||
scheme-minimal
|
|
||||||
latex-bin
|
|
||||||
latexmk
|
|
||||||
xelatex-dev
|
|
||||||
sourcesanspro
|
|
||||||
xkeyval
|
|
||||||
etoolbox
|
|
||||||
titlesec
|
|
||||||
fontspec
|
|
||||||
hyperref
|
|
||||||
mfirstuc
|
|
||||||
parskip
|
|
||||||
geometry
|
|
||||||
pdftexcmds
|
|
||||||
infwarerr
|
|
||||||
kvoptions
|
|
||||||
;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
mathDeps = (with nativePkgs; [
|
|
||||||
idris2
|
|
||||||
agda
|
|
||||||
git
|
|
||||||
zsh
|
|
||||||
zsh-autosuggestions
|
|
||||||
zsh-autocomplete
|
|
||||||
zsh-syntax-highlighting
|
|
||||||
tex
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
testDeps = (with hostPkgs; [ gtest gmock gbenchmark ]);
|
||||||
|
|
||||||
in {
|
in {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
devShells.default = (pkgs.mkShell.override { stdenv = stdenv';}) {
|
devShells.default = (pkgs.mkShell.override { stdenv = stdenv'; }) {
|
||||||
nativeBuildInputs = buildDevToolsDeps ++ buildToolsDeps ++ shellTools;
|
inherit (self.checks.${system}.git-hook-check) shellHook;
|
||||||
|
|
||||||
|
nativeBuildInputs = nativeBuildToolsDeps ++ buildToolsDeps;
|
||||||
|
buildInputs = buildDeps ++ testDeps
|
||||||
|
++ self.checks.${system}.git-hook-check.enabledPackages;
|
||||||
|
CPP_LS = "serene-clangd";
|
||||||
|
};
|
||||||
|
|
||||||
|
packages.devshell = stdenv'.mkDerivation {
|
||||||
|
inherit version;
|
||||||
|
name = "devshell";
|
||||||
|
|
||||||
|
doUnpack = false;
|
||||||
|
doCheck = false;
|
||||||
|
nativeBuildInputs = nativeBuildToolsDeps ++ buildToolsDeps;
|
||||||
buildInputs = buildDeps ++ testDeps;
|
buildInputs = buildDeps ++ testDeps;
|
||||||
shellHook =
|
|
||||||
''
|
|
||||||
BUILDER= ZDOTDIR=${zshDir} zsh -d && exit
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# This shell is gcc based and we use it only
|
checks = {
|
||||||
# for the mathematics side of our design
|
git-hook-check = git-hooks.lib.${system}.run {
|
||||||
devShells.math = nativePkgs.mkShell {
|
src = ./.;
|
||||||
#nativeBuildInputs = mathDeps;
|
hooks = {
|
||||||
buildInputs = mathDeps;
|
nixfmt.enable = true;
|
||||||
shellHook =
|
clang-format = {
|
||||||
''
|
enable = true;
|
||||||
BUILDER=Math ZDOTDIR=${zshDir} zsh -d && exit
|
types_or = hostPkgs.lib.mkForce [ "c" "c++" ];
|
||||||
'';
|
};
|
||||||
};
|
shellcheck.enable = true;
|
||||||
|
cmake-format.enable = true;
|
||||||
|
|
||||||
#packages.llvm = llvm;
|
};
|
||||||
}
|
};
|
||||||
);
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,100 @@
|
||||||
|
# Serene Programming Language
|
||||||
|
#
|
||||||
|
# Copyright (c) 2019-2024 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/>.
|
||||||
|
{ ... }: {
|
||||||
|
# Most of these overlays are do to bugs and problems
|
||||||
|
# in upstream nixpkgs. But thanks to their design
|
||||||
|
# We can fix them using these overlays and contribute
|
||||||
|
# them upstream little by little.
|
||||||
|
muslComp = (final: prev: {
|
||||||
|
p11-kit = prev.p11-kit.overrideAttrs
|
||||||
|
(old: { patches = [ ./nix/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; };
|
||||||
|
|
||||||
|
# libpam exmaples use glibc. We need to disable them
|
||||||
|
linux-pam = prev.linux-pam.overrideAttrs (old: {
|
||||||
|
postConfigure = ''
|
||||||
|
sed 's/examples//' -i Makefile
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
|
||||||
|
#=============================================================
|
||||||
|
# Since we're using lld-18, and --no-undefined-version is the
|
||||||
|
# default in lld-18. We need to explicitly turn it off for
|
||||||
|
# these problematic packages untill they fix it upstream.
|
||||||
|
libxcrypt = prev.libxcrypt.overrideAttrs (old: {
|
||||||
|
NIX_LDFLAGS = [ ] ++ final.lib.optional (prev.stdenv.cc.isClang)
|
||||||
|
[ "--undefined-version" ];
|
||||||
|
});
|
||||||
|
|
||||||
|
ncurses = prev.ncurses.overrideAttrs (old: {
|
||||||
|
NIX_LDFLAGS = [ ] ++ final.lib.optional (prev.stdenv.cc.isClang)
|
||||||
|
[ "--undefined-version" ];
|
||||||
|
});
|
||||||
|
|
||||||
|
libbsd = prev.libbsd.overrideAttrs (old: {
|
||||||
|
NIX_LDFLAGS = [ ] ++ final.lib.optional (prev.stdenv.cc.isClang)
|
||||||
|
[ "--undefined-version" ];
|
||||||
|
});
|
||||||
|
|
||||||
|
libxml2 = prev.libxml2.overrideAttrs (old: {
|
||||||
|
propagatedBuildInputs = old.propagatedBuildInputs ++ [ prev.zlib.static ];
|
||||||
|
NIX_LDFLAGS = [ ] ++ final.lib.optional (prev.stdenv.cc.isClang)
|
||||||
|
[ "--undefined-version" ];
|
||||||
|
});
|
||||||
|
|
||||||
|
binutils = prev.binutils.overrideAttrs (old: {
|
||||||
|
buildInputs = [ prev.zlib prev.gettext prev.zlib.static ];
|
||||||
|
NIX_LDFLAGS = [ "--undefined-version" ];
|
||||||
|
});
|
||||||
|
|
||||||
|
#==============================================================
|
||||||
|
|
||||||
|
iwyu = (prev.include-what-you-use.overrideAttrs (old:
|
||||||
|
let version = "0.22";
|
||||||
|
in {
|
||||||
|
inherit version;
|
||||||
|
|
||||||
|
src = prev.fetchurl {
|
||||||
|
url =
|
||||||
|
"${old.meta.homepage}/downloads/${old.pname}-${version}.src.tar.gz";
|
||||||
|
hash = "sha256-hZB0tGHqS4MlpzQYwgfKM7XmVmsI5rWH65FkQWVppt0=";
|
||||||
|
};
|
||||||
|
cmakeFlags = [ "-DCMAKE_PREFIX_PATH=${prev.llvmPackages_18.llvm.dev}" ];
|
||||||
|
|
||||||
|
})).override { llvmPackages = prev.__splicedPackages.llvmPackages_18; };
|
||||||
|
});
|
||||||
|
}
|
|
@ -13,18 +13,18 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
{ nixpkgs }:
|
{ nixpkgs }: {
|
||||||
{
|
get_pkgs = system: overlays: {
|
||||||
get_pkgs = system: overlays:
|
host = import nixpkgs { inherit system; };
|
||||||
if system == "x86_64-linux"
|
target = if system == "x86_64-linux" then
|
||||||
then import nixpkgs {
|
import nixpkgs {
|
||||||
inherit system overlays;
|
inherit system overlays;
|
||||||
linker = "lld";
|
linker = "lld";
|
||||||
crossSystem = nixpkgs.lib.systems.examples.musl64 // { useLLVM = true; };
|
crossSystem = nixpkgs.lib.systems.examples.musl64 // {
|
||||||
# config.replaceCrossStdenv = { buildPackages, baseStdenv }:
|
useLLVM = true;
|
||||||
# buildPackages.stdenvAdapters.overrideCC baseStdenv buildPackages.llvmPackages_17.clangUseLLVM;
|
};
|
||||||
}
|
}
|
||||||
else import nixpkgs {
|
else
|
||||||
inherit system overlays;
|
import nixpkgs { inherit system overlays; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue