templates: init
This commit is contained in:
parent
4ffa6a63e2
commit
cab19ec5ca
4 changed files with 46 additions and 0 deletions
|
@ -211,6 +211,7 @@
|
|||
imports = [
|
||||
./pkgs
|
||||
./shell
|
||||
./templates
|
||||
inputs.devshell.flakeModule
|
||||
inputs.treefmt-nix.flakeModule
|
||||
];
|
||||
|
|
15
templates/default.nix
Normal file
15
templates/default.nix
Normal 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
1
templates/default/.envrc
Normal file
|
@ -0,0 +1 @@
|
|||
use flake
|
29
templates/default/flake.nix
Normal file
29
templates/default/flake.nix
Normal 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; [ ];
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue