aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorQyriad <qyriad@qyriad.me>2024-05-07 15:25:08 -0600
committerQyriad <qyriad@qyriad.me>2024-05-07 18:09:51 -0600
commitf782c8a60a4be16eebf98ef329a8e614de814c30 (patch)
treeab9a77af5a00be158490a5275e0a391ebdded6c0 /flake.nix
parent8822fd7dd5254e781660704858f2eca386bdf5a2 (diff)
flake: refactor devShell creation
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
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix78
1 files changed, 5 insertions, 73 deletions
diff --git a/flake.nix b/flake.nix
index 141cb8f31..f7d600309 100644
--- a/flake.nix
+++ b/flake.nix
@@ -366,82 +366,14 @@
nix = pkgs.callPackage ./package.nix {
inherit stdenv versionSuffix;
busybox-sandbox-shell = pkgs.busybox-sandbox-shell or pkgs.default-busybox-sandbox;
- forDevShell = true;
+ internalApiDocs = true;
};
pre-commit = self.hydraJobs.pre-commit.${pkgs.system} or { };
in
- (nix.override {
- buildUnreleasedNotes = true;
- officialRelease = false;
- }).overrideAttrs
- (
- prev:
- {
- # Required for clang-tidy checks
- buildInputs =
- prev.buildInputs
- ++ [
- pkgs.just
- pkgs.nixfmt
- ]
- ++ lib.optional (pre-commit ? enabledPackages) pre-commit.enabledPackages
- ++ lib.optionals (stdenv.cc.isClang) [
- pkgs.llvmPackages.llvm
- pkgs.llvmPackages.clang-unwrapped.dev
- ];
- nativeBuildInputs =
- prev.nativeBuildInputs
- ++ lib.optional (stdenv.cc.isClang && !stdenv.buildPlatform.isDarwin) pkgs.buildPackages.bear
- # Required for clang-tidy checks
- ++ lib.optionals (stdenv.cc.isClang) [
- pkgs.buildPackages.cmake
- pkgs.buildPackages.ninja
- pkgs.buildPackages.llvmPackages.llvm.dev
- ]
- ++
- lib.optional (stdenv.cc.isClang && stdenv.hostPlatform == stdenv.buildPlatform)
- # for some reason that seems accidental and was changed in
- # NixOS 24.05-pre, clang-tools is pinned to LLVM 14 when
- # default LLVM is newer.
- (pkgs.buildPackages.clang-tools.override { inherit (pkgs.buildPackages) llvmPackages; })
- ++
- lib.optionals (lib.meta.availableOn pkgs.stdenv.hostPlatform pkgs.buildPackages.clangbuildanalyzer)
- [ pkgs.buildPackages.clangbuildanalyzer ];
-
- src = null;
-
- strictDeps = false;
-
- shellHook = ''
- PATH=$prefix/bin:$PATH
- unset PYTHONPATH
- export MANPATH=$out/share/man:$MANPATH
-
- # Make bash completion work.
- XDG_DATA_DIRS+=:$out/share
-
- ${lib.optionalString (pre-commit ? shellHook) pre-commit.shellHook}
- # Allow `touch .nocontribmsg` to turn this notice off.
- if ! [[ -f .nocontribmsg ]]; then
- cat ${contribNotice}
- fi
-
- # Install the Gerrit commit-msg hook.
- # (git common dir is the main .git, including for worktrees)
- if gitcommondir=$(git rev-parse --git-common-dir 2>/dev/null) && [[ ! -f "$gitcommondir/hooks/commit-msg" ]]; then
- echo 'Installing Gerrit commit-msg hook (adds Change-Id to commit messages)' >&2
- mkdir -p "$gitcommondir/hooks"
- curl -s -Lo "$gitcommondir/hooks/commit-msg" https://gerrit.lix.systems/tools/hooks/commit-msg
- chmod u+x "$gitcommondir/hooks/commit-msg"
- fi
- unset gitcommondir
- '';
- }
- // lib.optionalAttrs (stdenv.buildPlatform.isLinux && pkgs.glibcLocales != null) {
- # Required to make non-NixOS Linux not complain about missing locale files during configure in a dev shell
- LOCALE_ARCHIVE = "${lib.getLib pkgs.glibcLocales}/lib/locale/locale-archive";
- }
- );
+ pkgs.callPackage nix.mkDevShell {
+ pre-commit-checks = pre-commit;
+ inherit contribNotice;
+ };
in
forAllSystems (
system: