simple-osd-daemons/flake.nix

75 lines
2.7 KiB
Nix
Raw Permalink Normal View History

2020-09-14 02:35:24 +04:00
# This is free and unencumbered software released into the public domain.
# balsoft 2020
2020-09-13 21:26:46 +04:00
{
2020-09-21 02:48:51 +04:00
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
crate2nix = {
2020-12-24 17:10:02 +04:00
url = "github:balsoft/crate2nix/tools-nix-version-comparison";
2020-09-21 02:48:51 +04:00
flake = false;
};
};
2020-09-13 21:26:46 +04:00
description = "A collection of simple on-screen-display daemons";
2020-10-25 16:32:38 +04:00
outputs = { self, nixpkgs, crate2nix }:
2020-09-13 21:26:46 +04:00
let forAllSystems = f: builtins.mapAttrs (_: f) nixpkgs.legacyPackages;
in {
packages = forAllSystems (pkgs:
let
commonDeps = with pkgs; [ libnotify gdk_pixbuf glib ];
2020-10-25 16:32:38 +04:00
inherit (import "${crate2nix}/tools.nix" { inherit pkgs; })
generatedCargoNix;
2020-09-21 02:48:51 +04:00
2020-10-25 16:32:38 +04:00
project = pkgs.callPackage (generatedCargoNix {
name = "simple-osd-daemons";
src = ./.;
}) {
2020-09-21 20:05:28 +04:00
defaultCrateOverrides = pkgs.defaultCrateOverrides // {
2020-09-18 13:17:59 +04:00
simple-osd-battery = oa: { buildInputs = commonDeps; };
2020-09-13 21:26:46 +04:00
simple-osd-bluetooth = oa: {
2020-09-18 13:17:59 +04:00
buildInputs = commonDeps
++ [ pkgs.dbus_tools.lib pkgs.dbus_tools.dev ];
2020-09-13 21:26:46 +04:00
nativeBuildInputs = [ pkgs.pkg-config ];
};
2020-09-18 13:17:59 +04:00
simple-osd-brightness = oa: { buildInputs = commonDeps; };
2020-09-13 21:26:46 +04:00
# See https://github.com/kolloch/crate2nix/issues/149
libpulse-binding = oa: {
preBuild = "sed s/pulse::libpulse.so.0/pulse/ -i target/*link*";
};
simple-osd-pulseaudio = oa: {
buildInputs = commonDeps ++ [ pkgs.libpulseaudio ];
nativeBuildInputs = [ pkgs.pkg-config ];
preBuild = "sed s/pulse::libpulse.so.0/pulse/ -i target/*link*";
};
2020-09-18 13:17:59 +04:00
simple-osd-mpris = oa: {
buildInputs = commonDeps ++ [ pkgs.libpulseaudio ];
preBuild = "sed s/pulse::libpulse.so.0/pulse/ -i target/*link*";
};
2020-09-13 21:26:46 +04:00
};
};
2020-09-18 13:17:59 +04:00
membersList = builtins.attrValues (builtins.mapAttrs (name: member: {
name = pkgs.lib.removePrefix "simple-osd-" name;
value = member.build;
}) project.workspaceMembers);
2020-09-13 21:26:46 +04:00
in builtins.listToAttrs membersList);
apps = builtins.mapAttrs (_:
builtins.mapAttrs (_: pkg: {
type = "app";
program = "${pkg}/bin/${pkg.pname}";
})) self.packages;
defaultPackage = builtins.mapAttrs (system: pkgs:
pkgs.buildEnv {
name = "simple-osd-daemons";
paths = builtins.attrValues self.packages.${system};
}) nixpkgs.legacyPackages;
2020-09-18 13:17:59 +04:00
devShell = builtins.mapAttrs (system: pkgs:
pkgs.mkShell {
inputsFrom = builtins.attrValues self.packages.${system};
}) nixpkgs.legacyPackages;
2020-09-13 21:26:46 +04:00
};
}