chore: prepare config structure for multiple hosts

This commit is contained in:
2026-01-25 23:57:06 +01:00
parent c6c21ab886
commit 035bb3eaab
4 changed files with 51 additions and 57 deletions
+5 -29
View File
@@ -1,15 +1,8 @@
{
description = "Your new nix config";
inputs = {
# Nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
# You can access packages and modules from different nixpkgs revs
# at the same time. Here's an working example:
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
# Also see the 'unstable-packages' overlay at 'overlays/default.nix'.
# Home manager
home-manager.url = "github:nix-community/home-manager/release-25.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
@@ -27,44 +20,27 @@
}@inputs:
let
inherit (self) outputs;
# Supported systems for your flake packages, shell, etc.
systems = [
"x86_64-linux"
];
# This is a function that generates an attribute by calling a function you
# pass to it, with each system as an argument
forAllSystems = nixpkgs.lib.genAttrs systems;
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
in
{
# Your custom packages
# Accessible through 'nix build', 'nix shell', etc
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
# Your custom packages and modifications, exported as overlays
packages = import ./pkgs pkgs;
overlays = import ./overlays { inherit inputs; };
# Reusable nixos modules you might want to export
# These are usually stuff you would upstream into nixpkgs
nixosModules = import ./modules/nixos;
# Reusable home-manager modules you might want to export
# These are usually stuff you would upstream into home-manager
homeManagerModules = import ./modules/home-manager;
# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = {
desktop = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = [
./nixos/configuration.nix
./nixos/desktop
];
};
};
# Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#your-username@your-hostname'
homeConfigurations = {
"leonhard@desktop" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
inherit pkgs;
extraSpecialArgs = { inherit inputs outputs; };
modules = [
./home-manager/home.nix
+2 -25
View File
@@ -1,5 +1,3 @@
# This is your system's configuration file.
# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix)
{
inputs,
outputs,
@@ -10,7 +8,6 @@
}:
{
imports = [
./hardware-configuration.nix
outputs.nixosModules
];
@@ -73,32 +70,12 @@
LC_TIME = "de_DE.UTF-8";
};
# Enable CUPS to print documents.
#services.printing.enable = true;
# Enable firmware
#hardware.enableAllFirmware = true;
# Enable bluetooth
#hardware.bluetooth.enable = true;
# Enable sound with pipewire.
# security.rtkit.enable = true;
# services.pipewire = {
# enable = true;
# alsa.enable = true;
# alsa.support32Bit = true;
# pulse.enable = true;
# };
networking.hostName = "desktop";
users.users = {
leonhard = {
# TODO: You can set an initial password for your user.
# You can set an initial password for your user.
# If you do, you can skip setting a root password by passing '--no-root-passwd' to nixos-install.
# Be sure to change it (using passwd) after rebooting!
initialPassword = "correcthorsebatterystaple";
initialPassword = "leonhard";
isNormalUser = true;
extraGroups = [ "wheel" ];
};
+44
View File
@@ -0,0 +1,44 @@
{
inputs,
outputs,
lib,
config,
pkgs,
...
}:
{
imports = [
(import ../base.nix {
inherit
inputs
outputs
config
lib
pkgs
;
})
(import ./hardware-configuration.nix {
inherit lib;
})
];
# Enable CUPS to print documents.
#services.printing.enable = true;
# Enable firmware
#hardware.enableAllFirmware = true;
# Enable bluetooth
#hardware.bluetooth.enable = true;
# Enable sound with pipewire.
# security.rtkit.enable = true;
# services.pipewire = {
# enable = true;
# alsa.enable = true;
# alsa.support32Bit = true;
# pulse.enable = true;
# };
networking.hostName = "desktop";
}
@@ -1,8 +1,5 @@
{
config,
lib,
pkgs,
modulesPath,
...
}: