I’m trying to move display-manager.nix module into configuration.nix and 3 variables into flake.nix
Here is display manager module:
{ pkgs, ... }:
# Enable Display Manager.
let
tuigreet = "${pkgs.greetd.tuigreet}/bin/tuigreet";
session = "${pkgs.hyprland}/bin/Hyprland";
username = "mee";
in
{
services.greetd = {
enable = true;
settings = {
initial_session = {
command = "${session}";
user = "${username}";
};
default_session = {
command = "${tuigreet} --greeting 'Welcome to NixOS' --asterisks --remember --remember-user-session --time --cmd ${session}";
user = "greeter";
};
};
};
}
configuration.nix:
{ Variables, pkgs, ... }:
{
# Enable Flakes.
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Display manager.
services.greetd = {
enable = true;
settings = {
initial_session = {
command = "${Variables.session}";
user = "${Variables.username}";
};
default_session = {
command = "${Variables.tuigreet} --greeting 'Welcome to NixOS' --asterisks --remember --remember-user-session --time --cmd ${Variables.session}";
user = "greeter";
};
};
};
}
and flake.nix:
{
description = "Configurations";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
nixpkgs-stable.url = "nixpkgs/nixos-23.11";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { nixpkgs, nixpkgs-stable, home-manager, ... }:
let
Variables = {
username = "mee";
hostname = "nixos";
system = "x86_64-linux";
lib = nixpkgs.lib;
pkgs = nixpkgs.legacyPackages.${Variables.system};
pkgs-stable = nixpkgs-stable.legacyPackages.${Variables.system};
tuigreet = "${pkgs.greetd.tuigreet}/bin/tuigreet";
session = "${pkgs.hyprland}/bin/Hyprland";
};
in
{
nixosConfigurations = {
nixos = Variables.lib.nixosSystem {
system = Variables.system;
specialArgs = { inherit Variables; };
modules = [
./configuration.nix
./hardware-configuration.nix
];
};
};
homeConfigurations = {
mee = home-manager.lib.homeManagerConfiguration {
pkgs = Variables.pkgs;
extraSpecialArgs = { inherit Variables; };
modules = [
./home.nix
./modules/home/xdg.nix
./modules/home/gtk.nix
];
};
};
};
}
It complain in flake.nix about undefined variable ‘pkgs’ on tuigreet line.