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";
outputs = inputs@{ self, nixpkgs, nixpkgs-stable, emacs-pin-nixpkgs, kdenlive-pin-nixpkgs,
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, ... }:
outputs = inputs@{ self, ... }:
let
# ---- SYSTEM SETTINGS ---- #
systemSettings = {
@ -51,9 +48,9 @@
# create patched nixpkgs
nixpkgs-patched =
(import nixpkgs { system = systemSettings.system; }).applyPatches {
(import inputs.nixpkgs { system = systemSettings.system; }).applyPatches {
name = "nixpkgs-patched";
src = nixpkgs;
src = inputs.nixpkgs;
patches = [ ./patches/emacs-no-version-check.patch ];
};
@ -70,10 +67,10 @@
allowUnfree = 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;
config = {
allowUnfree = true;
@ -81,11 +78,11 @@
};
};
pkgs-emacs = import emacs-pin-nixpkgs {
pkgs-emacs = import inputs.emacs-pin-nixpkgs {
system = systemSettings.system;
};
pkgs-kdenlive = import kdenlive-pin-nixpkgs {
pkgs-kdenlive = import inputs.kdenlive-pin-nixpkgs {
system = systemSettings.system;
};
@ -94,17 +91,17 @@
# otherwise use patched nixos-unstable nixpkgs
lib = (if ((systemSettings.profile == "homelab") || (systemSettings.profile == "worklab"))
then
nixpkgs-stable.lib
inputs.nixpkgs-stable.lib
else
nixpkgs.lib);
inputs.nixpkgs.lib);
# use home-manager-stable if running a server (homelab or worklab profile)
# otherwise use home-manager-unstable
home-manager = (if ((systemSettings.profile == "homelab") || (systemSettings.profile == "worklab"))
then
home-manager-stable
inputs.home-manager-stable
else
home-manager-unstable);
inputs.home-manager-unstable);
# Systems that can run tests:
supportedSystems = [ "aarch64-linux" "i686-linux" "x86_64-linux" ];
@ -131,16 +128,7 @@
inherit pkgs-kdenlive;
inherit systemSettings;
inherit userSettings;
inherit (inputs) nix-doom-emacs;
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;
inherit inputs;
};
};
};
@ -156,8 +144,7 @@
inherit pkgs-stable;
inherit systemSettings;
inherit userSettings;
inherit (inputs) stylix;
inherit (inputs) blocklist-hosts;
inherit inputs;
};
};
};

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
@ -9,8 +9,6 @@
programs.home-manager.enable = true;
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/shell/sh.nix # My zsh and bash config
../../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
@ -9,8 +9,6 @@
programs.home-manager.enable = true;
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/cli-collection.nix # Useful CLI apps
../../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
{
networking.extraHosts = ''

View file

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

View file

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

View file

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