about summary refs log tree commit diff
path: root/flake.nix
blob: 685e66d430f403a2f4ca39676bdcd0a1b0aa4278 (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
{
  description = "personal NixOS configurations";

  inputs = {
    # Nixpkgs, NixOS's official repo
    nixpkgs.url = "github:nixos/nixpkgs/release-21.11";

    utils.url = "github:numtide/flake-utils";

    # We use the unstable nixpkgs repo for some packages.
    nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";

    emacs-overlay.url = "github:nix-community/emacs-overlay";

    agenix = {
      url = "github:ryantm/agenix";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    nur.url = "github:nix-community/NUR";

    pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
    flake-utils.url = "github:numtide/flake-utils";

    home-manager = {
      url = "github:nix-community/home-manager/release-21.11";
      # We want home-manager to use the same set of nixpkgs as our system.
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  # Output config, or config for NixOS system
  outputs = { ... }@inputs:
    let lib = import ./lib { inherit inputs; };
    in {
      nixosConfigurations = {
        carmel = lib.mkSystem {
          hostname = "carmel";
          system = "x86_64-linux";
        };
        aptos = lib.mkSystem {
          hostname = "aptos";
          system = "x86_64-linux";
        };
        tahoe = lib.mkSystem {
          hostname = "tahoe";
          system = "x86_64-linux";
        };
      };
    } // inputs.utils.lib.eachDefaultSystem (system:
      let
        pkgs = import inputs.nixpkgs { inherit system; };
        home-manager = inputs.home-manager.defaultPackage."${system}";
      in {
        packages = pkgs // {
          inherit home-manager;

          tools = { dnsupdate = import ./tools/dnsupdate { inherit pkgs; }; };

          users.fcuny = {
            blog = import ./users/fcuny/blog { inherit pkgs; };
            notes = import ./users/fcuny/notes { inherit pkgs; };
            resume = import ./users/fcuny/resume { inherit pkgs; };
          };
        };

        checks = {
          pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
            src = ./.;
            hooks = {
              nixpkgs-fmt.enable = true;
              shellcheck.enable = true;
            };
          };
        };
        devShell = pkgs.mkShell {
          buildInputs = with pkgs; [
            nixUnstable
            nixfmt
            rnix-lsp
            home-manager
            git
            go
            gopls
          ];
        };
      });
}