mirror of
https://github.com/nickolaj-jepsen/nixos.git
synced 2026-01-22 08:06:50 +01:00
update
This commit is contained in:
parent
2b7b63a18c
commit
638ef7093e
140 changed files with 307 additions and 121 deletions
98
hosts/default.nix
Normal file
98
hosts/default.nix
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
{
|
||||
inputs,
|
||||
withSystem,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
mkSystemImports = hostname: let
|
||||
hostDirectory = ./. + ("/" + hostname);
|
||||
nixFiles = filter (file: hasSuffix ".nix" file) (attrNames (builtins.readDir hostDirectory));
|
||||
imports = map (file: ./. + ("/" + hostname + "/" + file)) nixFiles;
|
||||
in {
|
||||
inherit imports;
|
||||
};
|
||||
|
||||
mkSystem = {
|
||||
hostname,
|
||||
username,
|
||||
modules ? [],
|
||||
system ? "x86_64-linux",
|
||||
}:
|
||||
withSystem system (
|
||||
{system, ...}: let
|
||||
pkgs = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
|
||||
pkgsUnstable = import inputs.nixpkgs-unstable {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
in
|
||||
inputs.nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = {inherit inputs hostname username pkgs pkgsUnstable;};
|
||||
modules =
|
||||
[
|
||||
inputs.disko.nixosModules.disko
|
||||
inputs.nixos-generators.nixosModules.all-formats
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
inputs.agenix.nixosModules.default
|
||||
inputs.agenix-rekey.nixosModules.default
|
||||
inputs.nix-index-database.nixosModules.nix-index
|
||||
inputs.nixos-facter-modules.nixosModules.facter
|
||||
../modules/base/user.nix
|
||||
(mkSystemImports hostname)
|
||||
]
|
||||
++ modules
|
||||
++ (
|
||||
lib.optional (builtins.pathExists ./${hostname}/facter.json)
|
||||
{config.facter.reportPath = ./${hostname}/facter.json;}
|
||||
);
|
||||
}
|
||||
);
|
||||
in {
|
||||
config.flake.nixosConfigurations = {
|
||||
bootstrap = mkSystem {
|
||||
hostname = "bootstrap";
|
||||
username = "nixos";
|
||||
modules = [
|
||||
../modules/required.nix
|
||||
../modules/shell.nix
|
||||
];
|
||||
};
|
||||
|
||||
laptop = mkSystem {
|
||||
hostname = "laptop";
|
||||
username = "nickolaj";
|
||||
modules = [
|
||||
../modules/required.nix
|
||||
../modules/shell.nix
|
||||
../modules/graphical.nix
|
||||
../modules/devenv.nix
|
||||
];
|
||||
};
|
||||
desktop = mkSystem {
|
||||
hostname = "desktop";
|
||||
username = "nickolaj";
|
||||
modules = [
|
||||
../modules/required.nix
|
||||
../modules/shell.nix
|
||||
../modules/graphical.nix
|
||||
../modules/devenv.nix
|
||||
];
|
||||
};
|
||||
work = mkSystem {
|
||||
hostname = "work";
|
||||
username = "nickolaj";
|
||||
modules = [
|
||||
../modules/required.nix
|
||||
../modules/shell.nix
|
||||
../modules/graphical.nix
|
||||
../modules/devenv.nix
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue