about summary refs log tree commit diff stats
path: root/flake/packages/default.nix
blob: 74f962cec4ed617c7c375ad0f4be355ba5e10b80 (plain) (blame)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{
  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 ../../home-manager/soispha/config/neovim/nixvim/default.nix
          args;
        build_args = args // {nixosConfig = value.config;};

        merge_attrs = list_of_attrs: builtins.foldl' (x: y: merge [x y]) {} 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;
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;
    neovim = nvim;
  }
  // output