-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
133 lines (114 loc) · 4.34 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
122
123
124
125
126
127
128
129
130
131
132
133
{
description = "ippetkov's nixos configs";
inputs = {
# Use the nixos-unstable channel for all of our configurations, even on non-NixOS
# systems. The nixpkgs-unstable branch tends to break a bit more often than
# nixos-unstable, so trying this out to see if things are a bit smoother. Also, it is
# nice having the exact same application versions across all machines rather than
# mixing and matching branches.
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# Pinned because deploying to rpi is slow as molasses due to SD card I/O being crap
nixpkgs-for-rpi.url = "github:NixOS/nixpkgs/4633a7c72337ea8fd23a4f2ba3972865e3ec685d";
nixos-hardware.url = "github:NixOS/nixos-hardware";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
flake-utils = {
url = "github:numtide/flake-utils";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
nixos-pibox = {
url = "github:ipetkov/nixos-pibox";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-compat.follows = "flake-compat";
flake-utils.follows = "flake-utils";
};
};
};
outputs = inputs@{ self, ... }:
let
inherit (inputs.nixpkgs) lib legacyPackages;
myPkgs = self.packages;
myLib = import ./lib {
inherit inputs lib myPkgs;
};
inherit (myLib) mkHost;
systemLinux = "x86_64-linux";
systemLinuxArm = "aarch64-linux";
in
{
homeManagerModules = {
alacritty = import ./homeManagerModules/alacritty.nix;
common = import ./homeManagerModules/common.nix;
direnv = import ./homeManagerModules/direnv.nix;
fish = args@{ config, lib, pkgs, ... }: (import ./homeManagerModules/fish.nix) (args // { inherit inputs; });
fonts = import ./homeManagerModules/fonts.nix;
fzf = import ./homeManagerModules/fzf.nix;
git = import ./homeManagerModules/git.nix;
gpg = import ./homeManagerModules/gpg.nix;
gtk = import ./homeManagerModules/gtk.nix;
nvim = args@{ config, lib, pkgs, ... }: (import ./homeManagerModules/nvim.nix) (args // { inherit inputs; });
rust = import ./homeManagerModules/rust.nix;
sway = args@{ config, lib, pkgs, ... }: (import ./homeManagerModules/sway.nix) (args // { inherit myPkgs; });
taskwarrior = import ./homeManagerModules/taskwarrior.nix;
};
homeConfigurations = import ./homeConfigurations {
inherit (inputs) home-manager nixpkgs;
inherit (self) homeManagerModules;
};
nixosModules = {
_1password = import ./nixosModules/_1password.nix;
default = import ./nixosModules/default.nix;
nixConfig = import ./nixosModules/nixConfig.nix;
pihole = import ./nixosModules/pihole.nix;
tailscale = import ./nixosModules/tailscale.nix;
zfs-send = import ./nixosModules/zfs-send.nix;
};
nixosConfigurations = {
asphodel = mkHost {
system = systemLinuxArm;
rootConfig = ./nixosConfigurations/asphodel;
};
elysium = mkHost {
system = systemLinux;
rootConfig = ./nixosConfigurations/elysium;
};
rpi = mkHost {
system = systemLinuxArm;
rootConfig = ./nixosConfigurations/rpi;
nixpkgs = inputs.nixpkgs-for-rpi;
};
tartarus = mkHost {
system = systemLinux;
rootConfig = ./nixosConfigurations/tartarus;
includeHomeManager = true;
};
};
} // inputs.flake-utils.lib.eachDefaultSystem (system:
let
pkgs = legacyPackages.${system};
packages = lib.filterAttrs
(_: pkg: builtins.any (x: x == system) pkg.meta.platforms)
(import ./pkgs { inherit pkgs; });
checksForConfigs = configs: extract: lib.attrsets.filterAttrs
(_: p: p.system == system)
(lib.attrsets.mapAttrs (_: extract) configs);
in
{
inherit packages;
checks = lib.lists.foldl
lib.attrsets.unionOfDisjoint
packages
[
(checksForConfigs self.homeConfigurations (hm: hm.activationPackage))
(checksForConfigs self.nixosConfigurations (c: c.config.system.build.toplevel))
];
});
}