Boilerplate reduction (I understand strings in nix now!)

This commit is contained in:
Emmet 2023-06-22 14:53:10 -05:00
parent c7f3327147
commit b4a0d72a92
17 changed files with 136 additions and 144 deletions

View file

@ -11,23 +11,14 @@
locale = "en_US.UTF-8"; # select locale locale = "en_US.UTF-8"; # select locale
# ----- USER SETTINGS ----- # # ----- USER SETTINGS ----- #
name = "emmet"; # username username = "emmet"; # username
name = "Emmet"; # name/identifier
email = "librephoenix3@pm.me"; # email (used for certain configurations) email = "librephoenix3@pm.me"; # email (used for certain configurations)
dotfilesDir = "~/.dotfiles"; # absolute path of the repo dotfilesDir = "~/.dotfiles"; # absolute path of the repo locally
theme = "ayu-dark"; # selcted theme from my themes directory theme = "ayu-dark"; # selcted theme from my themes directory
wm = "xmonad"; # Selected window manager or desktop environment wm = "xmonad"; # Selected window manager or desktop environment
font = "Inconsolata"; # Selected font
# --- PATH CALCULATIONS -- # fontPkg = pkgs.inconsolata; # Font package
homeNixPath = ./. + "/profiles"+("/"+profile)+"/home.nix";
configurationNixPath = ./. + "/profiles"+("/"+profile)+"/configuration.nix";
systemWMNixPath = ./. + "/system/wm"+("/"+wm)+".nix";
userWMNixPath = ./. + "/user/wm"+("/"+wm+"/"+wm)+".nix";
themePolarityPath = "/themes/"+theme+"/polarity.txt";
themePolarity = lib.removeSuffix "\n" (builtins.readFile (./. + themePolarityPath));
backgroundUrlPath = "/themes/"+theme+"/backgroundurl.txt";
backgroundUrl = builtins.readFile (./. + backgroundUrlPath);
backgroundSha256Path = "/themes/"+theme+"/backgroundsha256.txt";
backgroundSha256 = builtins.readFile (./. + backgroundSha256Path);
# set pkgs to correct type # set pkgs to correct type
pkgs = import nixpkgs { pkgs = import nixpkgs {
@ -42,20 +33,17 @@
homeConfigurations = { homeConfigurations = {
emmet = home-manager.lib.homeManagerConfiguration { emmet = home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
modules = [ modules = [ (./. + "/profiles"+("/"+profile)+"/home.nix") ]; # load home.nix from profile
homeNixPath
];
extraSpecialArgs = { extraSpecialArgs = {
myName = name; inherit username;
myHostname = hostname; inherit name;
myHomeDir = "/home/"+name; inherit hostname;
myEmail = email; inherit email;
myDotfilesDir = dotfilesDir; inherit dotfilesDir;
myTheme = theme; inherit theme;
myThemePolarity = themePolarity; inherit font;
myBackgroundUrl = backgroundUrl; inherit fontPkg;
myBackgroundSha256 = backgroundSha256; inherit wm;
inherit userWMNixPath;
inherit (inputs) nix-doom-emacs; inherit (inputs) nix-doom-emacs;
inherit (inputs) stylix; inherit (inputs) stylix;
inherit (inputs) eaf; inherit (inputs) eaf;
@ -67,17 +55,17 @@
nixosConfigurations = { nixosConfigurations = {
snowfire = lib.nixosSystem { snowfire = lib.nixosSystem {
inherit system; inherit system;
modules = [ configurationNixPath ]; modules = [ (./. + "/profiles"+("/"+profile)+"/configuration.nix") ]; # load configuration.nix from profile
specialArgs = { specialArgs = {
myName = name; inherit username;
myHostname = hostname; inherit name;
myTimezone = timezone; inherit hostname;
myLocale = locale; inherit timezone;
myTheme = theme; inherit locale;
myThemePolarity = themePolarity; inherit theme;
myBackgroundUrl = backgroundUrl; inherit font;
myBackgroundSha256 = backgroundSha256; inherit fontPkg;
inherit systemWMNixPath; inherit wm;
inherit (inputs) stylix; inherit (inputs) stylix;
inherit (inputs) blocklist-hosts; inherit (inputs) blocklist-hosts;
}; };

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, blocklist-hosts, myName, myHostname, myTimezone, myLocale, myTheme, myBackgroundUrl, myBackgroundSha256, ... }: { config, lib, pkgs, blocklist-hosts, username, hostname, timezone, locale, ... }:
args@{ ... }: args@{ ... }:
@ -32,26 +32,26 @@ args@{ ... }:
boot.loader.efi.efiSysMountPoint = "/boot/efi"; boot.loader.efi.efiSysMountPoint = "/boot/efi";
# Networking # Networking
networking.hostName = myHostname; # Define your hostname. networking.hostName = hostname; # Define your hostname.
networking.networkmanager.enable = true; # Use networkmanager networking.networkmanager.enable = true; # Use networkmanager
# Timezone and locale # Timezone and locale
time.timeZone = myTimezone; # time zone time.timeZone = timezone; # time zone
i18n.defaultLocale = myLocale; i18n.defaultLocale = locale;
i18n.extraLocaleSettings = { i18n.extraLocaleSettings = {
LC_ADDRESS = myLocale; LC_ADDRESS = locale;
LC_IDENTIFICATION = myLocale; LC_IDENTIFICATION = locale;
LC_MEASUREMENT = myLocale; LC_MEASUREMENT = locale;
LC_MONETARY = myLocale; LC_MONETARY = locale;
LC_NAME = myLocale; LC_NAME = locale;
LC_NUMERIC = myLocale; LC_NUMERIC = locale;
LC_PAPER = myLocale; LC_PAPER = locale;
LC_TELEPHONE = myLocale; LC_TELEPHONE = locale;
LC_TIME = myLocale; LC_TIME = locale;
}; };
# User account # User account
users.users.${myName} = { users.users.${username} = {
isNormalUser = true; isNormalUser = true;
description = "Emmet"; description = "Emmet";
extraGroups = [ "networkmanager" "wheel" ]; extraGroups = [ "networkmanager" "wheel" ];

View file

@ -1,10 +1,10 @@
{ config, lib, pkgs, python3Packages, nix-doom-emacs, stylix, myName, myEmail, myHomeDir, myDotfilesDir, myTheme, ... }: { config, lib, pkgs, python3Packages, nix-doom-emacs, stylix, username, email, dotfilesDir, theme, ... }:
{ {
# Home Manager needs a bit of information about you and the paths it should # Home Manager needs a bit of information about you and the paths it should
# manage. # manage.
home.username = myName; home.username = username;
home.homeDirectory = myHomeDir; home.homeDirectory = "/home/"+username;
programs.home-manager.enable = true; programs.home-manager.enable = true;

View file

@ -2,7 +2,7 @@
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ config, lib, pkgs, blocklist-hosts, myName, myHostname, myTimezone, myLocale, myTheme, myBackgroundUrl, myBackgroundSha256, ... }: { config, lib, pkgs, blocklist-hosts, username, name, hostname, timezone, locale, wm, theme, ... }:
{ {
imports = imports =
[ ../work/configuration.nix # Personal is essentially work system + games [ ../work/configuration.nix # Personal is essentially work system + games

View file

@ -1,10 +1,10 @@
{ config, lib, pkgs, python3Packages, nix-doom-emacs, stylix, myName, myEmail, myHomeDir, myDotfilesDir, myTheme, ... }: { config, lib, pkgs, python3Packages, nix-doom-emacs, stylix, username, email, dotfilesDir, theme, ... }:
{ {
# Home Manager needs a bit of information about you and the paths it should # Home Manager needs a bit of information about you and the paths it should
# manage. # manage.
home.username = myName; home.username = username;
home.homeDirectory = myHomeDir; home.homeDirectory = "/home/"+username;
programs.home-manager.enable = true; programs.home-manager.enable = true;

View file

@ -2,7 +2,7 @@
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ config, lib, pkgs, blocklist-hosts, myName, myHostname, myTimezone, myLocale, systemWMNixPath, myTheme, myBackgroundUrl, myBackgroundSha256, ... }: { config, lib, pkgs, blocklist-hosts, username, name, hostname, timezone, locale, wm, theme, ... }:
{ {
imports = imports =
[ ../../system/hardware-configuration.nix [ ../../system/hardware-configuration.nix
@ -10,7 +10,7 @@
../../system/hardware/opengl.nix ../../system/hardware/opengl.nix
../../system/hardware/printing.nix ../../system/hardware/printing.nix
../../system/hardware/bluetooth.nix ../../system/hardware/bluetooth.nix
systemWMNixPath # My window manager selected from flake (./. + "../../../system/wm"+("/"+wm)+".nix") # My window manager
../../system/app/flatpak.nix ../../system/app/flatpak.nix
../../system/security/doas.nix ../../system/security/doas.nix
../../system/security/gpg.nix ../../system/security/gpg.nix
@ -41,28 +41,28 @@
boot.loader.efi.efiSysMountPoint = "/boot/efi"; boot.loader.efi.efiSysMountPoint = "/boot/efi";
# Networking # Networking
networking.hostName = myHostname; # Define your hostname. networking.hostName = hostname; # Define your hostname.
networking.networkmanager.enable = true; # Use networkmanager networking.networkmanager.enable = true; # Use networkmanager
# Timezone and locale # Timezone and locale
time.timeZone = myTimezone; # time zone time.timeZone = timezone; # time zone
i18n.defaultLocale = myLocale; i18n.defaultLocale = locale;
i18n.extraLocaleSettings = { i18n.extraLocaleSettings = {
LC_ADDRESS = myLocale; LC_ADDRESS = locale;
LC_IDENTIFICATION = myLocale; LC_IDENTIFICATION = locale;
LC_MEASUREMENT = myLocale; LC_MEASUREMENT = locale;
LC_MONETARY = myLocale; LC_MONETARY = locale;
LC_NAME = myLocale; LC_NAME = locale;
LC_NUMERIC = myLocale; LC_NUMERIC = locale;
LC_PAPER = myLocale; LC_PAPER = locale;
LC_TELEPHONE = myLocale; LC_TELEPHONE = locale;
LC_TIME = myLocale; LC_TIME = locale;
}; };
# User account # User account
users.users.${myName} = { users.users.${username} = {
isNormalUser = true; isNormalUser = true;
description = "Emmet"; description = name;
extraGroups = [ "networkmanager" "wheel" ]; extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; []; packages = with pkgs; [];
uid = 1000; uid = 1000;

View file

@ -1,17 +1,17 @@
{ config, lib, pkgs, python3Packages, nix-doom-emacs, stylix, myName, myEmail, myHomeDir, myDotfilesDir, myTheme, userWMNixPath, ... }: { config, lib, pkgs, python3Packages, nix-doom-emacs, stylix, username, email, dotfilesDir, theme, wm, ... }:
{ {
# Home Manager needs a bit of information about you and the paths it should # Home Manager needs a bit of information about you and the paths it should
# manage. # manage.
home.username = myName; home.username = username;
home.homeDirectory = myHomeDir; home.homeDirectory = "/home/"+username;
programs.home-manager.enable = true; programs.home-manager.enable = true;
imports = [ imports = [
nix-doom-emacs.hmModule nix-doom-emacs.hmModule
stylix.homeManagerModules.stylix stylix.homeManagerModules.stylix
userWMNixPath # My window manager selected from flake (./. + "../../../user/wm"+("/"+wm+"/"+wm)+".nix") # My window manager selected from flake
../../user/shell/sh.nix # My zsh and bash config ../../user/shell/sh.nix # My zsh and bash config
../../user/shell/cli-collection.nix # Useful CLI apps ../../user/shell/cli-collection.nix # Useful CLI apps
../../user/bin/phoenix.nix # My nix command wrapper ../../user/bin/phoenix.nix # My nix command wrapper

View file

@ -21,10 +21,10 @@ My system-level Nix modules are organized into this directory:
Variables can be imported from [[../flake.nix][flake.nix]] by setting the =specialArgs= 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. Variables can be imported from [[../flake.nix][flake.nix]] by setting the =specialArgs= 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: I currently import the following variables to the system config:
- =myName= - Username - =username= - Username
- =myHostname= - Hostname for machine - =hostname= - Hostname for machine
- =myTimezone= - Timezone for machine - =timezone= - Timezone for machine
- =myLocale= - Locale for machine - =locale= - Locale for machine
- =myTheme= - base16 theme stored in ../themes to be used - =theme= - base16 theme stored in ../themes to be used
- =myBackgroundUrl= - Direct link to background wallpaper (used for login screen) - =backgroundUrl= - Direct link to background wallpaper (used for login screen)
- =myBackgroundSha256= - Checksum for background image used when downloading - =backgroundSha256= - Checksum for background image used when downloading

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, myName, storageDriver ? null, ... }: { config, lib, pkgs, username, storageDriver ? null, ... }:
assert lib.asserts.assertOneOf "storageDriver" storageDriver [ assert lib.asserts.assertOneOf "storageDriver" storageDriver [
null null
@ -17,5 +17,5 @@ assert lib.asserts.assertOneOf "storageDriver" storageDriver [
storageDriver = storageDriver; storageDriver = storageDriver;
autoPrune.enable = true; autoPrune.enable = true;
}; };
users.users.${myName}.extraGroups = [ "docker" ]; users.users.${username}.extraGroups = [ "docker" ];
} }

View file

@ -1,11 +1,11 @@
{ config, myName, pkgs, ... }: { config, username, pkgs, ... }:
{ {
# Doas instead of sudo # Doas instead of sudo
security.doas.enable = true; security.doas.enable = true;
security.sudo.enable = false; security.sudo.enable = false;
security.doas.extraRules = [{ security.doas.extraRules = [{
users = [ "${myName}" ]; users = [ "${username}" ];
keepEnv = true; keepEnv = true;
persist = true; persist = true;
}]; }];

View file

@ -1,33 +1,34 @@
{ config, pkgs, stylix, myTheme, myThemePolarity, myBackgroundUrl, myBackgroundSha256, ... }: { config, lib, pkgs, stylix, theme, font, fontPkg, ... }:
let let
myFont = "Inconsolata"; themePath = "../../../themes/"+theme+"/"+theme+".yaml";
myFontPkg = pkgs.inconsolata; themePolarity = lib.removeSuffix "\n" (builtins.readFile (./. + "../../../themes"+("/"+theme)+"/polarity.txt"));
myThemePath = "../../../themes/"+myTheme+"/"+myTheme+".yaml"; myLightDMTheme = if themePolarity == "light" then "Adwaita" else "Adwaita-dark";
myLightDMTheme = if myThemePolarity == "light" then "Adwaita" else "Adwaita-dark"; backgroundUrl = builtins.readFile (./. + "../../../themes"+("/"+theme)+"/backgroundurl.txt");
backgroundSha256 = builtins.readFile (./. + "../../../themes/"+("/"+theme)+"/backgroundsha256.txt");
in in
{ {
imports = [ stylix.nixosModules.stylix ]; imports = [ stylix.nixosModules.stylix ];
stylix.autoEnable = false; stylix.autoEnable = false;
stylix.polarity = myThemePolarity; stylix.polarity = themePolarity;
stylix.image = pkgs.fetchurl { stylix.image = pkgs.fetchurl {
url = myBackgroundUrl; url = backgroundUrl;
sha256 = myBackgroundSha256; sha256 = backgroundSha256;
}; };
stylix.base16Scheme = ./. + myThemePath; stylix.base16Scheme = ./. + themePath;
stylix.fonts = { stylix.fonts = {
monospace = { monospace = {
name = myFont; name = font;
package = myFontPkg; package = fontPkg;
}; };
serif = { serif = {
name = myFont; name = font;
package = myFontPkg; package = fontPkg;
}; };
sansSerif = { sansSerif = {
name = myFont; name = font;
package = myFontPkg; package = fontPkg;
}; };
emoji = { emoji = {
name = "Noto Color Emoji"; name = "Noto Color Emoji";

View file

@ -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. 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: I currently import the following variables to the system config:
- =myName= - Username - =username= - Username
- =myHostname= - Hostname for machine - =hostname= - Hostname for machine
- =myHomeDir= - Absolute path to home directory derived from =myName= - =myHomeDir= - Absolute path to home directory derived from =username=
- =myEmail= - Email - =email= - Email
- =myDotfilesDir= - Path to my dotfiles directory on the system - =dotfilesDir= - Path to my dotfiles directory on the system
- =myTheme= - base16 theme stored in ../themes to be used - =theme= - base16 theme stored in ../themes to be used
- =myThemePolarity= - whether theme is =light= or =dark= - =themePolarity= - whether theme is =light= or =dark=
- =myBackgroundUrl= - Direct link to background wallpaper (used for login screen) - =backgroundUrl= - Direct link to background wallpaper (used for login screen)
- =myBackgroundSha256= - Checksum for background image used when downloading - =backgroundSha256= - Checksum for background image used when downloading

View file

@ -1,6 +1,7 @@
{ config, lib, pkgs, eaf, eaf-browser, org-nursery, myThemePolarity, ... }: { config, lib, pkgs, eaf, eaf-browser, org-nursery, theme, ... }:
let let
myDashboardLogo = ./. + "/nix-" + myThemePolarity + ".png"; themePolarity = lib.removeSuffix "\n" (builtins.readFile (./. + "../../../../themes"+("/"+theme)+"/polarity.txt"));
dashboardLogo = ./. + "/nix-" + themePolarity + ".png";
in in
{ {
programs.doom-emacs = { programs.doom-emacs = {
@ -78,7 +79,7 @@ in
home.file.".emacs.d/org-nursery" = { home.file.".emacs.d/org-nursery" = {
source = "${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" = { 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; source = ./scripts/copy-link-or-file/copy-link-or-file-to-clipboard.sh;
executable = true; executable = true;

View file

@ -1409,9 +1409,10 @@ Any git package can be configured for a particular commit or branch:
* Nix Integration * 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]]. 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 #+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 let
myDashboardLogo = ./. + "/nix-" + myThemePolarity + ".png"; themePolarity = lib.removeSuffix "\n" (builtins.readFile (./. + "../../../../themes"+("/"+theme)+"/polarity.txt"));
dashboardLogo = ./. + "/nix-" + themePolarity + ".png";
in in
{ {
programs.doom-emacs = { programs.doom-emacs = {
@ -1489,7 +1490,7 @@ in
home.file.".emacs.d/org-nursery" = { home.file.".emacs.d/org-nursery" = {
source = "${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" = { 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; source = ./scripts/copy-link-or-file/copy-link-or-file-to-clipboard.sh;
executable = true; executable = true;

View file

@ -1,10 +1,10 @@
{ config, lib, pkgs, myName, myEmail, ... }: { config, lib, pkgs, username, email, ... }:
{ {
home.packages = [ pkgs.git ]; home.packages = [ pkgs.git ];
programs.git.enable = true; programs.git.enable = true;
programs.git.userName = myName; programs.git.userName = username;
programs.git.userEmail = myEmail; programs.git.userEmail = email;
programs.git.extraConfig = { programs.git.extraConfig = {
init.defaultBranch = "main"; init.defaultBranch = "main";
}; };

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, myName, myDotfilesDir, ... }: { config, lib, pkgs, username, dotfilesDir, ... }:
let let
# This sets up my "phoenix" script with my configuration paths # This sets up my "phoenix" script with my configuration paths
@ -6,12 +6,12 @@ let
myPhoenixScript = '' myPhoenixScript = ''
if [ "$1" = "sync" ]; then if [ "$1" = "sync" ]; then
if [ "$2" != "user" ]; then if [ "$2" != "user" ]; then
pushd ''+myDotfilesDir+''; pushd ''+dotfilesDir+'';
sudo nixos-rebuild switch --flake .#; sudo nixos-rebuild switch --flake .#;
popd; popd;
elif [ "2" != "system" ]; then elif [ "2" != "system" ]; then
pushd ''+myDotfilesDir+''; pushd ''+dotfilesDir+'';
home-manager switch --flake .#''+myName+''; home-manager switch --flake .#''+username+'';
popd; popd;
which xmobar &> /dev/null && killall xmobar; which xmobar &> /dev/null && killall xmobar;
which xmonad &> /dev/null && xmonad --recompile && xmonad --restart; which xmonad &> /dev/null && xmonad --recompile && xmonad --restart;
@ -19,7 +19,7 @@ let
[ -f ~/.fehbg-stylix ] &> /dev/null && ~/.fehbg-stylix; [ -f ~/.fehbg-stylix ] &> /dev/null && ~/.fehbg-stylix;
fi fi
elif [ "$1" = "update" ]; then elif [ "$1" = "update" ]; then
pushd ''+myDotfilesDir+''; pushd ''+dotfilesDir+'';
nix flake update; nix flake update;
popd; popd;
if [ -d ~/.emacs.d/eaf/app/browser ] if [ -d ~/.emacs.d/eaf/app/browser ]

View file

@ -1,32 +1,33 @@
{ config, pkgs, myTheme, myThemePolarity, myBackgroundUrl, myBackgroundSha256, ... }: { config, lib, pkgs, theme, font, fontPkg, ... }:
let let
myFont = "Inconsolata"; themePath = "../../../themes"+("/"+theme+"/"+theme)+".yaml";
myFontPkg = pkgs.inconsolata; themePolarity = lib.removeSuffix "\n" (builtins.readFile (./. + "../../../themes"+("/"+theme)+"/polarity.txt"));
myThemePath = "../../../themes/"+myTheme+"/"+myTheme+".yaml"; backgroundUrl = builtins.readFile (./. + "../../../themes"+("/"+theme)+"/backgroundurl.txt");
backgroundSha256 = builtins.readFile (./. + "../../../themes/"+("/"+theme)+"/backgroundsha256.txt");
in in
{ {
home.file.".currenttheme".text = myTheme; home.file.".currenttheme".text = theme;
stylix.autoEnable = false; stylix.autoEnable = false;
stylix.polarity = myThemePolarity; stylix.polarity = themePolarity;
stylix.image = pkgs.fetchurl { stylix.image = pkgs.fetchurl {
url = myBackgroundUrl; url = backgroundUrl;
sha256 = myBackgroundSha256; sha256 = backgroundSha256;
}; };
stylix.base16Scheme = ./. + myThemePath; stylix.base16Scheme = ./. + themePath;
stylix.fonts = { stylix.fonts = {
monospace = { monospace = {
name = myFont; name = font;
package = myFontPkg; package = fontPkg;
}; };
serif = { serif = {
name = myFont; name = font;
package = myFontPkg; package = fontPkg;
}; };
sansSerif = { sansSerif = {
name = myFont; name = font;
package = myFontPkg; package = fontPkg;
}; };
emoji = { emoji = {
name = "Noto Color Emoji"; name = "Noto Color Emoji";
@ -51,8 +52,8 @@ in
#!/bin/sh #!/bin/sh
feh --no-fehbg --bg-fill ''+ feh --no-fehbg --bg-fill ''+
pkgs.fetchurl { pkgs.fetchurl {
url = myBackgroundUrl; url = backgroundUrl;
sha256 = myBackgroundSha256; sha256 = backgroundSha256;
}+''; }+'';
''; '';
home.file.".fehbg-stylix".executable = true; home.file.".fehbg-stylix".executable = true;