flake: add devShells
exposed via nix registry :D can be used in nix-direnv like `use flake shells#cs.osu`
This commit is contained in:
parent
8c75ba2a2d
commit
76b6f7cfb8
11 changed files with 283 additions and 0 deletions
14
shells/cs/default.nix
Normal file
14
shells/cs/default.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
callPackage,
|
||||
lib,
|
||||
mkShell,
|
||||
dotnetCorePackages
|
||||
}:
|
||||
mkShell {
|
||||
nativeBuildInputs = [ (with dotnetCorePackages; combinePackages [ sdk_6_0 runtime_6_0 ]) ];
|
||||
DOTNET_CLI_TELEMETRY_OPTOUT = 1;
|
||||
|
||||
passthru = {
|
||||
osu = callPackage ./osu.nix {};
|
||||
};
|
||||
}
|
||||
80
shells/cs/osu.nix
Normal file
80
shells/cs/osu.nix
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
# Flake for development on https://github.com/ppy/osu
|
||||
{
|
||||
lib,
|
||||
mkShell,
|
||||
writeScript,
|
||||
stdenv,
|
||||
stdenvNoCC,
|
||||
|
||||
dotnetCorePackages,
|
||||
|
||||
alsa-lib,
|
||||
ffmpeg_4,
|
||||
icu,
|
||||
lltng-ust,
|
||||
numactl,
|
||||
openssl,
|
||||
SDL2
|
||||
}:
|
||||
let
|
||||
baseBuild = "-f net5.0 -v minimal /property:Version=$OSU_VERSION osu.Desktop -- $@";
|
||||
|
||||
deps = [
|
||||
alsa-lib ffmpeg_4 icu lttng-ust numactl openssl SDL2
|
||||
];
|
||||
|
||||
fixSdl = writeScript "osu-fixsdl" ''
|
||||
ln -sft osu.Desktop/bin/Debug/net5.0/linux-x64/ ${SDL2}/lib/libSDL2${stdenv.hostPlatform.extensions.sharedLibrary}
|
||||
ln -sft osu.Desktop/bin/Release/net5.0/linux-x64/ ${SDL2}/lib/libSDL2${stdenv.hostPlatform.extensions.sharedLibrary}
|
||||
'';
|
||||
buildScript = writeScript "osu-build" ''
|
||||
rm -f osu.Desktop/bin/Debug/net5.0/linux-x64/libSDL2.so
|
||||
dotnet build -c Debug -r linux-x64 ${baseBuild} && ${fixSdl}
|
||||
'';
|
||||
buildReleaseScript = writeScript "osu-build-rel" ''
|
||||
rm -f osu.Desktop/bin/Release/net5.0/linux-x64/libSDL2.so
|
||||
dotnet build -c Release -r linux-x64 ${baseBuild} && ${fixSdl}
|
||||
'';
|
||||
publishScript = writeScript "osu-publish" ''
|
||||
rm -f osu.Desktop/bin/Release/net5.0/linux-x64/libSDL2.so
|
||||
dotnet publish -c Release -r linux-x64 --self-contained false ${baseBuild} && ${fixSdl}
|
||||
'';
|
||||
publishWinScript = writeScript "osu-publish-win" ''
|
||||
dotnet publish -c Release -r win-x64 --self-contained false -o build-win ${baseBuild}
|
||||
'';
|
||||
runScript = writeScript "osu-run" ''
|
||||
${buildScript} && dotnet run --no-build -c Debug -f net5.0 -r linux-x64 -p osu.Desktop -v minimal -- $@
|
||||
'';
|
||||
runReleaseScript = writeScript "osu-run-rel" ''
|
||||
${buildReleaseScript} && dotnet run --no-build -c Release -f net5.0 -r linux-x64 -p osu.Desktop -v minimal -- $@
|
||||
'';
|
||||
|
||||
scripts = stdenvNoCC.mkDerivation {
|
||||
pname = "osu-scripts";
|
||||
version = "1.0.0";
|
||||
dontUnpack = true;
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
cp ${fixSdl} $out/osu-fixsdl
|
||||
cp ${buildScript} $out/osu-build
|
||||
cp ${buildReleaseScript} $out/osu-build-rel
|
||||
cp ${publishScript} $out/osu-publish
|
||||
cp ${publishWinScript} $out/osu-publish-win
|
||||
cp ${runScript} $out/osu-run
|
||||
cp ${runReleaseScript} $out/osu-run-rel
|
||||
'';
|
||||
};
|
||||
in mkShell {
|
||||
nativeBuildInputs = [
|
||||
icu
|
||||
|
||||
(with dotnetCorePackages; combinePackages [ sdk_5_0 runtime_5_0 ])
|
||||
];
|
||||
|
||||
DOTNET_CLI_TELEMETRY_OPTOUT = 1;
|
||||
DRI_PRIME = 1;
|
||||
LD_LIBRARY_PATH = lib.makeLibraryPath deps;
|
||||
shellHook = ''
|
||||
export PATH="${scripts}:$PATH"
|
||||
'';
|
||||
}
|
||||
7
shells/default.nix
Normal file
7
shells/default.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{ callPackage, inputs }: {
|
||||
cs = callPackage ./cs {};
|
||||
flutter = callPackage ./flutter {};
|
||||
js = callPackage ./js {};
|
||||
php = callPackage ./php {};
|
||||
rust = callPackage ./rust { inherit inputs; };
|
||||
}
|
||||
53
shells/flutter/default.nix
Normal file
53
shells/flutter/default.nix
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
lib,
|
||||
mkShell,
|
||||
|
||||
flutter,
|
||||
clang,
|
||||
cmake,
|
||||
ninja,
|
||||
pkg-config,
|
||||
|
||||
atk,
|
||||
cairo,
|
||||
gdk-pixbuf,
|
||||
glib,
|
||||
gtk3,
|
||||
harfbuzz,
|
||||
libGL,
|
||||
pango,
|
||||
wayland,
|
||||
xorg,
|
||||
}:
|
||||
let
|
||||
makeIncludePath = lib.makeSearchPathOutput "include" "include";
|
||||
|
||||
includePath = makeIncludePath [
|
||||
xorg.xorgproto
|
||||
xorg.libX11.dev
|
||||
];
|
||||
in mkShell {
|
||||
nativeBuildInputs = [
|
||||
flutter
|
||||
clang
|
||||
cmake
|
||||
ninja
|
||||
pkg-config
|
||||
];
|
||||
|
||||
C_INCLUDE_PATH = includePath;
|
||||
CPLUS_INCLUDE_PATH = includePath;
|
||||
|
||||
LD_LIBRARY_PATH = lib.makeLibraryPath "/lib" [
|
||||
atk
|
||||
cairo
|
||||
gdk-pixbuf
|
||||
glib
|
||||
gtk3
|
||||
harfbuzz
|
||||
libGL
|
||||
pango
|
||||
wayland
|
||||
xorg.libX11
|
||||
];
|
||||
}
|
||||
19
shells/js/default.nix
Normal file
19
shells/js/default.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
mkShell,
|
||||
|
||||
nodejs-16_x,
|
||||
nodePackages,
|
||||
watchman
|
||||
}:
|
||||
mkShell {
|
||||
buildInputs = [
|
||||
nodejs-16_x
|
||||
watchman
|
||||
|
||||
nodePackages.pnpm
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
export PATH="$(readlink -f ./node_modules/.bin):$PATH"
|
||||
'';
|
||||
}
|
||||
16
shells/php/default.nix
Normal file
16
shells/php/default.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
callPackage,
|
||||
mkShell,
|
||||
php80,
|
||||
php80Packages,
|
||||
}:
|
||||
mkShell {
|
||||
buildInputs = [
|
||||
php80
|
||||
php80Packages.composer
|
||||
];
|
||||
|
||||
passthru = {
|
||||
osu-web = callPackage ./osu-web.nix {};
|
||||
};
|
||||
}
|
||||
26
shells/php/osu-web.nix
Normal file
26
shells/php/osu-web.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# Flake for development on https://github.com/ppy/osu-web
|
||||
{
|
||||
mkShell,
|
||||
nodejs-14_x,
|
||||
nodePackages,
|
||||
php80,
|
||||
php80Packages,
|
||||
python3
|
||||
}:
|
||||
let
|
||||
phpPkg = php80.withExtensions ({ enabled, all }:
|
||||
enabled ++ [ all.intl all.redis ]
|
||||
);
|
||||
in mkShell {
|
||||
buildInputs = [
|
||||
nodejs-14_x
|
||||
nodePackages.yarn
|
||||
phpPkg
|
||||
php80Packages.composer
|
||||
python3
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
export PATH="$(readlink -f ./node_modules/.bin):$PATH"
|
||||
'';
|
||||
}
|
||||
25
shells/rust/default.nix
Normal file
25
shells/rust/default.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
inputs,
|
||||
mkShell,
|
||||
|
||||
pkg-config
|
||||
}:
|
||||
let
|
||||
overlays = [ (import inputs.rust-overlay) ];
|
||||
pkgs = import inputs.nixpkgs {
|
||||
inherit system overlays;
|
||||
};
|
||||
|
||||
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain;
|
||||
|
||||
rustPlatform = pkgs.makeRustPlatform {
|
||||
inherit (toolchain) cargo rustc;
|
||||
};
|
||||
in mkShell {
|
||||
nativeBuildInputs = [
|
||||
toolchain
|
||||
pkg-config
|
||||
];
|
||||
|
||||
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue