Replace lib.paths with config.dotfiles.*

This commit is contained in:
Henrik Lissner 2021-03-01 20:43:12 -05:00
parent 2073f02083
commit 9d90e3a822
15 changed files with 32 additions and 36 deletions

View file

@ -11,11 +11,8 @@ with lib.my;
# Common config for all nixos machines; and to ensure the flake operates # Common config for all nixos machines; and to ensure the flake operates
# soundly # soundly
environment.variables.DOTFILES = findFirst pathExists dotFilesDir [ environment.variables.DOTFILES = config.dotfiles.dir;
"${config.user.home}/.config/dotfiles" environment.variables.DOTFILES_BIN = config.dotfiles.binDir;
"/etc/dotfiles"
];
environment.variables.DOTFILES_BIN = "$DOTFILES/bin";
# Configure nix and nixpkgs # Configure nix and nixpkgs
environment.variables.NIXPKGS_ALLOW_UNFREE = "1"; environment.variables.NIXPKGS_ALLOW_UNFREE = "1";
@ -27,8 +24,8 @@ with lib.my;
package = pkgs.nixFlakes; package = pkgs.nixFlakes;
extraOptions = "experimental-features = nix-command flakes"; extraOptions = "experimental-features = nix-command flakes";
nixPath = nixPathInputs ++ [ nixPath = nixPathInputs ++ [
"nixpkgs-overlays=${dotFilesDir}/overlays" "nixpkgs-overlays=${config.dotfiles.dir}/overlays"
"dotfiles=${dotFilesDir}" "dotfiles=${config.dotfiles.dir}"
]; ];
binaryCaches = [ binaryCaches = [
"https://nix-community.cachix.org" "https://nix-community.cachix.org"

View file

@ -1,12 +0,0 @@
{ self, lib, ... }:
with builtins;
with lib;
rec {
# ...
dotFilesDir = toString ../.;
modulesDir = "${dotFilesDir}/modules";
configDir = "${dotFilesDir}/config";
binDir = "${dotFilesDir}/bin";
themesDir = "${modulesDir}/themes";
}

View file

@ -6,7 +6,7 @@ with builtins;
with lib; with lib;
with lib.my; with lib.my;
let inherit (inputs) agenix; let inherit (inputs) agenix;
secretsDir = "${dotFilesDir}/hosts/${config.networking.hostName}/secrets"; secretsDir = "${config.dotfiles.dir}/hosts/${config.networking.hostName}/secrets";
secretsFile = "${secretsDir}/secrets.nix"; secretsFile = "${secretsDir}/secrets.nix";
in { in {
imports = [ agenix.nixosModules.age ]; imports = [ agenix.nixosModules.age ];

View file

@ -21,48 +21,37 @@ in {
exec ${pkgs.rofi}/bin/rofi -terminal xst -m -1 "$@" exec ${pkgs.rofi}/bin/rofi -terminal xst -m -1 "$@"
'') '')
# For rapidly test changes to rofi's stylesheets
# (writeScriptBin "rofi-test" ''
# #!${stdenv.shell}
# themefile=$1
# themename=${my.theme.name}
# shift
# exec rofi \
# -theme ${themesDir}/$themename/rofi/$themefile \
# "$@"
# '')
# Fake rofi dmenu entries # Fake rofi dmenu entries
(makeDesktopItem { (makeDesktopItem {
name = "rofi-browsermenu"; name = "rofi-browsermenu";
desktopName = "Open Bookmark in Browser"; desktopName = "Open Bookmark in Browser";
icon = "bookmark-new-symbolic"; icon = "bookmark-new-symbolic";
exec = "$DOTFILES_BIN/rofi/browsermenu"; exec = "${config.dotfiles.binDir}/rofi/browsermenu";
}) })
(makeDesktopItem { (makeDesktopItem {
name = "rofi-browsermenu-history"; name = "rofi-browsermenu-history";
desktopName = "Open Browser History"; desktopName = "Open Browser History";
icon = "accessories-clock"; icon = "accessories-clock";
exec = "$DOTFILES_BIN/rofi/browsermenu history"; exec = "${config.dotfiles.binDir}/rofi/browsermenu history";
}) })
(makeDesktopItem { (makeDesktopItem {
name = "rofi-filemenu"; name = "rofi-filemenu";
desktopName = "Open Directory in Terminal"; desktopName = "Open Directory in Terminal";
icon = "folder"; icon = "folder";
exec = "$DOTFILES_BIN/rofi/filemenu"; exec = "${config.dotfiles.binDir}/rofi/filemenu";
}) })
(makeDesktopItem { (makeDesktopItem {
name = "rofi-filemenu-scratch"; name = "rofi-filemenu-scratch";
desktopName = "Open Directory in Scratch Terminal"; desktopName = "Open Directory in Scratch Terminal";
icon = "folder"; icon = "folder";
exec = "$DOTFILES_BIN/rofi/filemenu -x"; exec = "${config.dotfiles.binDir}/rofi/filemenu -x";
}) })
(makeDesktopItem { (makeDesktopItem {
name = "lock-display"; name = "lock-display";
desktopName = "Lock screen"; desktopName = "Lock screen";
icon = "system-lock-screen"; icon = "system-lock-screen";
exec = "$DOTFILES_BIN/zzz"; exec = "${config.dotfiles.binDir}/zzz";
}) })
]; ];
}; };

View file

@ -9,6 +9,7 @@ with lib;
with lib.my; with lib.my;
let cfg = config.modules.desktop.browsers.qutebrowser; let cfg = config.modules.desktop.browsers.qutebrowser;
pkg = pkgs.unstable.qutebrowser; pkg = pkgs.unstable.qutebrowser;
configDir = config.dotfiles.configDir;
in { in {
options.modules.desktop.browsers.qutebrowser = with types; { options.modules.desktop.browsers.qutebrowser = with types; {
enable = mkBoolOpt false; enable = mkBoolOpt false;

View file

@ -3,6 +3,7 @@
with lib; with lib;
with lib.my; with lib.my;
let cfg = config.modules.desktop.bspwm; let cfg = config.modules.desktop.bspwm;
configDir = config.dotfiles.configDir;
in { in {
options.modules.desktop.bspwm = { options.modules.desktop.bspwm = {
enable = mkBoolOpt false; enable = mkBoolOpt false;

View file

@ -10,6 +10,7 @@
with lib; with lib;
with lib.my; with lib.my;
let cfg = config.modules.desktop.media.graphics; let cfg = config.modules.desktop.media.graphics;
configDir = config.dotfiles.configDir;
in { in {
options.modules.desktop.media.graphics = { options.modules.desktop.media.graphics = {
enable = mkBoolOpt false; enable = mkBoolOpt false;

View file

@ -3,6 +3,7 @@
with lib; with lib;
with lib.my; with lib.my;
let cfg = config.modules.desktop.media.ncmpcpp; let cfg = config.modules.desktop.media.ncmpcpp;
configDir = config.dotfiles.configDir;
in { in {
options.modules.desktop.media.ncmpcpp = { options.modules.desktop.media.ncmpcpp = {
enable = mkBoolOpt false; enable = mkBoolOpt false;

View file

@ -3,6 +3,7 @@
with lib; with lib;
with lib.my; with lib.my;
let cfg = config.modules.desktop.stumpwm; let cfg = config.modules.desktop.stumpwm;
configDir = config.dotfiles.configDir;
in { in {
options.modules.desktop.stumpwm = { options.modules.desktop.stumpwm = {
enable = mkBoolOpt false; enable = mkBoolOpt false;

View file

@ -7,6 +7,7 @@
with lib; with lib;
with lib.my; with lib.my;
let cfg = config.modules.editors.emacs; let cfg = config.modules.editors.emacs;
configDir = config.dotfiles.configDir;
in { in {
options.modules.editors.emacs = { options.modules.editors.emacs = {
enable = mkBoolOpt false; enable = mkBoolOpt false;

View file

@ -6,6 +6,18 @@ with lib.my;
options = with types; { options = with types; {
user = mkOpt attrs {}; user = mkOpt attrs {};
dotfiles = let t = either str path; in {
dir = mkOpt t
(findFirst pathExists (toString ../.) [
"${config.user.home}/.config/dotfiles"
"/etc/dotfiles"
]);
binDir = mkOpt t "${config.dotfiles.dir}/bin";
configDir = mkOpt t "${config.dotfiles.dir}/config";
modulesDir = mkOpt t "${config.dotfiles.dir}/modules";
themesDir = mkOpt t "${config.dotfiles.modulesDir}/themes";
};
home = { home = {
file = mkOpt' attrs {} "Files to place directly in $HOME"; file = mkOpt' attrs {} "Files to place directly in $HOME";
configFile = mkOpt' attrs {} "Files to place in $XDG_CONFIG_HOME"; configFile = mkOpt' attrs {} "Files to place in $XDG_CONFIG_HOME";

View file

@ -3,6 +3,7 @@
with lib; with lib;
with lib.my; with lib.my;
let cfg = config.modules.services.docker; let cfg = config.modules.services.docker;
configDir = config.dotfiles.configDir;
in { in {
options.modules.services.docker = { options.modules.services.docker = {
enable = mkBoolOpt false; enable = mkBoolOpt false;

View file

@ -3,6 +3,7 @@
with lib; with lib;
with lib.my; with lib.my;
let cfg = config.modules.shell.git; let cfg = config.modules.shell.git;
configDir = config.dotfiles.configDir;
in { in {
options.modules.shell.git = { options.modules.shell.git = {
enable = mkBoolOpt false; enable = mkBoolOpt false;

View file

@ -10,6 +10,7 @@ let cfg = config.modules.shell.tmux;
#!${pkgs.stdenv.shell} #!${pkgs.stdenv.shell}
exec ${pkgs.tmux}/bin/tmux -f "$TMUX_HOME/config" "$@" exec ${pkgs.tmux}/bin/tmux -f "$TMUX_HOME/config" "$@"
''); '');
configDir = config.dotfiles.configDir;
in { in {
options.modules.shell.tmux = with types; { options.modules.shell.tmux = with types; {
enable = mkBoolOpt false; enable = mkBoolOpt false;

View file

@ -3,6 +3,7 @@
with lib; with lib;
with lib.my; with lib.my;
let cfg = config.modules.shell.zsh; let cfg = config.modules.shell.zsh;
configDir = config.dotfiles.configDir;
in { in {
options.modules.shell.zsh = with types; { options.modules.shell.zsh = with types; {
enable = mkBoolOpt false; enable = mkBoolOpt false;