summaryrefslogtreecommitdiff
path: root/templates/basic/flake.nix
diff options
context:
space:
mode:
authorseth <[email protected]>2023-08-24 07:48:57 -0400
committerseth <[email protected]>2023-08-24 07:48:57 -0400
commitd266cbb1844959961e7aa12a9b979d8676d14e98 (patch)
tree901f6f73ec4b459c756e8308e3133e043132cecc /templates/basic/flake.nix
parent71878eeef2a3579609142d4f4bf50b497b5acb5e (diff)
templates/basic: simplify functions
Diffstat (limited to 'templates/basic/flake.nix')
-rw-r--r--templates/basic/flake.nix23
1 files changed, 8 insertions, 15 deletions
diff --git a/templates/basic/flake.nix b/templates/basic/flake.nix
index 00ec696..32fd25b 100644
--- a/templates/basic/flake.nix
+++ b/templates/basic/flake.nix
@@ -10,7 +10,7 @@
nixpkgs,
...
}: let
- version = builtins.substring 0 8 self.lastModifiedDate;
+ version = builtins.substring 0 8 self.lastModifiedDate or "dirty";
systems = [
"x86_64-linux"
@@ -19,33 +19,26 @@
"aarch64-darwin"
];
- forAllSystems = nixpkgs.lib.genAttrs systems;
- nixpkgsFor = forAllSystems (system:
+ genSystems = nixpkgs.lib.genAttrs systems;
+ nixpkgsFor = genSystems (system:
import nixpkgs {
inherit system;
overlays = [self.overlays.default];
});
- forEachSystem = fn:
- forAllSystems (system:
- fn {
- inherit system;
- pkgs = nixpkgsFor.${system};
- });
+ forAllSystems = fn: genSystems (sys: fn nixpkgsFor.${sys});
in {
- devShells = forEachSystem ({pkgs, ...}: let
- inherit (pkgs) mkShell;
- in {
- default = mkShell {
+ devShells = forAllSystems (pkgs: {
+ default = pkgs.mkShell {
packages = with pkgs; [
bash
];
};
});
- formatter = forEachSystem ({pkgs, ...}: pkgs.alejandra);
+ formatter = forAllSystems (p: p.alejandra);
- packages = forEachSystem ({pkgs, ...}: {
+ packages = forAllSystems (pkgs: {
inherit (pkgs) hello;
default = pkgs.hello;
});