summaryrefslogtreecommitdiff
path: root/flake.nix
blob: 682cbb4b5751168ef41de0abd2f69cb4f48cf651 (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
{
  description = "My personal devices' flake modules";
  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";
    };
    firefox-gnome-theme = {
      url = "github:rafaelmardojai/firefox-gnome-theme";
      flake = false;
    };
    mixrank.url = "git+ssh://[email protected]/mixrank/mixrank";
    deploy-rs.url = "github:serokell/deploy-rs";
  };

  outputs = { self, nixpkgs, deploy-rs, ... } @ inputs : let
    inherit (builtins) readDir attrNames listToAttrs split head;
    modules = map (p: ./modules/${p}) (attrNames (readDir ./modules));
    make-config-named = host: nixpkgs.lib.nixosSystem {
      specialArgs = { inherit inputs; };
      modules = [
        ./hosts/${host}.nix
        inputs.home-manager.nixosModules.default
      ] ++ modules;
    };
    get-basename = n: head (split "\\." n);
    hosts-names = map get-basename (attrNames (readDir ./hosts));
    nixos-configs = map (h: { name= h; value = make-config-named h;}) hosts-names;
  in rec {
    nixosConfigurations = listToAttrs nixos-configs;
    deploy.nodes.iori = {
      hostname = "ssh.santi.net.br";
      remoteBuild = true;
      interactiveSudo = true;
      profiles.system = {
        user = "root";
        path = deploy-rs.lib.aarch64-linux.activate.nixos nixosConfigurations.iori;
      };
    };
  };
}