-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
117 lines (90 loc) · 3.64 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
# flake.nix -- Starting point for the snowball
#
# Further reading on Nix Flakes:
# Ref: https://nixos.wiki/wiki/Flakes
# Ref: https://github.com/nrdxp/nixflk#resources
#
# Implementation references:
# + https://github.com/hlissner/dotfiles
# + https://github.com/nrdxp/nixflk
{
description = "Pile many flakes and you can have a beautiful snowman.";
nixConfig = {
extra-experimental-features = "nix-command flakes";
extra-substituters =
"https://nrdxp.cachix.org https://nix-community.cachix.org";
extra-trusted-public-keys =
"nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=";
};
inputs = {
# Core dependencies.
# Track two channels (even though they're similar here) to allow granular
# configurations based on each use case. Change as you wish.
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-unstable.url = "github:nixos/nixpkgs/master";
nixlib.url = "github:nix-community/nixpkgs.lib";
latest.url = "github:nixos/nixpkgs/nixos-unstable";
blank.url = "github:divnix/blank";
# NixOS Hardware contain hardware-specific configurations (e.g. MacOS Wi-Fi
# drivers, proprietary notebook battery Kernel modules, etc) that helps
# speeding up the NixOS setup on some machines.
#
# nixos-hardware.url = "github:nixos/nixos-hardware";
deploy.url = "github:serokell/deploy-rs";
deploy.inputs.nixpkgs.follows = "nixpkgs-unstable";
home-manager.url = "github:nix-community/home-manager/master";
home-manager.inputs.nixpkgs.follows = "nixlib";
flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus";
# flake-compat = {
# url = "github:edolstra/flake-compat";
# flake = false;
# };
# Extras
emacs-overlay.url = "github:nix-community/emacs-overlay";
};
outputs = { self, nixpkgs, nixpkgs-unstable, nixlib, home-manager
, flake-utils-plus, ... }@inputs:
let
inherit (lib) attrValues;
inherit (lib.my) mapModules mapModulesRec mapHosts;
# Good luck trying to use Darwin or Windows. Modules are referring NixOS
# configurations that made this transition hard.
system = "x86_64-linux";
tests = import ./tests;
mkPkgs = pkgs: extraOverlays:
import pkgs {
inherit system;
config.allowUnfree = true; # necessary evil
# error: You MUST accept the Android SDK License Agreement.
# https://developer.android.com/studio/terms
#
# Therefore, if you do enable the Android module you're agreeing with
# the terms
config.android_sdk.accept_license = true;
overlays = extraOverlays ++ (attrValues self.overlays);
};
pkgs = mkPkgs nixpkgs [ self.overlay ];
uPkgs = mkPkgs nixpkgs-unstable [ ];
lib = nixpkgs.lib.extend (self: super: {
# Use nice convenient functions developed by @hlissner
# Ref: https://github.com/hlissner/dotfiles/tree/804011f53826c226cbf7e0acd8002087a223051d/lib
my = import ./lib {
inherit pkgs inputs;
lib = self;
};
});
in {
lib = lib.my;
overlay = final: prev: {
unstable = uPkgs;
my = self.packages."${system}";
};
overlays = mapModules ./overlays import;
packages."${system}" = mapModules ./packages (p: pkgs.callPackage p { });
nixosModules = {
dotfiles = import ./.;
} // mapModulesRec ./modules import;
nixosConfigurations = mapHosts ./hosts { inherit system; };
devShell."${system}" = import ./shell.nix { inherit pkgs; };
};
}