summaryrefslogtreecommitdiff
path: root/templates/full/nix/pkgs
diff options
context:
space:
mode:
authorseth <[email protected]>2023-08-24 07:49:07 -0400
committerseth <[email protected]>2023-08-24 07:49:07 -0400
commitfab63c5065d06e577dab7faec41a8365b80c48e4 (patch)
tree6ebe19664758903f0c6d2df619496c405de612cd /templates/full/nix/pkgs
parentd266cbb1844959961e7aa12a9b979d8676d14e98 (diff)
templates/full: improve layout
Diffstat (limited to 'templates/full/nix/pkgs')
-rw-r--r--templates/full/nix/pkgs/default.nix24
-rw-r--r--templates/full/nix/pkgs/hello.nix25
2 files changed, 49 insertions, 0 deletions
diff --git a/templates/full/nix/pkgs/default.nix b/templates/full/nix/pkgs/default.nix
new file mode 100644
index 0000000..2bc2a93
--- /dev/null
+++ b/templates/full/nix/pkgs/default.nix
@@ -0,0 +1,24 @@
+{
+ self,
+ inputs,
+ ...
+}: let
+ version = builtins.substring 0 8 self.lastModifiedDate or "dirty";
+
+ filterPkgs =
+ inputs.nixpkgs.lib.filterAttrs (_: v:
+ builtins.elem (v.meta.platforms or []) && !(v.meta.broken or false));
+
+ packageFn = pkgs: {
+ hello = pkgs.callpackage ./hello.nix {inherit self version;};
+ };
+in {
+ flake.overlays = _: prev: (packageFn prev);
+
+ perSystem = {pkgs, ...}: {
+ packages = let
+ p = filterPkgs (packageFn pkgs);
+ in
+ p // {default = p.hello;};
+ };
+}
diff --git a/templates/full/nix/pkgs/hello.nix b/templates/full/nix/pkgs/hello.nix
new file mode 100644
index 0000000..1e2ec12
--- /dev/null
+++ b/templates/full/nix/pkgs/hello.nix
@@ -0,0 +1,25 @@
+{
+ lib,
+ stdenv,
+ self,
+ version,
+ ...
+}:
+stdenv.mkDerivation {
+ pname = "hello";
+ inherit version;
+
+ src = lib.cleanSource self;
+
+ installPhase = ''
+ echo "hi" > $out
+ '';
+
+ meta = with lib; {
+ description = "";
+ homepage = "";
+ license = licenses.mit;
+ maintainers = [maintainers.getchoo];
+ platforms = platforms.linux;
+ };
+}