feat: add nix flake

This commit is contained in:
Jappie3 2024-06-28 13:40:54 +02:00
commit e0eca77670
No known key found for this signature in database
5 changed files with 337 additions and 0 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
compile_commands.json
out
.cache
result

View file

@ -40,6 +40,9 @@ If anything here sounds interesting to you, don't hesitate to contribute.
Please note that this plugin was created more or less as a joke. I mainly wanted to see how using a rotating or tilted cursor was like. So I will not guarantee any future updates and bugfixes. The only useful feature, shake to find, was implemented more or less as an afterthought.
## installation
### hyprpm
Installation is supported via `hyprpm`. Supported hyprland versions are `v0.41.2` and upwards. The main branch generally tries to target `-git`.
```sh
@ -49,6 +52,40 @@ hyprpm enable dynamic-cursors
Compatibility with other plugins is not guaranteed. It probably should work with most plugins, unless they also change your cursor's behaviour. It will however work with any cursor theme.
### NixOS
Add this flake to your inputs, note that using a mismatched/unsupported Hyprland release will fail to build or load the plugin:
```nix
inputs = {
hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; # follows development branch of hyprland
hypr-dynamic-cursors = {
url = "github:VirtCode/hypr-dynamic-cursors";
inputs.hyprland.follows = "hyprland"; # to make sure that the plugin is built for the correct version of hyprland
};
};
```
Then, in your home-manager config, add the plugin:
```nix
wayland.windowManager.hyprland = {
enable = true;
plugins = [ inputs.hypr-dynamic-cursors.packages.${pkgs.system}.hypr-dynamic-cursors ];
};
```
or add it like this:
```nix
wayland.windowManager.hyprland = {
enable = true;
extraConfig = ''
plugin = ${inputs.hypr-dynamic-cursors.packages.${pkgs.system}.hypr-dynamic-cursors}/lib/libhypr-dynamic-cursors.so
'';
};
```
## configuration
This plugin can be configured in its dedicated configuration section (`plugin:dynamic-cursors`). The default values are shown below.
```ini

250
flake.lock generated Normal file
View file

@ -0,0 +1,250 @@
{
"nodes": {
"hyprcursor": {
"inputs": {
"hyprlang": [
"hyprland",
"hyprlang"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1718450675,
"narHash": "sha256-jpsns6buS4bK+1sF8sL8AaixAiCRjA+nldTKvcwmvUs=",
"owner": "hyprwm",
"repo": "hyprcursor",
"rev": "66d5b46ff94efbfa6fa3d1d1b66735f1779c34a6",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprcursor",
"type": "github"
}
},
"hyprland": {
"inputs": {
"hyprcursor": "hyprcursor",
"hyprlang": "hyprlang",
"hyprutils": "hyprutils",
"hyprwayland-scanner": "hyprwayland-scanner",
"nixpkgs": "nixpkgs",
"systems": "systems",
"xdph": "xdph"
},
"locked": {
"lastModified": 1719526850,
"narHash": "sha256-GPqjH+P9PPmln5KQbyCKm3kfL1NCykIPLejhUel//w4=",
"ref": "refs/heads/main",
"rev": "b7f42a1e88a5b6c9d2dbdba31e0f35f6a02461e7",
"revCount": 4893,
"submodules": true,
"type": "git",
"url": "https://github.com/hyprwm/Hyprland"
},
"original": {
"submodules": true,
"type": "git",
"url": "https://github.com/hyprwm/Hyprland"
}
},
"hyprland-protocols": {
"inputs": {
"nixpkgs": [
"hyprland",
"xdph",
"nixpkgs"
],
"systems": [
"hyprland",
"xdph",
"systems"
]
},
"locked": {
"lastModified": 1714869498,
"narHash": "sha256-vbLVOWvQqo4n1yvkg/Q70VTlPbMmTiCQfNTgcWDCfJM=",
"owner": "hyprwm",
"repo": "hyprland-protocols",
"rev": "e06482e0e611130cd1929f75e8c1cf679e57d161",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-protocols",
"type": "github"
}
},
"hyprlang": {
"inputs": {
"hyprutils": [
"hyprland",
"hyprutils"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1717881852,
"narHash": "sha256-XeeVoKHQgfKuXoP6q90sUqKyl7EYy3ol2dVZGM+Jj94=",
"owner": "hyprwm",
"repo": "hyprlang",
"rev": "ec6938c66253429192274d612912649a0cfe4d28",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprlang",
"type": "github"
}
},
"hyprutils": {
"inputs": {
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1719316102,
"narHash": "sha256-dmRz128j/lJmMuTYeCYPfSBRHHQO3VeH4PbmoyAhHzw=",
"owner": "hyprwm",
"repo": "hyprutils",
"rev": "1f6bbec5954f623ff8d68e567bddcce97cd2f085",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprutils",
"type": "github"
}
},
"hyprwayland-scanner": {
"inputs": {
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1719067853,
"narHash": "sha256-mAnZG/eQy72Fp1ImGtqCgUrDumnR1rMZv2E/zgP4U74=",
"owner": "hyprwm",
"repo": "hyprwayland-scanner",
"rev": "914f083741e694092ee60a39d31f693d0a6dc734",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprwayland-scanner",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1719075281,
"narHash": "sha256-CyyxvOwFf12I91PBWz43iGT1kjsf5oi6ax7CrvaMyAo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a71e967ef3694799d0c418c98332f7ff4cc5f6af",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1719254875,
"narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "2893f56de08021cffd9b6b6dfc70fd9ccd51eb60",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"hyprland": "hyprland",
"nixpkgs": "nixpkgs_2"
}
},
"systems": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
}
},
"xdph": {
"inputs": {
"hyprland-protocols": "hyprland-protocols",
"hyprlang": [
"hyprland",
"hyprlang"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1718619174,
"narHash": "sha256-FWW68AVYmB91ZDQnhLMBNCUUTCjb1ZpO2k2KIytHtkA=",
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"rev": "c7894aa54f9a7dbd16df5cd24d420c8af22d5623",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

24
flake.nix Normal file
View file

@ -0,0 +1,24 @@
{
description = "A plugin to make your hyprland cursor more realistic, also adds shake to find.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1";
};
outputs = {
self,
nixpkgs,
...
} @ inputs: let
forAllSystems = function:
nixpkgs.lib.genAttrs [
"x86_64-linux"
] (system: function nixpkgs.legacyPackages.${system});
in {
packages = forAllSystems (pkgs: {
default = self.packages.${pkgs.system}.hypr-dynamic-cursors;
hypr-dynamic-cursors = pkgs.callPackage ./nix/package.nix {inherit inputs pkgs;};
});
};
}

25
nix/package.nix Normal file
View file

@ -0,0 +1,25 @@
{
inputs,
pkgs,
}:
pkgs.stdenvNoCC.mkDerivation rec {
name = "hypr-dynamic-cursors";
pname = name;
src = ./..;
nativeBuildInputs = inputs.hyprland.packages.${pkgs.system}.hyprland.nativeBuildInputs ++ [inputs.hyprland.packages.${pkgs.system}.hyprland pkgs.gcc13];
buildInputs = inputs.hyprland.packages.${pkgs.system}.hyprland.buildInputs;
dontUseCmakeConfigure = true;
dontUseMesonConfigure = true;
dontUseNinjaBuild = true;
dontUseNinjaInstall = true;
installPhase = ''
runHook preInstall
mkdir -p "$out/lib"
cp -r out/* "$out/lib/lib${name}.so"
runHook postInstall
'';
}