refactor for adding new hosts

This commit is contained in:
Sam 2024-05-13 22:17:40 +01:00
parent 651e3a9f3b
commit 154d7b0528
10 changed files with 54 additions and 16 deletions

View File

@ -38,6 +38,7 @@
# This is a function that generates an attribute by calling a function you # This is a function that generates an attribute by calling a function you
# pass to it, with each system as an argument # pass to it, with each system as an argument
forAllSystems = nixpkgs.lib.genAttrs systems; forAllSystems = nixpkgs.lib.genAttrs systems;
specialArgs = { inherit inputs outputs; };
in { in {
# Your custom packages # Your custom packages
# Accessible through 'nix build', 'nix shell', etc # Accessible through 'nix build', 'nix shell', etc
@ -60,26 +61,37 @@
nixosConfigurations = { nixosConfigurations = {
# FIXME replace with your hostname # FIXME replace with your hostname
nixdev = nixpkgs.lib.nixosSystem { nixdev = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;}; inherit specialArgs;
modules = [ modules = [
# > Our main nixos configuration file < # > Our main nixos configuration file <
./hosts/nixdev ./hosts/nixdev
home-manager.nixosModules.home-manager{
home-manager.extraSpecialArgs = specialArgs;
}
]; ];
}; };
}; };
# Standalone home-manager configuration entrypoint # # Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#your-username@your-hostname' # # Available through 'home-manager --flake .#your-username@your-hostname'
homeConfigurations = { # homeConfigurations = {
# FIXME replace with your username@hostname # # FIXME replace with your username@hostname
"sam@nixdev" = home-manager.lib.homeManagerConfiguration { # "sam@nixdev" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance # pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
extraSpecialArgs = {inherit inputs outputs ;}; # extraSpecialArgs = {inherit inputs outputs ;};
modules = [ # modules = [
# > Our main home-manager configuration file < # # > Our main home-manager configuration file <
./home/sam/nixdev.nix # ./home/nixdev.nix
]; # ];
}; # };
}; # "admin@fileserver" = home-manager.lib.homeManagerConfiguration {
# pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
# extraSpecialArgs = {inherit inputs outputs ;};
# modules = [
# # > Our main home-manager configuration file <
# ./home/nixdev.nix
# ];
# };
# };
}; };
} }

View File

@ -0,0 +1,5 @@
{ pkgs, ... }:
{
imports = [
] ;
}

View File

@ -1,6 +1,6 @@
{ inputs, config, ... }: { inputs, config, ... }:
let let
secretsFile = ../../../../secrets.yaml; secretsFile = ../../../secrets.yaml;
homeDirectory = config.home.homeDirectory; homeDirectory = config.home.homeDirectory;
in in
{ {

16
home/fileserver.nix Normal file
View File

@ -0,0 +1,16 @@
{
pkgs,
config,
lib,
...
}: {
imports = [
./common/core
./common/optional/sops.nix
# Import optional
./common/optional/git.nix
# Import users
./users/admin
];

View File

@ -9,6 +9,12 @@
./common/optional/desktop/hyprland ./common/optional/desktop/hyprland
./common/optional/desktop/waybar.nix ./common/optional/desktop/waybar.nix
./common/optional/sops.nix ./common/optional/sops.nix
# Import optional
./common/optional/git.nix
# Import users
./users/sam
]; ];
# ------ # ------

View File

@ -6,7 +6,6 @@
home.stateVersion = "23.11"; home.stateVersion = "23.11";
imports = [ imports = [
./git.nix
] ++ (builtins.attrValues outputs.homeManagerModules); # import all homeManagerModules? ] ++ (builtins.attrValues outputs.homeManagerModules); # import all homeManagerModules?
home.packages = [ home.packages = [