nix: add standalone project flake
This commit is contained in:
@@ -16,6 +16,7 @@ sockets.
|
||||
- `src/model.rs`: client data, application grouping, address normalization, and
|
||||
focus history.
|
||||
- `src/desktop.rs`: XDG desktop-file metadata and icon lookup.
|
||||
- `flake.nix`: standalone Nix package, app, checks, and development shell.
|
||||
- `../hyprland.conf`: source configuration integration. The live config may be
|
||||
deployed from another checkout; verify it before editing or reloading.
|
||||
|
||||
@@ -53,6 +54,7 @@ cargo fmt --check
|
||||
cargo test
|
||||
cargo clippy --workspace --all-targets -- -D warnings
|
||||
cargo build --release
|
||||
nix flake check
|
||||
```
|
||||
|
||||
Install a tested build with:
|
||||
@@ -80,4 +82,3 @@ proportional runtime checks in a live Hyprland session.
|
||||
Preserve unrelated dirty changes in both configuration checkouts. Use
|
||||
`readlink -f ~/.config/hypr/hyprland.conf` before assuming the workspace copy is
|
||||
the active one.
|
||||
|
||||
|
||||
@@ -40,6 +40,23 @@ other workspaces.
|
||||
|
||||
## Build and install
|
||||
|
||||
### Nix
|
||||
|
||||
The project flake owns the Rust and GTK build dependencies. Build or run the
|
||||
locked package directly:
|
||||
|
||||
```sh
|
||||
nix build
|
||||
nix run . -- show
|
||||
```
|
||||
|
||||
Use `nix develop` for a shell containing Cargo, Clippy, rustfmt, and the native
|
||||
GTK dependencies. Downstream flakes can install
|
||||
`packages.${system}.default` and make this flake's `nixpkgs` input follow
|
||||
their own.
|
||||
|
||||
### Cargo
|
||||
|
||||
Run this from the directory containing this README:
|
||||
|
||||
```sh
|
||||
@@ -48,8 +65,9 @@ cargo clippy --workspace --all-targets -- -D warnings
|
||||
cargo install --path . --root ~/.local --force
|
||||
```
|
||||
|
||||
The binary is installed as `~/.local/bin/hypr-switcher`. The accompanying
|
||||
`../hyprland.conf` starts the daemon and defines the bindings:
|
||||
The binary is installed as `~/.local/bin/hypr-switcher`. A Nix profile usually
|
||||
exposes it as `~/.nix-profile/bin/hypr-switcher`. Configure the applicable
|
||||
absolute path, then start the daemon and define the bindings:
|
||||
|
||||
```ini
|
||||
$switcher = ~/.local/bin/hypr-switcher
|
||||
|
||||
Generated
+27
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1786862985,
|
||||
"narHash": "sha256-FBJRXmbGXiSUDvYEbfLYRkckayyZ6SK1UEqhCrIZ2Cs=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e5bdc4a41d4c072fe1e3787eaa0320a384741d44",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
{
|
||||
description = "macOS-style application switching and hiding for Hyprland";
|
||||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
outputs =
|
||||
{ self, nixpkgs }:
|
||||
let
|
||||
supportedSystems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||
pkgsFor = system: import nixpkgs { inherit system; };
|
||||
in
|
||||
{
|
||||
packages = forAllSystems (
|
||||
system:
|
||||
let
|
||||
pkgs = pkgsFor system;
|
||||
in
|
||||
rec {
|
||||
hypr-switcher = pkgs.rustPlatform.buildRustPackage {
|
||||
pname = "hypr-switcher";
|
||||
version = "0.1.0";
|
||||
src = pkgs.lib.cleanSource ./.;
|
||||
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
pkg-config
|
||||
wrapGAppsHook4
|
||||
];
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
gtk4
|
||||
gtk4-layer-shell
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "macOS-style application switcher for Hyprland";
|
||||
homepage = "https://code.buzzert.dev/buzzert/hypr-switcher";
|
||||
mainProgram = "hypr-switcher";
|
||||
platforms = pkgs.lib.platforms.linux;
|
||||
};
|
||||
};
|
||||
|
||||
default = hypr-switcher;
|
||||
}
|
||||
);
|
||||
|
||||
apps = forAllSystems (system: {
|
||||
hypr-switcher = {
|
||||
type = "app";
|
||||
program = "${self.packages.${system}.hypr-switcher}/bin/hypr-switcher";
|
||||
};
|
||||
default = self.apps.${system}.hypr-switcher;
|
||||
});
|
||||
|
||||
checks = forAllSystems (system: {
|
||||
default = self.packages.${system}.hypr-switcher;
|
||||
});
|
||||
|
||||
devShells = forAllSystems (
|
||||
system:
|
||||
let
|
||||
pkgs = pkgsFor system;
|
||||
in
|
||||
{
|
||||
default = pkgs.mkShell {
|
||||
inputsFrom = [ self.packages.${system}.hypr-switcher ];
|
||||
packages = with pkgs; [
|
||||
cargo
|
||||
clippy
|
||||
rustc
|
||||
rustfmt
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
formatter = forAllSystems (system: (pkgsFor system).nixfmt);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user