-
Notifications
You must be signed in to change notification settings - Fork 3
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 <[email protected]>
- Loading branch information
1 parent
a38c33c
commit dbd766a
Showing
9 changed files
with
275 additions
and
2 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 |
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,23 @@ | ||
# SPDX-FileCopyrightText: 2024 Technology Innovation Institute (TII) | ||
# SPDX-FileCopyrightText: 2020-2024 Eelco Dolstra and the flake-compat contributors | ||
# | ||
# SPDX-License-Identifier: MIT | ||
# This file originates from: | ||
# https://github.com/nix-community/flake-compat | ||
# This file provides backward compatibility to nix < 2.4 clients | ||
{system ? builtins.currentSystem}: let | ||
lock = builtins.fromJSON (builtins.readFile ./flake.lock); | ||
|
||
inherit (lock.nodes.flake-compat.locked) owner repo rev narHash; | ||
|
||
flake-compat = fetchTarball { | ||
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; | ||
sha256 = narHash; | ||
}; | ||
|
||
flake = import flake-compat { | ||
inherit system; | ||
src = ./.; | ||
}; | ||
in | ||
flake.defaultNix |
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,32 @@ | ||
# Copyright 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"; | ||
flake-compat.url = "github:nix-community/flake-compat"; | ||
|
||
# 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 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 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 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; | ||
}; | ||
} |
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