nix tooling

This commit is contained in:
raf 2024-01-09 13:49:33 +03:00
parent 4cf46c1659
commit 17bd6eaf55
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
4 changed files with 92 additions and 0 deletions

23
default.nix Normal file
View file

@ -0,0 +1,23 @@
{
lib,
rustPlatform,
...
}: let
pname = "batmon";
version = "unstable-2024-01-08";
in
rustPlatform.buildRustPackage {
inherit pname version;
src = lib.cleanSource ./.;
cargoHash = "sha256-d9wWr17BnlRwa3CLcfDeby60a2BPwpBy1xjY6oTgyG0=";
meta = {
description = "Nananananananana batmon";
homepage = "https://github.com/NotAShelf/batmon.git";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [NotAShelf];
mainProgram = "batmon";
platforms = lib.platforms.linux;
};
}

26
flake.lock Normal file
View file

@ -0,0 +1,26 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1704796538,
"narHash": "sha256-uRMWOijfPGHzLXMqiYGoAitkq1beLfg2JAmGLdTjmvQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "792a7ddec9e0fe05aed934160eb75f1a821eb69b",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

23
flake.nix Normal file
View file

@ -0,0 +1,23 @@
{
description = "Batmon - battery monitor service";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = {
self,
nixpkgs,
}: let
systems = ["x86_64-linux" "aarch64-linux"];
forEachSystem = nixpkgs.lib.genAttrs systems;
pkgsForEach = nixpkgs.legacyPackages;
in {
packages = forEachSystem (system: {
default = pkgsForEach.${system}.callPackage ./default.nix {};
});
devShells = forEachSystem (system: {
default = pkgsForEach.${system}.callPackage ./shell.nix {};
});
};
}

20
shell.nix Normal file
View file

@ -0,0 +1,20 @@
{
callPackage,
rust-analyzer,
rustfmt,
clippy,
cargo,
}: let
mainPkg = callPackage ./default.nix {};
in
mainPkg.overrideAttrs (oa: {
nativeBuildInputs =
[
# Additional rust tooling
rust-analyzer
rustfmt
clippy
cargo
]
++ (oa.nativeBuildInputs or []);
})