Use variables for my name

This commit is contained in:
Gene Liverman 2023-09-12 16:31:47 -04:00
parent dc9a8d6ca8
commit 0c9459d351
3 changed files with 68 additions and 56 deletions

100
flake.nix
View file

@ -22,59 +22,67 @@
}; # end inputs }; # end inputs
outputs = { self, nixpkgs, nix-darwin, home-manager, nix-homebrew, ... }: { outputs = { self, nixpkgs, nix-darwin, home-manager, nix-homebrew, ... }: {
nixosConfigurations.rainbow-planet = nixpkgs.lib.nixosSystem { nixosConfigurations = let
system = "x86_64-linux"; user = "gene";
modules = [ in {
./modules/nixos/configuration.nix rainbow-planet = nixpkgs.lib.nixosSystem {
home-manager.nixosModules.home-manager system = "x86_64-linux";
{ modules = [
home-manager = { ./modules/nixos/configuration.nix
useGlobalPkgs = true; home-manager.nixosModules.home-manager
useUserPackages = true; {
users."gene".imports = [ home-manager = {
./modules/home-manager useGlobalPkgs = true;
./modules/nixos/dconf.nix useUserPackages = true;
]; users.${user}.imports = [
}; ./modules/home-manager
} ./modules/nixos/dconf.nix
]; ];
};
}
];
}; # end rainbow-planet
}; # end nixosConfigurations }; # end nixosConfigurations
# This is only set to work with x86 macOS right now... that will need to be updated # This is only set to work with x86 macOS right now... that will need to be updated
darwinConfigurations.Blue-Rock = nix-darwin.lib.darwinSystem { darwinConfigurations = let
system = "x86_64-darwin"; user = "gene.liverman";
pkgs = import nixpkgs { in {
Blue-Rock = nix-darwin.lib.darwinSystem {
system = "x86_64-darwin"; system = "x86_64-darwin";
config.allowUnfree = true; pkgs = import nixpkgs {
}; system = "x86_64-darwin";
modules = [ config.allowUnfree = true;
nix-homebrew.darwinModules.nix-homebrew };
{ modules = [
nix-homebrew = { nix-homebrew.darwinModules.nix-homebrew
# Install Homebrew under the default prefix {
enable = true; nix-homebrew = {
# Install Homebrew under the default prefix
enable = true;
# User owning the Homebrew prefix # User owning the Homebrew prefix
user = "gene.liverman"; user = "${user}";
# Automatically migrate existing Homebrew installations # Automatically migrate existing Homebrew installations
autoMigrate = true; autoMigrate = true;
}; };
} }
./modules/darwin ./modules/darwin
home-manager.darwinModules.home-manager home-manager.darwinModules.home-manager
{ {
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
users."gene.liverman".imports = [ users.${user}.imports = [
./modules/home-manager ./modules/home-manager
]; ];
}; };
} }
]; # end modules ]; # end modules
}; # end of darwinConfigurations.Blue-Rock }; # end Blue-Rock
}; # end darwinConfigurations
}; };
} }

View file

@ -1,4 +1,6 @@
{ pkgs, ... }: { { pkgs, ... }: let
user = "gene.liverman";
in {
system.stateVersion = 4; system.stateVersion = 4;
environment = { environment = {
@ -110,6 +112,7 @@
"flakes" "flakes"
"nix-command" "nix-command"
]; ];
trusted-users = [ "@admin" "${user}" ];
}; };
extraOptions = '' extraOptions = ''
# Generated by https://github.com/DeterminateSystems/nix-installer, version 0.11.0. # Generated by https://github.com/DeterminateSystems/nix-installer, version 0.11.0.
@ -121,8 +124,8 @@
services.nix-daemon.enable = true; services.nix-daemon.enable = true;
users.users."gene.liverman" = { users.users.${user} = {
home = "/Users/gene.liverman"; home = "/Users/${user}";
shell = pkgs.zsh; shell = pkgs.zsh;
}; };
} }

View file

@ -2,9 +2,10 @@
# 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, ... }:let
user = "gene";
{ hostname = "rainbow-planet";
in {
imports = imports =
[ # Include the results of the hardware scan. [ # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
@ -14,7 +15,7 @@
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "rainbow-planet"; # Define your hostname. networking.hostName = "${hostname}"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary # Configure network proxy if necessary
@ -83,7 +84,7 @@
# services.xserver.libinput.enable = true; # services.xserver.libinput.enable = true;
# 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.gene = { users.users.${user} = {
isNormalUser = true; isNormalUser = true;
description = "Gene Liverman"; description = "Gene Liverman";
extraGroups = [ "networkmanager" "wheel" "dialout" ]; extraGroups = [ "networkmanager" "wheel" "dialout" ];
@ -139,7 +140,7 @@
enable = true; enable = true;
# Certain features, including CLI integration and system authentication support, # Certain features, including CLI integration and system authentication support,
# require enabling PolKit integration on some desktop environments (e.g. Plasma). # require enabling PolKit integration on some desktop environments (e.g. Plasma).
polkitPolicyOwners = [ "gene" ]; polkitPolicyOwners = [ "${user}" ];
}; };
# List services that you want to enable: # List services that you want to enable:
@ -160,7 +161,7 @@
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.05"; # Did you read the comment? system.stateVersion = "23.05"; # Did you read the comment?
nix.settings.allowed-users = [ "gene" ]; nix.settings.allowed-users = [ "${user}" ];
nix.settings.experimental-features = [ nix.settings.experimental-features = [
"flakes" "flakes"
"nix-command" "nix-command"