summaryrefslogtreecommitdiff
path: root/templates/full/nix/pkgs
diff options
context:
space:
mode:
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;
+ };
+}