pass user as arg

This commit is contained in:
Noah Masur 2022-04-28 20:46:00 -04:00
parent eadec0c699
commit 71e4cc2f5a
6 changed files with 17 additions and 15 deletions

View File

@ -26,6 +26,7 @@
nixosConfigurations = { nixosConfigurations = {
desktop = nixpkgs.lib.nixosSystem { desktop = nixpkgs.lib.nixosSystem {
inherit system; inherit system;
specialArgs = { inherit user; };
modules = [ modules = [
./nixos/configuration.nix ./nixos/configuration.nix
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
@ -33,16 +34,17 @@
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
extraSpecialArgs = { inherit user; };
users.${user} = { users.${user} = {
imports = [ imports = [
./nixos/home.nix ./nixos/home.nix
./modules/applications/firefox.nix ./modules/applications/firefox.nix
./modules/applications/alacritty.nix
./modules/shell/fish.nix ./modules/shell/fish.nix
./modules/shell/utilities.nix ./modules/shell/utilities.nix
./modules/shell/git.nix ./modules/shell/git.nix
./modules/shell/github.nix ./modules/shell/github.nix
./modules/editor/neovim.nix ./modules/editor/neovim.nix
./modules/applications/alacritty.nix
]; ];
}; };
}; };

View File

@ -8,5 +8,6 @@
xdg.configFile = { "nvim/init.lua".source = ../../nvim.configlink/init.lua; }; xdg.configFile = { "nvim/init.lua".source = ../../nvim.configlink/init.lua; };
programs.git.extraConfig.core.editor = "nvim"; programs.git.extraConfig.core.editor = "nvim";
home.sessionVariables = { EDITOR = "nvim"; };
} }

View File

@ -90,6 +90,8 @@
shellInit = ""; shellInit = "";
}; };
home.sessionVariables = { fish_greeting = ""; };
programs.starship = { programs.starship = {
enable = true; enable = true;
enableFishIntegration = true; enableFishIntegration = true;

View File

@ -19,4 +19,9 @@
glow glow
]; ];
home.file = {
".rgignore".text = config.ignorePatterns;
".fdignore".text = config.ignorePatterns;
};
} }

View File

@ -2,7 +2,7 @@
# 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, pkgs, ... }: { config, pkgs, user, ... }:
{ {
imports = [ # Include the results of the hardware scan. imports = [ # Include the results of the hardware scan.
@ -102,7 +102,7 @@
fonts.fontconfig.defaultFonts.monospace = [ "Victor Mono" ]; fonts.fontconfig.defaultFonts.monospace = [ "Victor Mono" ];
# 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.noah = { users.users.${user} = {
# Create a home directory for human user # Create a home directory for human user
isNormalUser = true; isNormalUser = true;

View File

@ -1,9 +1,7 @@
{ pkgs, lib, ... }: { pkgs, user, lib, ... }:
let let
editor = "nvim";
font = "Victor Mono";
dotfiles = builtins.toString ../.; dotfiles = builtins.toString ../.;
nixos_config = builtins.toString ./.; nixos_config = builtins.toString ./.;
notes_path = "$HOME/dev/personal/notes"; notes_path = "$HOME/dev/personal/notes";
@ -22,11 +20,12 @@ let
in { in {
options = with lib; { options = with lib; {
user = mkOption { default = "noah"; }; testuser = mkOption { default = user; };
fullName = mkOption { default = "Noah Masur"; }; fullName = mkOption { default = "Noah Masur"; };
font = mkOption { default = font; }; font = mkOption { default = "Victor Mono"; };
nixos_config = mkOption { default = nixos_config; }; nixos_config = mkOption { default = nixos_config; };
dotfiles = mkOption { default = dotfiles; }; dotfiles = mkOption { default = dotfiles; };
ignorePatterns = mkOption { default = ignore_patterns; };
}; };
config = { config = {
@ -52,8 +51,6 @@ in {
gtk.theme = { name = "Adwaita-dark"; }; gtk.theme = { name = "Adwaita-dark"; };
home.sessionVariables = { home.sessionVariables = {
fish_greeting = "";
EDITOR = "${editor}";
NIXOS_CONFIG = "${nixos_config}"; NIXOS_CONFIG = "${nixos_config}";
DOTS = "${dotfiles}"; DOTS = "${dotfiles}";
NOTES_PATH = "${notes_path}"; NOTES_PATH = "${notes_path}";
@ -66,11 +63,6 @@ in {
"direnvrc".text = "source $HOME/.nix-profile/share/nix-direnv/direnvrc"; "direnvrc".text = "source $HOME/.nix-profile/share/nix-direnv/direnvrc";
"spectrwm/spectrwm.conf".source = ./spectrwm.conf; "spectrwm/spectrwm.conf".source = ./spectrwm.conf;
}; };
home.file = {
".rgignore".text = ignore_patterns;
".fdignore".text = ignore_patterns;
};
programs.direnv = { programs.direnv = {
enable = true; enable = true;
nix-direnv.enable = true; nix-direnv.enable = true;