nix: cleanup

This commit is contained in:
Aylur
2024-09-04 23:22:10 +02:00
parent 6299b0aa61
commit 3f8ed341bc
2 changed files with 67 additions and 52 deletions
+47 -31
View File
@@ -1,31 +1,45 @@
{
self,
pkgs,
astal,
}: let
toTOML = (pkgs.formats.toml {}).generate;
gen = pkg: name: out: toml: ''
mkdir -p $out/${out}
gi-docgen generate -C ${toTOML name toml} ${astal.${pkg}.dev}/share/gir-1.0/${name}-0.1.gir
cp -r ${name}-0.1/* $out/${out}
genRefForPkg = {
name,
pkg,
outPath,
metaData,
}: let
data = toTOML name metaData;
output = self.packages.${pkgs.system}.${pkg}.dev;
in ''
mkdir -p $out/${outPath}
gi-docgen generate -C ${data} ${output}/share/gir-1.0/${name}-0.1.gir
cp -r ${name}-0.1/* $out/${outPath}
'';
lib = name: namespace: description: {
genLib = name: namespace: description: {
authors ? "Aylur",
dependencies ? {},
out ? "libastal/${name}",
}:
gen name "Astal${namespace}" out {
library = {
inherit description authors;
license = "LGPL-2.1";
browse_url = "https://github.com/Aylur/Astal";
repository_url = "https://github.com/Aylur/Aylur.git";
website_url = "https://aylur.github.io/astal";
};
dependencies = {
inherit (dependency) "GObject-2.0";
inherit dependencies;
genRefForPkg {
name = "Astal${namespace}";
pkg = name;
outPath = out;
metaData = {
library = {
inherit description authors;
license = "LGPL-2.1";
browse_url = "https://github.com/Aylur/Astal";
repository_url = "https://github.com/Aylur/Aylur.git";
website_url = "https://aylur.github.io/astal";
};
dependencies = {
inherit (dependency) "GObject-2.0";
inherit dependencies;
};
};
};
@@ -37,7 +51,7 @@
};
};
in
pkgs.stdenv.mkDerivation {
pkgs.stdenvNoCC.mkDerivation {
nativeBuildInputs = with pkgs; [
gi-docgen
glib
@@ -54,18 +68,20 @@ in
src = ./.;
installPhase = ''
${lib "astal" "" "Astal core library" {out = "libastal";}}
${lib "apps" "Apps" "Application query library" {}}
${lib "auth" "Auth" "Authentication using pam" {authors = "kotontrion";}}
${lib "battery" "Battery" "DBus proxy for upowerd devices" {}}
${lib "bluetooth" "Bluetooth" "DBus proxy for bluez" {}}
${lib "hyprland" "Hyprland" "IPC client for Hyprland" {}}
${lib "mpris" "Mpris" "Control mpris players" {}}
${lib "network" "Network" "NetworkManager wrapper library" {}}
${lib "notifd" "Notifd" "Notification daemon library" {}}
${lib "powerprofiles" "PowerProfiles" "DBus proxy for upowerd profiles" {}}
${lib "river" "River" "IPC client for River" {authors = "kotontrion";}}
${lib "tray" "Tray" "StatusNotifierItem implementation" {authors = "kotontrion";}}
${lib "wireplumber" "Wp" "Wrapper library over the wireplumber API" {authors = "kotontrion";}}
runHook preInstall
${genLib "astal" "" "Astal core library" {out = "libastal";}}
${genLib "apps" "Apps" "Application query library" {}}
${genLib "auth" "Auth" "Authentication using pam" {authors = "kotontrion";}}
${genLib "battery" "Battery" "DBus proxy for upowerd devices" {}}
${genLib "bluetooth" "Bluetooth" "DBus proxy for bluez" {}}
${genLib "hyprland" "Hyprland" "IPC client for Hyprland" {}}
${genLib "mpris" "Mpris" "Control mpris players" {}}
${genLib "network" "Network" "NetworkManager wrapper library" {}}
${genLib "notifd" "Notifd" "Notification daemon library" {}}
${genLib "powerprofiles" "PowerProfiles" "DBus proxy for upowerd profiles" {}}
${genLib "river" "River" "IPC client for River" {authors = "kotontrion";}}
${genLib "tray" "Tray" "StatusNotifierItem implementation" {authors = "kotontrion";}}
${genLib "wireplumber" "Wp" "Wrapper library over the wireplumber API" {authors = "kotontrion";}}
runHook postInstall
'';
}
+20 -21
View File
@@ -5,11 +5,13 @@
self,
nixpkgs,
}: let
version = builtins.replaceStrings ["\n"] [""] (builtins.readFile ./version);
inherit (builtins) replaceStrings readFile;
version = replaceStrings ["\n"] [""] (readFile ./version);
system = "x86_64-linux";
pkgs = import nixpkgs {inherit system;};
lib = name: src: inputs:
mkPkg = name: src: inputs:
pkgs.stdenv.mkDerivation {
nativeBuildInputs = with pkgs; [
wrapGAppsHook
@@ -27,26 +29,23 @@
outputs = ["out" "dev"];
};
in {
packages.${system} = rec {
default = astal;
docs = import ./docs {
inherit pkgs;
astal = self.packages.${system};
};
packages.${system} = with pkgs; {
docs = import ./docs {inherit self pkgs;};
default = self.packages.${system}.astal;
astal = with pkgs; lib "astal" ./core [gtk3 gtk-layer-shell];
apps = with pkgs; lib "astal-apps" ./lib/apps [json-glib];
auth = with pkgs; lib "astal-auth" ./lib/auth [pam];
battery = lib "astal-battery" ./lib/battery [];
bluetooth = lib "astal-bluetooth" ./lib/bluetooth [];
hyprland = with pkgs; lib "astal-hyprland" ./lib/hyprland [json-glib];
mpris = with pkgs; lib "astal-mpris" ./lib/mpris [gvfs json-glib];
network = with pkgs; lib "astal-network" ./lib/network [networkmanager];
notifd = with pkgs; lib "astal-notifd" ./lib/notifd [json-glib gdk-pixbuf];
powerprofiles = with pkgs; lib "astal-power-profiles" ./lib/powerprofiles [json-glib];
river = with pkgs; lib "astal-river" ./lib/river [json-glib];
tray = with pkgs; lib "astal-tray" ./lib/tray [gtk3 gdk-pixbuf libdbusmenu-gtk3 json-glib];
wireplumber = lib "astal-wireplumber" ./lib/wireplumber [pkgs.wireplumber];
astal = mkPkg "astal" ./core [gtk3 gtk-layer-shell];
apps = mkPkg "astal-apps" ./lib/apps [json-glib];
auth = mkPkg "astal-auth" ./lib/auth [pam];
battery = mkPkg "astal-battery" ./lib/battery [];
bluetooth = mkPkg "astal-bluetooth" ./lib/bluetooth [];
hyprland = mkPkg "astal-hyprland" ./lib/hyprland [json-glib];
mpris = mkPkg "astal-mpris" ./lib/mpris [gvfs json-glib];
network = mkPkg "astal-network" ./lib/network [networkmanager];
notifd = mkPkg "astal-notifd" ./lib/notifd [json-glib gdk-pixbuf];
powerprofiles = mkPkg "astal-power-profiles" ./lib/powerprofiles [json-glib];
river = mkPkg "astal-river" ./lib/river [json-glib];
tray = mkPkg "astal-tray" ./lib/tray [gtk3 gdk-pixbuf libdbusmenu-gtk3 json-glib];
wireplumber = mkPkg "astal-wireplumber" ./lib/wireplumber [wireplumber];
};
devShells.${system} = let