add basic nix flake template

This commit is contained in:
Noah Masur 2022-08-07 12:52:00 -06:00
parent e9fef7dbbb
commit 79f8e621e6
4 changed files with 51 additions and 0 deletions

View File

@ -85,6 +85,10 @@
# Templates for starting other projects quickly
templates = {
basic = {
path = ./templates/basic;
description = "Basic program template";
};
poetry = {
path = ./templates/poetry;
description = "Poetry template";

1
templates/basic/.envrc Normal file
View File

@ -0,0 +1 @@
use flake

View File

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1659803779,
"narHash": "sha256-+5zkHlbcbFyN5f3buO1RAZ9pH1wXLxCesUJ0vFmLr9Y=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "f44884060cb94240efbe55620f38a8ec8d9af601",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

19
templates/basic/flake.nix Normal file
View File

@ -0,0 +1,19 @@
{
description = "Basic project";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }:
let
forAllSystems = nixpkgs.lib.genAttrs [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
in {
devShells = forAllSystems (system:
let pkgs = import nixpkgs { inherit system; };
in {
default = pkgs.mkShell { buildInputs = with pkgs; [ nixfmt ]; };
});
};
}