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 = { inputs = {
# Nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11"; 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"; 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.url = "github:nix-community/home-manager/release-25.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
@@ -27,44 +20,27 @@
}@inputs: }@inputs:
let let
inherit (self) outputs; inherit (self) outputs;
# Supported systems for your flake packages, shell, etc. system = "x86_64-linux";
systems = [ pkgs = import nixpkgs { inherit system; };
"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;
in in
{ {
# Your custom packages packages = import ./pkgs pkgs;
# Accessible through 'nix build', 'nix shell', etc
packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
# Your custom packages and modifications, exported as overlays
overlays = import ./overlays { inherit inputs; }; 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; 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; homeManagerModules = import ./modules/home-manager;
# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = { nixosConfigurations = {
desktop = nixpkgs.lib.nixosSystem { desktop = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs; }; specialArgs = { inherit inputs outputs; };
modules = [ modules = [
./nixos/configuration.nix ./nixos/desktop
]; ];
}; };
}; };
# Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#your-username@your-hostname'
homeConfigurations = { homeConfigurations = {
"leonhard@desktop" = home-manager.lib.homeManagerConfiguration { "leonhard@desktop" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance inherit pkgs;
extraSpecialArgs = { inherit inputs outputs; }; extraSpecialArgs = { inherit inputs outputs; };
modules = [ modules = [
./home-manager/home.nix ./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, inputs,
outputs, outputs,
@@ -10,7 +8,6 @@
}: }:
{ {
imports = [ imports = [
./hardware-configuration.nix
outputs.nixosModules outputs.nixosModules
]; ];
@@ -73,32 +70,12 @@
LC_TIME = "de_DE.UTF-8"; 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 = { users.users = {
leonhard = { 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. # 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! # Be sure to change it (using passwd) after rebooting!
initialPassword = "correcthorsebatterystaple"; initialPassword = "leonhard";
isNormalUser = true; isNormalUser = true;
extraGroups = [ "wheel" ]; 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, lib,
pkgs,
modulesPath,
... ...
}: }: