Put templates on top of main flake
This commit is contained in:
parent
0ba5e5f50a
commit
43df5c9b0b
92
flake.nix
92
flake.nix
|
@ -8,52 +8,7 @@
|
|||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
inherit (pkgs) mkShell writeScriptBin;
|
||||
run = pkg: "${pkgs.${pkg}}/bin/${pkg}";
|
||||
|
||||
format = writeScriptBin "format" ''
|
||||
${run "nixfmt"} **/*.nix
|
||||
'';
|
||||
update = writeScriptBin "update" ''
|
||||
# Update root
|
||||
$${run "nix"} flake update
|
||||
|
||||
for dir in `ls -d */`; do # Iterate through all the templates
|
||||
(
|
||||
cd $dir
|
||||
${run "nix"} flake update # Update flake.lock
|
||||
${run "direnv"} reload # Make sure things work after the update
|
||||
)
|
||||
done
|
||||
'';
|
||||
|
||||
visit = writeScriptBin "visit" ''
|
||||
for dir in `ls -d */`; do
|
||||
(
|
||||
cd $dir
|
||||
${run "direnv"} reload
|
||||
)
|
||||
done
|
||||
'';
|
||||
in {
|
||||
devShells = {
|
||||
default = mkShell {
|
||||
buildInputs = [ format update visit ];
|
||||
};
|
||||
};
|
||||
}
|
||||
) // {
|
||||
lib = let
|
||||
pkgs = nixpkgs;
|
||||
inherit (pkgs.lib) optionals;
|
||||
inherit (pkgs.stdenv) isDarwin isLinux;
|
||||
in {
|
||||
inherit flake-utils nixpkgs;
|
||||
};
|
||||
|
||||
{
|
||||
templates = {
|
||||
cue = {
|
||||
path = ./cue;
|
||||
|
@ -155,5 +110,50 @@
|
|||
description = "Zig development environment";
|
||||
};
|
||||
};
|
||||
|
||||
lib = let
|
||||
pkgs = nixpkgs;
|
||||
inherit (pkgs.lib) optionals;
|
||||
inherit (pkgs.stdenv) isDarwin isLinux;
|
||||
in {
|
||||
inherit flake-utils nixpkgs;
|
||||
};
|
||||
} // flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
inherit (pkgs) mkShell writeScriptBin;
|
||||
run = pkg: "${pkgs.${pkg}}/bin/${pkg}";
|
||||
|
||||
format = writeScriptBin "format" ''
|
||||
${run "nixfmt"} **/*.nix
|
||||
'';
|
||||
update = writeScriptBin "update" ''
|
||||
# Update root
|
||||
$${run "nix"} flake update
|
||||
|
||||
for dir in `ls -d */`; do # Iterate through all the templates
|
||||
(
|
||||
cd $dir
|
||||
${run "nix"} flake update # Update flake.lock
|
||||
${run "direnv"} reload # Make sure things work after the update
|
||||
)
|
||||
done
|
||||
'';
|
||||
|
||||
visit = writeScriptBin "visit" ''
|
||||
for dir in `ls -d */`; do
|
||||
(
|
||||
cd $dir
|
||||
${run "direnv"} reload
|
||||
)
|
||||
done
|
||||
'';
|
||||
in {
|
||||
devShells = {
|
||||
default = mkShell {
|
||||
buildInputs = [ format update visit ];
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue