Split modules and profiles
This commit is contained in:
parent
7efadcdd7f
commit
7db6eb7179
101
flake.nix
101
flake.nix
@ -59,9 +59,7 @@
|
|||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
nix-direnv = {
|
nix-direnv = { url = "github:nix-community/nix-direnv"; };
|
||||||
url = "github:nix-community/nix-direnv";
|
|
||||||
};
|
|
||||||
|
|
||||||
nheko = {
|
nheko = {
|
||||||
url = "github:balsoft/nheko/allow-edits-of-pending-messages";
|
url = "github:balsoft/nheko/allow-edits-of-pending-messages";
|
||||||
@ -69,53 +67,72 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { nixpkgs, nix, self, deploy-rs, ... }@inputs: {
|
outputs = { nixpkgs, nix, self, deploy-rs, ... }@inputs:
|
||||||
nixosModules = import ./modules;
|
let
|
||||||
|
findModules = dir:
|
||||||
|
builtins.concatLists (builtins.attrValues (builtins.mapAttrs
|
||||||
|
(name: type:
|
||||||
|
if type == "regular" then
|
||||||
|
[{
|
||||||
|
name = builtins.elemAt (builtins.match "(.*)\\.nix" name) 0;
|
||||||
|
value = dir + "/${name}";
|
||||||
|
}]
|
||||||
|
else if (builtins.readDir (dir + "/${name}"))
|
||||||
|
? "default.nix" then [{
|
||||||
|
inherit name;
|
||||||
|
value = dir + "/${name}";
|
||||||
|
}] else
|
||||||
|
findModules (dir + "/${name}")) (builtins.readDir dir)));
|
||||||
|
in {
|
||||||
|
nixosModules = builtins.listToAttrs (findModules ./modules);
|
||||||
|
|
||||||
nixosProfiles = import ./profiles;
|
nixosProfiles = builtins.listToAttrs (findModules ./profiles);
|
||||||
|
|
||||||
nixosConfigurations = with nixpkgs.lib;
|
nixosRoles = import ./roles;
|
||||||
let
|
|
||||||
hosts = builtins.attrNames (builtins.readDir ./machines);
|
|
||||||
mkHost = name:
|
|
||||||
nixosSystem {
|
|
||||||
system = builtins.readFile (./machines + "/${name}/system");
|
|
||||||
modules = [ (import (./machines + "/${name}")) { device = name; } ];
|
|
||||||
specialArgs = { inherit inputs; };
|
|
||||||
};
|
|
||||||
in genAttrs hosts mkHost;
|
|
||||||
|
|
||||||
legacyPackages.x86_64-linux =
|
nixosConfigurations = with nixpkgs.lib;
|
||||||
(builtins.head (builtins.attrValues self.nixosConfigurations)).pkgs;
|
let
|
||||||
|
hosts = builtins.attrNames (builtins.readDir ./machines);
|
||||||
|
mkHost = name:
|
||||||
|
nixosSystem {
|
||||||
|
system = builtins.readFile (./machines + "/${name}/system");
|
||||||
|
modules =
|
||||||
|
[ (import (./machines + "/${name}")) { device = name; } ];
|
||||||
|
specialArgs = { inherit inputs; };
|
||||||
|
};
|
||||||
|
in genAttrs hosts mkHost;
|
||||||
|
|
||||||
defaultApp = deploy-rs.defaultApp;
|
legacyPackages.x86_64-linux =
|
||||||
|
(builtins.head (builtins.attrValues self.nixosConfigurations)).pkgs;
|
||||||
|
|
||||||
devShell.x86_64-linux = with nixpkgs.legacyPackages.x86_64-linux;
|
defaultApp = deploy-rs.defaultApp;
|
||||||
mkShell {
|
|
||||||
buildInputs = [
|
|
||||||
nix.defaultPackage.x86_64-linux
|
|
||||||
deploy-rs.defaultPackage.x86_64-linux
|
|
||||||
nixfmt
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
deploy = {
|
devShell.x86_64-linux = with nixpkgs.legacyPackages.x86_64-linux;
|
||||||
user = "root";
|
mkShell {
|
||||||
nodes = (builtins.mapAttrs (_: machine: {
|
buildInputs = [
|
||||||
hostname = machine.config.networking.hostName;
|
nix.defaultPackage.x86_64-linux
|
||||||
profiles.system = {
|
deploy-rs.defaultPackage.x86_64-linux
|
||||||
user = "balsoft";
|
nixfmt
|
||||||
path = deploy-rs.lib.x86_64-linux.activate.noop
|
];
|
||||||
machine.config.system.build.toplevel;
|
|
||||||
};
|
};
|
||||||
}) self.nixosConfigurations) // {
|
|
||||||
T420-Laptop = {
|
deploy = {
|
||||||
hostname =
|
user = "root";
|
||||||
self.nixosConfigurations.T420-Laptop.config.networking.hostName;
|
nodes = (builtins.mapAttrs (_: machine: {
|
||||||
profiles.system.path = deploy-rs.lib.x86_64-linux.activate.nixos
|
hostname = machine.config.networking.hostName;
|
||||||
self.nixosConfigurations.T420-Laptop;
|
profiles.system = {
|
||||||
|
user = "balsoft";
|
||||||
|
path = deploy-rs.lib.x86_64-linux.activate.noop
|
||||||
|
machine.config.system.build.toplevel;
|
||||||
|
};
|
||||||
|
}) self.nixosConfigurations) // {
|
||||||
|
T420-Laptop = {
|
||||||
|
hostname =
|
||||||
|
self.nixosConfigurations.T420-Laptop.config.networking.hostName;
|
||||||
|
profiles.system.path = deploy-rs.lib.x86_64-linux.activate.nixos
|
||||||
|
self.nixosConfigurations.T420-Laptop;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
{ config, inputs, ... }: {
|
{ config, inputs, ... }: {
|
||||||
imports = [
|
imports = [
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
inputs.self.nixosProfiles.desktop
|
inputs.self.nixosRoles.desktop
|
||||||
inputs.self.nixosModules.print-scan
|
inputs.self.nixosProfiles.print-scan
|
||||||
inputs.self.nixosModules.aws
|
inputs.self.nixosProfiles.aws
|
||||||
];
|
];
|
||||||
deviceSpecific.devInfo = {
|
deviceSpecific.devInfo = {
|
||||||
cpu = {
|
cpu = {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{ inputs, ... }: {
|
{ inputs, ... }: {
|
||||||
imports = with inputs.self.nixosModules; [
|
imports = with inputs.self.nixosModules; [
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
inputs.self.nixosProfiles.server
|
inputs.self.nixosRoles.server
|
||||||
mailserver
|
mailserver
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{ inputs, ... }: {
|
{ inputs, ... }: {
|
||||||
imports = with inputs.self.nixosModules; [
|
imports = with inputs.self.nixosModules; [
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
inputs.self.nixosProfiles.base
|
inputs.self.nixosRoles.base
|
||||||
gitea
|
gitea
|
||||||
# jitsi
|
# jitsi
|
||||||
mailserver
|
mailserver
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{ inputs, ... }: {
|
{ inputs, ... }: {
|
||||||
imports = [ ./hardware-configuration.nix inputs.self.nixosProfiles.desktop ];
|
imports = [ ./hardware-configuration.nix inputs.self.nixosRoles.desktop ];
|
||||||
deviceSpecific.devInfo = {
|
deviceSpecific.devInfo = {
|
||||||
cpu = {
|
cpu = {
|
||||||
vendor = "intel";
|
vendor = "intel";
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{ inputs, lib, config, pkgs, ... }: {
|
{ inputs, lib, config, pkgs, ... }: {
|
||||||
imports = [
|
imports = [
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
inputs.self.nixosProfiles.desktop
|
inputs.self.nixosRoles.desktop
|
||||||
];
|
];
|
||||||
deviceSpecific.devInfo = {
|
deviceSpecific.devInfo = {
|
||||||
cpu = {
|
cpu = {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{ modulesPath, lib, inputs, pkgs, ... }: {
|
{ modulesPath, lib, inputs, pkgs, ... }: {
|
||||||
imports = with inputs.self.nixosModules; [
|
imports = with inputs.self.nixosModules; [
|
||||||
"${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix"
|
"${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix"
|
||||||
inputs.self.nixosProfiles.base
|
inputs.self.nixosRoles.base
|
||||||
themes
|
themes
|
||||||
fonts
|
fonts
|
||||||
cage
|
cage
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
let
|
|
||||||
findModules = dir:
|
|
||||||
builtins.concatLists (builtins.attrValues (builtins.mapAttrs (name: type:
|
|
||||||
if type == "regular" then
|
|
||||||
(if name == "default.nix" then
|
|
||||||
[ ]
|
|
||||||
else [{
|
|
||||||
name = builtins.elemAt (builtins.match "(.*)\\.nix" name) 0;
|
|
||||||
value = dir + "/${name}";
|
|
||||||
}])
|
|
||||||
else if (builtins.readDir (dir + "/${name}")) ? "default.nix" then [{
|
|
||||||
inherit name;
|
|
||||||
value = dir + "/${name}";
|
|
||||||
}] else
|
|
||||||
findModules (dir + "/${name}")) (builtins.readDir dir)));
|
|
||||||
|
|
||||||
in builtins.listToAttrs (findModules ./.)
|
|
@ -1,15 +1,19 @@
|
|||||||
{ inputs, ... }: {
|
{ inputs, ... }: {
|
||||||
imports = with inputs.self.nixosModules; [
|
imports = with inputs.self.nixosModules; with inputs.self.nixosProfiles; [
|
||||||
inputs.home-manager.nixosModules.home-manager
|
inputs.home-manager.nixosModules.home-manager
|
||||||
|
|
||||||
|
# MODULES
|
||||||
applications
|
applications
|
||||||
boot
|
|
||||||
secrets
|
secrets
|
||||||
secrets-envsubst
|
secrets-envsubst
|
||||||
|
persist
|
||||||
|
|
||||||
|
|
||||||
|
# PROFILES
|
||||||
autoRun
|
autoRun
|
||||||
xdg
|
xdg
|
||||||
|
|
||||||
|
boot
|
||||||
devices
|
devices
|
||||||
git
|
git
|
||||||
gpg
|
gpg
|
||||||
@ -18,7 +22,6 @@
|
|||||||
network
|
network
|
||||||
nix
|
nix
|
||||||
overlay
|
overlay
|
||||||
persist
|
|
||||||
security
|
security
|
||||||
ssh
|
ssh
|
||||||
zsh
|
zsh
|
@ -1,11 +1,15 @@
|
|||||||
{ inputs, ... }: {
|
{ inputs, ... }: {
|
||||||
imports = with inputs.self.nixosModules; [
|
imports = with inputs.self.nixosModules; with inputs.self.nixosProfiles; [
|
||||||
./base.nix
|
./base.nix
|
||||||
|
|
||||||
applications-setup
|
# MODULES
|
||||||
ezwg
|
|
||||||
hardware
|
|
||||||
themes
|
themes
|
||||||
|
ezwg
|
||||||
|
|
||||||
|
|
||||||
|
# PROFILES
|
||||||
|
applications-setup
|
||||||
|
hardware
|
||||||
virtualisation
|
virtualisation
|
||||||
|
|
||||||
alacritty
|
alacritty
|
Loading…
x
Reference in New Issue
Block a user