-
Notifications
You must be signed in to change notification settings - Fork 32
/
flake.nix
66 lines (60 loc) · 2.67 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
{
description = "NixOS configuration";
# All inputs for the system
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nur = {
url = "github:nix-community/NUR";
inputs.nixpkgs.follows = "nixpkgs";
};
};
# All outputs for the system (configs)
outputs = { home-manager, nixpkgs, nur, ... }@inputs:
let
system = "x86_64-linux"; #current system
pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
lib = nixpkgs.lib;
# This lets us reuse the code to "create" a system
# Credits go to sioodmy on this one!
# https://github.com/sioodmy/dotfiles/blob/main/flake.nix
mkSystem = pkgs: system: hostname:
pkgs.lib.nixosSystem {
system = system;
modules = [
{ networking.hostName = hostname; }
# General configuration (users, networking, sound, etc)
./modules/system/configuration.nix
# Hardware config (bootloader, kernel modules, filesystems, etc)
# DO NOT USE MY HARDWARE CONFIG!! USE YOUR OWN!!
(./. + "/hosts/${hostname}/hardware-configuration.nix")
home-manager.nixosModules.home-manager
{
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
extraSpecialArgs = { inherit inputs; };
# Home manager config (configures programs like firefox, zsh, eww, etc)
users.notus = (./. + "/hosts/${hostname}/user.nix");
};
nixpkgs.overlays = [
# Add nur overlay for Firefox addons
nur.overlay
(import ./overlays)
];
}
];
specialArgs = { inherit inputs; };
};
in {
nixosConfigurations = {
# Now, defining a new system is can be done in one line
# Architecture Hostname
laptop = mkSystem inputs.nixpkgs "x86_64-linux" "laptop";
desktop = mkSystem inputs.nixpkgs "x86_64-linux" "desktop";
};
};
}