Use homeConfigurations in nixos configs #18

Open
riley wants to merge 2 commits from refactor-flake-hm into mistress
4 changed files with 56 additions and 51 deletions

View file

@ -11,58 +11,58 @@
nixos-hardware.url = github:NixOS/nixos-hardware;
};
outputs = args@{ home-manager, nixpkgs, agenix, nixos-hardware, ... }: with nixpkgs; {
outputs = args@{ self, home-manager, nixpkgs, agenix, nixos-hardware, ... }: with nixpkgs; {
# Configurations for NixOS machines.
nixosConfigurations =
let mkUserConfig = path: {
imports = [ home-manager.nixosModules.home-manager ];
config = {
home-manager.users."riley" = (import "${path}/home.nix");
};
nixosConfigurations = let
# Generate a user configuration for the given user, based on the given home manager
# configuration.
userConfig = user: home: [
home-manager.nixosModules.home-manager
({ config, ... }: {
home-manager.users."${user}" = (home // {
config.home = {
inherit (config.system) stateVersion;
username = user;
};
}).config;
})
];
in {
# Desktop system
"strawberry" = lib.nixosSystem {
system = "x86_64-linux";
modules = [
(mkUserConfig ./system/strawberry)
agenix.nixosModules.default
./system/strawberry/core.nix
./shared/core
./shared/secrets.nix
];
] ++ (userConfig "riley" self.homeConfigurations."strawberry");
specialArgs = args;
};
# Thinkpad
"lime" = lib.nixosSystem {
system = "x86_64-linux";
modules = [
(mkUserConfig ./system/lime)
agenix.nixosModules.default
nixos-hardware.nixosModules.lenovo-thinkpad-x390
nixos-hardware.nixosModules.common-gpu-nvidia-disable
./system/lime/core.nix
./shared/core
./shared/secrets.nix
];
] ++ (userConfig "riley" self.homeConfigurations."lime");
specialArgs = args;
};
};
# Configurations for non-NixOS machines.
homeConfigurations = with home-manager.lib; {
"dev-lt-63" = homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages."x86_64-linux";
# Configurations for home-manager.
homeConfigurations = with home-manager.lib; let
forEachHost = lib.genAttrs [ "dev-lt-63" "strawberry" "lime" ];
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [ self.overlays.default ];
};
in forEachHost (host: homeManagerConfiguration {
inherit pkgs;
modules = [
./system/dev-lt-63/home.nix
./system/${host}/home.nix
./shared/home
];
};
};
});
overlays = {
default = (import ./shared/overlay.nix);

View file

@ -1,8 +1,10 @@
{ pkgs, ... }:
{ pkgs, agenix, ... }:
{
imports = [
agenix.nixosModules.default
../secrets.nix
./services.nix
./backups.nix
./users.nix

View file

@ -1,6 +1,10 @@
{ lib, modulesPath, ... }: {
{ lib, modulesPath, nixos-hardware, ... }: {
imports = [./hardware-configuration.nix];
imports = [
./hardware-configuration.nix
nixos-hardware.nixosModules.lenovo-thinkpad-x390
nixos-hardware.nixosModules.common-gpu-nvidia-disable
];
custom = {
gui.enable = true;
@ -15,7 +19,5 @@
system.stateVersion = "22.11";
services.xserver.libinput.enable = true;
home-manager.users."riley".home.stateVersion = "22.11";
}

View file

@ -9,4 +9,5 @@
};
};
programs.iamb.enable = true;
home.stateVersion = "22.11";
}