added stuff

This commit is contained in:
Charlie Root 2024-04-09 23:11:33 +02:00
commit 9d0ebdfbd0
907 changed files with 70990 additions and 0 deletions

View file

@ -0,0 +1,15 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.c]
ident_style = space
ident_size = 4
[Makefile*]
ident_style = tab
ident_size = 4

3
nyx/flake/templates/c/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
# ignore build artifacts
result
build

View file

@ -0,0 +1,9 @@
{clangStdenv}:
clangStdenv.mkDerivation {
pname = "sample-c-cpp";
version = "0.0.1";
src = ./.;
makeFlags = ["PREFIX=$(out)"];
}

View file

@ -0,0 +1,25 @@
{
description = "C/C++ Project Template";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = {
self,
nixpkgs,
...
}: let
systems = ["x86_64-linux" "aarch64-linux"];
forEachSystem = nixpkgs.lib.genAttrs systems;
pkgsForEach = nixpkgs.legacyPackages;
in {
packages = forEachSystem (system: {
default = pkgsForEach.${system}.callPackage ./default.nix {};
});
devShells = forEachSystem (system: {
default = pkgsForEach.${system}.callPackage ./shell.nix {};
});
};
}

View file

@ -0,0 +1,42 @@
PREFIX ?= /usr/local # this is overriden by the derivation makeFlags
BIN_DIR ?= $(PREFIX)/bin
TARGET_EXEC ?= foo-bar
BUILD_DIR ?= ./build
SRC_DIRS ?= ./src
SRCS := $(shell find $(SRC_DIRS) -name *.cpp -or -name *.c)
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
DEPS := $(OBJS:.o=.d)
INC_DIRS := $(shell find $(SRC_DIRS) -type d)
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
CPPFLAGS ?= $(INC_FLAGS) -MMD -MP
$(BUILD_DIR)/$(TARGET_EXEC): $(OBJS)
$(CXX) $(OBJS) -o $@ $(LDFLAGS)
# c source
$(BUILD_DIR)/%.c.o: %.c
mkdir -p $(dir $@)
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
# c++ source
$(BUILD_DIR)/%.cpp.o: %.cpp
mkdir -p $(dir $@)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
.PHONY: clean install run
clean:
rm -r $(BUILD_DIR)
install: $(BUILD_DIR)/$(TARGET_EXEC)
install -Dt $(BIN_DIR) $<
run: $(BUILD_DIR)/$(TARGET_EXEC)
./$<
-include $(DEPS)

View file

@ -0,0 +1,36 @@
{
callPackage,
clang-tools,
gnumake,
cmake,
bear,
libcxx,
cppcheck,
llvm,
gdb,
glm,
SDL2,
SDL2_gfx,
}: let
mainPkg = callPackage ./default.nix {};
in
mainPkg.overrideAttrs (oa: {
nativeBuildInputs =
[
clang-tools # fix headers not found
gnumake # builder
cmake # another builder
bear # bear.
libcxx # stdlib for cpp
cppcheck # static analysis
llvm.lldb # debugger
gdb # another debugger
llvm.libstdcxxClang # LSP and compiler
llvm.libcxx # stdlib for C++
# libs
glm
SDL2
SDL2_gfx
]
++ (oa.nativeBuildInputs or []);
})

View file

@ -0,0 +1,7 @@
#include <iostream>
int main() {
std::cout << "Hello, World!";
return 0;
}

View file

@ -0,0 +1,23 @@
_: {
flake.templates = {
c = {
path = ./c; # C/C++
description = "Development environment for C/C++";
};
rust = {
path = ./rust; # Rust
description = "Development environment for Rust";
};
node = {
path = ./node; # NodeJS
description = "Development environment for NodeJS";
};
go = {
path = ./go; # golang
description = "Development environment for Golang";
};
};
}

View file

@ -0,0 +1,11 @@
{buildGoModule}:
buildGoModule {
pname = "sample-go";
version = "0.0.1";
src = ./.;
vendorHash = "";
ldflags = ["-s" "-w"];
}

View file

@ -0,0 +1,26 @@
{
description = "Golang Project Template";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = {
self,
nixpkgs,
}: let
systems = ["x86_64-linux" "aarch64-linux"];
forEachSystem = nixpkgs.lib.genAttrs systems;
pkgsForEach = nixpkgs.legacyPackages;
in rec {
packages = forEachSystem (system: {
default = pkgsForEach.${system}.callPackage ./default.nix {};
});
devShells = forEachSystem (system: {
default = pkgsForEach.${system}.callPackage ./shell.nix {};
});
hydraJobs = packages;
};
}

View file

@ -0,0 +1,3 @@
module notashelf.dev/sample
go 1.20

View file

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}

View file

@ -0,0 +1,15 @@
{
callPackage,
gopls,
go,
}: let
mainPkg = callPackage ./default.nix {};
in
mainPkg.overrideAttrs (oa: {
nativeBuildInputs =
[
gopls
go
]
++ (oa.nativeBuildInputs or []);
})

3
nyx/flake/templates/node/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
result
build
node_modules

View file

@ -0,0 +1,12 @@
{
lib,
buildNpmPackage,
}:
buildNpmPackage {
pname = "foo-bar";
version = "0.1.0";
src = ./.;
npmDepsHash = lib.fakeSha256;
}

View file

@ -0,0 +1,26 @@
{
description = "NodeJS Project Template";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = {
self,
nixpkgs,
}: let
systems = ["x86_64-linux" "aarch64-linux"];
forEachSystem = nixpkgs.lib.genAttrs systems;
pkgsForEach = nixpkgs.legacyPackages;
in rec {
packages = forEachSystem (system: {
default = pkgsForEach.${system}.callPackage ./default.nix {};
});
devShells = forEachSystem (system: {
default = pkgsForEach.${system}.callPackage ./shell.nix {};
});
hydraJobs = packages;
};
}

View file

@ -0,0 +1,19 @@
{
"name": "sample-nodejs",
"version": "0.0.1",
"description": "Sample node program",
"bin": {
"sample-node": "build/index.js"
},
"scripts": {
"build": "tsc",
"start": "npm run build && node build/index.js"
},
"author": "NotAShelf",
"license": "MIT",
"devDependencies": {
"@types/node": "^20.1.2",
"typescript": "^5.0.4",
"typescript-language-server": "^3.3.2"
}
}

View file

@ -0,0 +1,24 @@
{
callPackage,
writeShellScriptBin,
eslint_d,
prettierd,
}: let
mainPkg = callPackage ./default.nix {};
mkNpxAlias = name: writeShellScriptBin name "npx ${name} \"$@\"";
in
mainPkg.overrideAttrs (oa: {
nativeBuildInputs =
[
eslint_d
prettierd
(mkNpxAlias "tsc")
(mkNpxAlias "tsserver")
]
++ (oa.nativeBuildInputs or []);
shellHook = ''
eslint_d start # start eslint daemon
eslint_d status # inform user about eslint daemon status
'';
})

View file

@ -0,0 +1 @@
console.log("Hello world!");

View file

@ -0,0 +1,16 @@
{
"compilerOptions": {
"target": "es2016",
"lib": ["es6"],
"module": "commonjs",
"rootDir": "src",
"resolveJsonModule": true,
"allowJs": true,
"outDir": "build",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitAny": true,
"skipLibCheck": true
}
}

View file

@ -0,0 +1 @@
use flake . --builders ""

View file

@ -0,0 +1,24 @@
{
lib,
python3Packages,
doCheck ? false,
...
}:
python3Packages.buildPythonApplication {
pname = "sample-python-project";
version = "0.0.1";
src = ./.;
propagatedBuildInputs = with python3Packages; [];
nativeCheckInputs = [
python3Packages.pytest
];
checkPhase = lib.optionals doCheck ''
runHook preCheck
pytest
runHook postCheck
'';
}

View file

@ -0,0 +1,26 @@
{
description = "Python Project Template";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = {
self,
nixpkgs,
}: let
systems = ["x86_64-linux" "aarch64-linux"];
forEachSystem = nixpkgs.lib.genAttrs systems;
pkgsForEach = nixpkgs.legacyPackages;
in rec {
packages = forEachSystem (system: {
default = pkgsForEach.${system}.callPackage ./default.nix {};
});
devShells = forEachSystem (system: {
default = pkgsForEach.${system}.callPackage ./shell.nix {};
});
hydraJobs = packages;
};
}

View file

@ -0,0 +1,13 @@
{
callPackage,
mkShellNoCC,
python3,
...
}: let
defaultPackage = callPackage ./default.nix;
in
mkShellNoCC {
packages = [
(python3.withPackages defaultPackage.propagatedBuildInputs)
];
}

View file

@ -0,0 +1,5 @@
[package]
name = "sample-rust"
version = "0.0.1"
license = "MIT"
edition = "2021"

View file

@ -0,0 +1,8 @@
{rustPlatform}:
rustPlatform.buildRustPackage {
pname = "sample-rust";
version = "0.0.1";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
}

View file

@ -0,0 +1,26 @@
{
description = "Rust Project Template";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = {
self,
nixpkgs,
}: let
systems = ["x86_64-linux" "aarch64-linux"];
forEachSystem = nixpkgs.lib.genAttrs systems;
pkgsForEach = nixpkgs.legacyPackages;
in rec {
packages = forEachSystem (system: {
default = pkgsForEach.${system}.callPackage ./default.nix {};
});
devShells = forEachSystem (system: {
default = pkgsForEach.${system}.callPackage ./shell.nix {};
});
hydraJobs = packages;
};
}

View file

@ -0,0 +1,20 @@
{
callPackage,
rust-analyzer,
rustfmt,
clippy,
cargo,
}: let
mainPkg = callPackage ./default.nix {};
in
mainPkg.overrideAttrs (oa: {
nativeBuildInputs =
[
# Additional rust tooling
rust-analyzer
rustfmt
clippy
cargo
]
++ (oa.nativeBuildInputs or []);
})

View file

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}