mirror of
https://github.com/hyprwm/hyprsysteminfo.git
synced 2024-11-24 17:15:58 +01:00
nix: fix package and add devshell
This commit is contained in:
parent
00beba904f
commit
707a315cd8
4 changed files with 45 additions and 20 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -34,5 +34,10 @@
|
||||||
.vscode/
|
.vscode/
|
||||||
.cache/
|
.cache/
|
||||||
build/
|
build/
|
||||||
|
/result
|
||||||
|
|
||||||
|
# direnv
|
||||||
|
/.direnv
|
||||||
|
/.envrc
|
||||||
|
|
||||||
compile_commands.json
|
compile_commands.json
|
||||||
|
|
11
flake.nix
11
flake.nix
|
@ -36,14 +36,9 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
devShells = eachSystem (system: {
|
devShells = eachSystem (system: {
|
||||||
default = pkgsFor.${system}.mkShell {
|
default = import ./nix/shell.nix {
|
||||||
inputsFrom = [self.packages.${system}.hyprsysteminfo];
|
pkgs = pkgsFor.${system};
|
||||||
|
inherit (pkgsFor.${system}) hyprsysteminfo;
|
||||||
shellHook = ''
|
|
||||||
# Generate compile_commands.json
|
|
||||||
CMAKE_EXPORT_COMPILE_COMMANDS=1 cmake -S . -B ./build
|
|
||||||
ln -s build/compile_commands.json .
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,28 +1,23 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
|
nix-gitignore,
|
||||||
stdenv,
|
stdenv,
|
||||||
|
|
||||||
cmake,
|
cmake,
|
||||||
kdePackages,
|
|
||||||
pciutils,
|
|
||||||
qt6,
|
qt6,
|
||||||
pkg-config,
|
pkg-config,
|
||||||
hyprutils,
|
hyprutils,
|
||||||
|
pciutils,
|
||||||
|
kdePackages,
|
||||||
version ? "0",
|
version ? "0",
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.sources) cleanSource cleanSourceWith;
|
inherit (lib.strings) makeBinPath;
|
||||||
inherit (lib.strings) hasSuffix makeBinPath;
|
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
pname = "hyprsysteminfo";
|
pname = "hyprsysteminfo";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
src = cleanSourceWith {
|
src = nix-gitignore.gitignoreSource [] ./..;
|
||||||
filter = name: _type: let
|
|
||||||
baseName = baseNameOf (toString name);
|
|
||||||
in
|
|
||||||
! (hasSuffix ".nix" baseName);
|
|
||||||
src = cleanSource ../.;
|
|
||||||
};
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
cmake
|
cmake
|
||||||
|
@ -31,11 +26,13 @@ in
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
kdePackages.kirigami-addons
|
|
||||||
qt6.qtbase
|
qt6.qtbase
|
||||||
|
qt6.qtdeclarative
|
||||||
qt6.qtsvg
|
qt6.qtsvg
|
||||||
qt6.qtwayland
|
qt6.qtwayland
|
||||||
hyprutils
|
hyprutils
|
||||||
|
kdePackages.qqc2-desktop-style
|
||||||
|
kdePackages.kirigami
|
||||||
];
|
];
|
||||||
|
|
||||||
preFixup = ''
|
preFixup = ''
|
||||||
|
|
28
nix/shell.nix
Normal file
28
nix/shell.nix
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
{
|
||||||
|
pkgs ? import <nixpkgs> {},
|
||||||
|
hyprsysteminfo ? pkgs.callPackage ./default.nix {},
|
||||||
|
...
|
||||||
|
}: pkgs.mkShell {
|
||||||
|
inputsFrom = [ hyprsysteminfo ];
|
||||||
|
nativeBuildInputs = [ pkgs.clang-tools pkgs.pciutils ];
|
||||||
|
|
||||||
|
shellHook = let
|
||||||
|
inherit (pkgs.lib.strings) concatMapStringsSep;
|
||||||
|
qtLibPath = f: concatMapStringsSep ":" f (with pkgs.qt6; [
|
||||||
|
qtbase
|
||||||
|
qtdeclarative
|
||||||
|
qtwayland
|
||||||
|
pkgs.kdePackages.qqc2-desktop-style
|
||||||
|
# see https://github.com/NixOS/nixpkgs/blob/e186dd1a34be7a76c6e2c038ab4b759faec32d5d/pkgs/kde/frameworks/kirigami/default.nix#L9-L11
|
||||||
|
pkgs.kdePackages.kirigami.unwrapped
|
||||||
|
]);
|
||||||
|
in ''
|
||||||
|
# Add Qt-related environment variables.
|
||||||
|
export QT_PLUGIN_PATH=${qtLibPath (p: "${p}/lib/qt-6/plugins")}
|
||||||
|
export QML2_IMPORT_PATH=${qtLibPath (p: "${p}/lib/qt-6/qml")}
|
||||||
|
|
||||||
|
# Generate compile_commands.json
|
||||||
|
CMAKE_EXPORT_COMPILE_COMMANDS=1 cmake -S . -B ./build
|
||||||
|
ln -s build/compile_commands.json .
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in a new issue