-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
132 lines (121 loc) · 4.65 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
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
home-manager = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-darwin = {
url = "github:lnl7/nix-darwin/nix-darwin-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ nixpkgs, nixpkgs-unstable, home-manager, flake-parts, nix-darwin, disko, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
flake =
let
mkSystem = import ./lib/mkSystem.nix;
specialArgs = {
user = "mccurdyc";
hashedPassword = "$y$j9T$5CjBgjlXBsYF3FYnTP9wQ.$hl8uCypIgOcrh3OrhcJA600Fgv5T9l0U85InRwmRdy5";
};
fgnixArgs = {
system = "x86_64-linux";
nixos-modules = [
./hosts/fgnix
./modules/nixos
];
home-module = ./home-modules/nixos;
inherit specialArgs; # passed to every module and home-module (via extraSpecialArgs)
inherit nixpkgs nixpkgs-unstable nix-darwin home-manager disko; # TODO - consider using 'inputs'
};
nucArgs = {
system = "x86_64-linux";
nixos-modules = [
./hosts/nuc
./modules/nixos
];
home-module = ./home-modules/nixos;
inherit specialArgs; # passed to every module and home-module (via extraSpecialArgs)
inherit nixpkgs nixpkgs-unstable nix-darwin home-manager disko; # TODO - consider using 'inputs'
};
faamacArgs = {
system = "aarch64-darwin";
darwin = true;
darwin-modules = [
./hosts/faamac
./modules/darwin
];
home-module = ./home-modules/darwin;
inherit specialArgs; # passed to every module and home-module (via extraSpecialArgs)
inherit nixpkgs nixpkgs-unstable nix-darwin home-manager disko; # TODO - consider using 'inputs'
# TODO: add lvk so that my mac can use the devbox for nix build, etc.
};
in
{
# sudo nixos-rebuild switch --flake '.#fgnix'
nixosConfigurations.fgnix = mkSystem fgnixArgs;
# sudo nixos-rebuild switch --flake '.#nuc'
nixosConfigurations.nuc = mkSystem nucArgs;
# darwin-rebuild switch --flake '.#faamac'
darwinConfigurations.faamac = mkSystem faamacArgs;
};
systems = [
"aarch64-darwin"
"x86_64-linux"
];
# This is needed for pkgs-unstable - https://github.com/hercules-ci/flake-parts/discussions/105
imports = [ inputs.flake-parts.flakeModules.easyOverlay ];
perSystem = { system, ... }:
let
pkgs = import inputs.nixpkgs { inherit system; config.allowUnfree = true; };
pkgs-unstable = import inputs.nixpkgs-unstable { inherit system; config.allowUnfree = true; };
in
{
# This is needed for pkgs-unstable - https://github.com/hercules-ci/flake-parts/discussions/105
overlayAttrs = { inherit pkgs-unstable; };
formatter = pkgs.nixpkgs-fmt;
devShells.default = import ./shell.nix { inherit pkgs pkgs-unstable; };
# nix build '.#fgnix'
# packages.fgnix = pkgs.testers.runNixOSTest {
# name = "Test connectivity to SSH";
# nodes.fgnix = {
# imports = [
# ./hosts/fgnix
# ./modules/nixos
#
# # TODO fix
# home-manager.nixosModules.home-manager
# {
# home-manager = {
# useGlobalPkgs = true;
# useUserPackages = true;
# extraSpecialArgs = { user = "mccurdyc"; }; # WRONG needs pkgs, etc.
# users.mccurdyc = import ./home-modules/nixos;
# };
# }
#
# # passed to every module as 'specialArgs'.
# {
# config._module.args = {
# user = "mccurdyc";
# inherit pkgs-unstable;
# };
# }
# ];
# };
# testScript = ''
# start_all()
# fgnix.wait_for_unit("network-online.target")
# fgnix.succeed("tailscale status")
# '';
# };
};
};
}