mirror of
https://github.com/genebean/dots.git
synced 2026-03-27 01:17:42 -04:00
Move nixosHostConfig out of flake.nix
This commit is contained in:
parent
537dbf0b82
commit
e1d4cddda0
3 changed files with 62 additions and 60 deletions
70
flake.nix
70
flake.nix
|
|
@ -79,6 +79,10 @@
|
||||||
home-manager, nix-darwin, nix-flatpak, nix-homebrew, nixos-cosmic,
|
home-manager, nix-darwin, nix-flatpak, nix-homebrew, nixos-cosmic,
|
||||||
nixos-hardware, nixpkgs-terraform, simple-nixos-mailserver, sops-nix, ...
|
nixos-hardware, nixpkgs-terraform, simple-nixos-mailserver, sops-nix, ...
|
||||||
}: let
|
}: let
|
||||||
|
# Functions that setup systems
|
||||||
|
mylib = import ./lib { inherit inputs nixpkgs nixpkgs-unstable compose2nix disko flox genebean-omp-themes
|
||||||
|
home-manager nix-darwin nix-flatpak nix-homebrew nixos-cosmic
|
||||||
|
nixos-hardware nixpkgs-terraform simple-nixos-mailserver sops-nix; };
|
||||||
|
|
||||||
# creates a macOS system config
|
# creates a macOS system config
|
||||||
darwinHostConfig = { system, hostname, username, additionalModules, additionalSpecialArgs }: nix-darwin.lib.darwinSystem {
|
darwinHostConfig = { system, hostname, username, additionalModules, additionalSpecialArgs }: nix-darwin.lib.darwinSystem {
|
||||||
|
|
@ -117,43 +121,6 @@
|
||||||
] ++ additionalModules; # end modules
|
] ++ additionalModules; # end modules
|
||||||
}; # end darwinSystem
|
}; # end darwinSystem
|
||||||
|
|
||||||
# creates a nixos system config
|
|
||||||
nixosHostConfig = { system, hostname, username, additionalModules, additionalSpecialArgs }: nixpkgs.lib.nixosSystem {
|
|
||||||
inherit system;
|
|
||||||
specialArgs = { inherit inputs compose2nix hostname username; } // additionalSpecialArgs;
|
|
||||||
modules = [
|
|
||||||
# move this to a common file later
|
|
||||||
({
|
|
||||||
nixpkgs = {
|
|
||||||
config = {
|
|
||||||
allowUnfree = true;
|
|
||||||
permittedInsecurePackages = [ "olm-3.2.16" "electron-27.3.11" ];
|
|
||||||
};
|
|
||||||
overlays = [ nixpkgs-terraform.overlays.default ];
|
|
||||||
};
|
|
||||||
})
|
|
||||||
|
|
||||||
disko.nixosModules.disko
|
|
||||||
|
|
||||||
home-manager.nixosModules.home-manager {
|
|
||||||
home-manager = {
|
|
||||||
extraSpecialArgs = { inherit genebean-omp-themes hostname username; };
|
|
||||||
useGlobalPkgs = true;
|
|
||||||
useUserPackages = true;
|
|
||||||
users.${username}.imports = [
|
|
||||||
./modules/home-manager/hosts/${hostname}/${username}.nix
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
nix-flatpak.nixosModules.nix-flatpak
|
|
||||||
|
|
||||||
sops-nix.nixosModules.sops # system wide secrets management
|
|
||||||
./modules/system/common/all-nixos.nix # system-wide stuff
|
|
||||||
./modules/hosts/nixos/${hostname} # host specific stuff
|
|
||||||
] ++ additionalModules;
|
|
||||||
}; # end nixosSystem
|
|
||||||
|
|
||||||
linuxHomeConfig = { system, hostname, username, additionalModules, additionalSpecialArgs }: home-manager.lib.homeManagerConfiguration {
|
linuxHomeConfig = { system, hostname, username, additionalModules, additionalSpecialArgs }: home-manager.lib.homeManagerConfiguration {
|
||||||
extraSpecialArgs = { inherit genebean-omp-themes hostname username;
|
extraSpecialArgs = { inherit genebean-omp-themes hostname username;
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
|
|
@ -205,60 +172,43 @@
|
||||||
|
|
||||||
# NixOS hosts
|
# NixOS hosts
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
bigboy = nixosHostConfig {
|
bigboy = mylib.nixosHostConfig {
|
||||||
system = "x86_64-linux";
|
|
||||||
hostname = "bigboy";
|
hostname = "bigboy";
|
||||||
username = "gene";
|
|
||||||
additionalModules = [
|
additionalModules = [
|
||||||
nixos-hardware.nixosModules.lenovo-thinkpad-p52
|
nixos-hardware.nixosModules.lenovo-thinkpad-p52
|
||||||
];
|
];
|
||||||
additionalSpecialArgs = {};
|
|
||||||
};
|
};
|
||||||
hetznix01 = nixosHostConfig {
|
hetznix01 = mylib.nixosHostConfig {
|
||||||
system = "x86_64-linux";
|
|
||||||
hostname = "hetznix01";
|
hostname = "hetznix01";
|
||||||
username = "gene";
|
|
||||||
additionalModules = [
|
additionalModules = [
|
||||||
simple-nixos-mailserver.nixosModule
|
simple-nixos-mailserver.nixosModule
|
||||||
];
|
];
|
||||||
additionalSpecialArgs = {};
|
|
||||||
};
|
};
|
||||||
hetznix02 = nixosHostConfig {
|
hetznix02 = mylib.nixosHostConfig {
|
||||||
system = "aarch64-linux";
|
system = "aarch64-linux";
|
||||||
hostname = "hetznix02";
|
hostname = "hetznix02";
|
||||||
username = "gene";
|
|
||||||
additionalModules = [
|
additionalModules = [
|
||||||
# simple-nixos-mailserver.nixosModule
|
# simple-nixos-mailserver.nixosModule
|
||||||
];
|
];
|
||||||
additionalSpecialArgs = {};
|
|
||||||
};
|
};
|
||||||
nixnas1 = nixosHostConfig {
|
nixnas1 = mylib.nixosHostConfig {
|
||||||
system = "x86_64-linux";
|
|
||||||
hostname = "nixnas1";
|
hostname = "nixnas1";
|
||||||
username = "gene";
|
|
||||||
additionalModules = [
|
additionalModules = [
|
||||||
simple-nixos-mailserver.nixosModule
|
simple-nixos-mailserver.nixosModule
|
||||||
];
|
];
|
||||||
additionalSpecialArgs = {};
|
|
||||||
};
|
};
|
||||||
nixnuc = nixosHostConfig {
|
nixnuc = mylib.nixosHostConfig {
|
||||||
system = "x86_64-linux";
|
|
||||||
hostname = "nixnuc";
|
hostname = "nixnuc";
|
||||||
username = "gene";
|
|
||||||
additionalModules = [
|
additionalModules = [
|
||||||
simple-nixos-mailserver.nixosModule
|
simple-nixos-mailserver.nixosModule
|
||||||
];
|
];
|
||||||
additionalSpecialArgs = {};
|
|
||||||
};
|
};
|
||||||
rainbow-planet = nixosHostConfig {
|
rainbow-planet = mylib.nixosHostConfig {
|
||||||
system = "x86_64-linux";
|
|
||||||
hostname = "rainbow-planet";
|
hostname = "rainbow-planet";
|
||||||
username = "gene";
|
|
||||||
additionalModules = [
|
additionalModules = [
|
||||||
nixos-cosmic.nixosModules.default
|
nixos-cosmic.nixosModules.default
|
||||||
nixos-hardware.nixosModules.dell-xps-13-9360
|
nixos-hardware.nixosModules.dell-xps-13-9360
|
||||||
];
|
];
|
||||||
additionalSpecialArgs = {};
|
|
||||||
};
|
};
|
||||||
}; # end nixosConfigurations
|
}; # end nixosConfigurations
|
||||||
|
|
||||||
|
|
|
||||||
12
lib/default.nix
Normal file
12
lib/default.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
{ inputs, nixpkgs, nixpkgs-unstable, compose2nix, disko, flox, genebean-omp-themes,
|
||||||
|
home-manager, nix-darwin, nix-flatpak, nix-homebrew, nixos-cosmic,
|
||||||
|
nixos-hardware, nixpkgs-terraform, simple-nixos-mailserver, sops-nix, ...
|
||||||
|
}: let
|
||||||
|
nixosHostConfig = import ./nixosHostConfig.nix { inherit inputs nixpkgs nixpkgs-unstable compose2nix disko flox genebean-omp-themes
|
||||||
|
home-manager nix-darwin nix-flatpak nix-homebrew nixos-cosmic
|
||||||
|
nixos-hardware nixpkgs-terraform simple-nixos-mailserver sops-nix; };
|
||||||
|
in {
|
||||||
|
inherit (nixosHostConfig)
|
||||||
|
nixosHostConfig
|
||||||
|
;
|
||||||
|
}
|
||||||
40
lib/nixosHostConfig.nix
Normal file
40
lib/nixosHostConfig.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
{ inputs, nixpkgs, nixpkgs-unstable, compose2nix, disko, flox, genebean-omp-themes,
|
||||||
|
home-manager, nix-darwin, nix-flatpak, nix-homebrew, nixos-cosmic,
|
||||||
|
nixos-hardware, nixpkgs-terraform, simple-nixos-mailserver, sops-nix, ...
|
||||||
|
}: {
|
||||||
|
nixosHostConfig = { system ? "x86_64-linux", hostname, username ? "gene", additionalModules ? [], additionalSpecialArgs ? {} }: nixpkgs.lib.nixosSystem {
|
||||||
|
inherit system;
|
||||||
|
specialArgs = { inherit inputs compose2nix hostname username; } // additionalSpecialArgs;
|
||||||
|
modules = [
|
||||||
|
# move this to a common file later
|
||||||
|
({
|
||||||
|
nixpkgs = {
|
||||||
|
config = {
|
||||||
|
allowUnfree = true;
|
||||||
|
permittedInsecurePackages = [ "olm-3.2.16" "electron-27.3.11" ];
|
||||||
|
};
|
||||||
|
overlays = [ nixpkgs-terraform.overlays.default ];
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
disko.nixosModules.disko
|
||||||
|
|
||||||
|
home-manager.nixosModules.home-manager {
|
||||||
|
home-manager = {
|
||||||
|
extraSpecialArgs = { inherit genebean-omp-themes hostname username; };
|
||||||
|
useGlobalPkgs = true;
|
||||||
|
useUserPackages = true;
|
||||||
|
users.${username}.imports = [
|
||||||
|
../modules/home-manager/hosts/${hostname}/${username}.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
nix-flatpak.nixosModules.nix-flatpak
|
||||||
|
|
||||||
|
sops-nix.nixosModules.sops # system wide secrets management
|
||||||
|
../modules/system/common/all-nixos.nix # system-wide stuff
|
||||||
|
../modules/hosts/nixos/${hostname} # host specific stuff
|
||||||
|
] ++ additionalModules;
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue