-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
90 lines (74 loc) · 2.43 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
{
description = "Chinos' Nix Flakes";
inputs = {
flake-schemas.url = "github:DeterminateSystems/flake-schemas";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
# cache for unfree pkgs
nixpkgs = {
url = "github:numtide/nixpkgs-unfree";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
nix-darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs-unstable"; # TODO idk
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-index-database = {
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-formatter-pack = {
url = "github:Gerschtli/nix-formatter-pack";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ {
flake-schemas,
nixpkgs,
nix-formatter-pack,
...
}: let
linuxSystems = ["x86_64-linux" "aarch64-linux"];
darwinSystems = ["aarch64-darwin" "x86_64-darwin"];
forEachSystem = f: nixpkgs.lib.genAttrs (linuxSystems ++ darwinSystems) f;
formatterPackArgs = forEachSystem (system: {
inherit nixpkgs system;
checkFiles = [./.];
config = {
tools = {
alejandra.enable = true;
deadnix.enable = true;
statix = {
enable = true;
disabledLints = (fromTOML (builtins.readFile ./statix.toml)).disabled;
};
};
};
});
in rec {
inherit inputs;
inherit (flake-schemas) schemas;
# nix-formatter-pack
checks = forEachSystem (system: {
nix-formatter-pack-check = nix-formatter-pack.lib.mkCheck formatterPackArgs.${system};
});
formatter = forEachSystem (system: nix-formatter-pack.lib.mkFormatter formatterPackArgs.${system});
darwinConfigurations = {
# $ darwin-rebuild switch --flake ~/.config/nix-darwin#chinos-mbp23
"chinos-mbp23" = import ./hosts/chinos-mbp23 inputs;
};
nixosConfigurations = {
# $ sudo nixos-rebuild switch --flake ~/.config/nix-config#chinos-twr20
"chinos-twr20" = import ./hosts/chinos-twr20 inputs;
# $ sudo nixos-rebuild switch --flake ~/.config/nix-config#chinos-r4s21
"chinos-r4s21" = import ./hosts/chinos-r4s21 inputs;
};
images = {
# $ nix build .#images.chinos-r4s21
"chinos-r4s21" = nixosConfigurations."chinos-r4s21".config.system.build.sdImage;
};
};
}