first commit

This commit is contained in:
benstrb 2026-01-03 12:48:28 +01:00
commit 780ddcda1c
37 changed files with 981 additions and 0 deletions

View file

@ -0,0 +1,62 @@
{pkgs, ...}: {
home.packages = [
(pkgs.writeScriptBin "create-project"
''
#!${pkgs.nushell}/bin/nu
def main [
type?: string
name?: string
--local (-l)
] {
if $name == null or $type == null {
print "Usage: create-project <name> <type> [Options: -l]"
exit 1
}
if ($name | str contains "/") or ($name | str contains ".") {
print "This is not a valid name for a project"
exit 1
}
if ($type | str contains "/") or ($type | str contains ".") {
print "This is not a valid project type"
exit 1
}
mkdir $name
cd $name
if ($"~/.nix-config/home/modules/create-project/project-blueprints/($type)" | path expand | ls $in | length) > 0 {
glob $"~/.nix-config/home/modules/create-project/project-blueprints/($type)/*" | each { |file| cp $file . }
}
if ($"./init.sh" | path type) == "file" {
bash $"./init.sh" $name
rm "init.sh"
}
echo "use flake" | save .envrc
direnv allow
git init
git add .
git commit -m "Project setup"
if $local {
print "You are all done"
exit 0
}
${pkgs.tea}/bin/tea repos create --name $name
git remote add origin $"https://git.stribrny.org/ben_ag/($name).git"
git push -u origin main
print "You are all done"
exit 0
}
'')
];
}

View file

@ -0,0 +1 @@
target

View file

@ -0,0 +1,29 @@
{
description = "My rust development shell";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {nixpkgs, ...} @ inputs: let
system = "x86_64-linux";
overlays = [(import inputs.rust-overlay)];
pkgs = import nixpkgs {
inherit system overlays;
};
in {
devShells."${system}" = {
default = pkgs.mkShell {
buildInputs = with pkgs; [
gcc
gnumake
rust-bin.stable.latest.default
evcxr
];
};
};
};
}

View file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
nix develop . --command bash -c "cargo new $1"
cp -r "$1"/* .
rm -fr "$1"