chore: switch to flake-parts

This commit is contained in:
Youwen Wu 2024-10-29 21:30:17 -07:00
parent b8d9ac366e
commit c52c7d095d
Signed by: youwen5
GPG key ID: 865658ED1FE61EC3
3 changed files with 65 additions and 37 deletions

View file

@ -3,7 +3,7 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
flake-parts.url = "github:hercules-ci/flake-parts";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
@ -12,17 +12,22 @@
};
outputs =
{
nixpkgs,
flake-utils,
inputs@{
flake-parts,
fenix,
naersk,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"aarch64-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
perSystem =
{ system, pkgs, ... }:
let
pkgs = import nixpkgs { inherit system; };
naersk' = pkgs.callPackage naersk { };
defaultBuildOpts = {
cargo = fenix.packages.${system}.stable.cargo;
@ -53,6 +58,6 @@
}
);
};
}
);
};
};
}

View file

@ -1,6 +1,7 @@
use cartographer::libcanvas::CanvasClient;
use reqwest::{Error, Url};
use std::env;
use ui;
#[tokio::main]
async fn main() -> Result<(), Error> {

22
src/ui.rs Normal file
View file

@ -0,0 +1,22 @@
use std::io;
use ratatui::{
crossterm::event::{self, KeyCode, KeyEventKind},
style::Stylize,
widgets::Paragraph,
DefaultTerminal,
};
fn run(mut terminal: DefaultTerminal) -> io::Result<()> {
loop {
terminal.draw(|frame| {
let greeting = paragraph
.new("Hello Ratatui! (press 'q' to quit)")
.white()
.on_blue();
frame.render_widget(greeting, frame.area());
if let event::Event::Key(key) -
})
}
}