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
# soundly
environment.variables.DOTFILES = findFirst pathExists dotFilesDir [
"${config.user.home}/.config/dotfiles"
"/etc/dotfiles"
];
environment.variables.DOTFILES_BIN = "$DOTFILES/bin";
environment.variables.DOTFILES = config.dotfiles.dir;
environment.variables.DOTFILES_BIN = config.dotfiles.binDir;
# Configure nix and nixpkgs
environment.variables.NIXPKGS_ALLOW_UNFREE = "1";
@ -27,8 +24,8 @@ with lib.my;
package = pkgs.nixFlakes;
extraOptions = "experimental-features = nix-command flakes";
nixPath = nixPathInputs ++ [
"nixpkgs-overlays=${dotFilesDir}/overlays"
"dotfiles=${dotFilesDir}"
"nixpkgs-overlays=${config.dotfiles.dir}/overlays"
"dotfiles=${config.dotfiles.dir}"
];
binaryCaches = [
"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.my;
let inherit (inputs) agenix;
secretsDir = "${dotFilesDir}/hosts/${config.networking.hostName}/secrets";
secretsDir = "${config.dotfiles.dir}/hosts/${config.networking.hostName}/secrets";
secretsFile = "${secretsDir}/secrets.nix";
in {
imports = [ agenix.nixosModules.age ];

View file

@ -21,48 +21,37 @@ in {
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
(makeDesktopItem {
name = "rofi-browsermenu";
desktopName = "Open Bookmark in Browser";
icon = "bookmark-new-symbolic";
exec = "$DOTFILES_BIN/rofi/browsermenu";
exec = "${config.dotfiles.binDir}/rofi/browsermenu";
})
(makeDesktopItem {
name = "rofi-browsermenu-history";
desktopName = "Open Browser History";
icon = "accessories-clock";
exec = "$DOTFILES_BIN/rofi/browsermenu history";
exec = "${config.dotfiles.binDir}/rofi/browsermenu history";
})
(makeDesktopItem {
name = "rofi-filemenu";
desktopName = "Open Directory in Terminal";
icon = "folder";
exec = "$DOTFILES_BIN/rofi/filemenu";
exec = "${config.dotfiles.binDir}/rofi/filemenu";
})
(makeDesktopItem {
name = "rofi-filemenu-scratch";
desktopName = "Open Directory in Scratch Terminal";
icon = "folder";
exec = "$DOTFILES_BIN/rofi/filemenu -x";
exec = "${config.dotfiles.binDir}/rofi/filemenu -x";
})
(makeDesktopItem {
name = "lock-display";
desktopName = "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;
let cfg = config.modules.desktop.browsers.qutebrowser;
pkg = pkgs.unstable.qutebrowser;
configDir = config.dotfiles.configDir;
in {
options.modules.desktop.browsers.qutebrowser = with types; {
enable = mkBoolOpt false;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -6,6 +6,18 @@ with lib.my;
options = with types; {
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 = {
file = mkOpt' attrs {} "Files to place directly in $HOME";
configFile = mkOpt' attrs {} "Files to place in $XDG_CONFIG_HOME";

View file

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

View file

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

View file

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

View file

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