mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-05-17 06:23:50 +02:00
various nix fixes + minecraft dev shell
This commit is contained in:
parent
869b7fe7f6
commit
bbabdab552
|
@ -24,7 +24,10 @@ cg.onDone(function(errors)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local nix = (loadfile "cgnix/nix.lua" or function() return {} end)()
|
local nix = (loadfile "nix/cgnix/nix.lua" or function()
|
||||||
|
print "no cgnix file!"
|
||||||
|
return {}
|
||||||
|
end)()
|
||||||
|
|
||||||
cg.opt.nix = nix
|
cg.opt.nix = nix
|
||||||
|
|
||||||
|
|
63
flake.nix
63
flake.nix
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
root-mod = {
|
root-mod = {
|
||||||
options.packages = nixpkgs.lib.mkOption { };
|
options.packages = nixpkgs.lib.mkOption { };
|
||||||
|
options.dev-shells = nixpkgs.lib.mkOption { };
|
||||||
|
|
||||||
config._module.args = {
|
config._module.args = {
|
||||||
inherit pkgs system;
|
inherit pkgs system;
|
||||||
|
@ -32,44 +33,46 @@
|
||||||
(flakePkg "github:nix-community/zon2nix")
|
(flakePkg "github:nix-community/zon2nix")
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# devshell for the dotfiles
|
||||||
|
config.dev-shells.default = nixpkgs.legacyPackages.${system}.mkShell {
|
||||||
|
buildInputs = with pkgs;
|
||||||
|
[
|
||||||
|
# packages required to build scripts
|
||||||
|
libGL
|
||||||
|
libgit2
|
||||||
|
luajit
|
||||||
|
pkg-config
|
||||||
|
racket
|
||||||
|
roswell
|
||||||
|
wayland
|
||||||
|
wayland-protocols
|
||||||
|
haxe
|
||||||
|
mpv-unwrapped
|
||||||
|
] ++
|
||||||
|
# shorthands for setup.rkt
|
||||||
|
builtins.map
|
||||||
|
(cmd: pkgs.writeShellScriptBin cmd ''
|
||||||
|
./setup.rkt ${cmd}
|
||||||
|
'') [
|
||||||
|
"install-scripts"
|
||||||
|
"install-plugins"
|
||||||
|
"install-lsps-paru"
|
||||||
|
"setup-nvim-config"
|
||||||
|
"setup-nix"
|
||||||
|
"run-confgen"
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
modopt = nixpkgs.lib.evalModules {
|
modopt = nixpkgs.lib.evalModules {
|
||||||
modules = [ root-mod ./cgnix ] ++ common.localconf;
|
modules = [ root-mod ./nix ] ++ common.localconf;
|
||||||
specialArgs = { inherit common; };
|
specialArgs = { inherit common; };
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
mzteinit = pkgs.callPackage ./scripts/mzteinit/package.nix { };
|
mzteinit = pkgs.callPackage ./scripts/mzteinit/package.nix { };
|
||||||
packages = modopt.config.packages;
|
packages = modopt.config.packages;
|
||||||
|
devShells = modopt.config.dev-shells;
|
||||||
devShells.default = nixpkgs.legacyPackages.${system}.mkShell {
|
|
||||||
buildInputs = with pkgs;
|
|
||||||
[
|
|
||||||
# packages required to build scripts
|
|
||||||
libGL
|
|
||||||
libgit2
|
|
||||||
luajit
|
|
||||||
pkg-config
|
|
||||||
racket
|
|
||||||
roswell
|
|
||||||
wayland
|
|
||||||
wayland-protocols
|
|
||||||
haxe
|
|
||||||
mpv-unwrapped
|
|
||||||
] ++
|
|
||||||
# shorthands for setup.rkt
|
|
||||||
builtins.map
|
|
||||||
(cmd: pkgs.writeShellScriptBin cmd ''
|
|
||||||
./setup.rkt ${cmd}
|
|
||||||
'') [
|
|
||||||
"install-scripts"
|
|
||||||
"install-plugins"
|
|
||||||
"install-lsps-paru"
|
|
||||||
"setup-nvim-config"
|
|
||||||
"setup-nix"
|
|
||||||
"run-confgen"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
0
cgnix/.gitignore → nix/cgnix/.gitignore
vendored
0
cgnix/.gitignore → nix/cgnix/.gitignore
vendored
4
nix/default.nix
Normal file
4
nix/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
imports = [ ./cgnix ./mcdev.nix ];
|
||||||
|
}
|
37
nix/mcdev.nix
Normal file
37
nix/mcdev.nix
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
# A dev shell for Minecraft development, including necessary dependencies for the game to run.
|
||||||
|
|
||||||
|
{ pkgs, ... }:
|
||||||
|
let
|
||||||
|
libs = with pkgs; [
|
||||||
|
libpulseaudio
|
||||||
|
libGL
|
||||||
|
glfw
|
||||||
|
openal
|
||||||
|
stdenv.cc.cc.lib
|
||||||
|
udev # OSHI
|
||||||
|
];
|
||||||
|
xorg-libs = with pkgs.xorg; [
|
||||||
|
libX11
|
||||||
|
libXext
|
||||||
|
libXcursor
|
||||||
|
libXrandr
|
||||||
|
libXxf86vm
|
||||||
|
];
|
||||||
|
in
|
||||||
|
{
|
||||||
|
dev-shells = builtins.mapAttrs
|
||||||
|
(_: extra-pkgs:
|
||||||
|
let
|
||||||
|
shpgks = libs ++ xorg-libs ++ extra-pkgs;
|
||||||
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
shellHook = ''
|
||||||
|
export LD_LIBRARY_PATH="${pkgs.addOpenGLRunpath.driverLink}/lib:${pkgs.lib.makeLibraryPath shpgks}:$LD_LIBRARY_PATH"
|
||||||
|
'';
|
||||||
|
buildInputs = shpgks;
|
||||||
|
})
|
||||||
|
{
|
||||||
|
mcdev = [ pkgs.jdk8 ];
|
||||||
|
mcdev-new = [ pkgs.jdk17 ];
|
||||||
|
};
|
||||||
|
}
|
|
@ -19,22 +19,24 @@ pub fn main() !u8 {
|
||||||
var env = try std.process.getEnvMap(alloc);
|
var env = try std.process.getEnvMap(alloc);
|
||||||
defer env.deinit();
|
defer env.deinit();
|
||||||
|
|
||||||
|
const jvm_basepath = opts.jvm orelse "/usr/lib/jvm";
|
||||||
|
|
||||||
if (env.getPtr("PATH")) |path_p| {
|
if (env.getPtr("PATH")) |path_p| {
|
||||||
const newpath = try std.fmt.allocPrint(
|
const newpath = try std.fmt.allocPrint(
|
||||||
alloc,
|
alloc,
|
||||||
(opts.jvm orelse "/usr/lib/jvm") ++ "/{s}/bin:{s}",
|
jvm_basepath ++ "/{s}/bin:{s}",
|
||||||
.{ std.os.argv[1], path_p.* },
|
.{ std.os.argv[1], path_p.* },
|
||||||
);
|
);
|
||||||
alloc.free(path_p.*);
|
alloc.free(path_p.*);
|
||||||
path_p.* = newpath;
|
path_p.* = newpath;
|
||||||
} else {
|
} else {
|
||||||
const newpath = try std.fmt.allocPrint(alloc, "/usr/lib/jvm/{s}/bin", .{std.os.argv[1]});
|
const newpath = try std.fmt.allocPrint(alloc, jvm_basepath ++ "/{s}/bin", .{std.os.argv[1]});
|
||||||
errdefer alloc.free(newpath);
|
errdefer alloc.free(newpath);
|
||||||
try env.putMove(try alloc.dupe(u8, "PATH"), newpath);
|
try env.putMove(try alloc.dupe(u8, "PATH"), newpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const java_home = try std.fmt.allocPrint(alloc, "/usr/lib/jvm/{s}", .{std.os.argv[1]});
|
const java_home = try std.fmt.allocPrint(alloc, jvm_basepath ++ "/{s}", .{std.os.argv[1]});
|
||||||
errdefer alloc.free(java_home);
|
errdefer alloc.free(java_home);
|
||||||
try env.putMove(try alloc.dupe(u8, "JAVA_HOME"), java_home);
|
try env.putMove(try alloc.dupe(u8, "JAVA_HOME"), java_home);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,4 +5,4 @@
|
||||||
(define (run)
|
(define (run)
|
||||||
(define out (build-path (find-system-path 'home-dir) ".local" "mzte-nix"))
|
(define out (build-path (find-system-path 'home-dir) ".local" "mzte-nix"))
|
||||||
(cmd "nix" "build" ".#mzte-nix" "--impure" "--out-link" out)
|
(cmd "nix" "build" ".#mzte-nix" "--impure" "--out-link" out)
|
||||||
(cmd "nix" "build" ".#cgnix" "--impure" "--out-link" "cgnix/nix.lua"))
|
(cmd "nix" "build" ".#cgnix" "--impure" "--out-link" "nix/cgnix/nix.lua"))
|
||||||
|
|
Loading…
Reference in a new issue