-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
87 lines (81 loc) · 2.83 KB
/
flake.nix
File metadata and controls
87 lines (81 loc) · 2.83 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
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-25.11-darwin";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils/flatten-tree-system";
nixos-hardware.url = "github:NixOS/nixos-hardware";
home-manager = {
url = "github:nix-community/home-manager/release-25.11";
inputs.nixpkgs.follows = "nixpkgs";
};
musnix = {
url = "github:musnix/musnix";
flake = false;
};
darwin = {
url = "github:nix-darwin/nix-darwin/nix-darwin-25.11";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ self, nixpkgs, nixpkgs-unstable, flake-utils, home-manager, darwin, ... }:
with builtins;
with nixpkgs.lib;
let
inherit (flake-utils.lib) eachDefaultSystem flattenTreeSystem;
inputFlakes = {
nix.registry = {
nixpkgs.flake = nixpkgs;
home-manager.flake = home-manager;
};
};
overlayModule = {
nixpkgs.overlays = [
self.overlay
#(self: super: { unstable = nixpkgs-unstable.legacyPackages.${self.system}; })
(final: prev: { unstable = import nixpkgs-unstable { system = final.system; config.allowUnfree = true; }; })
];
};
commonModules = [
inputFlakes
overlayModule
];
linuxModules = [
./profiles/linux/base.nix
(import inputs.musnix)
home-manager.nixosModules.home-manager
];
darwinModules = [
./profiles/darwin/base.nix
home-manager.darwinModules.home-manager
];
outputs =
{
# Import host configurations from ./hosts/
nixosConfigurations =
genAttrs (attrNames (filterAttrs (name: type: type == "directory") (readDir ./hosts/linux)))
(host: nixpkgs.lib.nixosSystem (
let
syscfg = (import (./hosts/linux + "/${host}") inputs);
defaultModules = commonModules ++ linuxModules;
in syscfg // { modules = syscfg.modules ++ defaultModules; }
));
darwinConfigurations =
genAttrs (attrNames (filterAttrs (name: type: type == "directory") (readDir ./hosts/darwin)))
(host: darwin.lib.darwinSystem (
let
syscfg = (import (./hosts/darwin + "/${host}") inputs);
defaultModules = commonModules ++ darwinModules;
in syscfg // { modules = syscfg.modules ++ defaultModules; }
));
# Export packages defined in ./pkgs as overlay and flake packages
overlay = import ./pkgs;
};
in
(eachDefaultSystem
(system:
let
pkgs = import nixpkgs { inherit system; };
in
{ packages = (flattenTreeSystem system (outputs.overlay pkgs pkgs)); }
)) // outputs;
}