Skip to content

Commit

Permalink
Use Nix flake for devShell, create Nix package
Browse files Browse the repository at this point in the history
Signed-off-by: Humaid Alqasimi <humaid.alqassimi@tii.ae>
  • Loading branch information
humaidq-tii committed Jul 3, 2024
1 parent 8936ae8 commit ac218be
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 18 deletions.
4 changes: 4 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if ! has nix_direnv_version || ! nix_direnv_version 3.0.5; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.5/direnvrc" "sha256-RuwIS+QKFj/T9M2TFXScjBsLR6V3A17YVoEW/Q6AZ1w="
fi
use flake
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
target
.direnv/
result
61 changes: 61 additions & 0 deletions flake.lock

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

57 changes: 57 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
description = "Nix Flake for Ghaf Control Panel";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";

outputs = {
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
in rec {
devShells.default = pkgs.mkShell {
packages = [
pkgs.bashInteractive

pkgs.glib
pkgs.gtk4
pkgs.libadwaita
pkgs.pkg-config
pkgs.gcc
pkgs.rustc
pkgs.cargo
pkgs.protoc-gen-tonic
pkgs.protobuf
];
PKG_CONFIG_PATH = "${pkgs.glib.dev}/lib/pkgconfig:${pkgs.gtk4.dev}/lib/pkgconfig";
};

packages.ghaf-ctrl-panel = pkgs.rustPlatform.buildRustPackage {
pname = "ghaf-ctrl-panel";
version = "0.1.0";

buildInputs = with pkgs; [
gtk4
glib
libadwaita
];

nativeBuildInputs = with pkgs; [
gtk4
glib
rustPlatform.cargoSetupHook
rustc
cargo
pkg-config
protoc-gen-tonic
protobuf
];
cargoHash = "sha256-fjmEzXUyCoEiQiuQDA1195kLSmhTCcDSGZKj9quuNFA=";

src = ./.;
};
defaultPackage = packages.ghaf-ctrl-panel;
});
}
18 changes: 0 additions & 18 deletions shell.nix

This file was deleted.

0 comments on commit ac218be

Please # to comment.