summaryrefslogtreecommitdiff
path: root/templates/full/nix/packages.nix
diff options
context:
space:
mode:
authorseth <[email protected]>2023-09-24 14:24:05 -0400
committerseth <[email protected]>2023-09-24 14:24:05 -0400
commit9b912d435520c1f0cc952c46a2c75100457cc245 (patch)
treeb4c0646d7539c63b1a24dd06d66d1797204b88c3 /templates/full/nix/packages.nix
parent0f7848c8a6936bc80b043b2d2308ef0d85633b13 (diff)
templates/final: use slightly better practices
Diffstat (limited to 'templates/full/nix/packages.nix')
-rw-r--r--templates/full/nix/packages.nix24
1 files changed, 24 insertions, 0 deletions
diff --git a/templates/full/nix/packages.nix b/templates/full/nix/packages.nix
new file mode 100644
index 0000000..8b23ea7
--- /dev/null
+++ b/templates/full/nix/packages.nix
@@ -0,0 +1,24 @@
+{self, ...}: {
+ flake.overlays.default = _: prev: {
+ foo = prev.callPackage ./derivation.nix {inherit self;};
+ };
+
+ perSystem = {
+ lib,
+ pkgs,
+ ...
+ }: {
+ package = let
+ fixup = lib.filterAttrs (
+ _: v:
+ builtins.elem (v.meta.platforms or []) && !(v.meta.broken or false)
+ );
+
+ unfiltered = lib.fix (final: self.overlays.default final pkgs);
+ pkgs' = fixup unfiltered;
+ in {
+ inherit (pkgs') foo;
+ default = pkgs'.foo;
+ };
+ };
+}