mirror of
https://github.com/the-nix-way/dev-templates
synced 2024-05-08 02:26:13 +02:00
Streamline scripts again
This commit is contained in:
parent
5ba1e69d91
commit
a35fa248d8
121
flake.nix
121
flake.nix
|
@ -6,78 +6,73 @@
|
|||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
overlays = [
|
||||
(final: prev: {
|
||||
format = final.writeShellApplication {
|
||||
name = "format";
|
||||
runtimeInputs = with final; [ nixpkgs-fmt ];
|
||||
text = "nixpkgs-fmt '**/*.nix'";
|
||||
};
|
||||
|
||||
# only run this locally, as Actions will run out of disk space
|
||||
build = final.writeShellApplication {
|
||||
name = "build";
|
||||
text = ''
|
||||
SYSTEM=$(nix eval --impure --raw --expr 'builtins.currentSystem')
|
||||
|
||||
for dir in */; do # Iterate through all the templates
|
||||
(final: prev:
|
||||
let
|
||||
getSystem = "SYSTEM=$(nix eval --impure --raw --expr 'builtins.currentSystem')";
|
||||
forEachDir = exec: ''
|
||||
for dir in */; do
|
||||
(
|
||||
cd "''${dir}"
|
||||
|
||||
${exec}
|
||||
)
|
||||
done
|
||||
'';
|
||||
in
|
||||
{
|
||||
format = final.writeShellApplication {
|
||||
name = "format";
|
||||
runtimeInputs = with final; [ nixpkgs-fmt ];
|
||||
text = "nixpkgs-fmt '**/*.nix'";
|
||||
};
|
||||
|
||||
# only run this locally, as Actions will run out of disk space
|
||||
build = final.writeShellApplication {
|
||||
name = "build";
|
||||
text = ''
|
||||
${getSystem}
|
||||
|
||||
${forEachDir ''
|
||||
echo "building ''${dir}"
|
||||
nix build ".#devShells.''${SYSTEM}.default"
|
||||
)
|
||||
done
|
||||
'';
|
||||
};
|
||||
''}
|
||||
'';
|
||||
};
|
||||
|
||||
check = final.writeShellApplication {
|
||||
name = "check";
|
||||
text = ''
|
||||
for dir in */; do # Iterate through all the templates
|
||||
(
|
||||
cd "''${dir}"
|
||||
check = final.writeShellApplication {
|
||||
name = "check";
|
||||
text = forEachDir ''
|
||||
echo "checking ''${dir}"
|
||||
nix flake check --all-systems --no-build
|
||||
'';
|
||||
};
|
||||
|
||||
echo "checking ''${dir}"
|
||||
nix flake check --all-systems --no-build
|
||||
)
|
||||
done
|
||||
'';
|
||||
};
|
||||
dvt = final.writeShellApplication {
|
||||
name = "dvt";
|
||||
text = ''
|
||||
if [ -z $1 ]; then
|
||||
echo "no template specified"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dvt = final.writeShellApplication {
|
||||
name = "dvt";
|
||||
text = ''
|
||||
if [ -z $1 ]; then
|
||||
echo "no template specified"
|
||||
exit 1
|
||||
fi
|
||||
TEMPLATE=$1
|
||||
|
||||
TEMPLATE=$1
|
||||
nix \
|
||||
--experimental-features 'nix-command flakes' \
|
||||
flake init \
|
||||
--template \
|
||||
"github:the-nix-way/dev-templates#''${TEMPLATE}"
|
||||
'';
|
||||
};
|
||||
|
||||
nix \
|
||||
--experimental-features 'nix-command flakes' \
|
||||
flake init \
|
||||
--template \
|
||||
"github:the-nix-way/dev-templates#''${TEMPLATE}"
|
||||
'';
|
||||
};
|
||||
|
||||
update = final.writeShellApplication {
|
||||
name = "update";
|
||||
text = ''
|
||||
for dir in */; do # Iterate through all the templates
|
||||
(
|
||||
cd "''${dir}"
|
||||
|
||||
echo "updating ''${dir}"
|
||||
nix flake update
|
||||
|
||||
echo "checking ''${dir}"
|
||||
nix flake check --all-systems --no-build
|
||||
)
|
||||
done
|
||||
'';
|
||||
};
|
||||
})
|
||||
update = final.writeShellApplication {
|
||||
name = "update";
|
||||
text = forEachDir ''
|
||||
echo "updating ''${dir}"
|
||||
nix flake update
|
||||
'';
|
||||
};
|
||||
})
|
||||
];
|
||||
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
||||
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
|
||||
|
|
Loading…
Reference in New Issue