mirror of
https://github.com/librephoenix/nixos-config
synced 2025-07-06 06:52:13 +05:30
Boilerplate reduction (I understand strings in nix now!)
This commit is contained in:
parent
c7f3327147
commit
b4a0d72a92
17 changed files with 136 additions and 144 deletions
|
@ -41,12 +41,12 @@ My user-level Nix modules are organized into this directory:
|
|||
Variables can be imported from [[../flake.nix][flake.nix]] by setting the =extraSpecialArgs= block inside the flake (see [[../flake.nix][my flake]] for more details). This allows variables to merely be managed in one place ([[../flake.nix][flake.nix]]) rather than having to manage them in multiple locations.
|
||||
|
||||
I currently import the following variables to the system config:
|
||||
- =myName= - Username
|
||||
- =myHostname= - Hostname for machine
|
||||
- =myHomeDir= - Absolute path to home directory derived from =myName=
|
||||
- =myEmail= - Email
|
||||
- =myDotfilesDir= - Path to my dotfiles directory on the system
|
||||
- =myTheme= - base16 theme stored in ../themes to be used
|
||||
- =myThemePolarity= - whether theme is =light= or =dark=
|
||||
- =myBackgroundUrl= - Direct link to background wallpaper (used for login screen)
|
||||
- =myBackgroundSha256= - Checksum for background image used when downloading
|
||||
- =username= - Username
|
||||
- =hostname= - Hostname for machine
|
||||
- =myHomeDir= - Absolute path to home directory derived from =username=
|
||||
- =email= - Email
|
||||
- =dotfilesDir= - Path to my dotfiles directory on the system
|
||||
- =theme= - base16 theme stored in ../themes to be used
|
||||
- =themePolarity= - whether theme is =light= or =dark=
|
||||
- =backgroundUrl= - Direct link to background wallpaper (used for login screen)
|
||||
- =backgroundSha256= - Checksum for background image used when downloading
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{ config, lib, pkgs, eaf, eaf-browser, org-nursery, myThemePolarity, ... }:
|
||||
{ config, lib, pkgs, eaf, eaf-browser, org-nursery, theme, ... }:
|
||||
let
|
||||
myDashboardLogo = ./. + "/nix-" + myThemePolarity + ".png";
|
||||
themePolarity = lib.removeSuffix "\n" (builtins.readFile (./. + "../../../../themes"+("/"+theme)+"/polarity.txt"));
|
||||
dashboardLogo = ./. + "/nix-" + themePolarity + ".png";
|
||||
in
|
||||
{
|
||||
programs.doom-emacs = {
|
||||
|
@ -78,7 +79,7 @@ in
|
|||
home.file.".emacs.d/org-nursery" = {
|
||||
source = "${org-nursery}";
|
||||
};
|
||||
home.file.".emacs.d/dashboard-logo.png".source = myDashboardLogo;
|
||||
home.file.".emacs.d/dashboard-logo.png".source = dashboardLogo;
|
||||
home.file.".emacs.d/scripts/copy-link-or-file/copy-link-or-file-to-clipboard.sh" = {
|
||||
source = ./scripts/copy-link-or-file/copy-link-or-file-to-clipboard.sh;
|
||||
executable = true;
|
||||
|
|
|
@ -1409,9 +1409,10 @@ Any git package can be configured for a particular commit or branch:
|
|||
* Nix Integration
|
||||
In order to have Nix load my Doom Emacs configuration [[./doom.nix][doom.nix]], which I source in the =imports= block of my [[../../home.nix][home.nix]].
|
||||
#+BEGIN_SRC nix :tangle doom.nix
|
||||
{ config, lib, pkgs, eaf, eaf-browser, org-nursery, myThemePolarity, ... }:
|
||||
{ config, lib, pkgs, eaf, eaf-browser, org-nursery, theme, ... }:
|
||||
let
|
||||
myDashboardLogo = ./. + "/nix-" + myThemePolarity + ".png";
|
||||
themePolarity = lib.removeSuffix "\n" (builtins.readFile (./. + "../../../../themes"+("/"+theme)+"/polarity.txt"));
|
||||
dashboardLogo = ./. + "/nix-" + themePolarity + ".png";
|
||||
in
|
||||
{
|
||||
programs.doom-emacs = {
|
||||
|
@ -1489,7 +1490,7 @@ in
|
|||
home.file.".emacs.d/org-nursery" = {
|
||||
source = "${org-nursery}";
|
||||
};
|
||||
home.file.".emacs.d/dashboard-logo.png".source = myDashboardLogo;
|
||||
home.file.".emacs.d/dashboard-logo.png".source = dashboardLogo;
|
||||
home.file.".emacs.d/scripts/copy-link-or-file/copy-link-or-file-to-clipboard.sh" = {
|
||||
source = ./scripts/copy-link-or-file/copy-link-or-file-to-clipboard.sh;
|
||||
executable = true;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{ config, lib, pkgs, myName, myEmail, ... }:
|
||||
{ config, lib, pkgs, username, email, ... }:
|
||||
|
||||
{
|
||||
home.packages = [ pkgs.git ];
|
||||
programs.git.enable = true;
|
||||
programs.git.userName = myName;
|
||||
programs.git.userEmail = myEmail;
|
||||
programs.git.userName = username;
|
||||
programs.git.userEmail = email;
|
||||
programs.git.extraConfig = {
|
||||
init.defaultBranch = "main";
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, pkgs, myName, myDotfilesDir, ... }:
|
||||
{ config, lib, pkgs, username, dotfilesDir, ... }:
|
||||
|
||||
let
|
||||
# This sets up my "phoenix" script with my configuration paths
|
||||
|
@ -6,12 +6,12 @@ let
|
|||
myPhoenixScript = ''
|
||||
if [ "$1" = "sync" ]; then
|
||||
if [ "$2" != "user" ]; then
|
||||
pushd ''+myDotfilesDir+'';
|
||||
pushd ''+dotfilesDir+'';
|
||||
sudo nixos-rebuild switch --flake .#;
|
||||
popd;
|
||||
elif [ "2" != "system" ]; then
|
||||
pushd ''+myDotfilesDir+'';
|
||||
home-manager switch --flake .#''+myName+'';
|
||||
pushd ''+dotfilesDir+'';
|
||||
home-manager switch --flake .#''+username+'';
|
||||
popd;
|
||||
which xmobar &> /dev/null && killall xmobar;
|
||||
which xmonad &> /dev/null && xmonad --recompile && xmonad --restart;
|
||||
|
@ -19,7 +19,7 @@ let
|
|||
[ -f ~/.fehbg-stylix ] &> /dev/null && ~/.fehbg-stylix;
|
||||
fi
|
||||
elif [ "$1" = "update" ]; then
|
||||
pushd ''+myDotfilesDir+'';
|
||||
pushd ''+dotfilesDir+'';
|
||||
nix flake update;
|
||||
popd;
|
||||
if [ -d ~/.emacs.d/eaf/app/browser ]
|
||||
|
|
|
@ -1,32 +1,33 @@
|
|||
{ config, pkgs, myTheme, myThemePolarity, myBackgroundUrl, myBackgroundSha256, ... }:
|
||||
{ config, lib, pkgs, theme, font, fontPkg, ... }:
|
||||
|
||||
let
|
||||
myFont = "Inconsolata";
|
||||
myFontPkg = pkgs.inconsolata;
|
||||
myThemePath = "../../../themes/"+myTheme+"/"+myTheme+".yaml";
|
||||
themePath = "../../../themes"+("/"+theme+"/"+theme)+".yaml";
|
||||
themePolarity = lib.removeSuffix "\n" (builtins.readFile (./. + "../../../themes"+("/"+theme)+"/polarity.txt"));
|
||||
backgroundUrl = builtins.readFile (./. + "../../../themes"+("/"+theme)+"/backgroundurl.txt");
|
||||
backgroundSha256 = builtins.readFile (./. + "../../../themes/"+("/"+theme)+"/backgroundsha256.txt");
|
||||
in
|
||||
{
|
||||
home.file.".currenttheme".text = myTheme;
|
||||
home.file.".currenttheme".text = theme;
|
||||
stylix.autoEnable = false;
|
||||
stylix.polarity = myThemePolarity;
|
||||
stylix.polarity = themePolarity;
|
||||
stylix.image = pkgs.fetchurl {
|
||||
url = myBackgroundUrl;
|
||||
sha256 = myBackgroundSha256;
|
||||
url = backgroundUrl;
|
||||
sha256 = backgroundSha256;
|
||||
};
|
||||
stylix.base16Scheme = ./. + myThemePath;
|
||||
stylix.base16Scheme = ./. + themePath;
|
||||
|
||||
stylix.fonts = {
|
||||
monospace = {
|
||||
name = myFont;
|
||||
package = myFontPkg;
|
||||
name = font;
|
||||
package = fontPkg;
|
||||
};
|
||||
serif = {
|
||||
name = myFont;
|
||||
package = myFontPkg;
|
||||
name = font;
|
||||
package = fontPkg;
|
||||
};
|
||||
sansSerif = {
|
||||
name = myFont;
|
||||
package = myFontPkg;
|
||||
name = font;
|
||||
package = fontPkg;
|
||||
};
|
||||
emoji = {
|
||||
name = "Noto Color Emoji";
|
||||
|
@ -51,8 +52,8 @@ in
|
|||
#!/bin/sh
|
||||
feh --no-fehbg --bg-fill ''+
|
||||
pkgs.fetchurl {
|
||||
url = myBackgroundUrl;
|
||||
sha256 = myBackgroundSha256;
|
||||
url = backgroundUrl;
|
||||
sha256 = backgroundSha256;
|
||||
}+'';
|
||||
'';
|
||||
home.file.".fehbg-stylix".executable = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue