aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
AgeCommit message (Collapse)Author
2024-05-15release-notes: build unreleased release notes by defaultJade Lovelace
Surely if you have unreleased changes you want them on a page right? `officialRelease` means "this is a *release version*", which is a reasonable case to not want it, but we are not that here. I understand wanting to be able to turn it off for deps reasons or something, but other than that, uhh, seems better to just turn it on always; it is basically free compute-wise to the point we run it on pre-commit. Part two of fixing lix#297. Fixes: https://git.lix.systems/lix-project/lix/issues/297 Change-Id: I0f8dd1ae42458df371aef529c456e47a7ac04ae0
2024-05-15build-release-notes: add change author metadata and use itJade Lovelace
Change-Id: I6f5fb54f70b02a467bbdee4c526f59da1193f7db
2024-05-09Merge "fix: eval error of .#devShells.x86_64-linux.x86_64-freebsd13" into mainjade
2024-05-09fix: eval error of .#devShells.x86_64-linux.x86_64-freebsd13Jade Lovelace
This is broken and our resident nixbsd maintainers say it should probably just be temporarily removed till we switch to 24.05 instead of diagnosing it. Originally introduced in: https://github.com/nixos/nix/pull/8887 Fixes: https://git.lix.systems/lix-project/lix/issues/277 Change-Id: I1e7db8859620024a7b37dbd0cc1c5ec139b9e5cb
2024-05-08flake: update nixpkgs input to latest nixos-23.11Maximilian Bosch
This includes the update to libseccomp 2.5.5[1], so we don't need to override it on our own. [1] https://nixpk.gs/pr-tracker.html?pr=306070 Change-Id: I1fa9c7fcc23e501d75f774745107c6bb086ced70
2024-05-07flake: refactor devShell creationQyriad
Now instead of a derivation overridden from Lix, we use a mkShell derivation parameterized on an already called package.nix. This also lets callPackage take care of the buildPackages distinction for the devShell. Change-Id: I5ddfec40d83fa6136032da7606fe6d3d5014ef42
2024-05-07package: default the build-release-notes arg like we do with lix-docQyriad
Change-Id: I0e2df55efc1cd6ea0a3252b9f26676e84612fdb6
2024-05-07remove the autoconf+Make buildsystemQyriad
We're not using it anymore. Any leftover bugs in the Meson buildsystem are now just bugs. Closes #249. Change-Id: I0465a0c37ae819f94d40e7829f5bff046aa63d73
2024-05-07Merge "feat: setup gerrit commit-msg hook with nix develop" into mainPatrick Jackson
2024-05-07flake: fix devShell on i686-linux by disabling ClangBuildAnalyzer on itQyriad
ClangBuildAnalyzer doesn't build on i686-linux due to `long long int`/`size_t` conversion errors, so let's just exclude it from the devshell on that platform Change-Id: If1077a7b3860db4381999c8e304f6d4b2bc96a05
2024-05-07feat: setup gerrit commit-msg hook with nix developPatrick Jackson
Closes #273 Change-Id: Id883d2cda06adbcae53b8c360ad015330f0af81b
2024-05-07flake: fix eval of checks & devshell on i686-linuxQyriad
Change-Id: I62da3161327051005e3f48f83974140efef4417e
2024-05-07flake: move the pre-commit definition to its own fileQyriad
It's a good hundred LOC, and wasn't coupled to the actual flake logic at all. Change-Id: Iebb4667b3197dbd8cb2b019014e99fa651848832
2024-05-05add a contributor notice message to the dev shell hookQyriad
It can be turned off by creating a file `.nocontribmsg` in the root of the repo. Change-Id: Iecc5c647c824a0416e527550226447780b94c08e
2024-05-03libstore/local-derivation-goal: prohibit creating setuid/setgid binariesMaximilian Bosch
With Linux kernel >=6.6 & glibc 2.39 a `fchmodat2(2)` is available that isn't filtered away by the libseccomp sandbox. Being able to use this to bypass that restriction has surprising results for some builds such as lxc[1]: > With kernel ≥6.6 and glibc 2.39, lxc's install phase uses fchmodat2, > which slips through https://github.com/NixOS/nix/blob/9b88e5284608116b7db0dbd3d5dd7a33b90d52d7/src/libstore/build/local-derivation-goal.cc#L1650-L1663. > The fixupPhase then uses fchmodat, which fails. > With older kernel or glibc, setting the suid bit fails in the > install phase, which is not treated as fatal, and then the > fixup phase does not try to set it again. Please note that there are still ways to bypass this sandbox[2] and this is mostly a fix for the breaking builds. This change works by creating a syscall filter for the `fchmodat2` syscall (number 452 on most systems). The problem is that glibc 2.39 is needed to have the correct syscall number available via `__NR_fchmodat2` / `__SNR_fchmodat2`, but this flake is still on nixpkgs 23.11. To have this change everywhere and not dependent on the glibc this package is built against, I added a header "fchmodat2-compat.hh" that sets the syscall number based on the architecture. On most platforms its 452 according to glibc with a few exceptions: $ rg --pcre2 'define __NR_fchmodat2 (?!452)' sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h 58:#define __NR_fchmodat2 1073742276 sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h 67:#define __NR_fchmodat2 6452 sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h 62:#define __NR_fchmodat2 5452 sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h 70:#define __NR_fchmodat2 4452 sysdeps/unix/sysv/linux/alpha/arch-syscall.h 59:#define __NR_fchmodat2 562 I added a small regression-test to the setuid integration-test that attempts to set the suid bit on a file using the fchmodat2 syscall. I confirmed that the test fails without the change in local-derivation-goal. Additionally, we require libseccomp 2.5.5 or greater now: as it turns out, libseccomp maintains an internal syscall table and validates each rule against it. This means that when using libseccomp 2.5.4 or older, one may pass `452` as syscall number against it, but since it doesn't exist in the internal structure, `libseccomp` will refuse to create a filter for that. This happens with nixpkgs-23.11, i.e. on stable NixOS and when building Lix against the project's flake. To work around that * a backport of libseccomp 2.5.5 on upstream nixpkgs has been scheduled[3]. * the package now uses libseccomp 2.5.5 on its own already. This is to provide a quick fix since the correct fix for 23.11 is still a staging cycle away. We still need the compat header though since `SCMP_SYS(fchmodat2)` internally transforms this into `__SNR_fchmodat2` which points to `__NR_fchmodat2` from glibc 2.39, so it wouldn't build on glibc 2.38. The updated syscall table from libseccomp 2.5.5 is NOT used for that step, but used later, so we need both, our compat header and their syscall table 🤷 Relevant PRs in CppNix: * https://github.com/NixOS/nix/pull/10591 * https://github.com/NixOS/nix/pull/10501 [1] https://github.com/NixOS/nixpkgs/issues/300635#issuecomment-2031073804 [2] https://github.com/NixOS/nixpkgs/issues/300635#issuecomment-2030844251 [3] https://github.com/NixOS/nixpkgs/pull/306070 (cherry picked from commit ba6804518772e6afb403dd55478365d4b863c854) Change-Id: I6921ab5a363188c6bff617750d00bb517276b7fe
2024-04-22meson: flip the switch!!Qyriad
This commit makes Meson the default buildsystem for Lix. The Make buildsystem is now deprecated and will be removed soon, but has not yet, which will be done in a later commit when all seems good. The mesonBuild jobs have been removed, and have not been replaced with equivalent jobs to ensure the Make buildsystem still works. The full, new commands in a development shell are: $ meson setup ./build "--prefix=$out" $mesonFlags (A simple `meson setup ./build` will also build, but will do a different thing, not having the settings from package.nix applied.) $ meson compile -C build $ meson test -C build --suite=check $ meson install -C build $ meson test -C build --suite=installcheck (Check and installcheck may both be done after install, allowing you to omit the --suite argument entirely, but this is the order package.nix runs them in.) If tests fail and Meson helpfully has no output for why, use the `--print-error-logs` option to `meson test`. Why this is not the default I cannot explain. If you change a setting in the buildsystem, most cases will automatically regenerate the Meson configuration, but some cases, like trying to build a specific target whose name is new to the buildsystem (e.g. `meson compile -C build src/libmelt/libmelt.dylib`, when `libmelt.dylib` did not exist as a target the last time the buildsystem was generated), then you can reconfigure using new settings but existing options, and only recompiling stuff affected by the changes: $ meson setup --reconfigure build Note that changes to the default values in `meson.options` or in the `default_options :` argument to project() are NOT propagated with `--reconfigure`. If you want a totally clean build, you can use: $ meson setup --wipe build That will work regardless of if `./build` exists or not. Specific, named targets may be addressed in `meson build -C build <target>` with the "target ID" if there is one, which is the first string argument passed to target functions that have one, and unrelated to the variable name, e.g.: libexpr_dylib = library('nixexpr', …) can be addressed with: $ meson compile -C build nixexpr All targets may be addressed as their output, relative to the build directory, e.g.: $ meson compile -C build src/libexpr/libnixexpr.so But Meson does not consider intermediate files like object files targets. To build a specific object file, use Ninja directly and specify the output file relative to the build directory: $ ninja -C build src/libexpr/libnixexpr.so.p/nixexpr.cc.o To inspect the canonical source of truth on what the state of the buildsystem configuration is, use: $ meson introspect Have fun! Change-Id: Ia3e7b1e6fae26daf3162e655b4ded611a5cd57ad
2024-04-17Merge "build internal API docs with Meson" into mainQyriad
2024-04-15build internal API docs with MesonQyriad
This commit adds the capability for building the Doxygen internal API docs in the Meson buildsystem, and also makes doing so the default for the internal-api-docs hydra job. Aside from the /nix-support directory, which differed only by the hash part of a store path, the outputs of hydraJobs.internal-api-docs before and after this commit were bit-for-bit identical on my machine. Change-Id: I98f0017891c25b06866c15f7652fe74f706ec8e1
2024-04-12flake: factor out binary tarball into its own fileQyriad
Bit-for-bit identical, and this one is callPackage-able Change-Id: Ic635687b0054e107271a9c24ae69101f5e0fba9e
2024-04-08pre-commit check for pragma once and ///@fileJade Lovelace
This is in our style guide, we can cheaply enforce it, let's do it. ``` $ pre-commit check-case-conflicts.....................................................Passed check-executables-have-shebangs..........................................Passed check-headers............................................................Failed - hook id: check-headers - exit code: 1 Missing pattern @file in file src/libexpr/value.hh We found some header files that don't conform to the style guide. The Lix style guide requests that header files: - Begin with `#pragma once` so they only get parsed once - Contain a doxygen comment (`/**` or `///`) containing `@file`, for example, `///@file`, which will make doxygen generate docs for them. When adding that, consider also adding a `@brief` with a sentence explaining what the header is for. For more details: https://wiki.lix.systems/link/3#bkmrk-header-files check-merge-conflicts....................................................Passed check-shebang-scripts-are-executable.....................................Passed check-symlinks.......................................(no files to check)Skipped end-of-file-fixer........................................................Passed mixed-line-endings.......................................................Passed no-commit-to-branch......................................................Passed release-notes........................................(no files to check)Skipped treefmt..................................................................Passed trim-trailing-whitespace.................................................Passed ``` Fixes: https://git.lix.systems/lix-project/lix/issues/233 Change-Id: I77150b9298c844ffedd0f85cc5250ae9208502e3
2024-04-08release-notes: check with pre-commitJade Lovelace
This required making the build-release-notes script understand how to check multiple directories. Change-Id: I057f5f636155ab6c6fb5755da5217b7e72249ece
2024-04-08pre-commit: stop using the flakeJade Lovelace
The flake for pre-commit-checks is rather questionable. We ignored it so it uses our own nixpkgs and doesn't reimport nixpkgs. This should save a couple of seconds of eval time! Change-Id: I4584982beb32e0122f791fa29f6a544bdbb9e201
2024-04-08Format Nix code with `nixfmt`Rebecca Turner
Change-Id: I61efeb666ff7481c05fcb247168290e86a250151
2024-04-08Add `nixfmt`Rebecca Turner
Change-Id: I7f21695e3971cfd02b2cce0dd016ff6eb3389905
2024-04-08nix-doc -> lix-doc, make self-contained in package.nixJade Lovelace
package.nix previously needed this callPackage'd externally, which didn't make a lot of sense to us since this is an internal dependency. Thus we changed it to make it more self contained. Change-Id: I4935bc0bc80e1a132bc9b1519e917791da95037c
2024-04-07flake: remove dead codeJade Lovelace
Some of this code existed for installer tests, and indeed its removal is an indication that our daemon cross-compatibility tests were removed. Although these are not like, super critical tests, we would like to restore them. See: https://git.lix.systems/lix-project/lix/issues/33 Change-Id: I75c733b25c00eca3a9676d498703bbfc1d6ec21b
2024-04-07Merge "flake: fix rl-next and rl-next-dev checks after 32eaa8a29 (fix nix ↵Qyriad
flake check)" into main
2024-04-07package: just use fileset from libQyriad
The following command is now sufficient to build Lix from outside of the flake: nix-build -E 'let pkgs = import <nixpkgs> { }; in pkgs.callPackage ./package.nix { build-release-notes = false; nix-doc = pkgs.callPackage ./nix-doc/package.nix { }; }' Change-Id: Ie6b14b446480ac07c7266d4fba20042b04cc35b9
2024-04-07flake: fix rl-next and rl-next-dev checks after 32eaa8a29 (fix nix flake check)Qyriad
follow-up to 32eaa8a29[1] "flake: move release note checks to hydraJobs", this commit fixes a load-bearing typo for`checks.rl-next` and `checks.rl-next-dev`. [1]: 32eaa8a2910793538deab31f85534faf7e722ef7 Change-Id: I9383ed21f7eccc337c0c2f65525418b735a94a1d
2024-04-07package: put boehmgc patch logic in package.nixQyriad
In our view it really doesn't make sense to not have this in in package.nix in some way. These patches aren't just for performance or something -- Lix flat out doesn't build without these patches. (Arguably that makes them a buildsystem responsibility as well, but that can wait for when we're ready to start adding subproject fallback dependency resolution to Meson.) This is a step towards making `package.nix` more self-sufficient and `callPackage`able without excessive external logic. With this change the following command is enough to build Lix from out of the flake: nix-build -E 'let pkgs = import <nixpkgs> { }; in pkgs.callPackage ./package.nix { build-release-notes = false; inherit (pkgs.lib) fileset; nix-doc = pkgs.callPackage ./nix-doc/package.nix { }; }' Change-Id: Ia37fe8171f87d3293033de8be07d9bab12716f1d
2024-04-06flake: move release note checks to hydraJobseldritch horrors
having them in checks only does not run them in CI, which can cause broken release notes entries to pass. fixes #228 Change-Id: If0ba7b1be0b6525fc884a27e941cbc84b5a160f9
2024-04-03repl: improve `:doc` builtin repl command to support lambdas.Lunaphied
For a long time `nix repl` has supported displaying documentation set on builtins, however, it has long been convention to use Markdown comments on Nix functions themselves for documentation. This exposes that information to `nix repl` users in a nice and formatted way. NixOS/rfcs#145 doc-comments are primarily what this feature is intended to consume, however, support for lambda documentation in the repl is experimental. We do our best effort to support the RFC here. These changes are based on [the nix-doc library](https://github.com/lf-/nix-doc) and are licensed under the terms described in the relevant source files. Change-Id: Ic6fe947d39a22540705d890737e336c4720b0a22
2024-04-03Merge "Add `treefmt` `pre-commit` hook" into mainrebecca “wiggles” turner
2024-04-02Merge "Use upstream `cachix/git-hooks.nix` for pre-commit" into mainrebecca “wiggles” turner
2024-04-01Use upstream `cachix/git-hooks.nix` for pre-commitRebecca Turner
Change-Id: I6bbc7d6da9accd7d2daffa9d780384df7226670e
2024-03-31flake: Add cmake to devShellArtemis Tosini
Meson fails to setup when cmake is not found. Add cmake to the default devShell so meson build works. Change-Id: I4d933efac9540c564f3171e43c23e7a645722ef7
2024-03-29Add `treefmt` `pre-commit` hookRebecca Turner
This lets us use different formatters for different filetypes. Change-Id: Ib52383dd5097c8919a65e299aca2b5a55412223c
2024-03-29Add `pre-commit` checksRebecca Turner
The big ones here are `trim-trailing-whitespace` and `end-of-file-fixer` (which makes sure that every file ends with exactly one newline character). Change-Id: Idca73b640883188f068f9903e013cf0d82aa1123
2024-03-30Add a `justfile` to make `meson` friendly :)Rebecca Turner
Change-Id: Id6e4528392266c6f2444e030b67293abe297ed17
2024-03-27Enable clang build timing analysisJade Lovelace
I didn't enable this by default for clang due to making the build time 10% worse or so. Unfortunate, but tbh devs for whom 10% of build time is not *that* bad should probably simply enable this. Change-Id: I8d1e5b6f3f76c649a4e2f115f534f7f97cee46e6
2024-03-27Add release notes system for dev facing release notesJade Lovelace
We keep changing dev stuff and we probably should keep the news up to date? Change-Id: I819da6a29f1c56c8ab8d758c159a9c96164cb04e
2024-03-27flake: always build release notes in devshelleldritch horrors
Change-Id: I0e02567fe8f102a8a8f1558aa094eefacdac9393
2024-03-27build: replace changelog-d with local scripteldritch horrors
hacking changelog-d to support not just github but also forgejo and gerrit is a lot more complicated than it's worth, even moreso since the entire thing can just as well be done with ~60 lines of python. this new script is also much cheaper to instantiate (being python), so having it enabled in all shells is far less of a hassle. we've also adjusted existing release notes that referenced a gerrit cl to auto-link to the cl in question, making the diff a bit bigger closes https://git.lix.systems/lix-project/lix/issues/176 Change-Id: I8ba7dd0070aad9ba4474401731215fcf5d9d2130
2024-03-25flake.nix: linearize meson buildseldritch horrors
parallel meson builds need too much ram. linearize them for now, and hopefully we can remove the make build system and this hack soonish. Change-Id: I42c092db8b0c63680e77da2263cdfe9e7f6575be
2024-03-22build: optionally build and install with mesonQyriad
This commit adds several meson.build, which successfully build and install Lix executables, libraries, and headers. Meson does not yet build docs, Perl bindings, or run tests, which will be added in following commits. As such, this commit does not remove the existing build system, or make it the default, and also as such, this commit has several FIXMEs and TODOs as notes for what should be done before the existing autoconf + make buildsystem can be removed and Meson made the default. This commit does not modify any source files. A Meson-enabled build is also added as a Hydra job, and to `nix flake check`. Change-Id: I667c8685b13b7bab91e281053f807a11616ae3d4
2024-03-21Merge "clang-tidy check infrastructure" into mainjade
2024-03-21flake: fix arm32 Linux cross devShell on macOS (fix nix flake check)Qyriad
Change-Id: Iacac97de0b3d5f2df52c7bc985148624a351f45d
2024-03-18clang-tidy check infrastructureJade Lovelace
This brings in infrastructure for developing new custom clang-tidy lints and refactors for Lix. Change-Id: I3df5f5855712ab4f97d4e84d771e5e818f81f881
2024-03-17flake: fix musl static stdenv devShell (fix nix flake check)Qyriad
pkgs.pkgsStatic.glibcLocales is null, so the string coercion was failing for devShells against static stdenvs Change-Id: Iee8e1042a852133ce0432627d72a85e97c17055e
2024-03-14Backport PR#9633 by cole-h: package: don't set sysconfdir in devShellsCole Helbling
(cherry-picked from commit ba0087316acc2aba999cabe5e1a159da636b2569) Change-Id: I5a50afb3b7b65516df798ee51b74f06727a91928