-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
156 lines (144 loc) · 4.77 KB
/
Copy pathflake.nix
File metadata and controls
156 lines (144 loc) · 4.77 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
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
{
description = "nixOS + Home Manager configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-26.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
};
betterfox = {
url = "github:yokoffing/Betterfox";
flake = false;
};
browseros-ai = {
url = "github:skifli/browseros-ai"; # Run nix store prefetch-file \
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/release-26.05";
inputs.nixpkgs.follows = "nixpkgs";
}; # Managing files and configs in each users' home directory
ironbar.url = "github:JakeStanger/ironbar";
lan-mouse.url = "github:feschber/lan-mouse";
# Switched from sodiboo/niri-flake to BANanaD3V/niri-nix
# See: https://github.com/niri-wm/niri/pull/4404
# TODO: Switch back to sodiboo/niri-flake when it gets updated again <3
niri-nix = {
url = "git+https://codeberg.org/BANanaD3V/niri-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-index-database = {
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
stylix = {
url = "github:nix-community/stylix/release-26.05";
inputs.nixpkgs.follows = "nixpkgs";
}; # System wide theming
way-edges = {
url = "github:way-edges/way-edges";
inputs.nixpkgs.follows = "nixpkgs";
};
/*
winapps = {
url = "github:winapps-org/winapps";
inputs.nixpkgs.follows = "nixpkgs";
};
*/
zen-browser = {
url = "github:0xc000022070/zen-browser-flake";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
affinity-nix.url = "github:mrshmllow/affinity-nix";
anki-seara.url = "github:rodrada/seara";
chaotic.url = "github:chaotic-cx/nyx/nyxpkgs-unstable";
# anki-mcp.url = "github:ankimcp/anki-mcp-server-addon";
# concord.url = "github:chojs23/concord";
vicinae.url = "github:vicinaehq/vicinae"; # Following nixpkgs makes cache miss
vicinae-extensions.url = "github:vicinaehq/extensions";
};
outputs = {
self,
nixpkgs,
nixpkgs-unstable,
...
} @ inputs:
# Captures all inputs into a variable
let
# Helper function to generate attributes for all systems in the list
mkHost =
# Pass host and system into the function
hostname: system:
nixpkgs.lib.nixosSystem {
# Import required modules
modules = [
./hosts/${hostname}/configuration.nix
./lix.nix
# Below is specifically with stable nixOS - inputs.chaotic.nixosModules.default is IMPORTANT for UNstable - but irrelevant to me
inputs.chaotic.nixosModules.nyx-cache
inputs.chaotic.nixosModules.nyx-overlay
inputs.chaotic.nixosModules.nyx-registry
];
# Attribute set of extra arguments passed to Nix module functions
specialArgs = {
pkgsUnstable = import nixpkgs-unstable {
inherit system;
};
inherit
self
inputs
hostname
system
;
};
};
# Define the hosts and their respective architecture
hosts = {
lyra = {
system = "x86_64-linux";
builder = mkHost;
};
};
systems = nixpkgs.lib.unique ((map (cfg: cfg.system) (builtins.attrValues hosts)) ++ ["aarch64-linux"]);
hostsForSystem = system: builtins.attrNames (nixpkgs.lib.filterAttrs (_: cfg: cfg.system == system) hosts);
in {
# Automatically generate nixosConfigurations from hosts list
nixosConfigurations = builtins.mapAttrs (hostname: cfg: cfg.builder hostname cfg.system) hosts;
checks = nixpkgs.lib.genAttrs systems (
system: let
pkgs = nixpkgs.legacyPackages.${system};
in
builtins.listToAttrs (
map (
hostname: {
name = "eval-${hostname}";
value = pkgs.runCommand "eval-${hostname}" {} ''
echo "${self.nixosConfigurations.${hostname}.config.system.build.toplevel.drvPath}" > "$out"
'';
}
) (hostsForSystem system)
)
);
devShells = nixpkgs.lib.genAttrs systems (
system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
default = pkgs.mkShell {
packages = with pkgs; [
pre-commit
alejandra
statix
deadnix
];
shellHook = ''
if [ -d .git ]; then
pre-commit install --install-hooks >/dev/null 2>&1 || true
fi
'';
};
}
);
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt;
};
}