Moved configuration.nix and home.nix to profiles

This commit is contained in:
Emmet 2023-06-20 22:03:14 -05:00
parent c4619cbe4f
commit 727b44b3a4
4 changed files with 45 additions and 32 deletions

View file

@ -28,15 +28,24 @@
outputs = { self, nixpkgs, home-manager, nix-doom-emacs, stylix, eaf, eaf-browser, org-nursery, blocklist-hosts, rust-overlay, ... }@inputs: outputs = { self, nixpkgs, home-manager, nix-doom-emacs, stylix, eaf, eaf-browser, org-nursery, blocklist-hosts, rust-overlay, ... }@inputs:
let let
# --- SYSTEM SETTINGS --- #
system = "x86_64-linux"; # system arch system = "x86_64-linux"; # system arch
hostname = "snowfire"; # hostname hostname = "snowfire"; # hostname
profile = "personal"; # select a profile defined from my profiles directory 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 name = "emmet"; # username
email = "librephoenix3@pm.me"; # email (used for certain configurations) email = "librephoenix3@pm.me"; # email (used for certain configurations)
dotfilesDir = "~/.dotfiles"; # absolute path of the repo dotfilesDir = "~/.dotfiles"; # absolute path of the repo
theme = "ayu-dark"; # selcted theme from my themes directory 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"; themePolarityPath = "/themes/"+theme+"/polarity.txt";
themePolarity = lib.removeSuffix "\n" (builtins.readFile (./. + themePolarityPath)); themePolarity = lib.removeSuffix "\n" (builtins.readFile (./. + themePolarityPath));
backgroundUrlPath = "/themes/"+theme+"/backgroundurl.txt"; backgroundUrlPath = "/themes/"+theme+"/backgroundurl.txt";
@ -57,12 +66,11 @@
emmet = home-manager.lib.homeManagerConfiguration { emmet = home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
modules = [ modules = [
./user/home.nix homeNixPath
nix-doom-emacs.hmModule
stylix.homeManagerModules.stylix
]; ];
extraSpecialArgs = { extraSpecialArgs = {
myName = name; myName = name;
myHostname = hostname;
myHomeDir = "/home/"+name; myHomeDir = "/home/"+name;
myEmail = email; myEmail = email;
myDotfilesDir = dotfilesDir; myDotfilesDir = dotfilesDir;
@ -70,6 +78,8 @@
myThemePolarity = themePolarity; myThemePolarity = themePolarity;
myBackgroundUrl = backgroundUrl; myBackgroundUrl = backgroundUrl;
myBackgroundSha256 = backgroundSha256; myBackgroundSha256 = backgroundSha256;
inherit (inputs) nix-doom-emacs;
inherit (inputs) stylix;
inherit (inputs) eaf; inherit (inputs) eaf;
inherit (inputs) eaf-browser; inherit (inputs) eaf-browser;
inherit (inputs) org-nursery; inherit (inputs) org-nursery;
@ -79,16 +89,15 @@
nixosConfigurations = { nixosConfigurations = {
snowfire = lib.nixosSystem { snowfire = lib.nixosSystem {
inherit system; inherit system;
modules = [ modules = [ configurationNixPath ];
./system/configuration.nix
stylix.nixosModules.stylix
];
specialArgs = { specialArgs = {
myName = name;
myTheme = theme; myTheme = theme;
myHostname = hostname; myHostname = hostname;
myThemePolarity = themePolarity; myThemePolarity = themePolarity;
myBackgroundUrl = backgroundUrl; myBackgroundUrl = backgroundUrl;
myBackgroundSha256 = backgroundSha256; myBackgroundSha256 = backgroundSha256;
inherit (inputs) stylix;
inherit (inputs) blocklist-hosts; inherit (inputs) blocklist-hosts;
}; };
}; };

View file

@ -2,13 +2,13 @@
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # 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"; let blocklist = builtins.readFile "${blocklist-hosts}/alternates/gambling-porn/hosts";
in in
{ {
imports = imports =
[ ./hardware-configuration.nix [ ../../system/hardware-configuration.nix
./style/stylix.nix ../../system/style/stylix.nix
]; ];
nix.nixPath = [ "nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos" nix.nixPath = [ "nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos"
@ -26,7 +26,7 @@ in
security.doas.enable = true; security.doas.enable = true;
security.sudo.enable = false; security.sudo.enable = false;
security.doas.extraRules = [{ security.doas.extraRules = [{
users = [ "emmet" ]; users = [ "${myName}" ];
keepEnv = true; keepEnv = true;
persist = true; persist = true;
}]; }];
@ -135,7 +135,7 @@ in
users.defaultUserShell = pkgs.zsh; users.defaultUserShell = pkgs.zsh;
# Define a user account. Don't forget to set a password with passwd. # Define a user account. Don't forget to set a password with passwd.
users.users.emmet = { users.users.${myName} = {
isNormalUser = true; isNormalUser = true;
description = "Emmet"; description = "Emmet";
extraGroups = [ "networkmanager" "wheel" ]; extraGroups = [ "networkmanager" "wheel" ];

View file

@ -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 # Home Manager needs a bit of information about you and the paths it should
@ -9,21 +9,23 @@
programs.home-manager.enable = true; programs.home-manager.enable = true;
imports = [ imports = [
./wm/xmonad/xmonad.nix # My xmonad config nix-doom-emacs.hmModule
./shell/sh.nix # My zsh and bash config stylix.homeManagerModules.stylix
./shell/cli-collection.nix # Useful CLI apps ../../user/wm/xmonad/xmonad.nix # My xmonad config
./bin/phoenix.nix # My nix command wrapper ../../user/shell/sh.nix # My zsh and bash config
./app/doom-emacs/doom.nix # My doom emacs config ../../user/shell/cli-collection.nix # Useful CLI apps
./app/ranger/ranger.nix # My ranger file manager config ../../user/bin/phoenix.nix # My nix command wrapper
./app/git/git.nix # My git config ../../user/app/doom-emacs/doom.nix # My doom emacs config
./app/keepass/keepass.nix # My password manager ../../user/app/ranger/ranger.nix # My ranger file manager config
./app/browser/librewolf.nix # My default browser ../../user/app/git/git.nix # My git config
./app/games/games.nix # Various videogame apps ../../user/app/keepass/keepass.nix # My password manager
./app/virtualization/virtualization.nix # Virtual machines ../../user/app/browser/librewolf.nix # My default browser
./app/flatpak/flatpak.nix # Flatpaks ../../user/app/games/games.nix # Various videogame apps
./style/stylix.nix # Styling and themes for my apps ../../user/app/virtualization/virtualization.nix # Virtual machines
./lang/cc/cc.nix # C and C++ tools ../../user/app/flatpak/flatpak.nix # Flatpaks
./lang/godot/godot.nix # Game development ../../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. home.stateVersion = "22.11"; # Please read the comment before changing.

View file

@ -1,4 +1,4 @@
{ config, pkgs, myTheme, myThemePolarity, myBackgroundUrl, myBackgroundSha256, ... }: { config, pkgs, stylix, myTheme, myThemePolarity, myBackgroundUrl, myBackgroundSha256, ... }:
let let
myFont = "Inconsolata"; myFont = "Inconsolata";
@ -7,11 +7,13 @@ let
myLightDMTheme = if myThemePolarity == "light" then "Adwaita" else "Adwaita-dark"; myLightDMTheme = if myThemePolarity == "light" then "Adwaita" else "Adwaita-dark";
in in
{ {
imports = [ stylix.nixosModules.stylix ];
stylix.autoEnable = false; stylix.autoEnable = false;
stylix.polarity = myThemePolarity; stylix.polarity = myThemePolarity;
stylix.image = pkgs.fetchurl { stylix.image = pkgs.fetchurl {
url = myBackgroundUrl; url = myBackgroundUrl;
sha256 = myBackgroundSha256; sha256 = myBackgroundSha256;
}; };
stylix.base16Scheme = ./. + myThemePath; stylix.base16Scheme = ./. + myThemePath;
stylix.fonts = { stylix.fonts = {