repo: init
welcome 👋 to my world 🌍
This commit is contained in:
parent
531fc54f1f
commit
edcf6f758e
11 changed files with 134 additions and 2 deletions
13
LICENSE
Normal file
13
LICENSE
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||||
|
Version 2, December 2004
|
||||||
|
|
||||||
|
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim or modified
|
||||||
|
copies of this license document, and changing it is allowed as long
|
||||||
|
as the name is changed.
|
||||||
|
|
||||||
|
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. You just DO WHAT THE FUCK YOU WANT TO.
|
10
README.md
10
README.md
|
@ -1,3 +1,9 @@
|
||||||
# flake-template-hell
|
### Flake Templates
|
||||||
|
###### My templates I have created whenever I need to make a Nix flake for a project.
|
||||||
|
|
||||||
My flake templates, forAllSystems... and languages.
|
---
|
||||||
|
|
||||||
|
### Why?
|
||||||
|
|
||||||
|
This is just a handy timesaver that I can use whenever I need to make some project and repo.
|
||||||
|
It also may be handy for those that need to borrow a flake template for their own project and repo.
|
||||||
|
|
12
flake.nix
Normal file
12
flake.nix
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
description = "Flake Template Hell";
|
||||||
|
|
||||||
|
outputs = _: {
|
||||||
|
templates = {
|
||||||
|
"python" = {
|
||||||
|
path = ./templates/python;
|
||||||
|
description = "python flake template";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
1
templates/python/.gitignore
vendored
Normal file
1
templates/python/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
**/result
|
1
templates/python/README
Normal file
1
templates/python/README
Normal file
|
@ -0,0 +1 @@
|
||||||
|
remember to change python-app to whatever you please!
|
27
templates/python/flake.lock
generated
Normal file
27
templates/python/flake.lock
generated
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1722987190,
|
||||||
|
"narHash": "sha256-68hmex5efCiM2aZlAAEcQgmFI4ZwWt8a80vOeB/5w3A=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "21cc704b5e918c5fbf4f9fff22b4ac2681706d90",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-24.05",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
26
templates/python/flake.nix
Normal file
26
templates/python/flake.nix
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
description = "Python flake";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs }:
|
||||||
|
let
|
||||||
|
systems = [ "x86_64-linux" "aarch64-linux" ];
|
||||||
|
forAllSystems = nixpkgs.lib.genAttrs systems;
|
||||||
|
pkgsForEach = nixpkgs.legacyPackages;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
packages = forAllSystems (system: {
|
||||||
|
default = pkgsForEach.${system}.callPackage ./nix/package.nix { };
|
||||||
|
python-app = self.packages.${system}.default;
|
||||||
|
});
|
||||||
|
|
||||||
|
devShells = forAllSystems (system: {
|
||||||
|
default = pkgsForEach.${system}.callPackage ./nix/shell.nix {
|
||||||
|
inherit (self.packages.${system}) python-app;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
16
templates/python/nix/package.nix
Normal file
16
templates/python/nix/package.nix
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{ python3Packages }:
|
||||||
|
let
|
||||||
|
pname = "python-app";
|
||||||
|
version = "0.1.0";
|
||||||
|
inherit (python3Packages)
|
||||||
|
buildPythonApplication
|
||||||
|
flask
|
||||||
|
;
|
||||||
|
in
|
||||||
|
buildPythonApplication {
|
||||||
|
inherit pname version;
|
||||||
|
propagatedBuildInputs = [
|
||||||
|
flask
|
||||||
|
];
|
||||||
|
src = ../${pname};
|
||||||
|
}
|
8
templates/python/nix/shell.nix
Normal file
8
templates/python/nix/shell.nix
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{ mkShell, python-app, python312Packages }:
|
||||||
|
mkShell {
|
||||||
|
inputsFrom = [ python-app ];
|
||||||
|
nativeBuildInputs = [
|
||||||
|
python312Packages.ruff-lsp
|
||||||
|
python312Packages.ruff
|
||||||
|
];
|
||||||
|
}
|
11
templates/python/python-app/python-app
Normal file
11
templates/python/python-app/python-app
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
from flask import Flask
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
@app.route('/')
|
||||||
|
def hello_world():
|
||||||
|
return 'Hello, World!'
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app.run(host="0.0.0.0", port=8080)
|
11
templates/python/python-app/setup.py
Normal file
11
templates/python/python-app/setup.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
|
setup(name='python-app',
|
||||||
|
version='0.1.0',
|
||||||
|
# Modules to import from other scripts:
|
||||||
|
packages=find_packages(),
|
||||||
|
# Executables
|
||||||
|
scripts=["python-app"],
|
||||||
|
)
|
Loading…
Add table
Add a link
Reference in a new issue