summaryrefslogtreecommitdiff
path: root/flake.nix
blob: 2d2332b542d1e95eac13ceb47b2cf7458fd3f153 (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
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
{
  inputs = {
    nixpkgs = {
      url = "github:NixOS/nixpkgs/nixos-23.05";
    };
    home-manager = {
      url = "github:nix-community/home-manager/release-23.05";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    nix-darwin = {
      url = "github:LnL7/nix-darwin";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    agenix = {
      url = "github:ryantm/agenix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    push-notification-api = {
      url = "github:linnnus/push-notification-api";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { self, nixpkgs, home-manager, nix-darwin, agenix, push-notification-api, ... }@inputs:
    let
      args = {
        flakeInputs = inputs;
        flakeOutputs = self.outputs;
        metadata = nixpkgs.lib.importTOML ./metadata.toml;
      };

      # This is a function that generates an attribute by calling a function
      # you pass to it, with each system as an argument. `systems` lists all
      # supported systems.
      systems = [
        "aarch64-linux"
        "i686-linux"
        "x86_64-linux"
        "aarch64-darwin"
        "x86_64-darwin"
      ];
      forAllSystems = nixpkgs.lib.genAttrs systems;
    in
    {
      darwinConfigurations = {
        muhammed = nix-darwin.lib.darwinSystem {
          inherit inputs;
          system = "aarch64-darwin";
          modules = [
	    { _module.args = args; }
            home-manager.darwinModules.home-manager
            ./hosts/muhammed/configuration.nix
            ./hosts/common.nix
            ./home
            # FIXME: Get the following to work without nix-darwin bithcing about unused NixOS options.
            # ./modules
            # ./services
          ];
        };
      };

      nixosConfigurations = {
        ahmed = nixpkgs.lib.nixosSystem {
          system = "x86_64-linux";
          modules = [
            { _module.args = args; }
            home-manager.nixosModules.home-manager
            agenix.nixosModules.default
            push-notification-api.nixosModules.default
            ./hosts/ahmed/configuration.nix
            ./hosts/common.nix
            ./home
	    ./modules
            ./services
          ];
        };
      };

      packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});

      overlays = import ./overlays;
    };
}