templates: initial templates config

This commit is contained in:
ooks-io 2024-11-19 11:26:21 +11:00
parent ecbb5c8700
commit 151da369a0
10 changed files with 113 additions and 0 deletions

View file

@ -8,5 +8,6 @@
./pkgs
./images.nix
./devshells
./templates
];
}

View file

@ -0,0 +1,15 @@
{
description = "Description for the project";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default-linux";
};
outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = import inputs.systems;
imports = [./outputs];
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./shell.nix
./pkgs.nix
];
}

View file

@ -0,0 +1,18 @@
{self, ...}: {
perSystem = {
pkgs,
self',
...
}: {
packages.default = pkgs.stdenvNoCC.mkDerivation {
pname = "my package";
version = "0.1.0";
src = "${self}/src";
nativeBuildInputs = [];
buildPhase = "";
dontInstall = true;
};
apps.default = self'.packages.default;
};
}

View file

@ -0,0 +1,10 @@
{
perSystem = {pkgs, ...}: {
devShells.default = pkgs.mkShellNoCC {
name = "project devshell";
packages =
builtins.attrValues {
};
};
};
}

View file

@ -0,0 +1,12 @@
{
flake.templates = {
default = {
path = ./basic;
description = "Default project template";
};
go = {
path = ./go;
description = "Basic go template";
};
};
}

View file

@ -0,0 +1,15 @@
{
description = "Description for the project";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default-linux";
};
outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = import inputs.systems;
imports = [./outputs];
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./shell.nix
./pkgs.nix
];
}

View file

@ -0,0 +1,20 @@
{self, ...}: {
perSystem = {
pkgs,
self',
lib,
...
}: {
packages.default = pkgs.buildGoModule {
pname = "hello";
version = "0.0.1";
src = "${self}/src";
meta.mainProgram = "hello";
vendorHash = null;
};
apps.default = {
type = "app";
program = "${lib.getExe self'.packages.default}";
};
};
}

View file

@ -0,0 +1,10 @@
{
perSystem = {pkgs, ...}: {
devShells.default = pkgs.mkShellNoCC {
name = "project devshell";
packages = builtins.attrValues {
inherit (pkgs) go gopls gotools go-tools;
};
};
};
}