summaryrefslogtreecommitdiff
path: root/flake.nix
blob: d983d24a31177e86a1c220a9f20400f57e63b3f3 (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
{
  description = "My personal devices' flake modules";

  nixConfig = {
    extra-substituters = [
      "https://nix-community.cachix.org"
      "s3://mr-nixcache-icenyeamyubu?profile=mixrank"
    ];
    extra-trusted-public-keys = [
      "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
      "mr-nixcache-icenyeamyubu:q2ulb+bD5NCbp9nvvHod39/1qNqnYX0ACb8eQckb7pI="
    ];
  };

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    nixos-hardware.url = "github:NixOS/nixos-hardware";
    home-manager.url = "github:nix-community/home-manager";
    agenix = {
      url = "github:ryantm/agenix";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.home-manager.follows = "home-manager";
    };
    emacs-overlay = {
      url = "github:nix-community/emacs-overlay";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    from-elisp = {
      url = "github:o-santi/from-elisp";
      flake = false;
    };
    firefox-gnome-theme = {
      url = "github:rafaelmardojai/firefox-gnome-theme";
      flake = false;
    };
    mixrank.url = "git+ssh://[email protected]/mixrank/mixrank?ref=2024-05-06-hosts-in-nix";
  };

  outputs = { self, nixpkgs, home-manager, agenix, mixrank, ... } @ inputs :
    let
      inherit (builtins) listToAttrs readDir attrNames;
      system = "x86_64-linux";
      hosts = attrNames (readDir ./hosts);
      defaultNixosSystem = host: nixpkgs.lib.nixosSystem {
        inherit system;
        specialArgs = { inherit inputs hosts; };
        modules = [
          ./hosts/${host}/configuration.nix
          ./users/leonardo.nix
          home-manager.nixosModules.home-manager
          agenix.nixosModules.default
          mixrank.nixosModules.dev-machine
        ];
      };
    in {
      nixosConfigurations =
        (listToAttrs (map (host: {name = host; value = defaultNixosSystem host; }) hosts))
         // { iori = nixpkgs.lib.nixosSystem {
                system = "aarch64-linux";
                specialArgs = { inherit inputs; };
                modules = [
                  ./hosts/iori/configuration.nix
                ];
              };
            };
    };
}