summaryrefslogtreecommitdiff
path: root/default.nix
blob: 25178be815cbf293e7838f6e19b5e17cbb409ca0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
let
  lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
{
  pkgs ? import nixpkgs {
    config = { };
    overlays = [ ];
    inherit system;
  },
  nixpkgs ? (
    fetchTarball {
      url = "https://github.com/NixOS/nixpkgs/archive/${lock.nodes.nixpkgs.locked.rev}.tar.gz";
      sha256 = lock.nodes.nixpkgs.locked.narHash;
    }
  ),
  system ? builtins.currentSystem,
}:
let
  inherit (pkgs) lib;
  packageDirectory = ./pkgs;

  scope = lib.makeScope pkgs.newScope (
    final:
    lib.packagesFromDirectoryRecursive {
      inherit (final) callPackage;
      directory = packageDirectory;
    }
  );

  # Filter extraneous attributes from the scope, based on the files in our package directory
  packageFileNames = builtins.attrNames (builtins.readDir packageDirectory);
  packages = lib.getAttrs packageFileNames scope;
in
packages