use flake by default

This commit is contained in:
guochao 2024-06-04 11:30:13 +08:00
parent 4e51d58c65
commit bf968f2976
Signed by: guochao
GPG Key ID: 79F7306D2AA32FC3
6 changed files with 108 additions and 8 deletions

2
.envrc
View File

@ -1 +1 @@
use nix --expr '(import <nixpkgs> {}).callPackage ./shell.nix {}'
use flake

7
crate2nix.nix Normal file
View File

@ -0,0 +1,7 @@
{ callPackage, defaultCrateOverrides, cargoNix? callPackage ./Cargo.nix {}, projectConfig ? callPackage ./project-config.nix { }, ... }: cargoNix.workspaceMembers.chat-signaling-server.build.override {
crateOverrides = defaultCrateOverrides // {
signaling = { ... }: {
inherit (projectConfig) buildInputs nativeBuildInputs;
};
};
}

View File

@ -1,7 +1,19 @@
{ callPackage, defaultCrateOverrides, cargoNix? callPackage ./Cargo.nix {}, projectConfig ? callPackage ./project-config.nix { }, ... }: cargoNix.workspaceMembers.chat-signaling-server.build.override {
crateOverrides = defaultCrateOverrides // {
signaling = { ... }: {
inherit (projectConfig) buildInputs nativeBuildInputs;
};
{ rustPlatform, lib, callPackage, projectConfig ? callPackage ./project-config.nix { }, ... }: rustPlatform.buildRustPackage {
inherit (projectConfig) buildInputs nativeBuildInputs;
pname = "chat-signaling-server";
version = "0.1.0";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
meta = with lib; {
description = "rust project scaffold";
homepage = "https://git.jeffthecoder.xyz/public/os-flakes";
license = licenses.unlicense;
maintainers = [ ];
};
}

78
flake.lock generated Normal file
View File

@ -0,0 +1,78 @@
{
"nodes": {
"fenix": {
"inputs": {
"nixpkgs": "nixpkgs",
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1717309557,
"narHash": "sha256-CJ7i/WcZMlEtn/uc2YLOtt5ihHg2AMdx314TsQPtHhE=",
"owner": "nix-community",
"repo": "fenix",
"rev": "53cd289dfda8bcd148dc92178efa707ac83c9d9a",
"type": "github"
},
"original": {
"id": "fenix",
"type": "indirect"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1716948383,
"narHash": "sha256-SzDKxseEcHR5KzPXLwsemyTR/kaM9whxeiJohbL04rs=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "ad57eef4ef0659193044870c731987a6df5cf56b",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1716948383,
"narHash": "sha256-SzDKxseEcHR5KzPXLwsemyTR/kaM9whxeiJohbL04rs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ad57eef4ef0659193044870c731987a6df5cf56b",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"root": {
"inputs": {
"fenix": "fenix",
"nixpkgs": "nixpkgs_2"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1717268339,
"narHash": "sha256-v/3DU1Qqa5ZuyT7C4pn7VP0tsLt4zzlqL2lkACGEmtk=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "ca5568182df1bccf32014d65db70e7e1f121c3a6",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View File

@ -23,7 +23,9 @@
let
pkgs = import nixpkgs { inherit system; };
in
pkgs.callPackage ./shell.nix { }
{
default = pkgs.callPackage ./shell.nix { };
}
);
};
}

View File

@ -1,6 +1,7 @@
{ callPackage
, cargo-tarpaulin
, cargo-watch
, protobuf
, rustfmt
, crate2nix
@ -20,7 +21,7 @@
# cargo-make
# cargo-mobile2
# cargo-tauri
# cargo-watch
cargo-watch
# TODO: cargo-xcode
# TODO: create-tauri-app
# cargo-espflash