stuffies
This commit is contained in:
parent
ccc4950e0c
commit
22d0414de5
10 changed files with 151 additions and 1 deletions
19
.gitignore
vendored
19
.gitignore
vendored
|
@ -52,3 +52,22 @@ Module.symvers
|
||||||
Mkfile.old
|
Mkfile.old
|
||||||
dkms.conf
|
dkms.conf
|
||||||
|
|
||||||
|
# ---> Rust
|
||||||
|
# Generated by Cargo
|
||||||
|
# will have compiled files and executables
|
||||||
|
debug/
|
||||||
|
target/
|
||||||
|
|
||||||
|
# These are backup files generated by rustfmt
|
||||||
|
**/*.rs.bk
|
||||||
|
|
||||||
|
# MSVC Windows builds of rustc generate these, which store debugging information
|
||||||
|
*.pdb
|
||||||
|
|
||||||
|
# ---> Nix
|
||||||
|
# Ignore build outputs from performing a nix-build or `nix build` command
|
||||||
|
result
|
||||||
|
result-*
|
||||||
|
|
||||||
|
# Ignore direnv
|
||||||
|
.direnv/
|
||||||
|
|
|
@ -56,9 +56,14 @@ int main(int argc, char **argv) {
|
||||||
if (strcmp("help", argv[1]) == 0) {
|
if (strcmp("help", argv[1]) == 0) {
|
||||||
printf("help command \n");
|
printf("help command \n");
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
};
|
||||||
|
if (strcmp("ball", argv[1]) == 0) {
|
||||||
ball_vol();
|
ball_vol();
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
if (strcmp("ooe", argv[1]) == 0) {
|
||||||
odd_or_even();
|
odd_or_even();
|
||||||
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
return 0;
|
return 0;
|
1
rust/.envrc
Normal file
1
rust/.envrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
use flake
|
7
rust/Cargo.lock
generated
Normal file
7
rust/Cargo.lock
generated
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "example-rust"
|
||||||
|
version = "0.0.1"
|
8
rust/Cargo.toml
Normal file
8
rust/Cargo.toml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[package]
|
||||||
|
name = "example-rust"
|
||||||
|
version = "0.0.1"
|
||||||
|
license = "MIT"
|
||||||
|
description = "A example rust project using nix"
|
||||||
|
homepage = "https://github.com/isabelroses/example-rust"
|
||||||
|
authors = ["Isabel Roses <isabel@isabelroses.com>"]
|
||||||
|
edition = "2021"
|
30
rust/default.nix
Normal file
30
rust/default.nix
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
rustPlatform,
|
||||||
|
}: let
|
||||||
|
toml = (lib.importTOML ./Cargo.toml).package;
|
||||||
|
in
|
||||||
|
rustPlatform.buildRustPackage {
|
||||||
|
pname = "mafs-rust";
|
||||||
|
inherit (toml) version;
|
||||||
|
|
||||||
|
src = lib.fileset.toSource {
|
||||||
|
root = ./.;
|
||||||
|
fileset = lib.fileset.intersection (lib.fileset.fromSource (lib.sources.cleanSource ./.)) (
|
||||||
|
lib.fileset.unions [
|
||||||
|
./Cargo.toml
|
||||||
|
./Cargo.lock
|
||||||
|
./src
|
||||||
|
]
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
cargoLock.lockFile = ./Cargo.lock;
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
inherit (toml) homepage description;
|
||||||
|
license = lib.licenses.mit;
|
||||||
|
maintainers = with lib.maintainers; [blahai];
|
||||||
|
mainPackage = "mafs";
|
||||||
|
};
|
||||||
|
}
|
27
rust/flake.lock
generated
Normal file
27
rust/flake.lock
generated
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1737525964,
|
||||||
|
"narHash": "sha256-3wFonKmNRWKq1himW9N3TllbeGIHFACI5vmLpk6moF8=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "5757bbb8bd7c0630a0cc4bb19c47e588db30b97c",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
29
rust/flake.nix
Normal file
29
rust/flake.nix
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
{
|
||||||
|
description = "Rust Project Template";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
{ self, nixpkgs }@inputs:
|
||||||
|
let
|
||||||
|
forAllSystems =
|
||||||
|
function:
|
||||||
|
nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (
|
||||||
|
system: function nixpkgs.legacyPackages.${system}
|
||||||
|
);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
packages = forAllSystems (pkgs: {
|
||||||
|
example = pkgs.callPackage ./default.nix { };
|
||||||
|
default = self.packages.${pkgs.stdenv.hostPlatform.system}.example;
|
||||||
|
});
|
||||||
|
|
||||||
|
devShells = forAllSystems (pkgs: {
|
||||||
|
default = pkgs.callPackage ./shell.nix { inherit inputs; };
|
||||||
|
});
|
||||||
|
|
||||||
|
overlays.default = final: _: { example = final.callPackage ./default.nix { }; };
|
||||||
|
};
|
||||||
|
}
|
21
rust/shell.nix
Normal file
21
rust/shell.nix
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
stdenv,
|
||||||
|
mkShell,
|
||||||
|
|
||||||
|
# extra tooling
|
||||||
|
clippy,
|
||||||
|
rustfmt,
|
||||||
|
rust-analyzer,
|
||||||
|
|
||||||
|
inputs, # our inputs
|
||||||
|
self ? inputs.self,
|
||||||
|
}:
|
||||||
|
mkShell {
|
||||||
|
inputsFrom = [ self.packages.${stdenv.hostPlatform.system}.default ];
|
||||||
|
|
||||||
|
packages = [
|
||||||
|
clippy
|
||||||
|
rustfmt
|
||||||
|
rust-analyzer
|
||||||
|
];
|
||||||
|
}
|
3
rust/src/main.rs
Normal file
3
rust/src/main.rs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
fn main() {
|
||||||
|
println!("Hello, world!");
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue