Add multiple hosts & restructure things
This commit is contained in:
12
common/default.nix
Normal file
12
common/default.nix
Normal file
@@ -0,0 +1,12 @@
|
||||
{ config, lib, helpers, ... }:
|
||||
|
||||
{
|
||||
options.custom = {
|
||||
modules = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.path;
|
||||
default = [];
|
||||
};
|
||||
};
|
||||
|
||||
imports = (helpers.getModules "/default.nix" config.custom.modules);
|
||||
}
|
||||
25
common/helpers.nix
Normal file
25
common/helpers.nix
Normal file
@@ -0,0 +1,25 @@
|
||||
{ lib, ... }: {
|
||||
getModules = (filename: modules:
|
||||
(builtins.filter
|
||||
(path: builtins.pathExists path)
|
||||
# (builtins.map
|
||||
# (dirname: ./. + ("/" + dirname) + filename)
|
||||
# (lib.attrsets.filterAttrs
|
||||
# (entry: entry == "directory")
|
||||
# (builtins.readDir ../modules)
|
||||
# )
|
||||
# )
|
||||
(builtins.map
|
||||
(path: path + filename)
|
||||
modules
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
filterModules = (modules:
|
||||
(builtins.filter
|
||||
(path: builtins.pathExists path)
|
||||
modules
|
||||
)
|
||||
);
|
||||
}
|
||||
70
common/home.nix
Normal file
70
common/home.nix
Normal file
@@ -0,0 +1,70 @@
|
||||
{ pkgs, config, lib, helpers, ... }:
|
||||
|
||||
{
|
||||
options.custom = {
|
||||
username = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "dakedres";
|
||||
};
|
||||
|
||||
nonFreePackages = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [];
|
||||
};
|
||||
|
||||
wallpaper = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
};
|
||||
|
||||
colors =
|
||||
let
|
||||
colorOption = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "#000000";
|
||||
};
|
||||
in
|
||||
{
|
||||
base00 = colorOption;
|
||||
base01 = colorOption;
|
||||
base02 = colorOption;
|
||||
base03 = colorOption;
|
||||
base04 = colorOption;
|
||||
base05 = colorOption;
|
||||
base06 = colorOption;
|
||||
base07 = colorOption;
|
||||
base08 = colorOption;
|
||||
base09 = colorOption;
|
||||
base0A = colorOption;
|
||||
base0B = colorOption;
|
||||
base0C = colorOption;
|
||||
base0D = colorOption;
|
||||
base0E = colorOption;
|
||||
base0F = colorOption;
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
username = config.custom.username;
|
||||
nonFreePackages = config.custom.nonFreePackages;
|
||||
in
|
||||
{
|
||||
home = {
|
||||
username = username;
|
||||
homeDirectory = "/home/${username}";
|
||||
};
|
||||
|
||||
# Unfree packages
|
||||
nixpkgs.config.allowUnfreePredicate = pkg:
|
||||
builtins.elem (lib.getName pkg) nonFreePackages;
|
||||
|
||||
home.packages =
|
||||
map (name: pkgs.${name}) nonFreePackages;
|
||||
|
||||
# Take over my xsession
|
||||
xsession.enable = true;
|
||||
|
||||
# Let Home Manager install and manage itself.
|
||||
programs.home-manager.enable = true;
|
||||
};
|
||||
}
|
||||
3
common/homeOptions.nix
Normal file
3
common/homeOptions.nix
Normal file
@@ -0,0 +1,3 @@
|
||||
{ lib, ... }: {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user