about summary refs log tree commit diff stats
path: root/flake/packages/default.nix
blob: a8fc2d64d38c71c9cb2cea42685d3b3249fafe61 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
{
  self,
  nixos-generators,
  pkgs,
  myPkgs,
  pkgsStable,
  sysLib,
  nixVim,
  system,
  shell_library,
  ...
}: let
  inherit (pkgs) lib;
  output = import ../../bootstrap {inherit pkgs sysLib;};

  run_test_description = pkgs.callPackage ../../tests/infrastructure/run.nix {};

  nvim =
    builtins.mapAttrs (
      name: value: let
        config = value.config.home-manager.users.soispha.programs.nixvim;

        # NOTE: This is copied from `nixvim`, and could be achieved by setting
        # `config.wrapRc` to `true`. But I have yet to find a way to set this in this
        # context, but not in the general context.  <2024-11-09>
        wrapped = config.build.package.override (prev: {
          wrapperArgs =
            (
              if lib.isString prev.wrapperArgs
              then prev.wrapperArgs
              else lib.escapeShellArgs prev.wrapperArgs
            )
            + " "
            + ''--add-flags -u --add-flags "${config.build.initFile}"'';
          wrapRc = false;
        });
      in
        wrapped
    )
    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.legacy/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;
    inherit run_test_description;
  }
  // output
  // output_neovim
  // firefox
  // myPkgsFlat