Skip to content

Commit

Permalink
Use variables for my name
Browse files Browse the repository at this point in the history
  • Loading branch information
genebean committed Sep 12, 2023
1 parent dc9a8d6 commit 0c9459d
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 56 deletions.
100 changes: 54 additions & 46 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,59 +22,67 @@

}; # end inputs
outputs = { self, nixpkgs, nix-darwin, home-manager, nix-homebrew, ... }: {
nixosConfigurations.rainbow-planet = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./modules/nixos/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users."gene".imports = [
./modules/home-manager
./modules/nixos/dconf.nix
];
};
}
];
nixosConfigurations = let
user = "gene";
in {
rainbow-planet = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./modules/nixos/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.${user}.imports = [
./modules/home-manager
./modules/nixos/dconf.nix
];
};
}
];
}; # end rainbow-planet
}; # end nixosConfigurations

# This is only set to work with x86 macOS right now... that will need to be updated
darwinConfigurations.Blue-Rock = nix-darwin.lib.darwinSystem {
system = "x86_64-darwin";
pkgs = import nixpkgs {
darwinConfigurations = let
user = "gene.liverman";
in {
Blue-Rock = nix-darwin.lib.darwinSystem {
system = "x86_64-darwin";
config.allowUnfree = true;
};
modules = [
nix-homebrew.darwinModules.nix-homebrew
{
nix-homebrew = {
# Install Homebrew under the default prefix
enable = true;
pkgs = import nixpkgs {
system = "x86_64-darwin";
config.allowUnfree = true;
};
modules = [
nix-homebrew.darwinModules.nix-homebrew
{
nix-homebrew = {
# Install Homebrew under the default prefix
enable = true;

# User owning the Homebrew prefix
user = "gene.liverman";
# User owning the Homebrew prefix
user = "${user}";

# Automatically migrate existing Homebrew installations
autoMigrate = true;
};
}
# Automatically migrate existing Homebrew installations
autoMigrate = true;
};
}

./modules/darwin
./modules/darwin

home-manager.darwinModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users."gene.liverman".imports = [
./modules/home-manager
];
};
}
]; # end modules
}; # end of darwinConfigurations.Blue-Rock
home-manager.darwinModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.${user}.imports = [
./modules/home-manager
];
};
}
]; # end modules
}; # end Blue-Rock
}; # end darwinConfigurations
};
}
9 changes: 6 additions & 3 deletions modules/darwin/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{ pkgs, ... }: {
{ pkgs, ... }: let
user = "gene.liverman";
in {
system.stateVersion = 4;

environment = {
Expand Down Expand Up @@ -110,6 +112,7 @@
"flakes"
"nix-command"
];
trusted-users = [ "@admin" "${user}" ];
};
extraOptions = ''
# Generated by https://github.com/DeterminateSystems/nix-installer, version 0.11.0.
Expand All @@ -121,8 +124,8 @@

services.nix-daemon.enable = true;

users.users."gene.liverman" = {
home = "/Users/gene.liverman";
users.users.${user} = {
home = "/Users/${user}";
shell = pkgs.zsh;
};
}
15 changes: 8 additions & 7 deletions modules/nixos/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, ... }:

{
{ config, pkgs, ... }:let
user = "gene";
hostname = "rainbow-planet";
in {
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
Expand All @@ -14,7 +15,7 @@
boot.loader.systemd-boot.enable = 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.

# Configure network proxy if necessary
Expand Down Expand Up @@ -83,7 +84,7 @@
# services.xserver.libinput.enable = true;

# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.gene = {
users.users.${user} = {
isNormalUser = true;
description = "Gene Liverman";
extraGroups = [ "networkmanager" "wheel" "dialout" ];
Expand Down Expand Up @@ -139,7 +140,7 @@
enable = true;
# Certain features, including CLI integration and system authentication support,
# require enabling PolKit integration on some desktop environments (e.g. Plasma).
polkitPolicyOwners = [ "gene" ];
polkitPolicyOwners = [ "${user}" ];
};
# List services that you want to enable:

Expand All @@ -160,7 +161,7 @@
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.05"; # Did you read the comment?

nix.settings.allowed-users = [ "gene" ];
nix.settings.allowed-users = [ "${user}" ];
nix.settings.experimental-features = [
"flakes"
"nix-command"
Expand Down

0 comments on commit 0c9459d

Please sign in to comment.