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






                       
                                                       
               




                                                             
 
                                                         






















                                                                        
                                                                                                             
   
                                                  





                                       

                                              



                            
                     
                       
           
                  
{
  self,
  nixos-generators,
  defaultSpecialArgs,
  defaultModules,
  pkgs,
  sysLib,
  nixVim,
  system,
  ...
}: let
  inherit (pkgs) lib;
  inherit (import ./merge.nix {inherit lib;}) merge;
  output = import ../../bootstrap {inherit pkgs sysLib;};
  args = {
    inherit pkgs;
    inherit (pkgs) lib;
  };
  nvim =
    builtins.mapAttrs (
      name: value: let
        nvim_config =
          import ../../hm/soispha/conf/nvim/default.nix
          args;
        build_args =
          args
          // {
            nixosConfig = value.config;
            config = value.config.home-manager.users.soispha;
          };

        merge_attrs = list_of_attrs: merge list_of_attrs;
        resolve_imports = attrs:
          merge_attrs (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_attrs [
              (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;
in
  {
    install-iso = nixos-generators.nixosGenerate {
      system = "x86_64-linux";
      specialArgs = defaultSpecialArgs;
      modules = [
        ../../hosts/marduk
      ];
      format = "install-iso";
    };
    gpg-iso = nixos-generators.nixosGenerate {
      system = "x86_64-linux";
      specialArgs = defaultSpecialArgs;
      modules =
        [
          ../../hosts/isimud
        ]
        ++ defaultModules;
      format = "iso";
    };
    nvim = nvim.tiamat;
  }
  // output
  // output_neovim