{ # Evaluates a minimal Home Manager module from `module.nix` and verifies # its effect through a throwaway Home Manager configuration. description = "A minimal Home Manager module"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { nixpkgs, home-manager, ... }: let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; testConfig = home-manager.lib.homeManagerConfiguration { inherit pkgs; modules = [ ./module.nix { home = { username = "learner"; homeDirectory = "/home/learner"; stateVersion = "24.11"; }; playground.welcome = { enable = true; name = "flakes"; }; } ]; }; in { checks.${system}.welcome = pkgs.runCommand "home-manager-welcome-check" { got = testConfig.config.home.file."welcome.txt".text; expected = "hello, flakes"; } '' if [ "$got" = "$expected" ]; then echo ok > "$out" else echo "unexpected welcome text: $got" >&2 exit 1 fi ''; }; }