From fab63c5065d06e577dab7faec41a8365b80c48e4 Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 24 Aug 2023 07:49:07 -0400 Subject: templates/full: improve layout --- templates/full/nix/pkgs/default.nix | 24 ++++++++++++++++++++++++ templates/full/nix/pkgs/hello.nix | 25 +++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 templates/full/nix/pkgs/default.nix create mode 100644 templates/full/nix/pkgs/hello.nix (limited to 'templates/full/nix/pkgs') 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; + }; +} -- cgit v1.2.3