nix: init tooling

This commit is contained in:
raf 2024-12-22 18:44:11 +03:00
commit b78133a5c4
No known key found for this signature in database
GPG key ID: EED98D11B85A2819
5 changed files with 89 additions and 0 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake

26
flake.lock generated Normal file
View file

@ -0,0 +1,26 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1734880952,
"narHash": "sha256-ZTt3x0DN55JGjdYv8TEDC/YDxcYfpFDLApYvKFMnxNM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "578baae41df4920fb34db92ae3a312c23ea90b89",
"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 @@
{
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 rec {
packages = forEachSystem (system: {
default = pkgsForEach.${system}.callPackage ./nix/package.nix {};
});
devShells = forEachSystem (system: {
default = pkgsForEach.${system}.callPackage ./nix/shell.nix {};
});
hydraJobs = packages;
};
}

12
nix/package.nix Normal file
View file

@ -0,0 +1,12 @@
{rustPlatform}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "mrc";
version = "0.0.1";
src = ./.;
cargoLock.lockFile = finalAttrs.src + /Cargo.lock;
meta = {
description = "MPV IPC wrapper";
mainProgram = "mrc";
};
})

27
nix/shell.nix Normal file
View file

@ -0,0 +1,27 @@
{
mkShell,
rust-analyzer,
rustfmt,
clippy,
cargo,
gcc,
openssl,
pkg-config,
rustc,
}:
mkShell {
name = "mrc";
packages = [
rust-analyzer
rustfmt
clippy
cargo
cargo
gcc
clippy
rustfmt
openssl
pkg-config
rustc
];
}