diff options
Diffstat (limited to 'templates/basic/flake.nix')
| -rw-r--r-- | templates/basic/flake.nix | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/templates/basic/flake.nix b/templates/basic/flake.nix index 2c638b2..00ec696 100644 --- a/templates/basic/flake.nix +++ b/templates/basic/flake.nix @@ -26,23 +26,42 @@ overlays = [self.overlays.default]; }); - packageFn = pkgs: let - inherit (pkgs.lib) licenses maintainers platforms; + forEachSystem = fn: + forAllSystems (system: + fn { + inherit system; + pkgs = nixpkgsFor.${system}; + }); + in { + devShells = forEachSystem ({pkgs, ...}: let + inherit (pkgs) mkShell; in { - hello = pkgs.stdenv.mkDerivation rec { + default = mkShell { + packages = with pkgs; [ + bash + ]; + }; + }); + + formatter = forEachSystem ({pkgs, ...}: pkgs.alejandra); + + packages = forEachSystem ({pkgs, ...}: { + inherit (pkgs) hello; + default = pkgs.hello; + }); + + overlays.default = _: prev: { + hello = prev.stdenv.mkDerivation { pname = "hello"; inherit version; - src = builtins.path { - name = "${pname}-src"; - path = ./.; - }; + src = self; installPhase = '' echo "hi" > $out ''; - meta = { + meta = with prev.lib; { description = ""; homepage = ""; license = licenses.mit; @@ -51,25 +70,5 @@ }; }; }; - in { - devShells = forAllSystems (s: let - pkgs = nixpkgsFor.${s}; - inherit (pkgs) mkShell; - in { - default = mkShell { - packages = with pkgs; [ - bash - ]; - }; - }); - - formatter = forAllSystems (s: nixpkgsFor.${s}.alejandra); - - packages = forAllSystems (s: rec { - inherit (nixpkgsFor.${s}) hello; - default = hello; - }); - - overlays.default = final: _: packageFn final; }; } |
