mirror of
https://github.com/imgurbot12/rmenu.git
synced 2025-01-27 05:18:33 +01:00
update nix tooling
This commit is contained in:
parent
b6ce0ccb52
commit
179418dece
3 changed files with 72 additions and 4 deletions
48
flake.nix
48
flake.nix
|
@ -17,12 +17,51 @@
|
|||
in {
|
||||
devShells = forAllSystems (system: let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
overrides = (builtins.fromTOML (builtins.readFile ./rust-toolchain.toml));
|
||||
libPath = with pkgs; lib.makeLibraryPath [
|
||||
# load external libraries that you need in your rust project here
|
||||
glib
|
||||
gtk3
|
||||
libsoup_3
|
||||
networkmanager
|
||||
webkitgtk_4_1
|
||||
];
|
||||
in {
|
||||
default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
llvmPackages.bintools
|
||||
rustup
|
||||
];
|
||||
RUSTC_VERSION = overrides.toolchain.channel;
|
||||
# https://github.com/rust-lang/rust-bindgen#environment-variables
|
||||
LIBCLANG_PATH = pkgs.lib.makeLibraryPath [ pkgs.llvmPackages_latest.libclang.lib ];
|
||||
shellHook = ''
|
||||
export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/bin
|
||||
export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/
|
||||
'';
|
||||
|
||||
# Add precompiled library to rustc search path
|
||||
RUSTFLAGS = (builtins.map (a: ''-L ${a}/lib'') [
|
||||
# add libraries here (e.g. pkgs.libvmi)
|
||||
]);
|
||||
LD_LIBRARY_PATH = libPath;
|
||||
# Add glibc, clang, glib, and other headers to bindgen search path
|
||||
BINDGEN_EXTRA_CLANG_ARGS =
|
||||
# Includes normal include path
|
||||
(builtins.map (a: ''-I"${a}/include"'') [
|
||||
# add dev libraries here (e.g. pkgs.libvmi.dev)
|
||||
pkgs.glibc.dev
|
||||
])
|
||||
# Includes with special directory paths
|
||||
++ [
|
||||
''-I"${pkgs.llvmPackages_latest.libclang.lib}/lib/clang/${pkgs.llvmPackages_latest.libclang.version}/include"''
|
||||
''-I"${pkgs.glib.dev}/include/glib-2.0"''
|
||||
''-I${pkgs.glib.out}/lib/glib-2.0/include/''
|
||||
];
|
||||
packages = with pkgs; [
|
||||
# base toolchain
|
||||
pkg-config
|
||||
cargo
|
||||
rustup
|
||||
|
||||
# runtime deps
|
||||
glib
|
||||
|
@ -48,6 +87,13 @@
|
|||
rmenu = rmenu-pkg;
|
||||
default = rmenu-pkg;
|
||||
});
|
||||
|
||||
nixosModules = let
|
||||
rmenu-module = (import ./nix/rmenu.nix);
|
||||
in {
|
||||
rmenu = rmenu-module;
|
||||
default = rmenu-module;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{ cargo
|
||||
, fetchFromGitHub
|
||||
, glib
|
||||
, gnused
|
||||
, gtk3
|
||||
, lib
|
||||
, libsoup_3
|
||||
|
@ -47,21 +48,34 @@ rustPlatform.buildRustPackage rec {
|
|||
libsoup_3
|
||||
networkmanager
|
||||
webkitgtk_4_1
|
||||
gnused
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
# copy themes and plugins
|
||||
mkdir $out/themes
|
||||
mkdir $out/plugins
|
||||
cp -vfr $src/themes/* $out/themes/.
|
||||
cp -vfr $src/other-plugins/* $out/plugins/.
|
||||
mv $out/bin/* $out/plugins # everything is a plugin by default
|
||||
|
||||
# rmenu and rmenu-build are actual binaries
|
||||
mv $out/plugins/rmenu $out/bin/rmenu
|
||||
mv $out/plugins/rmenu-build $out/bin/rmenu-build
|
||||
|
||||
mkdir -p $out/etc/rmenu
|
||||
cp -vf $src/rmenu/public/config.yaml $out/etc/rmenu/config.yaml
|
||||
ln -sf $out/themes/dark.css $out/etc/rmenu/style.css
|
||||
# fix plugin names
|
||||
# desktop network pactl-audio.sh powermenu.sh run window
|
||||
mv $out/plugins/run $out/plugins/rmenu-run
|
||||
mv $out/plugins/desktop $out/plugins/rmenu-desktop
|
||||
mv $out/plugins/network $out/plugins/rmenu-network
|
||||
mv $out/plugins/window $out/plugins/rmenu-window
|
||||
|
||||
# fix config and theme
|
||||
mkdir -p $out/etc/xdg/rmenu
|
||||
cp -vf $src/rmenu/public/config.yaml $out/etc/xdg/rmenu/config.yaml
|
||||
sed -i "s@~\/\.config\/rmenu\/themes@$out\/themes@g" $out/etc/xdg/rmenu/config.yaml
|
||||
sed -i "s@~\/\.config\/rmenu@$out\/plugins@g" $out/etc/xdg/rmenu/config.yaml
|
||||
ln -sf $out/themes/dark.css $out/etc/xdg/rmenu/style.css
|
||||
'';
|
||||
|
||||
doCheck = true;
|
||||
|
|
8
nix/rmenu.nix
Normal file
8
nix/rmenu.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{ lib, pkgs, ... }:
|
||||
let
|
||||
rmenu-pkg = pkgs.callPackage ./package.nix {};
|
||||
in {
|
||||
config.environment.systemPackages = [ rmenu-pkg ];
|
||||
|
||||
meta.maintainers = with lib.maintainers; [ grimmauld ];
|
||||
}
|
Loading…
Reference in a new issue