-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Nix flake for devShell, create Nix package
Signed-off-by: Humaid Alqasimi <humaid.alqassimi@tii.ae>
- Loading branch information
1 parent
a38c33c
commit 76ea602
Showing
8 changed files
with
231 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
target | ||
.direnv/ | ||
result |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
{ | ||
description = "Ghaf Control Panel Flake"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
|
||
# Modularity | ||
flake-parts.url = "github:hercules-ci/flake-parts"; | ||
flake-root.url = "github:srid/flake-root"; | ||
|
||
# Formatting | ||
treefmt-nix = { | ||
url = "github:numtide/treefmt-nix"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
}; | ||
|
||
outputs = inputs @ {flake-parts, ...}: | ||
flake-parts.lib.mkFlake {inherit inputs;} { | ||
imports = [ | ||
./nix/treefmt.nix | ||
./nix/devshell.nix | ||
]; | ||
systems = ["x86_64-linux" "aarch64-linux" "riscv64-linux"]; | ||
perSystem = {pkgs, ...}: { | ||
packages.default = pkgs.callPackage ./nix {}; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
{ | ||
cargo, | ||
glib, | ||
gtk4, | ||
lib, | ||
libadwaita, | ||
librsvg, | ||
pkg-config, | ||
protobuf, | ||
protoc-gen-tonic, | ||
rustPlatform, | ||
rustc, | ||
version ? "git", | ||
}: | ||
rustPlatform.buildRustPackage { | ||
pname = "ghaf-ctrl-panel"; | ||
inherit version; | ||
meta = with lib; { | ||
description = "Ghaf Control Panel"; | ||
license = licenses.asl20; | ||
mainProgram = "ctrl-panel"; | ||
}; | ||
|
||
buildInputs = [ | ||
gtk4 | ||
glib | ||
libadwaita | ||
]; | ||
|
||
nativeBuildInputs = [ | ||
gtk4 | ||
glib | ||
rustPlatform.cargoSetupHook | ||
rustc | ||
cargo | ||
pkg-config | ||
protoc-gen-tonic | ||
protobuf | ||
]; | ||
|
||
gappsWrapperArgs = '' | ||
--prefix XDG_DATA_DIRS : "${librsvg}/share" | ||
''; | ||
|
||
cargoLock.lockFile = ../Cargo.lock; | ||
|
||
src = ./..; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
{ | ||
perSystem = {pkgs, ...}: { | ||
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"; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
{inputs, ...}: { | ||
imports = with inputs; [ | ||
flake-root.flakeModule | ||
treefmt-nix.flakeModule | ||
]; | ||
perSystem = { | ||
config, | ||
pkgs, | ||
... | ||
}: { | ||
treefmt.config = { | ||
package = pkgs.treefmt; | ||
inherit (config.flake-root) projectRootFile; | ||
|
||
programs = { | ||
alejandra.enable = true; | ||
deadnix.enable = true; | ||
statix.enable = true; | ||
rustfmt.enable = true; | ||
}; | ||
}; | ||
|
||
formatter = config.treefmt.build.wrapper; | ||
}; | ||
} |