summaryrefslogtreecommitdiff
path: root/flake.nix
blob: 70153b4819cd7e1dbbe1e0cd8c83b974003d6dc5 (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
{
  description = "sinan's reproducible nixos systems";

  inputs = {
    nixpkgs.url = "github:NixOs/nixpkgs/nixos-unstable";

    sops-nix = {
      url = "github:Mic92/sops-nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    home-manager = {
      url = "github:sinanmohd/home-manager/sway-generators";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { self, nixpkgs, sops-nix, home-manager }: let
    lib = nixpkgs.lib;

    makeNixos = host: system: lib.nixosSystem {
      inherit system;
      modules = [
        {
          networking.hostName = host;
          nix.nixPath = [ "nixpkgs=${nixpkgs}" ];
        }

        ./global/common
        ./os/${host}/configuration.nix
        sops-nix.nixosModules.sops
      ] ++ lib.optional (builtins.pathExists ./global/${host})
        ./global/${host};
    };

    makeHome = host: system: home-manager.lib.homeManagerConfiguration {
      pkgs = nixpkgs.legacyPackages.${system};
      modules = [
        ./global/common
        ./home/${host}/home.nix
      ] ++ lib.optional (builtins.pathExists ./global/${host})
        ./global/${host};
    };
  in
  {
    nixosConfigurations =
      lib.genAttrs [ "cez" "kay" "lia" "fscusat" "dspace" ]
      (host: makeNixos host "x86_64-linux");
    homeConfigurations =
      lib.genAttrs [ "common" "wayland" "cez" ]
      (host: makeHome host "x86_64-linux");
  };
}