templates: init

This commit is contained in:
Infinidoge 2024-08-07 18:51:52 -04:00
parent 4ffa6a63e2
commit cab19ec5ca
Signed by: Infinidoge
SSH key fingerprint: SHA256:GT2StvPQMMfFHyiiFJymQxfTG/z6EWLJ6NWItf5K5sA
4 changed files with 46 additions and 0 deletions

View file

@ -211,6 +211,7 @@
imports = [ imports = [
./pkgs ./pkgs
./shell ./shell
./templates
inputs.devshell.flakeModule inputs.devshell.flakeModule
inputs.treefmt-nix.flakeModule inputs.treefmt-nix.flakeModule
]; ];

15
templates/default.nix Normal file
View file

@ -0,0 +1,15 @@
{ lib, ... }:
let
mkTemplate = name:
let
path = ./. + "/${name}";
flake = import (path + "/flake.nix");
in
{ inherit path; }
// lib.optionalAttrs (flake ? description) { inherit (flake) description; };
templates = lib.attrNames (lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./.));
in
{
flake.templates = lib.genAttrs templates mkTemplate;
}

1
templates/default/.envrc Normal file
View file

@ -0,0 +1 @@
use flake

View file

@ -0,0 +1,29 @@
{
description = "My standard flake-parts devshell template";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
devshell.url = "github:numtide/devshell";
devshell.inputs.nixpkgs.follows = "nixpkgs";
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
};
outputs = inputs: inputs.flake-parts.lib.mkFlake ({ ... }: {
systems = [ "x86_64-linux" ];
imports = with inputs; [
devshell.flakeModule
];
perSystem = { pkgs, ... }: {
devshells.default.devshell = {
name = "template";
motd = "";
packages = with pkgs; [ ];
};
};
});
}