nix: add standalone project flake

This commit is contained in:
2026-08-16 21:52:28 -07:00
parent 67562f4e92
commit d57c3177c1
4 changed files with 133 additions and 3 deletions
+2 -1
View File
@@ -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.
+20 -2
View File
@@ -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
View File
@@ -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
}
+84
View File
@@ -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);
};
}