templates: initial templates config
This commit is contained in:
parent
ecbb5c8700
commit
151da369a0
10 changed files with 113 additions and 0 deletions
|
|
@ -8,5 +8,6 @@
|
|||
./pkgs
|
||||
./images.nix
|
||||
./devshells
|
||||
./templates
|
||||
];
|
||||
}
|
||||
|
|
|
|||
15
outputs/templates/basic/flake.nix
Normal file
15
outputs/templates/basic/flake.nix
Normal 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];
|
||||
};
|
||||
}
|
||||
6
outputs/templates/basic/outputs/default.nix
Normal file
6
outputs/templates/basic/outputs/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./shell.nix
|
||||
./pkgs.nix
|
||||
];
|
||||
}
|
||||
18
outputs/templates/basic/outputs/pkgs.nix
Normal file
18
outputs/templates/basic/outputs/pkgs.nix
Normal 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;
|
||||
};
|
||||
}
|
||||
10
outputs/templates/basic/outputs/shell.nix
Normal file
10
outputs/templates/basic/outputs/shell.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
perSystem = {pkgs, ...}: {
|
||||
devShells.default = pkgs.mkShellNoCC {
|
||||
name = "project devshell";
|
||||
packages =
|
||||
builtins.attrValues {
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
12
outputs/templates/default.nix
Normal file
12
outputs/templates/default.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
flake.templates = {
|
||||
default = {
|
||||
path = ./basic;
|
||||
description = "Default project template";
|
||||
};
|
||||
go = {
|
||||
path = ./go;
|
||||
description = "Basic go template";
|
||||
};
|
||||
};
|
||||
}
|
||||
15
outputs/templates/go/flake.nix
Normal file
15
outputs/templates/go/flake.nix
Normal 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];
|
||||
};
|
||||
}
|
||||
6
outputs/templates/go/outputs/default.nix
Normal file
6
outputs/templates/go/outputs/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./shell.nix
|
||||
./pkgs.nix
|
||||
];
|
||||
}
|
||||
20
outputs/templates/go/outputs/pkgs.nix
Normal file
20
outputs/templates/go/outputs/pkgs.nix
Normal 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}";
|
||||
};
|
||||
};
|
||||
}
|
||||
10
outputs/templates/go/outputs/shell.nix
Normal file
10
outputs/templates/go/outputs/shell.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
perSystem = {pkgs, ...}: {
|
||||
devShells.default = pkgs.mkShellNoCC {
|
||||
name = "project devshell";
|
||||
packages = builtins.attrValues {
|
||||
inherit (pkgs) go gopls gotools go-tools;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue