Skip to content

Commit

Permalink
feat(templates): Auto-expose all dirs under templates/ as flake out…
Browse files Browse the repository at this point in the history
…puts
  • Loading branch information
PetarKirov committed Mar 3, 2024
1 parent 7b50988 commit 0ac0606
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
19 changes: 13 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,18 @@
devShells.ci = import ./shells/ci.nix {inherit pkgs;};
};

flake.templates = {
macos-aarch64-devshell-for-dmd = {
path = ./templates/macos-aarch64-devshell-with-dmd;
description = "A minimal x86_64-darwin devshell that allows running dmd on Apple Silicon macOS";
};
};
flake.templates = let
lib = nixpkgs.lib;
allTemplates = lib.pipe (builtins.readDir ./templates) [
(lib.filterAttrs (k: v: v == "directory"))
(builtins.mapAttrs (k: v: rec {
path = ./templates + "/${k}";
description = lib.removeSuffix "\n" (
builtins.readFile (path + "/description.txt")
);
}))
];
in
allTemplates;
};
}
1 change: 1 addition & 0 deletions templates/devshell/description.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Flake Parts-style minimal flak containing devshell with ldc and dub
1 change: 1 addition & 0 deletions templates/macos-aarch64-devshell-with-dmd/description.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A minimal x86_64-darwin devshell that allows running dmd on Apple Silicon macOS
1 change: 1 addition & 0 deletions templates/pre-flake-devshell/description.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A minimal devshell showcasing usage with classic Nix (pre-flakes)

0 comments on commit 0ac0606

Please sign in to comment.