Init repo

This commit is contained in:
clerie 2024-03-14 19:17:47 +01:00
commit bc8bc281ab
7 changed files with 113 additions and 0 deletions

5
README.md Normal file
View File

@ -0,0 +1,5 @@
# flake-templates
A collection of templates for software projects I regularly use.
See `flake.nix` and directories for available templates.

18
flake.nix Normal file
View File

@ -0,0 +1,18 @@
{
outputs = { ... }: {
templates = {
pyproject = {
path = ./pyproject;
description = "Python project with pyproject.toml";
};
pyscript = {
path = ./pyscript;
description = "Simple python script as application";
};
rust = {
path = ./rust;
description = "Rust cargo project";
};
};
};
}

2
pyproject/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
__pycache__
result

33
pyproject/flake.nix Normal file
View File

@ -0,0 +1,33 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs, ... }: {
packages.x86_64-linux = let
pkgs = import nixpkgs {
system = "x86_64-linux";
};
in {
my_project = pkgs.python311Packages.buildPythonPackage rec {
pname = "my_project";
version = "0.0.1";
src = ./.;
format = "pyproject";
buildInputs = [ pkgs.python311Packages.hatchling ];
propagatedBuildInputs = with pkgs.python311Packages; [
];
pythonImportsCheck = [ "my_project" ];
};
default = self.packages.x86_64-linux.my_project;
};
hydraJobs = {
inherit (self)
packages;
};
};
}

18
pyproject/pyproject.toml Normal file
View File

@ -0,0 +1,18 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "my_project"
version = "0.0.1"
authors = [
{ name="clerie", email="hallo@clerie.de" },
]
description = ""
readme = "README.md"
license = { file="LICENSE" }
requires-python = ">=3.11"
dependencies = [
]

2
pyscript/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
__pycache__
result

35
pyscript/flake.nix Normal file
View File

@ -0,0 +1,35 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs, ... }: {
packages.x86_64-linux = let
pkgs = import nixpkgs {
system = "x86_64-linux";
};
in {
my_project = pkgs.python311Packages.buildPythonPackage rec {
pname = "my_project";
version = "0.0.1";
src = ./.;
format = "other";
propagatedBuildInputs = with pkgs.python311Packages; [
];
installPhase = ''
mkdir -p $out/bin
cp my_project.py $out/bin/my_project
'';
};
default = self.packages.x86_64-linux.my_project;
};
hydraJobs = {
inherit (self)
packages;
};
};
}