From 79f8e621e601661c87aad0c42225afd1d5e3b60b Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Sun, 7 Aug 2022 12:52:00 -0600 Subject: [PATCH] add basic nix flake template --- flake.nix | 4 ++++ templates/basic/.envrc | 1 + templates/basic/flake.lock | 27 +++++++++++++++++++++++++++ templates/basic/flake.nix | 19 +++++++++++++++++++ 4 files changed, 51 insertions(+) create mode 100644 templates/basic/.envrc create mode 100644 templates/basic/flake.lock create mode 100644 templates/basic/flake.nix diff --git a/flake.nix b/flake.nix index db2d00c..e5477e4 100644 --- a/flake.nix +++ b/flake.nix @@ -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"; diff --git a/templates/basic/.envrc b/templates/basic/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/templates/basic/.envrc @@ -0,0 +1 @@ +use flake diff --git a/templates/basic/flake.lock b/templates/basic/flake.lock new file mode 100644 index 0000000..0adf65d --- /dev/null +++ b/templates/basic/flake.lock @@ -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 +} diff --git a/templates/basic/flake.nix b/templates/basic/flake.nix new file mode 100644 index 0000000..edfb050 --- /dev/null +++ b/templates/basic/flake.nix @@ -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 ]; }; + }); + }; +}