summaryrefslogtreecommitdiffstats
path: root/flake.nix
blob: 8846d8a1cd006fc190a5c5f3a9701750638b7cb4 (plain)
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
{
  inputs.nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst";

  outputs = {
    self,
    nixpkgs,
    ...
  } @ inputs: let
    # We should only specify the modules Hjem explicitly supports, or we risk
    # allowing not-so-defined behaviour. For example, adding nix-systems should
    # be avoided, because it allows specifying systems Hjem is not tested on.
    forAllSystems = nixpkgs.lib.genAttrs ["x86_64-linux" "aarch64-linux" "aarch64-darwin"];
    finix = (import ./npins).finix;
    pkgsFor = system: nixpkgs.legacyPackages.${system};
  in {
    nixosModules = import ./modules/nixos;
    darwinModules = import ./modules/nix-darwin;
    finixModules = import ./modules/finix;

    packages = forAllSystems (system:
      import ./internal/packages.nix rec {
        inherit nixpkgs;
        hjemModule = self.nixosModules.default;
        pkgs = pkgsFor system;
      });

    checks = forAllSystems (system:
      import ./internal/checks.nix rec {
        inherit self;
        pkgs = pkgsFor system;
      }
      // import ./internal/finix-checks.nix {
        inherit self finix;
        pkgs = pkgsFor system;
      });

    devShells = forAllSystems (system: {
      default = import ./internal/shell.nix (pkgsFor system);
      rust = import ./internal/rust-shell.nix (pkgsFor system);
    });

    formatter =
      forAllSystems (system:
        import ./internal/formatter.nix (pkgsFor system));

    hjem-lib = forAllSystems (system:
      import ./lib.nix {
        inherit (nixpkgs) lib;
        pkgs = nixpkgs.legacyPackages.${system};
      });
  };
}