1

Config: Move project develop shell flake to config/

This commit is contained in:
2025-06-30 19:40:08 +02:00
parent 0e8a177114
commit eb5312a52b

View File

@ -1,4 +1,4 @@
{ rec {
description = ""; description = "";
inputs = { inputs = {
@ -10,16 +10,17 @@
}; };
outputs = { outputs = {
inputs, self,
nixpkgs, nixpkgs,
flake-utils, flake-utils,
rust-overlay,
}: }:
flake-utils.lib.eachDefaultSystem (system: let flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
config.allowUnfree = true; config.allowUnfree = true;
overlays = [ overlays = [
inputs.rust-overlay.overlays.default rust-overlay.overlays.default
]; ];
}; };
@ -41,12 +42,12 @@
libc = pkgs.glibc; libc = pkgs.glibc;
}; };
gcc = pkgs.hiPrio (pkgs.wrapCCWith { gcc = pkgs.hiPrio (pkgs.wrapCCWith {
cc = pkgs.gcc15.cc; # Unwrapped gcc cc = pkgs.gcc.cc; # Unwrapped gcc
libc = pkgs.glibc; libc = pkgs.glibc;
bintools = bintools; bintools = bintools;
}); });
clang = pkgs.wrapCCWith { clang = pkgs.wrapCCWith {
cc = pkgs.clang_20.cc; # Unwrapped clang cc = pkgs.clang.cc; # Unwrapped clang
libc = pkgs.glibc; libc = pkgs.glibc;
bintools = bintools; bintools = bintools;
}; };
@ -57,12 +58,12 @@
libc = pkgs.glibc_multi; libc = pkgs.glibc_multi;
}; };
gcc_multilib = pkgs.hiPrio (pkgs.wrapCCWith { gcc_multilib = pkgs.hiPrio (pkgs.wrapCCWith {
cc = pkgs.gcc15.cc; # Unwrapped gcc cc = pkgs.gcc.cc; # Unwrapped gcc
libc = pkgs.glibc_multi; libc = pkgs.glibc_multi;
bintools = bintools_multilib; bintools = bintools_multilib;
}); });
clang_multilib = pkgs.wrapCCWith { clang_multilib = pkgs.wrapCCWith {
cc = pkgs.clang_20.cc; # Unwrapped clang cc = pkgs.clang.cc; # Unwrapped clang
libc = pkgs.glibc_multi; libc = pkgs.glibc_multi;
bintools = bintools_multilib; bintools = bintools_multilib;
}; };
@ -75,7 +76,7 @@
# }; # };
devShell = pkgs.mkShell { devShell = pkgs.mkShell {
name = "Development Environment"; name = description;
# Comments on buildInputs, nativeBuildInputs, buildPackages: # Comments on buildInputs, nativeBuildInputs, buildPackages:
# https://discourse.nixos.org/t/use-buildinputs-or-nativebuildinputs-for-nix-shell/8464 # https://discourse.nixos.org/t/use-buildinputs-or-nativebuildinputs-for-nix-shell/8464
@ -110,15 +111,14 @@
]; ];
# Stuff ran at build-time (e.g. cmake, autoPatchelfHook). # Stuff ran at build-time (e.g. cmake, autoPatchelfHook).
# Architecture will be the build platform (relevant for e.g. cross-compilation). # Architecture will be the build/target platform (relevant for e.g. cross-compilation).
# Packages will be added to $PATH. # Packages will be added to $PATH.
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [];
];
# Rust stdlib source: # Rust stdlib source:
# RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library"; # RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library";
# Dynamic libraries example: # Custom dynamic libraries:
# LD_LIBRARY_PATH = builtins.concatStringsSep ":" [ # LD_LIBRARY_PATH = builtins.concatStringsSep ":" [
# # Rust Bevy GUI app # # Rust Bevy GUI app
# "${pkgs.xorg.libX11}/lib" # "${pkgs.xorg.libX11}/lib"
@ -131,20 +131,31 @@
# Dynamic libraries from buildinputs: # Dynamic libraries from buildinputs:
# LD_LIBRARY_PATH = nixpkgs.lib.makeLibraryPath buildInputs; # LD_LIBRARY_PATH = nixpkgs.lib.makeLibraryPath buildInputs;
# Setup the shell when entering the "nix develop" environment # Setup the shell when entering the "nix develop" environment (bash script).
shellHook = builtins.concatStringsSep "\n" [ shellHook = let
# Qt: Set the environment variables that Qt apps expect # Use this to specify commands that should be ran after entering fish shell
# '' initProjectShell = pkgs.writeShellScript "init-shell.fish" ''
# fishdir=$(mktemp -d) echo "Entering \"${description}\" environment..."
# makeWrapper "$(type -p fish)" "$fishdir/fish" "''${qtWrapperArgs[@]}"
# exec "$fishdir/fish"
# ''
# Add shell abbreviations specific to this build environment # Add shell abbreviations specific to this build environment
# ''
# abbr -a build-release-windows "CARGO_FEATURE_PURE=1 cargo xwin build --release --target x86_64-pc-windows-msvc" # Rust Bevy:
# '' # abbr -a build-release-windows "CARGO_FEATURE_PURE=1 cargo xwin build --release --target x86_64-pc-windows-msvc"
]; '';
in
builtins.concatStringsSep "\n" [
# Launch into pure fish shell
''
exec "$(type -p fish)" -C "source ${initProjectShell}"
''
# Qt: Launch into wrapped fish shell
# ''
# fishdir=$(mktemp -d)
# makeWrapper "$(type -p fish)" "$fishdir/fish" "''${qtWrapperArgs[@]}"
# exec "$fishdir/fish" -C "source ${initProjectShell}"
# ''
];
}; };
}); });
} }