-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
85 lines (76 loc) · 3.75 KB
/
flake.nix
File metadata and controls
85 lines (76 loc) · 3.75 KB
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
{
description = "bphenriques's fleet";
nixConfig = {
extra-substituters = [
"https://nix-community.cachix.org"
"https://nixpkgs-wayland.cachix.org"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
];
};
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; # Stable(ish) enough. Plus home-manager is _always_ on unstable.
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
# Private dotfiles for confidential information required in build-time
dotfiles-private.url = "git+ssh://git@github.com/bphenriques/dotfiles-private";
dotfiles-private.inputs.nixpkgs.follows = "nixpkgs";
# Personal modules version controlled separately
selfhost-nix.url = "git+ssh://git@github.com/bphenriques/selfhost-nix";
selfhost-nix.inputs.nixpkgs.follows = "nixpkgs";
# Community flakes
stylix.url = "github:danth/stylix"; # Consistent coloring across my system. I can still tweak manually.
nur.url = "github:nix-community/nur"; # Collection of packages. Use it for Firefox extensions
sops-nix.url = "github:Mic92/sops-nix"; # Manage secrets using sops
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
disko.url = "github:nix-community/disko"; # Declaratively describe my disks layout
disko.inputs.nixpkgs.follows = "nixpkgs";
treefmt-nix.url = "github:numtide/treefmt-nix"; # Unified formatter for multiple languages
nix-index-database.url = "github:nix-community/nix-index-database"; # Pre-built nix-index database for comma
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs @ { self, nixpkgs, treefmt-nix, ... }:
let
generators = import ./lib/generators.nix { inherit (nixpkgs) lib; };
inherit (generators) forAllSystems readModulesAttrs;
treefmtEval = forAllSystems (system: treefmt-nix.lib.evalModule nixpkgs.legacyPackages.${system} ./treefmt.nix);
inherit (import ./lib/hosts.nix { inherit nixpkgs self inputs; }) mkNixosHost;
in {
lib.builders = forAllSystems (system:
import ./lib/builders.nix {
inherit (nixpkgs) lib;
pkgs = nixpkgs.legacyPackages.${system};
}
);
apps = import ./apps { inherit nixpkgs self generators; };
packages = import ./packages { inherit nixpkgs generators; builders = self.lib.builders; };
formatter = forAllSystems (system: treefmtEval.${system}.config.build.wrapper); # `nix fmt`
checks = forAllSystems (system: { # `nix flake check`
formatting = treefmtEval.${system}.config.build.check self;
} // nixpkgs.lib.optionalAttrs (system == "x86_64-linux") {
eval-compute = self.nixosConfigurations.compute.config.system.build.toplevel;
eval-laptop = self.nixosConfigurations.laptop.config.system.build.toplevel;
});
devShells = forAllSystems (system: {
default = import ./shell.nix { pkgs = nixpkgs.legacyPackages.${system}; };
});
overlays = import ./overlays inputs;
# Modules
nixosModules = readModulesAttrs ./modules/nixos;
homeManagerModules = readModulesAttrs ./modules/home-manager;
nixosConfigurations = {
laptop = mkNixosHost {
hostName = "laptop";
configPath = ./hosts/laptop;
extraOverlays = [ inputs.nur.overlays.default ];
extraHmModules = [ inputs.stylix.homeModules.stylix ];
};
compute = mkNixosHost {
hostName = "compute";
configPath = ./hosts/compute;
};
};
};
}