about summary refs log blame commit diff stats
path: root/flake/packages/default.nix
blob: b670793df654b2f0f3d145662d821eb76d190b22 (plain) (tree)
1
2
3
4
5
6
7
8
9
 
       
                   
       
         
         
         
                
     
      
                                                    
                                                         
 


                       
                                                         







                                                           
 
                                
                                                      



                                                                        
                                     














                                                       
 
                                                                                                             
























                                                                                    
   







                                                    
                                                                               
 








                                                
                       
           
                  
            
               
{
  self,
  nixos-generators,
  pkgs,
  myPkgs,
  sysLib,
  nixVim,
  system,
  shell_library,
  ...
}: let
  inherit (pkgs) lib;
  inherit (import ./merge.nix {inherit lib;}) merge;
  output = import ../../bootstrap {inherit pkgs sysLib;};

  nvim =
    builtins.mapAttrs (
      name: value: let
        nvim_config =
          import ../../modules/home/conf/nvim/default.nix
          build_args;
        build_args = let
          inherit (value._module.args) pkgs;
          inherit (pkgs) lib;
        in {
          inherit pkgs lib;
          nixosConfig = value.config;
          config = value.config.home-manager.users.soispha;
        };

        resolve_imports = attrs:
          merge (builtins.map (v: import v build_args)
            attrs.imports);

        resolve_imports' = attrs:
          if builtins.any (n: n == "imports") (builtins.attrNames attrs)
          then
            resolve_imports' (merge [
              (resolve_imports attrs)
              (builtins.removeAttrs
                attrs
                ["imports"])
            ])
          else attrs;

        complete_config = resolve_imports' nvim_config;
      in
        nixVim.legacyPackages."${system}".makeNixvim
        (
          builtins.removeAttrs
          complete_config.programs.nixvim ["enable"]
        )
    )
    self.nixosConfigurations;

  output_neovim = lib.attrsets.mapAttrs' (name: value: lib.attrsets.nameValuePair "nvim_${name}" value) nvim;

  myPkgsFlat =
    builtins.listToAttrs
    # Filter out the `override` and `overrideDerivation` functions
    (builtins.filter ({
      name,
      value,
    }:
      lib.attrsets.isDerivation value) (lib.lists.flatten
      (
        lib.attrsets.mapAttrsToList (name: value:
          if lib.attrsets.isDerivation value
          then [
            {
              inherit name value;
            }
          ]
          else
            lib.attrsets.mapAttrsToList (name: value: {
              inherit name value;
            })
            value)
        myPkgs
      )));

  firefox = (import ../../modules/home/conf/firefox/scripts) {inherit pkgs sysLib;};
in
  {
    # install-iso = nixos-generators.nixosGenerate {
    #   system = "x86_64-linux";
    #   specialArgs = defaultSpecialArgs;
    #   modules = [
    #     ../../hosts/marduk
    #   ];
    #   format = "install-iso";
    # };

    update_shell_lib = shell_library.packages."${system}".update_shell_library;

    # gpg-iso = nixos-generators.nixosGenerate {
    #   system = "x86_64-linux";
    #   specialArgs = defaultSpecialArgs;
    #   modules =
    #     [
    #       ../../hosts/isimud
    #     ]
    #     ++ defaultModules;
    #   format = "iso";
    # };
    nvim = nvim.tiamat;
  }
  // output
  // output_neovim
  // firefox
  // myPkgsFlat