Skip to content

Commit

Permalink
nix: remove further bad patterns; use mesonBool; add hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
NotAShelf committed Jul 18, 2024
1 parent 3371cca commit 0486c30
Showing 1 changed file with 89 additions and 84 deletions.
173 changes: 89 additions & 84 deletions nix/default.nix
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
{ lib
, stdenv
, buildNpmPackage
, fetchFromGitLab
, nodePackages
, meson
, pkg-config
, ninja
, gobject-introspection
, gtk3
, libpulseaudio
, gjs
, wrapGAppsHook
, upower
, gnome
, gtk-layer-shell
, glib-networking
, networkmanager
, libdbusmenu-gtk3
, gvfs
, libsoup_3
, libnotify
, pam
, extraPackages ? [ ]
, version ? "git"
, buildTypes ? true
}:
{
lib,
stdenv,
buildNpmPackage,
fetchFromGitLab,
nodePackages,
meson,
pkg-config,
ninja,
gobject-introspection,
gtk3,
libpulseaudio,
gjs,
wrapGAppsHook,
upower,
gnome,
gtk-layer-shell,
glib-networking,
networkmanager,
libdbusmenu-gtk3,
gvfs,
libsoup_3,
libnotify,
pam,
extraPackages ? [],
version ? "git",
buildTypes ? true,
}: let
pname = "ags";

let
gvc-src = fetchFromGitLab {
domain = "gitlab.gnome.org";
owner = "GNOME";
Expand All @@ -35,70 +36,74 @@ let
sha256 = "sha256-FosJwgTCp6/EI6WVbJhPisokRBA6oT0eo7d+Ya7fFX8=";
};
in
stdenv.mkDerivation rec {
pname = "ags";
inherit version;
stdenv.mkDerivation {
inherit pname version;

src = buildNpmPackage {
name = pname;
src = lib.cleanSource ../.;
src = buildNpmPackage {
name = pname;
src = lib.cleanSource ../.;

dontBuild = true;
dontBuild = true;

npmDepsHash = "sha256-ucWdADdMqAdLXQYKGOXHNRNM9bhjKX4vkMcQ8q/GZ20=";
npmDepsHash = "sha256-ucWdADdMqAdLXQYKGOXHNRNM9bhjKX4vkMcQ8q/GZ20=";

installPhase = ''
mkdir $out
cp -r * $out
'';
};
installPhase = ''
runHook preInstall
mkdir $out
cp -r * $out
runHook postInstall
'';
};

mesonFlags = [
"-Dbuild_types=${if buildTypes then "true" else "false"}"
];
nativeBuildInputs = [
pkg-config
meson
ninja
nodePackages.typescript
wrapGAppsHook
gobject-introspection
];

prePatch = ''
mkdir -p ./subprojects/gvc
cp -r ${gvc-src}/* ./subprojects/gvc
'';
buildInputs =
[
gjs
gtk3
libpulseaudio
upower
gnome.gnome-bluetooth
gtk-layer-shell
glib-networking
networkmanager
libdbusmenu-gtk3
gvfs
libsoup_3
libnotify
pam
]
++ extraPackages;

postPatch = ''
chmod +x post_install.sh
patchShebangs post_install.sh
'';
mesonFlags = [
(lib.mesonBool "build_types" buildTypes)
];

nativeBuildInputs = [
pkg-config
meson
ninja
nodePackages.typescript
wrapGAppsHook
gobject-introspection
];
prePatch = ''
mkdir -p ./subprojects/gvc
cp -r ${gvc-src}/* ./subprojects/gvc
'';

buildInputs = [
gjs
gtk3
libpulseaudio
upower
gnome.gnome-bluetooth
gtk-layer-shell
glib-networking
networkmanager
libdbusmenu-gtk3
gvfs
libsoup_3
libnotify
pam
] ++ extraPackages;
postPatch = ''
chmod +x post_install.sh
patchShebangs post_install.sh
'';

outputs = [ "out" "lib" ];
outputs = ["out" "lib"];

meta = with lib; {
description = "A customizable and extensible shell";
homepage = "https://github.com/Aylur/ags";
platforms = [ "x86_64-linux" "aarch64-linux" ];
license = licenses.gpl3;
meta.maintainers = [ lib.maintainers.Aylur ];
};
}
meta = {
description = "A customizable and extensible shell";
homepage = "https://github.com/Aylur/ags";
changelog = "https://github.com/Aylur/ags/blob/${version}/CHANGELOG.md";
platforms = ["x86_64-linux" "aarch64-linux"];
license = lib.licenses.gpl3;
meta.maintainers = [lib.maintainers.Aylur];
};
}

0 comments on commit 0486c30

Please sign in to comment.