generated from ryantm/home-manager-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
home.nix
71 lines (56 loc) · 1.77 KB
/
home.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
{ pkgs, lib, ... }:
let
# ---------------------------------------------------------
# ENVIRONMENT
# ---------------------------------------------------------
homeDir = builtins.getEnv "HOME";
userName = builtins.getEnv "USER";
libDir = toString ./lib/defaults;
meConfig = "${homeDir}/.me.nix";
defaultMeDir = "${homeDir}/.me.d";
# ---------------------------------------------------------
# FUNCTIONS
# ---------------------------------------------------------
nixFilesIn = dir: with builtins;
map
(f: "${dir}/${f}")
(filter
(f: lib.strings.hasSuffix ".nix" "${f}")
(builtins.attrNames (builtins.readDir dir)));
# ---------------------------------------------------------
# VARIABLES
# ---------------------------------------------------------
libModules = nixFilesIn libDir;
meModules =
with builtins;
if pathExists meConfig then
concatMap (p: nixFilesIn p)(import meConfig)
else
if pathExists defaultMeDir then
nixFilesIn defaultMeDir
else
[];
modules = libModules ++ meModules;
in
{
imports = modules;
# Override this in ~/.me.d/
nixpkgs.config = {
allowUnfree = true;
permittedInsecurePackages = [];
};
# Override this in ~/.me.d/
home.file.".config/nix/nix.conf".text = ''
experimental-features = nix-command flakes
'';
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
# incompatible changes.
#
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
#stateVersion = "20.09";
home.stateVersion = "20.09";
}