-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathflake.nix
164 lines (136 loc) · 4.96 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
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
157
158
159
160
161
162
163
164
# flake.nix --- Where the journey to a declarative system starts
#
# Author: Matthias Thym <[email protected]>
# URL: https://codeberg.org/totoroot/dotfiles
# License: MIT
# If you have no idea what flakes are and what they are used for, then do like I
# did and read up on it with the following resources:
# Flakes in NixOS wiki: https://nixos.wiki/wiki/Flakes
# Nix Flake in NixOS manual: https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html
# Examples for getting started: https://jdisaacs.com/blog/nixos-config/
# Article by tweag.io on Nix flakes: https://www.tweag.io/blog/2020-07-31-nixos-flakes/
{
description = "My Personal NixOS, Linux and Darwin System Flake Configuration";
inputs = {
# All flake references used to build this NixOS setup. These are dependencies.
# Nix packages
nixos.url = "github:nixos/nixpkgs/nixos-unstable";
nixos-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
# nixpkgs-fork.url = "github:totoroot/nixpkgs/master";
# nixpkgs-fork.url = "github:pitkling/nixpkgs/libfprint-2-tod1-broadcom";
# Nix hardware tweaks
nixos-hardware.url = "github:nixos/nixos-hardware";
# User space configuration, dotfile and package management
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
# Darwin configuration and package managements
darwin = {
url = "github:lnl7/nix-darwin/master";
inputs.nixpkgs.follows = "nixpkgs";
};
# Nix User Repository packages
# Add "nur.nixosModules.nur" to the host modules
nur.url = "github:nix-community/NUR";
# Official Hyprland flake
# Add "hyprland.nixosModules.default" to the host modules
hyprland = {
url = "github:vaxerski/Hyprland";
inputs.nixpkgs.follows = "nixpkgs";
};
# YES!!! https://lix.systems/
lix = {
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.91.1-1.tar.gz";
inputs.nixpkgs.follows = "nixpkgs";
};
zen-browser = {
url = "github:youwen5/zen-browser-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
# https://github.com/thefossguy/nixos-needsreboot
nixos-needsreboot = {
url = "github:thefossguy/nixos-needsreboot";
inputs.nixpkgs.follows = "nixpkgs";
};
# KDE Plasma user settings
# Add "inputs.plasma-manager.homeManagerModules.plasma-manager" to the home-manager.users.${user}.imports
plasma-manager = {
url = "github:pjones/plasma-manager";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "nixpkgs";
};
# Development environments in seconds
devenv = {
url = "github:cachix/devenv/latest";
inputs.nixpkgs.follows = "nixpkgs";
};
# Graphical App Store for Nix/NixOS
nix-software-center = {
url = "github:ljubitje/nix-software-center";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ { self, nixos, nixos-unstable, home-manager, darwin, devenv, ... }:
let
inherit (lib) attrValues;
inherit (lib.my) mapModules mapModulesRec mapHosts;
system = "x86_64-linux";
lib = nixos.lib.extend
(self: _super: { my = import ./lib { inherit pkgs inputs; lib = self; }; });
mkPkgs = pkgs: extraOverlays: import pkgs {
inherit system;
# Allow the use of unfree software
config.allowUnfree = true;
overlays = extraOverlays ++ (attrValues self.overlays);
};
# Use different channels for installed packages for increased flexibility
pkgs = mkPkgs nixos [ self.overlay ];
unstable = mkPkgs nixos-unstable [ ];
nixpkgs = mkPkgs nixpkgs [ ];
in
{
lib = lib.my;
overlay =
_final: _prev: {
inherit unstable nixpkgs;
# Add overlays for flakes
user = self.packages.${system};
devenv = devenv.packages.${system}.devenv;
};
overlays =
mapModules ./overlays import;
packages.${system} =
mapModules ./packages
(p: pkgs.callPackage p { });
nixosModules =
{ dotfiles = import ./.; }
// mapModulesRec ./modules import;
devShells.${system} =
import ./shell.nix {
inherit pkgs;
};
# Configuration for NixOS hosts
nixosConfigurations =
mapHosts ./hosts {
inherit system;
};
# Configuration for macOS using Nix, nix-darwin and home-manager
darwinConfigurations = (
import ./darwin {
inherit (nixpkgs) lib;
inherit inputs nixpkgs darwin home-manager;
}
);
# Configuration for generic Linux distros using Nix and home-manager
homeConfigurations = (
import ./generic-linux {
inherit (nixpkgs) lib;
inherit inputs nixpkgs home-manager;
}
);
# Flake variables
purple = self.nixosConfigurations.purple.activationPackage;
};
}