From 727b44b3a48efd8b4f29c360c73d3d4a46c7b765 Mon Sep 17 00:00:00 2001 From: Emmet Date: Tue, 20 Jun 2023 22:03:14 -0500 Subject: [PATCH] Moved configuration.nix and home.nix to profiles --- flake.nix | 25 +++++++++----- .../personal}/configuration.nix | 10 +++--- {user => profiles/personal}/home.nix | 34 ++++++++++--------- system/style/stylix.nix | 8 +++-- 4 files changed, 45 insertions(+), 32 deletions(-) rename {system => profiles/personal}/configuration.nix (95%) rename {user => profiles/personal}/home.nix (63%) diff --git a/flake.nix b/flake.nix index 7f46145..19834f1 100644 --- a/flake.nix +++ b/flake.nix @@ -28,15 +28,24 @@ outputs = { self, nixpkgs, home-manager, nix-doom-emacs, stylix, eaf, eaf-browser, org-nursery, blocklist-hosts, rust-overlay, ... }@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 + + # ---- USER SETTINGS ---- # 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 + # ---- CALCULATIONS ----- # + profileWithSlash = "/" + profile; # I honestly don't know why this is necessary + homeNixPath = ./. + "/profiles" + profileWithSlash + "/home.nix"; + configurationNixPath = ./. + "/profiles" + profileWithSlash + "/configuration.nix"; + themePolarityPath = "/themes/"+theme+"/polarity.txt"; themePolarity = lib.removeSuffix "\n" (builtins.readFile (./. + themePolarityPath)); backgroundUrlPath = "/themes/"+theme+"/backgroundurl.txt"; @@ -57,12 +66,11 @@ emmet = home-manager.lib.homeManagerConfiguration { inherit pkgs; modules = [ - ./user/home.nix - nix-doom-emacs.hmModule - stylix.homeManagerModules.stylix + homeNixPath ]; extraSpecialArgs = { myName = name; + myHostname = hostname; myHomeDir = "/home/"+name; myEmail = email; myDotfilesDir = dotfilesDir; @@ -70,6 +78,8 @@ myThemePolarity = themePolarity; myBackgroundUrl = backgroundUrl; myBackgroundSha256 = backgroundSha256; + inherit (inputs) nix-doom-emacs; + inherit (inputs) stylix; inherit (inputs) eaf; inherit (inputs) eaf-browser; inherit (inputs) org-nursery; @@ -79,16 +89,15 @@ nixosConfigurations = { snowfire = lib.nixosSystem { inherit system; - modules = [ - ./system/configuration.nix - stylix.nixosModules.stylix - ]; + modules = [ configurationNixPath ]; specialArgs = { + myName = name; myTheme = theme; myHostname = hostname; myThemePolarity = themePolarity; myBackgroundUrl = backgroundUrl; myBackgroundSha256 = backgroundSha256; + inherit (inputs) stylix; inherit (inputs) blocklist-hosts; }; }; diff --git a/system/configuration.nix b/profiles/personal/configuration.nix similarity index 95% rename from system/configuration.nix rename to profiles/personal/configuration.nix index 0b461f0..7594a78 100644 --- a/system/configuration.nix +++ b/profiles/personal/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, myHostname, myTheme, myBackgroundUrl, myBackgroundSha256, ... }: +{ config, lib, pkgs, blocklist-hosts, myName, myHostname, myTheme, myBackgroundUrl, myBackgroundSha256, ... }: let blocklist = builtins.readFile "${blocklist-hosts}/alternates/gambling-porn/hosts"; in { imports = - [ ./hardware-configuration.nix - ./style/stylix.nix + [ ../../system/hardware-configuration.nix + ../../system/style/stylix.nix ]; nix.nixPath = [ "nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos" @@ -26,7 +26,7 @@ in security.doas.enable = true; security.sudo.enable = false; security.doas.extraRules = [{ - users = [ "emmet" ]; + users = [ "${myName}" ]; keepEnv = true; persist = true; }]; @@ -135,7 +135,7 @@ in users.defaultUserShell = pkgs.zsh; # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.emmet = { + users.users.${myName} = { isNormalUser = true; description = "Emmet"; extraGroups = [ "networkmanager" "wheel" ]; diff --git a/user/home.nix b/profiles/personal/home.nix similarity index 63% rename from user/home.nix rename to profiles/personal/home.nix index 928053c..2965852 100644 --- a/user/home.nix +++ b/profiles/personal/home.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, python3Packages, myName, myEmail, myHomeDir, myDotfilesDir, myTheme, ... }: +{ config, lib, pkgs, python3Packages, nix-doom-emacs, stylix, myName, myEmail, myHomeDir, myDotfilesDir, myTheme, ... }: { # Home Manager needs a bit of information about you and the paths it should @@ -9,21 +9,23 @@ programs.home-manager.enable = true; imports = [ - ./wm/xmonad/xmonad.nix # My xmonad config - ./shell/sh.nix # My zsh and bash config - ./shell/cli-collection.nix # Useful CLI apps - ./bin/phoenix.nix # My nix command wrapper - ./app/doom-emacs/doom.nix # My doom emacs config - ./app/ranger/ranger.nix # My ranger file manager config - ./app/git/git.nix # My git config - ./app/keepass/keepass.nix # My password manager - ./app/browser/librewolf.nix # My default browser - ./app/games/games.nix # Various videogame apps - ./app/virtualization/virtualization.nix # Virtual machines - ./app/flatpak/flatpak.nix # Flatpaks - ./style/stylix.nix # Styling and themes for my apps - ./lang/cc/cc.nix # C and C++ tools - ./lang/godot/godot.nix # Game development + nix-doom-emacs.hmModule + stylix.homeManagerModules.stylix + ../../user/wm/xmonad/xmonad.nix # My xmonad config + ../../user/shell/sh.nix # My zsh and bash config + ../../user/shell/cli-collection.nix # Useful CLI apps + ../../user/bin/phoenix.nix # My nix command wrapper + ../../user/app/doom-emacs/doom.nix # My doom emacs config + ../../user/app/ranger/ranger.nix # My ranger file manager config + ../../user/app/git/git.nix # My git config + ../../user/app/keepass/keepass.nix # My password manager + ../../user/app/browser/librewolf.nix # My default browser + ../../user/app/games/games.nix # Various videogame apps + ../../user/app/virtualization/virtualization.nix # Virtual machines + ../../user/app/flatpak/flatpak.nix # Flatpaks + ../../user/style/stylix.nix # Styling and themes for my apps + ../../user/lang/cc/cc.nix # C and C++ tools + ../../user/lang/godot/godot.nix # Game development ]; home.stateVersion = "22.11"; # Please read the comment before changing. diff --git a/system/style/stylix.nix b/system/style/stylix.nix index 8ab8982..4fb5b9b 100644 --- a/system/style/stylix.nix +++ b/system/style/stylix.nix @@ -1,4 +1,4 @@ -{ config, pkgs, myTheme, myThemePolarity, myBackgroundUrl, myBackgroundSha256, ... }: +{ config, pkgs, stylix, myTheme, myThemePolarity, myBackgroundUrl, myBackgroundSha256, ... }: let myFont = "Inconsolata"; @@ -7,11 +7,13 @@ let myLightDMTheme = if myThemePolarity == "light" then "Adwaita" else "Adwaita-dark"; in { + imports = [ stylix.nixosModules.stylix ]; + stylix.autoEnable = false; stylix.polarity = myThemePolarity; stylix.image = pkgs.fetchurl { - url = myBackgroundUrl; - sha256 = myBackgroundSha256; + url = myBackgroundUrl; + sha256 = myBackgroundSha256; }; stylix.base16Scheme = ./. + myThemePath; stylix.fonts = {