Skip to content

Commit

Permalink
Add Nix support
Browse files Browse the repository at this point in the history
  • Loading branch information
pterror committed Aug 10, 2024
1 parent 6499528 commit 7c23199
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/target
*.sock
*.log*
*.log*
/result
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,35 @@ package in the AUR. You can easily install it using your favorite AUR helper:
paru -S verdi-git
```

If you're using NixOS, or the Nix package manager, Verdi is available as a
flake.

<details>
<summary>Detailed Nix instructions</summary>

```nix
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
verdi.url = "github:verdiwm/verdi";
verdi.inputs.nixpkgs.follows = "nixpkgs";
};
}
```

It defines the `verdi` package, and `default` as an alias to `verdi`.
It also defines a `default` shell for development purposes.

It can be used in your system installation:
```nix
environment.systemPackages = [
inputs.verdi.packages.${pkgs.system}.verdi
# or
inputs.verdi.packages.${pkgs.system}.default
];
```
</details>

Support for additional distributions is on the roadmap and will be available
soon.

Expand Down
26 changes: 26 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{ lib
, rustPlatform
, pkg-config
, udev
, libinput
}:
rustPlatform.buildRustPackage rec {
pname = "verdi";
version = "0.0.1";
nativeBuildInputs = [
pkg-config
];
buildInputs = [
udev # required by `devil`
libinput # required by `colpetto`
];
cargoLock.lockFile = ./Cargo.lock;
cargoLock.outputHashes = {
"diretto-0.0.3" = "sha256-UF52K0aBB9kTvlEFFgKN2QLcFQEZim3vrh/Boxhbhek=";
"linux-raw-sys-0.6.4" = "sha256-eg9LCBcrKHXKzpxLV9ClcI5b/7e/pKA3f2dB59lwzx4=";
"naga-22.0.0" = "sha256-/JTgJlmDlbtsu/HhXHbGro46Oa/kbbMX9G0YdaxH52E=";
"raw-window-handle-0.6.2" = "sha256-gAlhrvx/yILQSqaBCAqVB+eopiZqLDBQTGGyvM799KM=";
};
src = lib.cleanSource ./.;
}

27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
inputs = {
nixpkgs.url = github:nixos/nixpkgs/nixpkgs-unstable;
};
outputs = { self, nixpkgs }:
let
forEachSystem = fn: nixpkgs.lib.genAttrs
nixpkgs.lib.systems.flakeExposed
(system: fn system nixpkgs.legacyPackages.${system});
in
{
packages = forEachSystem
(system: pkgs: rec {
verdi = pkgs.callPackage ./default.nix {};
default = verdi;
});
devShells = forEachSystem
(system: pkgs: {
default = import ./shell.nix {
inherit pkgs;
inherit (self.packages.${system}) default;
};
});
};
}
9 changes: 9 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
with import <nixpkgs> {};
mkShell {
nativeBuildInputs = [
cargo
rustc
rustfmt
pkg-config
];
}

0 comments on commit 7c23199

Please sign in to comment.