Add template scaffolding
This commit is contained in:
commit
1f31615620
10 changed files with 205 additions and 0 deletions
2
.envrc.recommended
Normal file
2
.envrc.recommended
Normal file
|
@ -0,0 +1,2 @@
|
|||
use flake
|
||||
dotenv_if_exists
|
5
.forgejo/default_merge_message/MERGE_TEMPLATE.md
Normal file
5
.forgejo/default_merge_message/MERGE_TEMPLATE.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
#${PullRequestIndex} ${PullRequestTitle}
|
||||
|
||||
${PullRequestDescription}
|
||||
|
||||
Reviewed-on: https://patagia.dev/${BaseRepoOwnerName}/${BaseRepoName}/pulls/${PullRequestIndex}
|
5
.forgejo/default_merge_message/REBASE_TEMPLATE.md
Normal file
5
.forgejo/default_merge_message/REBASE_TEMPLATE.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
#${PullRequestIndex} ${PullRequestTitle}
|
||||
|
||||
${PullRequestDescription}
|
||||
|
||||
Reviewed-on: https://patagia.dev/${BaseRepoOwnerName}/${BaseRepoName}/pulls/${PullRequestIndex}
|
5
.forgejo/default_merge_message/SQUASH_TEMPLATE.md
Normal file
5
.forgejo/default_merge_message/SQUASH_TEMPLATE.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
#${PullRequestIndex} ${PullRequestTitle}
|
||||
|
||||
${PullRequestDescription}
|
||||
|
||||
Reviewed-on: https://patagia.dev/${BaseRepoOwnerName}/${BaseRepoName}/pulls/${PullRequestIndex}
|
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
.direnv
|
||||
.env
|
||||
.envrc
|
||||
.git
|
||||
result*
|
33
.woodpecker/ci.yaml
Normal file
33
.woodpecker/ci.yaml
Normal file
|
@ -0,0 +1,33 @@
|
|||
when:
|
||||
- event: pull_request
|
||||
- event: push
|
||||
branch:
|
||||
- ${CI_REPO_DEFAULT_BRANCH}
|
||||
|
||||
steps:
|
||||
check:
|
||||
image: alpine
|
||||
volumes:
|
||||
- nix:/nix
|
||||
commands:
|
||||
# install nix
|
||||
- |
|
||||
test -f /nix/installer || wget -O /nix/installer https://github.com/DeterminateSystems/nix-installer/releases/download/v0.18.0/nix-installer-x86_64-linux
|
||||
chmod +x /nix/installer
|
||||
rm -f /nix/receipt.json /nix/nix-installer
|
||||
/nix/installer install linux --init=none --no-confirm
|
||||
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
||||
|
||||
# configure nix
|
||||
- |
|
||||
mkdir -p /etc/nix
|
||||
cat <<EOF > /etc/nix/nix.conf
|
||||
sandbox = false
|
||||
experimental-features = nix-command flakes
|
||||
EOF
|
||||
|
||||
# build
|
||||
- nix build .
|
||||
|
||||
# check
|
||||
- nix flake check
|
1
README.md
Normal file
1
README.md
Normal file
|
@ -0,0 +1 @@
|
|||
# My Project
|
61
flake.lock
Normal file
61
flake.lock
Normal file
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1726560853,
|
||||
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1726969270,
|
||||
"narHash": "sha256-8fnFlXBgM/uSvBlLWjZ0Z0sOdRBesyNdH0+esxqizGc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "23cbb250f3bf4f516a2d0bf03c51a30900848075",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-24.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
60
flake.nix
Normal file
60
flake.nix
Normal file
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
description = "My Project";
|
||||
|
||||
inputs = {
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
flake-utils,
|
||||
nixpkgs,
|
||||
...
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
in
|
||||
{
|
||||
# Formatter for the Nix code
|
||||
formatter = pkgs.nixpkgs-fmt;
|
||||
|
||||
# Checks/tests for the project
|
||||
checks = {
|
||||
# FIXME: Add actual tests
|
||||
simple-test = pkgs.runCommand "simple-test" { } ''
|
||||
${self.packages.${system}.default}/bin/my-program
|
||||
touch $out
|
||||
'';
|
||||
};
|
||||
|
||||
# Packages
|
||||
packages = {
|
||||
my-program = pkgs.writeShellScriptBin "my-program" ''
|
||||
${pkgs.ddate}/bin/ddate +'Hello, world! Today is the %e of %B%, %Y' |
|
||||
${pkgs.cowsay}/bin/cowsay
|
||||
'';
|
||||
|
||||
default = self.packages.${system}.my-program;
|
||||
};
|
||||
|
||||
# Development shell
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
just
|
||||
watchexec
|
||||
];
|
||||
shellHook = ''
|
||||
echo
|
||||
echo "✨ Welcome to the My Project development environment! ✨"
|
||||
echo "Run 'just' to see available commands."
|
||||
echo
|
||||
'';
|
||||
};
|
||||
|
||||
}
|
||||
);
|
||||
}
|
28
justfile
Normal file
28
justfile
Normal file
|
@ -0,0 +1,28 @@
|
|||
set shell := ["/usr/bin/env", "bash", "-euo", "pipefail", "-c"]
|
||||
|
||||
[private]
|
||||
default:
|
||||
@just --choose
|
||||
|
||||
# Run all tests
|
||||
test:
|
||||
nix flake check
|
||||
|
||||
# Lint all source code
|
||||
lint:
|
||||
echo FIXME: Add linter(s) here
|
||||
|
||||
# Format all source code
|
||||
fmt:
|
||||
echo FIXME: Add formatter here
|
||||
|
||||
# Update all dependencies
|
||||
update: update-nix-pkgs
|
||||
|
||||
# Update nix flake packages
|
||||
update-nix-pkgs:
|
||||
nix flake update
|
||||
|
||||
# Run local development
|
||||
dev $OTEL_SERVICE_NAME="my-project":
|
||||
watchexec --clear --restart --stop-signal INT --debounce 300ms -- nix run .
|
Loading…
Reference in a new issue