fix: fix nix build (#24)

* fix: fix nix build

* feat: automatically prefix ANYRUN_PLUGINS with the nix store
This commit is contained in:
Michał
2023-05-02 19:51:46 +02:00
committed by GitHub
parent 9fed55e692
commit 599fc1d44d
4 changed files with 18 additions and 76 deletions

View File

@@ -33,6 +33,7 @@ Here are the libraries you need to have to build & run it:
- `glib2 (libgobject-2.0 libgio-2.0 libglib-2.0)`
## Installation
[![Packaging status](https://repology.org/badge/vertical-allrepos/anyrun.svg)](https://repology.org/project/anyrun/versions)
### Nix
@@ -66,48 +67,6 @@ You can use the flake:
}
```
_Note: The flake does not install the plugins anywhere like /etc/anyrun/plugins.
Make sure to specify full paths to the plugins in your config,
by managing it in Nix/home-manager, and using the full path, like this (in hm):_
```nix
xdg.configFile."anyrun/config.ron".text = ''
Config(
// `width` and `vertical_offset` use an enum for the value it can be either:
// Absolute(n): The absolute value in pixels
// Fraction(n): A fraction of the width or height of the full screen (depends on exclusive zones and the settings related to them) window respectively
// How wide the input box and results are.
width: Absolute(800),
// Where Anyrun is located on the screen: Top, Center
position: Top,
// How much the runner is shifted vertically
vertical_offset: Fraction(0.3),
// Hide match and plugin info icons
hide_icons: false,
// ignore exclusive zones, f.e. Waybar
ignore_exclusive_zones: false,
// Layer shell layer: Background, Bottom, Top, Overlay
layer: Overlay,
// Hide the plugin info panel
hide_plugin_info: true,
// Close window when a click outside the main box is received
close_on_click: false,
plugins: [
"${pkgs.anyrun}/lib/libapplications.so",
],
)
'';
```
### Manual installation
Make sure all of the dependencies are installed, and then run the following commands in order:

View File

@@ -1,10 +1,9 @@
# default.nix
{
lib,
naersk,
glib,
targetPlatform,
makeWrapper,
rustPlatform,
atk,
gtk3,
gtk-layer-shell,
@@ -16,7 +15,7 @@
}: let
cargoToml = builtins.fromTOML (builtins.readFile ./anyrun/Cargo.toml);
in
naersk.lib."${targetPlatform.system}".buildPackage {
rustPlatform.buildRustPackage {
src = ./.;
buildInputs = [
@@ -27,9 +26,18 @@ in
librsvg
gtk-layer-shell
];
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"kidex-common-0.1.0" = "sha256-sPzCTK0gdIYkKWxrtoPJ/F2zrG2ZKHOSmANW2g00fSQ=";
};
};
checkInputs = [cargo rustc];
nativeBuildInputs = [
pkg-config
makeWrapper
rustfmt
rustc
@@ -46,7 +54,8 @@ in
postInstall = ''
wrapProgram $out/bin/anyrun \
--set GDK_PIXBUF_MODULE_FILE "$(echo ${librsvg.out}/lib/gdk-pixbuf-2.0/*/loaders.cache)"
--set GDK_PIXBUF_MODULE_FILE "$(echo ${librsvg.out}/lib/gdk-pixbuf-2.0/*/loaders.cache)" \
--prefix ANYRUN_PLUGINS : $out/lib
'';
meta = with lib; {

27
flake.lock generated
View File

@@ -1,32 +1,12 @@
{
"nodes": {
"naersk": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1679567394,
"narHash": "sha256-ZvLuzPeARDLiQUt6zSZFGOs+HZmE+3g4QURc8mkBsfM=",
"owner": "nmattia",
"repo": "naersk",
"rev": "88cd22380154a2c36799fe8098888f0f59861a15",
"type": "github"
},
"original": {
"owner": "nmattia",
"repo": "naersk",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1682109806,
"narHash": "sha256-d9g7RKNShMLboTWwukM+RObDWWpHKaqTYXB48clBWXI=",
"lastModified": 1682960002,
"narHash": "sha256-5Zjh4pT3lAjFGN1gVrjqj1LLJHKCAlGdLD8raU7oEMc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2362848adf8def2866fabbffc50462e929d7fffb",
"rev": "8670e496ffd093b60e74e7fa53526aa5920d09eb",
"type": "github"
},
"original": {
@@ -38,7 +18,6 @@
},
"root": {
"inputs": {
"naersk": "naersk",
"nixpkgs": "nixpkgs"
}
}

View File

@@ -3,23 +3,18 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
naersk = {
url = "github:nmattia/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
naersk,
}: let
cargoToml = builtins.fromTOML (builtins.readFile ./anyrun/Cargo.toml);
supportedSystems = ["x86_64-linux" "aarch64-linux"];
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
in {
overlay = final: prev: {
"${cargoToml.package.name}" = final.callPackage ./. {inherit naersk;};
"${cargoToml.package.name}" = final.callPackage ./. {};
};
packages = forAllSystems (system: let