NixOS modules move one level up because it's unlikely that //ops/nixos will contain actual systems at this point (they're user-specific). This is the first users folder, so it is also added to the root readTree invocation for the repository. Change-Id: I546c701145fa204b7ba7518a8a56a783588629e0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/244 Reviewed-by: tazjin <mail@tazj.in>
		
			
				
	
	
		
			72 lines
		
	
	
	
		
			2 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			72 lines
		
	
	
	
		
			2 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
| # This file sets up the top-level package set by traversing the package tree
 | |
| # (see read-tree.nix for details) and constructing a matching attribute set
 | |
| # tree.
 | |
| #
 | |
| # This makes packages accessible via the Nixery instance that is configured to
 | |
| # use this repository as its nixpkgs source.
 | |
| 
 | |
| { ... }@args:
 | |
| 
 | |
| with builtins;
 | |
| 
 | |
| let
 | |
|   # This definition of fix is identical to <nixpkgs>.lib.fix, but the global
 | |
|   # package set is not available here.
 | |
|   fix = f: let x = f x; in x;
 | |
| 
 | |
|   # Global configuration that all packages are called with.
 | |
|   config = depot: {
 | |
|     inherit depot;
 | |
| 
 | |
|     # Pass third_party as 'pkgs' (for compatibility with external
 | |
|     # imports for certain subdirectories)
 | |
|     pkgs = depot.third_party;
 | |
| 
 | |
|     kms = {
 | |
|       project = "tazjins-infrastructure";
 | |
|       region = "europe-north1";
 | |
|       keyring = "tazjins-keys";
 | |
|       key = "kontemplate-key";
 | |
|     };
 | |
|   };
 | |
| 
 | |
|   readTree' = import ./nix/readTree {};
 | |
| 
 | |
|   localPkgs = readTree: {
 | |
|     fun           = readTree ./fun;
 | |
|     lisp          = readTree ./lisp;
 | |
|     net           = readTree ./net;
 | |
|     nix           = readTree ./nix;
 | |
|     ops           = readTree ./ops;
 | |
|     presentations = readTree ./presentations;
 | |
|     third_party   = readTree ./third_party;
 | |
|     tools         = readTree ./tools;
 | |
|     users         = readTree ./users;
 | |
|     web           = readTree ./web;
 | |
|   };
 | |
| in fix(self: {
 | |
|   config = config self;
 | |
| 
 | |
|   # Elevate 'lib' from nixpkgs
 | |
|   lib = import (self.third_party.nixpkgsSrc + "/lib");
 | |
| 
 | |
|   # Expose readTree for downstream repo consumers.
 | |
|   readTree = {
 | |
|     __functor = x: (readTree' x.config);
 | |
|     config = self.config;
 | |
|   };
 | |
| 
 | |
|   # Make the path to the depot available for things that might need it
 | |
|   # (e.g. NixOS module inclusions)
 | |
|   depotPath = ./.;
 | |
| }
 | |
| 
 | |
| # Add local packages as structured by readTree
 | |
| // (localPkgs (readTree' (self.config // { inherit (self) lib; })))
 | |
| 
 | |
| # Load overrides into the top-level.
 | |
| #
 | |
| # This can be used to move things from third_party into the top-level, too (such
 | |
| # as `lib`).
 | |
| // (readTree' { depot = self; pkgs = self.third_party; }) ./overrides
 | |
| )
 |