Skip to content

Commit

Permalink
feat: defining host and user metadata in flake file
Browse files Browse the repository at this point in the history
  • Loading branch information
luisnquin committed Mar 2, 2024
1 parent 856c103 commit b1c5f6e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
16 changes: 13 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,28 @@
inherit system;
};

host = {
# Define your hostname.
name = "nixos";
};

user = {
fullName = "Guest user";
alias = "guest";
};

specialArgs =
{
grub-pkgs = grub-themes.packages.${system};
pkgsx = import ./pkgs {inherit pkgs;};

inherit (hyprland.packages.${system}) hyprland xdg-desktop-portal-hyprland;
inherit pkgs;
inherit pkgs host user;
}
// hyprland-contrib.packages.${system}
// scripts.packages.${system};
in {
nixosConfigurations."nixos" = nixpkgs.lib.nixosSystem {
nixosConfigurations.${host.name} = nixpkgs.lib.nixosSystem {
inherit (pkgs) system;
inherit specialArgs;

Expand All @@ -46,7 +56,7 @@
];
};

homeConfigurations."guest" = home-manager.lib.homeManagerConfiguration {
homeConfigurations.${user.alias} = home-manager.lib.homeManagerConfiguration {
extraSpecialArgs = specialArgs;
inherit pkgs;

Expand Down
6 changes: 3 additions & 3 deletions home/home.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
{user, ...}: {
imports = [
./modules
];

home = {
homeDirectory = "/home/guest";
username = "guest";
homeDirectory = "/home/${user.alias}";
username = user.alias;
stateVersion = "24.05";
};

Expand Down
8 changes: 5 additions & 3 deletions system/configuration.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
grub-pkgs,
config,
user,
host,
pkgs,
...
}: {
Expand Down Expand Up @@ -29,7 +31,7 @@
supportedFilesystems = ["ntfs"];
};

networking.hostName = "nixos"; # Define your hostname.
networking.hostName = host.name;

# Set your time zone.
time.timeZone = "America/Lima";
Expand All @@ -54,9 +56,9 @@
};

# Define a user account. Don't forget to set a password with ‘passwd’.
users.users."guest" = {
users.users.${user.alias} = {
isNormalUser = true;
description = "Guest user";
description = user.fullName;
extraGroups = ["networkmanager" "wheel"];
packages = with pkgs; [
firefox
Expand Down

0 comments on commit b1c5f6e

Please sign in to comment.