-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
91 lines (79 loc) · 2.87 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 = "Webframp nix config flake";
inputs = {
# Nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# You can access packages and modules from different nixpkgs revs
# at the same time. Here's an working example:
# nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
# Pure Nix flake utility functions.
flake-utils.url = "github:numtide/flake-utils";
# Home manager
home-manager.url = "github:nix-community/home-manager/master";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
# NixOS-WSL: https://github.com/nix-community/NixOS-WSL/
nixos-wsl.url = "github:nix-community/NixOS-WSL";
# nix-darwin
nix-darwin.url = "github:LnL7/nix-darwin/master";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
# emacs overlay
emacs-overlay.url = "github:nix-community/emacs-overlay";
emacs-overlay.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = {
self,
nixpkgs,
home-manager,
nix-darwin,
...
} @ inputs: let
inherit (self) outputs;
forEachSystem = nixpkgs.lib.genAttrs ["x86_64-linux" "x86_64-darwin" "aarch64-darwin"];
forEachPkgs = f: forEachSystem (sys: f nixpkgs.legacyPackages.${sys});
mkNixos = modules:
nixpkgs.lib.nixosSystem {
inherit modules;
specialArgs = {inherit inputs outputs;};
};
mkHome = modules: pkgs:
home-manager.lib.homeManagerConfiguration {
inherit modules pkgs;
extraSpecialArgs = {inherit inputs outputs;};
};
in {
# Custom packages
# Acessible through 'nix build', 'nix shell', etc
packages = forEachSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
in
import ./pkgs {inherit pkgs;});
# Devshell for bootstrapping, use 'nix develop'
devShells = forEachPkgs (pkgs: import ./shell.nix {inherit pkgs;});
formatter = forEachPkgs (pkgs: pkgs.alejandra);
# Custom packages and modifications
overlays = import ./overlays {inherit inputs;};
# Stuff to upstream into nixpkgs
nixosModules = import ./modules/nixos;
# Stuff to upstream into home-manager
# homeManagerModules = import ./modules/home-manager;
# NixOS entrypoint
# Use:'nixos-rebuild --flake .#hostname'
nixosConfigurations = {galvatron = mkNixos [./hosts/galvatron-wsl];};
# Standalone home-manager entrypoints
# Use: 'home-manager --flake .#username@your-hostname'
homeConfigurations = {
"sme@bluestreak" =
mkHome [./home/sme/bluestreak.nix]
nixpkgs.legacyPackages."aarch64-darwin";
"sme@megatron" =
mkHome [./home/sme/megatron.nix]
nixpkgs.legacyPackages."x86_64-darwin";
"sme@ubuntu" =
mkHome [./home/sme/ubuntu-wsl.nix]
nixpkgs.legacyPackages."x86_64-linux";
"sme@generic" =
mkHome [./home/sme/generic.nix]
nixpkgs.legacyPackages."x86_64-linux";
};
};
}