From 27a9c23600f989c0418b51c26d56c262dd234d20 Mon Sep 17 00:00:00 2001 From: jolheiser Date: Wed, 16 Aug 2023 22:27:04 -0500 Subject: [PATCH] feat: devflake Signed-off-by: jolheiser --- LICENSE | 2 +- README.md | 4 ++-- template/.tmplkeep | 1 - template/flake.nix | 25 +++++++++++++++++++++++++ tmpl.yaml | 15 ++++++--------- 5 files changed, 34 insertions(+), 13 deletions(-) delete mode 100644 template/.tmplkeep create mode 100644 template/flake.nix diff --git a/LICENSE b/LICENSE index c46b0ca..56f09ee 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2020 John Olheiser +Copyright (c) 2023 John Olheiser Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 4b65cbd..f20cea8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# tmpl templates +# devflake -Check out the various branches for some basic examples of templates. +Create a simple `flake.nix` for `nix develop` ## License diff --git a/template/.tmplkeep b/template/.tmplkeep deleted file mode 100644 index b4bd1aa..0000000 --- a/template/.tmplkeep +++ /dev/null @@ -1 +0,0 @@ -Delete this file and put something else here! \ No newline at end of file diff --git a/template/flake.nix b/template/flake.nix new file mode 100644 index 0000000..435bab0 --- /dev/null +++ b/template/flake.nix @@ -0,0 +1,25 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs{{if unstable}}/nixpkgs-unstable{{end}}"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { + self, + flake-utils, + nixpkgs, + }: + flake-utils.lib.eachDefaultSystem ( + system: let + pkgs = nixpkgs.legacyPackages.${system}; + in { + devShells.default = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + {{- range $pkg := (splitList "," packages)}} + {{trim $pkg}} + {{- end}} + ]; + }; + } + ); +} \ No newline at end of file diff --git a/tmpl.yaml b/tmpl.yaml index a259ff0..153d2c9 100644 --- a/tmpl.yaml +++ b/tmpl.yaml @@ -1,11 +1,8 @@ -# tmpl.yaml -# Write any template args here to prompt the user for, giving any defaults/options as applicable - prompts: - - id: name - label: Name - default: MyProject - - id: lang - label: Language - default: Go + - id: unstable + label: Use unstable + help: Blank for stable, non-blank for unstable + - id: packages + label: Packages + help: nixpkgs delimited by comma