added stuff
This commit is contained in:
parent
6d31f5b5a1
commit
7d4f626b7d
907 changed files with 70990 additions and 0 deletions
15
nyx/flake/templates/c/.editorconfig
Normal file
15
nyx/flake/templates/c/.editorconfig
Normal 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
3
nyx/flake/templates/c/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
# ignore build artifacts
|
||||
result
|
||||
build
|
9
nyx/flake/templates/c/default.nix
Normal file
9
nyx/flake/templates/c/default.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{clangStdenv}:
|
||||
clangStdenv.mkDerivation {
|
||||
pname = "sample-c-cpp";
|
||||
version = "0.0.1";
|
||||
|
||||
src = ./.;
|
||||
|
||||
makeFlags = ["PREFIX=$(out)"];
|
||||
}
|
25
nyx/flake/templates/c/flake.nix
Normal file
25
nyx/flake/templates/c/flake.nix
Normal 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 {};
|
||||
});
|
||||
};
|
||||
}
|
42
nyx/flake/templates/c/makefile
Normal file
42
nyx/flake/templates/c/makefile
Normal 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)
|
36
nyx/flake/templates/c/shell.nix
Normal file
36
nyx/flake/templates/c/shell.nix
Normal 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 []);
|
||||
})
|
7
nyx/flake/templates/c/src/main.cpp
Normal file
7
nyx/flake/templates/c/src/main.cpp
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "Hello, World!";
|
||||
|
||||
return 0;
|
||||
}
|
23
nyx/flake/templates/default.nix
Normal file
23
nyx/flake/templates/default.nix
Normal 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";
|
||||
};
|
||||
};
|
||||
}
|
11
nyx/flake/templates/go/default.nix
Normal file
11
nyx/flake/templates/go/default.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{buildGoModule}:
|
||||
buildGoModule {
|
||||
pname = "sample-go";
|
||||
version = "0.0.1";
|
||||
|
||||
src = ./.;
|
||||
|
||||
vendorHash = "";
|
||||
|
||||
ldflags = ["-s" "-w"];
|
||||
}
|
26
nyx/flake/templates/go/flake.nix
Normal file
26
nyx/flake/templates/go/flake.nix
Normal 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;
|
||||
};
|
||||
}
|
3
nyx/flake/templates/go/go.mod
Normal file
3
nyx/flake/templates/go/go.mod
Normal file
|
@ -0,0 +1,3 @@
|
|||
module notashelf.dev/sample
|
||||
|
||||
go 1.20
|
7
nyx/flake/templates/go/main.go
Normal file
7
nyx/flake/templates/go/main.go
Normal file
|
@ -0,0 +1,7 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fmt.Println("Hello, World!")
|
||||
}
|
15
nyx/flake/templates/go/shell.nix
Normal file
15
nyx/flake/templates/go/shell.nix
Normal 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
3
nyx/flake/templates/node/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
result
|
||||
build
|
||||
node_modules
|
12
nyx/flake/templates/node/default.nix
Normal file
12
nyx/flake/templates/node/default.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
lib,
|
||||
buildNpmPackage,
|
||||
}:
|
||||
buildNpmPackage {
|
||||
pname = "foo-bar";
|
||||
version = "0.1.0";
|
||||
|
||||
src = ./.;
|
||||
|
||||
npmDepsHash = lib.fakeSha256;
|
||||
}
|
26
nyx/flake/templates/node/flake.nix
Normal file
26
nyx/flake/templates/node/flake.nix
Normal 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;
|
||||
};
|
||||
}
|
19
nyx/flake/templates/node/package.json
Normal file
19
nyx/flake/templates/node/package.json
Normal 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"
|
||||
}
|
||||
}
|
24
nyx/flake/templates/node/shell.nix
Normal file
24
nyx/flake/templates/node/shell.nix
Normal 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
|
||||
'';
|
||||
})
|
1
nyx/flake/templates/node/src/index.ts
Normal file
1
nyx/flake/templates/node/src/index.ts
Normal file
|
@ -0,0 +1 @@
|
|||
console.log("Hello world!");
|
16
nyx/flake/templates/node/tsconfig.json
Normal file
16
nyx/flake/templates/node/tsconfig.json
Normal 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
|
||||
}
|
||||
}
|
1
nyx/flake/templates/python/.envrc
Normal file
1
nyx/flake/templates/python/.envrc
Normal file
|
@ -0,0 +1 @@
|
|||
use flake . --builders ""
|
24
nyx/flake/templates/python/default.nix
Normal file
24
nyx/flake/templates/python/default.nix
Normal 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
|
||||
'';
|
||||
}
|
26
nyx/flake/templates/python/flake.nix
Normal file
26
nyx/flake/templates/python/flake.nix
Normal 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;
|
||||
};
|
||||
}
|
13
nyx/flake/templates/python/shell.nix
Normal file
13
nyx/flake/templates/python/shell.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
callPackage,
|
||||
mkShellNoCC,
|
||||
python3,
|
||||
...
|
||||
}: let
|
||||
defaultPackage = callPackage ./default.nix;
|
||||
in
|
||||
mkShellNoCC {
|
||||
packages = [
|
||||
(python3.withPackages defaultPackage.propagatedBuildInputs)
|
||||
];
|
||||
}
|
5
nyx/flake/templates/rust/Cargo.toml
Normal file
5
nyx/flake/templates/rust/Cargo.toml
Normal file
|
@ -0,0 +1,5 @@
|
|||
[package]
|
||||
name = "sample-rust"
|
||||
version = "0.0.1"
|
||||
license = "MIT"
|
||||
edition = "2021"
|
8
nyx/flake/templates/rust/default.nix
Normal file
8
nyx/flake/templates/rust/default.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
{rustPlatform}:
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = "sample-rust";
|
||||
version = "0.0.1";
|
||||
|
||||
src = ./.;
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
}
|
26
nyx/flake/templates/rust/flake.nix
Normal file
26
nyx/flake/templates/rust/flake.nix
Normal 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;
|
||||
};
|
||||
}
|
20
nyx/flake/templates/rust/shell.nix
Normal file
20
nyx/flake/templates/rust/shell.nix
Normal 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 []);
|
||||
})
|
3
nyx/flake/templates/rust/src/main.rs
Normal file
3
nyx/flake/templates/rust/src/main.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue