From 33a090a73d89fddeac4bf5ad9398f0149a052569 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Thu, 1 Sep 2022 22:46:55 +0800 Subject: [PATCH] templates/basic-overlay-flake: improve and format template --- templates/basic-overlay-flake/flake.nix | 27 +++++++++++++++++++------ templates/basic-overlay-flake/shell.nix | 7 ++++++- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/templates/basic-overlay-flake/flake.nix b/templates/basic-overlay-flake/flake.nix index 7258f53d..c07b13ad 100644 --- a/templates/basic-overlay-flake/flake.nix +++ b/templates/basic-overlay-flake/flake.nix @@ -1,6 +1,6 @@ { description = '' - Basic flake template for an overlay with flake and traditional channels. + Basic flake template for an overlay with flake. ''; inputs = { @@ -9,9 +9,24 @@ }; outputs = inputs@{ self, nixpkgs, ... }: - let systems = inputs.flake-utils.lib.defaultSystems; - in inputs.flake-utils.lib.eachSystem systems (system: { - devShells.default = - import ./shell.nix { pkgs = import nixpkgs { inherit system; }; }; - }); + let + inherit (inputs.flake-utils.lib) defaultSystems eachSystem flattenTree; + in + eachSystem defaultSystems + (system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + devShells.default = + import ./shell.nix { inherit pkgs; }; + + formatter = pkgs.nixpkgs-fmt; + + packages = flattenTree (self.overlays.default pkgs pkgs); + }) // { + overlays.default = final: prev: import ./pkgs { pkgs = prev; }; + + nixosModules = {}; + }; } diff --git a/templates/basic-overlay-flake/shell.nix b/templates/basic-overlay-flake/shell.nix index eb0d07c6..212ccd0c 100644 --- a/templates/basic-overlay-flake/shell.nix +++ b/templates/basic-overlay-flake/shell.nix @@ -2,4 +2,9 @@ with pkgs; -mkShell { packages = [ ]; } +mkShell { + packages = [ + rnix-lsp + nixpkgs-fmt + ]; +}