forked from fediversity/fediversity
		
	follow-up on Fediversity/Fediversity#447 (comment) Reviewed-on: Fediversity/Fediversity#451 Reviewed-by: Valentin Gagarin <valentin.gagarin@tweag.io> Co-authored-by: Nicolas “Niols” Jeannerod <nicolas.jeannerod@moduscreate.com> Co-committed-by: Nicolas “Niols” Jeannerod <nicolas.jeannerod@moduscreate.com>
		
			
				
	
	
		
			54 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
## This file contains a tweak of flake-parts's `mkFlake` function to splice in
 | 
						|
## sources taken from npins.
 | 
						|
 | 
						|
## NOTE: Much of the logic in this file feels like it should be not super
 | 
						|
## specific to fediversity. Could it make sense to extract the core of this to
 | 
						|
## another place it feels closer to in spirit, such as @fricklerhandwerk's
 | 
						|
## flake-inputs (which this code already depends on anyway, and which already
 | 
						|
## contained two distinct helpers for migrating away from flakes)? cf
 | 
						|
## https://git.fediversity.eu/Fediversity/Fediversity/pulls/447#issuecomment-8671
 | 
						|
 | 
						|
inputs@{ self, ... }:
 | 
						|
 | 
						|
let
 | 
						|
  sources = import ./npins;
 | 
						|
  inherit (import sources.flake-inputs) import-flake;
 | 
						|
 | 
						|
  # XXX(@fricklerhandwerk): this atrocity is required to splice in a foreign Nixpkgs via flake-parts
 | 
						|
  # XXX - this is just importing a flake
 | 
						|
  nixpkgs = import-flake { src = sources.nixpkgs; };
 | 
						|
 | 
						|
  # XXX - this overrides the inputs attached to `self`
 | 
						|
  inputs' = self.inputs // {
 | 
						|
    nixpkgs = nixpkgs;
 | 
						|
  };
 | 
						|
  self' = self // {
 | 
						|
    inputs = inputs';
 | 
						|
  };
 | 
						|
 | 
						|
  flake-parts-lib = import "${sources.flake-parts}/lib.nix" { inherit (nixpkgs) lib; };
 | 
						|
in
 | 
						|
 | 
						|
flakeModule:
 | 
						|
 | 
						|
flake-parts-lib.mkFlake
 | 
						|
  {
 | 
						|
    # XXX - finally we override the overall set of `inputs` -- we need both:
 | 
						|
    #       `flake-parts obtains `nixpkgs` from `self.inputs` and not from `inputs`.
 | 
						|
    inputs = inputs // {
 | 
						|
      inherit nixpkgs;
 | 
						|
    };
 | 
						|
    self = self';
 | 
						|
    specialArgs = {
 | 
						|
      inherit sources;
 | 
						|
    };
 | 
						|
  }
 | 
						|
  {
 | 
						|
    systems = [
 | 
						|
      "x86_64-linux"
 | 
						|
      "aarch64-linux"
 | 
						|
      "x86_64-darwin"
 | 
						|
      "aarch64-darwin"
 | 
						|
    ];
 | 
						|
    imports = [ flakeModule ];
 | 
						|
  }
 |