feat: add a few ways to easily run/author small rust packages
All checks were successful
/ build-host (map[host:beefcake]) (push) Successful in 34s
/ build-host (map[host:dragon]) (push) Successful in 47s
/ build-host (map[host:flipflop]) (push) Successful in 39s
/ build-host (map[host:foxtrot]) (push) Successful in 45s
/ build-host (map[host:rascal]) (push) Successful in 19s
/ build-host (map[host:router]) (push) Successful in 37s
/ build-host (map[host:steamdeck]) (push) Successful in 44s
/ build-devshell (push) Successful in 18s
/ flake-check (push) Successful in 5m48s
All checks were successful
/ build-host (map[host:beefcake]) (push) Successful in 34s
/ build-host (map[host:dragon]) (push) Successful in 47s
/ build-host (map[host:flipflop]) (push) Successful in 39s
/ build-host (map[host:foxtrot]) (push) Successful in 45s
/ build-host (map[host:rascal]) (push) Successful in 19s
/ build-host (map[host:router]) (push) Successful in 37s
/ build-host (map[host:steamdeck]) (push) Successful in 44s
/ build-devshell (push) Successful in 18s
/ flake-check (push) Successful in 5m48s
This commit is contained in:
parent
a76394b643
commit
eb0a6757cd
7 changed files with 54 additions and 2 deletions
|
@ -18,8 +18,9 @@ let
|
|||
];
|
||||
*/
|
||||
|
||||
cargoHash = pkgs.lib.fakeHash;
|
||||
useFetchCargoVendor = true;
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
|
|
|
@ -9,4 +9,8 @@ in
|
|||
# installer = pkgs.callPackage ./installer.nix { };
|
||||
ghostty-terminfo = pkgs.callPackage ./ghostty-terminfo.nix { };
|
||||
forgejo-actions-container = pkgs.callPackage ./forgejo-actions-container.nix { };
|
||||
hello_world = pkgs.callPackage ./rust/hello_world { };
|
||||
hello_world_script = pkgs.writeScriptBin "hello_world_script" (
|
||||
builtins.readFile ./rust/hello_world_script/main.rs
|
||||
);
|
||||
}
|
||||
|
|
7
packages/rust/hello_world/Cargo.lock
generated
Normal file
7
packages/rust/hello_world/Cargo.lock
generated
Normal file
|
@ -0,0 +1,7 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "hello_world"
|
||||
version = "0.1.0"
|
6
packages/rust/hello_world/Cargo.toml
Normal file
6
packages/rust/hello_world/Cargo.toml
Normal file
|
@ -0,0 +1,6 @@
|
|||
[package]
|
||||
name = "hello_world"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
16
packages/rust/hello_world/default.nix
Normal file
16
packages/rust/hello_world/default.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
rustPlatform,
|
||||
}:
|
||||
let
|
||||
inherit (builtins) fromTOML readFile;
|
||||
pname = "hello_world";
|
||||
src = ./.;
|
||||
package = rustPlatform.buildRustPackage {
|
||||
inherit pname src;
|
||||
version = (fromTOML (readFile "${src}/Cargo.toml")).package.version;
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
};
|
||||
};
|
||||
in
|
||||
package
|
3
packages/rust/hello_world/src/main.rs
Normal file
3
packages/rust/hello_world/src/main.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
15
packages/rust/hello_world_script/main.rs
Executable file
15
packages/rust/hello_world_script/main.rs
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env nix
|
||||
//! ```cargo
|
||||
//! [dependencies]
|
||||
//! time = "0.1.25"
|
||||
//! ```
|
||||
/*
|
||||
#!nix shell nixpkgs#rustc nixpkgs#rust-script nixpkgs#cargo --command rust-script
|
||||
*/
|
||||
fn main() {
|
||||
for argument in std::env::args().skip(1) {
|
||||
println!("{}", argument);
|
||||
}
|
||||
println!("{}", std::env::var("HOME").expect(""));
|
||||
println!("{}", time::now().rfc822z());
|
||||
}
|
Loading…
Add table
Reference in a new issue