This repository has been archived by the owner on Nov 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
121 lines (111 loc) · 3.4 KB
/
flake.nix
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
{
description = "tlater's host configurations";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
flake-utils.url = "github:numtide/flake-utils";
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/release-22.05";
inputs.nixpkgs.follows = "nixpkgs";
};
dotfiles = {
url = "github:tlater/dotfiles";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs = {
nixpkgs,
nixos-hardware,
flake-utils,
sops-nix,
home-manager,
dotfiles,
...
}: let
# A helper function that removes the duplication of things that
# will be common across all hosts.
make-nixos-system = {
nixpkgs,
system,
modules ? [],
}: let
pkgs = nixpkgs.legacyPackages.${system};
# Overlays to be added to the system
overlays = [(final: prev: {tlater = import ./pkgs {pkgs = prev;};})];
in
nixpkgs.lib.nixosSystem {
inherit system;
# The configuration modules
modules =
[
(import ./configurations)
sops-nix.nixosModules.sops
home-manager.nixosModules.home-manager
({...}: {
# Use the flakes' nixpkgs for commands
nix = {
nixPath = ["nixpkgs=${nixpkgs}"];
registry.nixpkgs = {
from = {
id = "nixpkgs";
type = "indirect";
};
flake = nixpkgs;
};
};
nixpkgs.overlays = overlays;
})
]
++ modules;
# Additional modules with custom configuration options
extraModules = [(import ./modules)];
};
in
{
nixosConfigurations = {
yui = make-nixos-system {
nixpkgs = nixpkgs;
system = "x86_64-linux";
modules = [
(import ./configurations/yui)
(dotfiles.lib.nixosConfigurationFromProfile
dotfiles.profiles.pcs.personal "tlater")
];
};
ct-lt-02052 = make-nixos-system {
nixpkgs = nixpkgs;
system = "x86_64-linux";
modules = [
(import ./configurations/ct-lt-02052)
(dotfiles.lib.nixosConfigurationFromProfile
dotfiles.profiles.pcs.work "tlater")
nixos-hardware.nixosModules.lenovo-thinkpad-t490
];
};
};
}
# Set up a "dev shell" that will work on all architectures.
// (flake-utils.lib.eachSystem
# Sops currently doesn't support aarch64-darwin or i686-linux
(builtins.filter (system: !(builtins.elem system ["aarch64-darwin" "i686-linux"]))
flake-utils.lib.defaultSystems) (system: let
pkgs = nixpkgs.legacyPackages.${system};
sops-pkgs = sops-nix.packages.${system};
in {
devShells.default = pkgs.mkShell {
buildInputs = with pkgs;
with sops-pkgs; [
nixfmt
sops-init-gpg-key
];
nativeBuildInputs = with sops-pkgs; [sops-import-keys-hook];
sopsPGPKeyDirs = ["./keys/hosts/" "./keys/users/"];
};
}));
}