From c4619cbe4ffa5ae7e374a05885717e8997b45556 Mon Sep 17 00:00:00 2001 From: Emmet Date: Tue, 20 Jun 2023 17:31:49 -0500 Subject: [PATCH] Generic improvements to flake --- flake.nix | 15 +++++++++------ system/configuration.nix | 6 +++--- user/bin/phoenix.nix | 19 +++++++++++-------- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/flake.nix b/flake.nix index 03b5921..7f46145 100644 --- a/flake.nix +++ b/flake.nix @@ -28,12 +28,15 @@ outputs = { self, nixpkgs, home-manager, nix-doom-emacs, stylix, eaf, eaf-browser, org-nursery, blocklist-hosts, rust-overlay, ... }@inputs: let - system = "x86_64-linux"; - name = "emmet"; - email = "librephoenix3@pm.me"; - dotfilesDir = "~/.dotfiles"; - theme = "ayu-dark"; + system = "x86_64-linux"; # system arch + hostname = "snowfire"; # hostname + profile = "personal"; # select a profile defined from my profiles directory + name = "emmet"; # username + email = "librephoenix3@pm.me"; # email (used for certain configurations) + dotfilesDir = "~/.dotfiles"; # absolute path of the repo + theme = "ayu-dark"; # selcted theme from my themes directory + # calculates certain things for stylix themePolarityPath = "/themes/"+theme+"/polarity.txt"; themePolarity = lib.removeSuffix "\n" (builtins.readFile (./. + themePolarityPath)); backgroundUrlPath = "/themes/"+theme+"/backgroundurl.txt"; @@ -78,11 +81,11 @@ inherit system; modules = [ ./system/configuration.nix - ./system/style/stylix.nix stylix.nixosModules.stylix ]; specialArgs = { myTheme = theme; + myHostname = hostname; myThemePolarity = themePolarity; myBackgroundUrl = backgroundUrl; myBackgroundSha256 = backgroundSha256; diff --git a/system/configuration.nix b/system/configuration.nix index 0ddf074..0b461f0 100644 --- a/system/configuration.nix +++ b/system/configuration.nix @@ -2,13 +2,13 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ config, lib, pkgs, blocklist-hosts, myTheme, myBackgroundUrl, myBackgroundSha256, ... }: +{ config, lib, pkgs, blocklist-hosts, myHostname, myTheme, myBackgroundUrl, myBackgroundSha256, ... }: let blocklist = builtins.readFile "${blocklist-hosts}/alternates/gambling-porn/hosts"; in { imports = [ ./hardware-configuration.nix - #./style/stylix.nix + ./style/stylix.nix ]; nix.nixPath = [ "nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos" @@ -54,7 +54,7 @@ in "/crypto_keyfile.bin" = null; }; - networking.hostName = "snowfire"; # Define your hostname. + networking.hostName = myHostname; # Define your hostname. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. networking.extraHosts = '' diff --git a/user/bin/phoenix.nix b/user/bin/phoenix.nix index 0100ad9..dd0acd0 100644 --- a/user/bin/phoenix.nix +++ b/user/bin/phoenix.nix @@ -13,19 +13,22 @@ let pushd ''+myDotfilesDir+''; home-manager switch --flake .#''+myName+''; popd; - killall xmobar; - xmonad --recompile && xmonad --restart; - emacsclient --no-wait --eval "(load-theme 'doom-stylix t nil)"; - pushd ~/.emacs.d/eaf/app/browser; - rm package*.json; - npm install darkreader @mozilla/readability && rm package*.json; - popd; - ~/.fehbg-stylix; + which xmobar &> /dev/null && killall xmobar; + which xmonad &> /dev/null && xmonad --recompile && xmonad --restart; + which emacsclient &> /dev/null && emacsclient --no-wait --eval "(load-theme 'doom-stylix t nil)"; + [ -f ~/.fehbg-stylix ] &> /dev/null && ~/.fehbg-stylix; fi elif [ "$1" = "update" ]; then pushd ''+myDotfilesDir+''; nix flake update; popd; + if [ -d ~/.emacs.d/eaf/app/browser ] + then + pushd ~/.emacs.d/eaf/app/browser; + rm package*.json; + npm install darkreader @mozilla/readability && rm package*.json; + popd; + fi elif [ "$1" = "gc" ]; then if [ "$2" = "full" ]; then sudo nix-collect-garbage --delete-old;