Refactors flake inputs to be passed as single specialArg for simplicity

This commit is contained in:
Emmet 2024-04-13 15:21:51 -05:00
parent 7888439a8d
commit d558c9a91e
8 changed files with 43 additions and 57 deletions

View file

@ -1,10 +1,7 @@
{ {
description = "Flake of LibrePhoenix"; description = "Flake of LibrePhoenix";
outputs = inputs@{ self, nixpkgs, nixpkgs-stable, emacs-pin-nixpkgs, kdenlive-pin-nixpkgs, outputs = inputs@{ self, ... }:
home-manager-unstable, home-manager-stable, nix-doom-emacs,
nix-straight, stylix, blocklist-hosts, rust-overlay, org-nursery, org-yaap,
org-side-tree, org-timeblock, org-krita, org-sliced-images, phscroll, mini-frame, ... }:
let let
# ---- SYSTEM SETTINGS ---- # # ---- SYSTEM SETTINGS ---- #
systemSettings = { systemSettings = {
@ -51,9 +48,9 @@
# create patched nixpkgs # create patched nixpkgs
nixpkgs-patched = nixpkgs-patched =
(import nixpkgs { system = systemSettings.system; }).applyPatches { (import inputs.nixpkgs { system = systemSettings.system; }).applyPatches {
name = "nixpkgs-patched"; name = "nixpkgs-patched";
src = nixpkgs; src = inputs.nixpkgs;
patches = [ ./patches/emacs-no-version-check.patch ]; patches = [ ./patches/emacs-no-version-check.patch ];
}; };
@ -70,10 +67,10 @@
allowUnfree = true; allowUnfree = true;
allowUnfreePredicate = (_: true); allowUnfreePredicate = (_: true);
}; };
overlays = [ rust-overlay.overlays.default ]; overlays = [ inputs.rust-overlay.overlays.default ];
})); }));
pkgs-stable = import nixpkgs-stable { pkgs-stable = import inputs.nixpkgs-stable {
system = systemSettings.system; system = systemSettings.system;
config = { config = {
allowUnfree = true; allowUnfree = true;
@ -81,11 +78,11 @@
}; };
}; };
pkgs-emacs = import emacs-pin-nixpkgs { pkgs-emacs = import inputs.emacs-pin-nixpkgs {
system = systemSettings.system; system = systemSettings.system;
}; };
pkgs-kdenlive = import kdenlive-pin-nixpkgs { pkgs-kdenlive = import inputs.kdenlive-pin-nixpkgs {
system = systemSettings.system; system = systemSettings.system;
}; };
@ -94,17 +91,17 @@
# otherwise use patched nixos-unstable nixpkgs # otherwise use patched nixos-unstable nixpkgs
lib = (if ((systemSettings.profile == "homelab") || (systemSettings.profile == "worklab")) lib = (if ((systemSettings.profile == "homelab") || (systemSettings.profile == "worklab"))
then then
nixpkgs-stable.lib inputs.nixpkgs-stable.lib
else else
nixpkgs.lib); inputs.nixpkgs.lib);
# use home-manager-stable if running a server (homelab or worklab profile) # use home-manager-stable if running a server (homelab or worklab profile)
# otherwise use home-manager-unstable # otherwise use home-manager-unstable
home-manager = (if ((systemSettings.profile == "homelab") || (systemSettings.profile == "worklab")) home-manager = (if ((systemSettings.profile == "homelab") || (systemSettings.profile == "worklab"))
then then
home-manager-stable inputs.home-manager-stable
else else
home-manager-unstable); inputs.home-manager-unstable);
# Systems that can run tests: # Systems that can run tests:
supportedSystems = [ "aarch64-linux" "i686-linux" "x86_64-linux" ]; supportedSystems = [ "aarch64-linux" "i686-linux" "x86_64-linux" ];
@ -131,16 +128,7 @@
inherit pkgs-kdenlive; inherit pkgs-kdenlive;
inherit systemSettings; inherit systemSettings;
inherit userSettings; inherit userSettings;
inherit (inputs) nix-doom-emacs; inherit inputs;
inherit (inputs) org-nursery;
inherit (inputs) org-yaap;
inherit (inputs) org-side-tree;
inherit (inputs) org-timeblock;
inherit (inputs) org-krita;
inherit (inputs) org-sliced-images;
inherit (inputs) phscroll;
inherit (inputs) mini-frame;
inherit (inputs) stylix;
}; };
}; };
}; };
@ -156,8 +144,7 @@
inherit pkgs-stable; inherit pkgs-stable;
inherit systemSettings; inherit systemSettings;
inherit userSettings; inherit userSettings;
inherit (inputs) stylix; inherit inputs;
inherit (inputs) blocklist-hosts;
}; };
}; };
}; };

View file

@ -1,4 +1,4 @@
{ config, pkgs, pkgs-kdenlive, nix-doom-emacs, stylix, userSettings, ... }: { config, pkgs, pkgs-kdenlive, userSettings, ... }:
{ {
# 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
@ -9,8 +9,6 @@
programs.home-manager.enable = true; programs.home-manager.enable = true;
imports = [ imports = [
(if ((userSettings.editor == "emacs") || (userSettings.editor == "emacsclient")) then nix-doom-emacs.hmModule else null)
stylix.homeManagerModules.stylix
(./. + "../../../user/wm"+("/"+userSettings.wm+"/"+userSettings.wm)+".nix") # My window manager selected from flake (./. + "../../../user/wm"+("/"+userSettings.wm+"/"+userSettings.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

View file

@ -1,4 +1,4 @@
{ config, pkgs, nix-doom-emacs, stylix, userSettings, ... }: { config, pkgs, userSettings, ... }:
{ {
# 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
@ -9,8 +9,6 @@
programs.home-manager.enable = true; programs.home-manager.enable = true;
imports = [ imports = [
(if ((userSettings.editor == "emacs") || (userSettings.editor == "emacsclient")) then nix-doom-emacs.hmModule else null)
stylix.homeManagerModules.stylix
../../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/app/doom-emacs/doom.nix # My doom emacs config ../../user/app/doom-emacs/doom.nix # My doom emacs config

View file

@ -1,6 +1,6 @@
{ blocklist-hosts, ... }: { inputs, ... }:
let blocklist = builtins.readFile "${blocklist-hosts}/alternates/gambling-porn/hosts"; let blocklist = builtins.readFile "${inputs.blocklist-hosts}/alternates/gambling-porn/hosts";
in in
{ {
networking.extraHosts = '' networking.extraHosts = ''

View file

@ -1,4 +1,4 @@
{ lib, pkgs, stylix, userSettings, ... }: { lib, pkgs, inputs, userSettings, ... }:
let let
themePath = "../../../themes/"+userSettings.theme+"/"+userSettings.theme+".yaml"; themePath = "../../../themes/"+userSettings.theme+"/"+userSettings.theme+".yaml";
@ -8,7 +8,7 @@ let
backgroundSha256 = builtins.readFile (./. + "../../../themes/"+("/"+userSettings.theme)+"/backgroundsha256.txt"); backgroundSha256 = builtins.readFile (./. + "../../../themes/"+("/"+userSettings.theme)+"/backgroundsha256.txt");
in in
{ {
imports = [ stylix.nixosModules.stylix ]; imports = [ inputs.stylix.nixosModules.stylix ];
stylix.autoEnable = false; stylix.autoEnable = false;
stylix.polarity = themePolarity; stylix.polarity = themePolarity;

View file

@ -1,11 +1,11 @@
{ config, lib, pkgs-emacs, pkgs-stable, userSettings, systemSettings, { config, lib, pkgs-emacs, pkgs-stable, inputs, userSettings, systemSettings, ... }:
org-nursery, org-yaap, org-side-tree, org-timeblock, org-krita, org-sliced-images, phscroll, mini-frame, ... }:
let let
themePolarity = lib.removeSuffix "\n" (builtins.readFile (./. + "../../../../themes"+("/"+userSettings.theme)+"/polarity.txt")); themePolarity = lib.removeSuffix "\n" (builtins.readFile (./. + "../../../../themes"+("/"+userSettings.theme)+"/polarity.txt"));
dashboardLogo = ./. + "/nix-" + themePolarity + ".png"; dashboardLogo = ./. + "/nix-" + themePolarity + ".png";
in in
{ {
imports = [ imports = [
inputs.nix-doom-emacs.hmModule
../git/git.nix ../git/git.nix
../../shell/sh.nix ../../shell/sh.nix
../../shell/cli-collection.nix ../../shell/cli-collection.nix
@ -79,30 +79,30 @@ in
}; };
home.file.".emacs.d/org-yaap" = { home.file.".emacs.d/org-yaap" = {
source = "${org-yaap}"; source = "${inputs.org-yaap}";
recursive = true; recursive = true;
}; };
home.file.".emacs.d/org-side-tree" = { home.file.".emacs.d/org-side-tree" = {
source = "${org-side-tree}"; source = "${inputs.org-side-tree}";
recursive = true; recursive = true;
}; };
home.file.".emacs.d/org-timeblock" = { home.file.".emacs.d/org-timeblock" = {
source = "${org-timeblock}"; source = "${inputs.org-timeblock}";
recursive = true; recursive = true;
}; };
home.file.".emacs.d/org-nursery" = { home.file.".emacs.d/org-nursery" = {
source = "${org-nursery}"; source = "${inputs.org-nursery}";
}; };
home.file.".emacs.d/org-krita" = { home.file.".emacs.d/org-krita" = {
source = "${org-krita}"; source = "${inputs.org-krita}";
}; };
home.file.".emacs.d/org-sliced-images" = { home.file.".emacs.d/org-sliced-images" = {
source = "${org-sliced-images}"; source = "${inputs.org-sliced-images}";
}; };
home.file.".emacs.d/dashboard-logo.png".source = dashboardLogo; home.file.".emacs.d/dashboard-logo.png".source = dashboardLogo;
@ -112,11 +112,11 @@ in
}; };
home.file.".emacs.d/phscroll" = { home.file.".emacs.d/phscroll" = {
source = "${phscroll}"; source = "${inputs.phscroll}";
}; };
home.file.".emacs.d/mini-frame" = { home.file.".emacs.d/mini-frame" = {
source = "${mini-frame}"; source = "${inputs.mini-frame}";
}; };
home.file.".emacs.d/system-vars.el".text = '' home.file.".emacs.d/system-vars.el".text = ''

View file

@ -1983,14 +1983,14 @@ 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 [[../../../profiles/work/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 [[../../../profiles/work/home.nix][home.nix]].
#+BEGIN_SRC nix :tangle doom.nix #+BEGIN_SRC nix :tangle doom.nix
{ config, lib, pkgs-emacs, pkgs-stable, userSettings, systemSettings, { config, lib, pkgs-emacs, pkgs-stable, inputs, userSettings, systemSettings, ... }:
org-nursery, org-yaap, org-side-tree, org-timeblock, org-krita, org-sliced-images, phscroll, mini-frame, ... }:
let let
themePolarity = lib.removeSuffix "\n" (builtins.readFile (./. + "../../../../themes"+("/"+userSettings.theme)+"/polarity.txt")); themePolarity = lib.removeSuffix "\n" (builtins.readFile (./. + "../../../../themes"+("/"+userSettings.theme)+"/polarity.txt"));
dashboardLogo = ./. + "/nix-" + themePolarity + ".png"; dashboardLogo = ./. + "/nix-" + themePolarity + ".png";
in in
{ {
imports = [ imports = [
inputs.nix-doom-emacs.hmModule
../git/git.nix ../git/git.nix
../../shell/sh.nix ../../shell/sh.nix
../../shell/cli-collection.nix ../../shell/cli-collection.nix
@ -2064,30 +2064,30 @@ in
}; };
home.file.".emacs.d/org-yaap" = { home.file.".emacs.d/org-yaap" = {
source = "${org-yaap}"; source = "${inputs.org-yaap}";
recursive = true; recursive = true;
}; };
home.file.".emacs.d/org-side-tree" = { home.file.".emacs.d/org-side-tree" = {
source = "${org-side-tree}"; source = "${inputs.org-side-tree}";
recursive = true; recursive = true;
}; };
home.file.".emacs.d/org-timeblock" = { home.file.".emacs.d/org-timeblock" = {
source = "${org-timeblock}"; source = "${inputs.org-timeblock}";
recursive = true; recursive = true;
}; };
home.file.".emacs.d/org-nursery" = { home.file.".emacs.d/org-nursery" = {
source = "${org-nursery}"; source = "${inputs.org-nursery}";
}; };
home.file.".emacs.d/org-krita" = { home.file.".emacs.d/org-krita" = {
source = "${org-krita}"; source = "${inputs.org-krita}";
}; };
home.file.".emacs.d/org-sliced-images" = { home.file.".emacs.d/org-sliced-images" = {
source = "${org-sliced-images}"; source = "${inputs.org-sliced-images}";
}; };
home.file.".emacs.d/dashboard-logo.png".source = dashboardLogo; home.file.".emacs.d/dashboard-logo.png".source = dashboardLogo;
@ -2097,11 +2097,11 @@ in
}; };
home.file.".emacs.d/phscroll" = { home.file.".emacs.d/phscroll" = {
source = "${phscroll}"; source = "${inputs.phscroll}";
}; };
home.file.".emacs.d/mini-frame" = { home.file.".emacs.d/mini-frame" = {
source = "${mini-frame}"; source = "${inputs.mini-frame}";
}; };
home.file.".emacs.d/system-vars.el".text = '' home.file.".emacs.d/system-vars.el".text = ''

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, userSettings, ... }: { config, lib, pkgs, inputs, userSettings, ... }:
let let
themePath = "../../../themes"+("/"+userSettings.theme+"/"+userSettings.theme)+".yaml"; themePath = "../../../themes"+("/"+userSettings.theme+"/"+userSettings.theme)+".yaml";
@ -7,6 +7,9 @@ let
backgroundSha256 = builtins.readFile (./. + "../../../themes/"+("/"+userSettings.theme)+"/backgroundsha256.txt"); backgroundSha256 = builtins.readFile (./. + "../../../themes/"+("/"+userSettings.theme)+"/backgroundsha256.txt");
in in
{ {
imports = [ inputs.stylix.homeManagerModules.stylix ];
home.file.".currenttheme".text = userSettings.theme; home.file.".currenttheme".text = userSettings.theme;
stylix.autoEnable = false; stylix.autoEnable = false;
stylix.polarity = themePolarity; stylix.polarity = themePolarity;