-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
91 lines (75 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
91
{
description = "Nix & NixOS configuration";
inputs = {
# Main Nixpkgs (Unstable)
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# Stable Nixpkgs
# Accesible through 'stable-packages' overlay
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.11";
# Home manager
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-flatpak.url = "github:gmodena/nix-flatpak";
nur.url = "github:nix-community/NUR";
};
outputs = {
self,
nixpkgs,
home-manager,
...
} @ inputs: let
inherit (self) outputs;
# Default username
username = "mohamed";
# Path to the configuration
configPath = "/home/mohamed/Projects/nix-config";
# Supported systems for your flake packages, shell, etc
systems = [
"aarch64-linux"
"i686-linux"
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
# Generates an attributes set for each system
forAllSystems = nixpkgs.lib.genAttrs systems;
in {
# Custom packages
# Accessible through 'nix build', 'nix shell', etc
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
# Nix files formatter
# Available through 'nix fmt'
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
# Custom packages and modifications, exported as overlays
overlays = import ./overlays {inherit inputs;};
# Reusable nixos modules to export
# Usually stuff to upstream into nixpkgs
nixosModules = import ./modules/nixos;
# Reusable home-manager modules to export
# Usually stuff to upstream into home-manager
homeManagerModules = import ./modules/home-manager;
# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#hostname'
nixosConfigurations = {
crazy = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs username configPath;};
modules = [
./hosts/crazy
];
};
};
# Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#username@hostname'
homeConfigurations = {
"mohamed@crazy" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = {inherit inputs outputs;};
modules = [
./home/users/mohamed
];
};
};
};
}