Home

dotnix @8355a996418d9abde0b83ac48ed5f6fe7cc8b67a - refs - log -
-
https://git.jolheiser.com/dotnix.git
My nix dotfiles
dotnix / flake.nix
- raw
  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
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
{
  description = "jolheiser's nixos config";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
    nixpkgs-py36.url = "github:nixos/nixpkgs/34f85de51bbc74595e63b22ee089adbb31f7c7a2";

    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    agenix = {
      url = "github:ryantm/agenix";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        darwin.follows = "";
        home-manager.follows = "";
      };
    };
    flake-utils.url = "github:numtide/flake-utils";

    nur.url = "github:nix-community/NUR";
    jolheiser-nur = {
      url = "git+https://git.jojodev.com/jolheiser/nur";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    helix = {
      url = "git+https://git.jojodev.com/jolheiser/helix.drv";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    website = {
      url = "git+https://git.jojodev.com/jolheiser/jolheiser.com";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        flake-utils.follows = "flake-utils";
        nur.follows = "jolheiser-nur";
      };
    };
    resume = {
      url = "git+https://git.jojodev.com/jolheiser/resume";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        flake-utils.follows = "flake-utils";
      };
    };
    git-age = {
      url = "git+https://git.jojodev.com/jolheiser/git-age";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        flake-utils.follows = "flake-utils";
      };
    };
    gist = {
      url = "git+https://git.jojodev.com/jolheiser/gist";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    # Other flakes
    golink = {
      url = "github:tailscale/golink";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        flake-utils.follows = "flake-utils";
      };
    };
    tclip = {
      url = "github:tailscale-dev/tclip";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        utils.follows = "flake-utils";
      };
    };
    templ = {
      url = "github:a-h/templ";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = {
    nixpkgs,
    home-manager,
    agenix,
    jolheiser-nur,
    helix,
    website,
    resume,
    git-age,
    gist,
    nixpkgs-py36,
    golink,
    tclip,
    templ,
    ...
  } @ inputs: let
    overlays = [
      (_: prev: {
        nur = import inputs.nur {
          nurpkgs = prev;
          pkgs = prev;
        };
        jolheiser = {
          nur = inputs.jolheiser-nur.packages.${prev.system};
          helix = inputs.helix.packages.${prev.system}.default;
          website = inputs.website.packages.${prev.system}.default;
          resume = inputs.resume.packages.${prev.system}.default;
          git-age = inputs.git-age.packages.${prev.system}.default;
          gist = inputs.gist.packages.${prev.system}.default;
        };
        tclip = inputs.tclip.packages.${prev.system}.tclip;
        templ = inputs.templ.packages.${prev.system}.templ;
      })
      golink.overlay
    ];
    userSecret = path: {
      file = path;
      owner = username;
    };
    commonConfig = {gui ? true}: {config, ...}: {
      config = {
        nixpkgs.overlays = overlays;
        home-manager = {
          useGlobalPkgs = true;
          useUserPackages = true;
          users.${username}.imports =
            if gui
            then [./apps/gui]
            else [./apps/nogui];
          extraSpecialArgs = {
            flakePath = "/home/${username}/.config/nixpkgs";
          };
        };
        age.secrets = {
          ssh-config = userSecret ./secrets/shared/ssh-config.age;
          ssh-config-work = userSecret ./secrets/shared/ssh-config-work.age;
          spotify = {
            file = ./secrets/shared/spotify.age;
            owner = username;
            path = "/home/${username}/.cache/spotify-player/credentials.json";
          };
          irc-pw = userSecret ./secrets/shared/irc-pw.age;
          gist-pw = userSecret ./secrets/shared/gist-pw.age;
          git-send-email = userSecret ./secrets/shared/git-send-email.age;
        };
      };
    };
    username = "jolheiser";
  in
    {
      nixosConfigurations = {
        "chai" = nixpkgs.lib.nixosSystem {
          system = "x86_64-linux";
          modules = [
            home-manager.nixosModules.home-manager
            agenix.nixosModules.default
            ./machines/chai
            (commonConfig {})
            ({pkgs, ...}: {
              config = {
                nixpkgs.overlays = [
                  (_: _: {
                    py36 = import nixpkgs-py36 {inherit (pkgs) system;};
                  })
                ];
                home-manager.users.${username}.programs = {
                  git.package = pkgs.gitSVN;
                  firefox.profiles.default.bookmarks = [(import ./apps/gui/firefox/work.nix)];
                };
                age.secrets = {
                  netrc = {
                    file = ./secrets/work/netrc.age;
                    owner = username;
                    path = "/home/${username}/.netrc";
                  };
                  pipconf = {
                    file = ./secrets/work/pip.conf.age;
                    owner = username;
                    path = "/home/${username}/.config/pip/pip.conf";
                  };
                  pypirc = {
                    file = ./secrets/work/pypirc.age;
                    owner = username;
                    path = "/home/${username}/.pypirc";
                  };
                  cifs = userSecret ./secrets/work/cifs.age;
                };
              };
            })
          ];
        };
        "matcha" = nixpkgs.lib.nixosSystem {
          system = "x86_64-linux";
          modules = [
            home-manager.nixosModules.home-manager
            agenix.nixosModules.default
            ./machines/matcha
            (commonConfig {})
          ];
        };
      };
      colmena = {
        meta = {
          nixpkgs = import nixpkgs {
            system = "x86_64-linux";
            overlays = overlays;
          };
        };
        dragonwell = {
          imports = [
            golink.nixosModules.default
            ./machines/dragonwell
          ];
        };
      };
      nixConfig = {
        extra-substitutors = ["https://jolheiser.cachix.org"];
        extra-trusted-public-keys = ["jolheiser.cachix.org-1:fiKkfTuHFqDK5ZOVxcqb4InUkKsrTvtMLISid7XvuVg="];
      };
    }
    // inputs.flake-utils.lib.eachDefaultSystem (system: let
      pkgs = nixpkgs.legacyPackages.${system};
    in {
      devShells.default = pkgs.mkShell {
        nativeBuildInputs = [
          agenix.packages.${system}.agenix
          pkgs.colmena
        ];
      };
    });
}