Optimized some specialArgs and module argument use

This commit is contained in:
Emmet
2024-01-18 15:36:52 -06:00
parent 2d75530b6d
commit 18c8365f40
76 changed files with 282 additions and 284 deletions

114
flake.nix
View File

@@ -1,39 +1,47 @@
{
description = "Flake of LibrePhoenix";
outputs = { self, nixpkgs, home-manager, nix-doom-emacs, stylix, eaf, eaf-browser, org-nursery, org-yaap, org-timeblock, phscroll, blocklist-hosts, rust-overlay, hyprland-plugins, ... }@inputs:
outputs = { self, nixpkgs, home-manager, nix-doom-emacs, stylix,
blocklist-hosts, rust-overlay, hyprland-plugins,
eaf, eaf-browser, org-nursery, org-yaap,
org-side-tree, org-timeblock, phscroll, ... }@inputs:
let
# ---- SYSTEM SETTINGS ---- #
system = "x86_64-linux"; # system arch
hostname = "snowfire"; # hostname
profile = "personal"; # select a profile defined from my profiles directory
timezone = "America/Chicago"; # select timezone
locale = "en_US.UTF-8"; # select locale
systemSettings = {
system = "x86_64-linux"; # system arch
hostname = "snowfire"; # hostname
profile = "personal"; # select a profile defined from my profiles directory
timezone = "America/Chicago"; # select timezone
locale = "en_US.UTF-8"; # select locale
};
# ----- USER SETTINGS ----- #
username = "emmet"; # username
name = "Emmet"; # name/identifier
email = "emmet@librephoenix.com"; # email (used for certain configurations)
dotfilesDir = "~/.dotfiles"; # absolute path of the local repo
theme = "uwunicorn-yt"; # selcted theme from my themes directory (./themes/)
wm = "hyprland"; # Selected window manager or desktop environment; must select one in both ./user/wm/ and ./system/wm/
wmType = "wayland"; # x11 or wayland
browser = "qutebrowser"; # Default browser; must select one from ./user/app/browser/
editor = "emacsclient"; # Default editor;
defaultRoamDir = "Personal.p"; # Default org roam directory relative to ~/Org
term = "alacritty"; # Default terminal command;
font = "Intel One Mono"; # Selected font
fontPkg = pkgs.intel-one-mono; # Font package
userSettings = rec {
username = "emmet"; # username
name = "Emmet"; # name/identifier
email = "emmet@librephoenix.com"; # email (used for certain configurations)
dotfilesDir = "~/.dotfiles"; # absolute path of the local repo
theme = "uwunicorn-yt"; # selcted theme from my themes directory (./themes/)
wm = "hyprland"; # Selected window manager or desktop environment; must select one in both ./user/wm/ and ./system/wm/
# window manager type (hyprland or x11) translator
wmType = if (wm == "hyprland") then "wayland" else "x11";
browser = "qutebrowser"; # Default browser; must select one from ./user/app/browser/
defaultRoamDir = "Personal.p"; # Default org roam directory relative to ~/Org
term = "alacritty"; # Default terminal command;
font = "Intel One Mono"; # Selected font
fontPkg = pkgs.intel-one-mono; # Font package
editor = "emacsclient"; # Default editor;
# editor spawning translator
# generates a command that can be used to spawn editor inside a gui
# EDITOR and TERM session variables must be set in home.nix or other module
# I set the session variable SPAWNEDITOR to this in my home.nix for convenience
spawnEditor = if (editor == "emacsclient") then "emacsclient -c -a 'emacs'"
else (if ((editor == "vim") || (editor == "nvim") || (editor == "nano")) then "exec " + term + " -e " + editor else editor);
};
# editor spawning translator
# generates a command that can be used to spawn editor inside a gui
# EDITOR and TERM session variables must be set in home.nix or other module
# I set the session variable SPAWNEDITOR to this in my home.nix for convenience
spawnEditor = if (editor == "emacsclient") then "emacsclient -c -a 'emacs'"
else (if ((editor == "vim") || (editor == "nvim") || (editor == "nano")) then "exec " + term + " -e " + editor else editor);
# create patched nixpkgs
nixpkgs-patched = (import nixpkgs { inherit system; }).applyPatches {
nixpkgs-patched = (import nixpkgs { system = systemSettings.system; }).applyPatches {
name = "nixpkgs-patched";
src = nixpkgs;
patches = [
@@ -44,7 +52,7 @@
# configure pkgs
pkgs = import nixpkgs-patched {
inherit system;
system = systemSettings.system;
config = { allowUnfree = true;
allowUnfreePredicate = (_: true); };
overlays = [ rust-overlay.overlays.default ];
@@ -57,30 +65,14 @@
homeConfigurations = {
user = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [ (./. + "/profiles"+("/"+profile)+"/home.nix") # load home.nix from selected PROFILE
modules = [ (./. + "/profiles"+("/"+systemSettings.profile)+"/home.nix") # load home.nix from selected PROFILE
# inputs.nix-flatpak.homeManagerModules.nix-flatpak # Declarative flatpaks
];
extraSpecialArgs = {
# pass config variables from above
inherit username;
inherit name;
inherit hostname;
inherit profile;
inherit email;
inherit dotfilesDir;
inherit defaultRoamDir;
inherit theme;
inherit font;
inherit fontPkg;
inherit wm;
inherit wmType;
inherit browser;
inherit editor;
inherit term;
inherit spawnEditor;
inherit systemSettings;
inherit userSettings;
inherit (inputs) nix-doom-emacs;
#inherit (inputs) nix-flatpak;
inherit (inputs) stylix;
inherit (inputs) eaf;
inherit (inputs) eaf-browser;
inherit (inputs) org-nursery;
@@ -88,25 +80,20 @@
inherit (inputs) org-side-tree;
inherit (inputs) org-timeblock;
inherit (inputs) phscroll;
#inherit (inputs) nix-flatpak;
inherit (inputs) stylix;
inherit (inputs) hyprland-plugins;
};
};
};
nixosConfigurations = {
system = lib.nixosSystem {
inherit system;
modules = [ (./. + "/profiles"+("/"+profile)+"/configuration.nix") ]; # load configuration.nix from selected PROFILE
system = systemSettings.system;
modules = [ (./. + "/profiles"+("/"+systemSettings.profile)+"/configuration.nix") ]; # load configuration.nix from selected PROFILE
specialArgs = {
# pass config variables from above
inherit username;
inherit name;
inherit hostname;
inherit timezone;
inherit locale;
inherit theme;
inherit font;
inherit fontPkg;
inherit wm;
inherit systemSettings;
inherit userSettings;
inherit (inputs) stylix;
inherit (inputs) blocklist-hosts;
};
@@ -116,12 +103,11 @@
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager/master";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nix-doom-emacs.url = "github:librephoenix/nix-doom-emacs?ref=pgtk-patch";
stylix.url = "github:danth/stylix";
rust-overlay.url = "github:oxalica/rust-overlay";
#nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=v0.2.0";
eaf = {
url = "github:emacs-eaf/emacs-application-framework";
flake = false;
@@ -150,10 +136,18 @@
url = "github:misohena/phscroll";
flake = false;
};
stylix.url = "github:danth/stylix";
rust-overlay.url = "github:oxalica/rust-overlay";
#nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=v0.2.0";
blocklist-hosts = {
url = "github:StevenBlack/hosts";
flake = false;
};
hyprland-plugins = {
url = "github:hyprwm/hyprland-plugins";
flake = false;