Move common system code into a dedicated file
Remove a lot of copy-pasting
This commit is contained in:
parent
63a8f1c81d
commit
7bf9848482
2 changed files with 64 additions and 105 deletions
128
flake.nix
128
flake.nix
|
|
@ -16,10 +16,6 @@
|
|||
|
||||
outputs = { self, home-manager, nixpkgs, nixvim, sops-nix, ...}:
|
||||
let
|
||||
allowed-unfree-packages = [
|
||||
"corefonts"
|
||||
"mongodb"
|
||||
];
|
||||
configFiles = pkgs.stdenv.mkDerivation {
|
||||
name = "config-files";
|
||||
src = ./configs;
|
||||
|
|
@ -32,110 +28,32 @@
|
|||
system = "x86_64-linux";
|
||||
in {
|
||||
nixosConfigurations = {
|
||||
corp = nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.extraSpecialArgs = { inherit configFiles; };
|
||||
home-manager.sharedModules = [
|
||||
nixvim.homeManagerModules.nixvim
|
||||
./modules/home/nixvim.nix
|
||||
];
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
}
|
||||
./host/corp/configuration.nix
|
||||
./modules
|
||||
sops-nix.nixosModules.sops {
|
||||
sops = {
|
||||
age.generateKey = true;
|
||||
age.keyFile = "/var/libs/sops-nix/key.txt";
|
||||
age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
defaultSopsFile = ./secrets/secrets.yaml;
|
||||
};
|
||||
}
|
||||
./users
|
||||
];
|
||||
pkgs = import nixpkgs {
|
||||
config = {
|
||||
allowUnfreePredicate = pkg: builtins.elem (nixpkgs.lib.getName pkg) allowed-unfree-packages;
|
||||
};
|
||||
system = "${system}";
|
||||
};
|
||||
specialArgs = {
|
||||
inherit configFiles;
|
||||
};
|
||||
system = "${system}";
|
||||
corp = import ./system.nix {
|
||||
configuration = ./host/corp/configuration.nix;
|
||||
inherit configFiles;
|
||||
inherit home-manager;
|
||||
inherit nixpkgs;
|
||||
inherit nixvim;
|
||||
inherit sops-nix;
|
||||
inherit system;
|
||||
};
|
||||
"sync.nidus.cloud" = nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.extraSpecialArgs = { inherit configFiles; };
|
||||
home-manager.sharedModules = [
|
||||
nixvim.homeManagerModules.nixvim
|
||||
./modules/home/nixvim.nix
|
||||
];
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
}
|
||||
./host/sync/configuration.nix
|
||||
./modules
|
||||
sops-nix.nixosModules.sops {
|
||||
sops = {
|
||||
age.generateKey = true;
|
||||
age.keyFile = "/var/libs/sops-nix/key.txt";
|
||||
age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
defaultSopsFile = ./secrets/secrets.yaml;
|
||||
};
|
||||
}
|
||||
./users
|
||||
];
|
||||
pkgs = import nixpkgs {
|
||||
config = {
|
||||
allowUnfreePredicate = pkg: builtins.elem (nixpkgs.lib.getName pkg) allowed-unfree-packages;
|
||||
};
|
||||
system = "${system}";
|
||||
};
|
||||
specialArgs = {
|
||||
inherit configFiles;
|
||||
};
|
||||
system = "${system}";
|
||||
"sync.nidus.cloud" = import ./system.nix {
|
||||
configuration = ./host/sync/configuration.nix;
|
||||
inherit configFiles;
|
||||
inherit home-manager;
|
||||
inherit nixpkgs;
|
||||
inherit nixvim;
|
||||
inherit sops-nix;
|
||||
inherit system;
|
||||
};
|
||||
test-corp = nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.extraSpecialArgs = { inherit configFiles; };
|
||||
home-manager.sharedModules = [
|
||||
nixvim.homeManagerModules.nixvim
|
||||
./modules/home/nixvim.nix
|
||||
];
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
}
|
||||
./host/test-corp/configuration.nix
|
||||
./modules
|
||||
sops-nix.nixosModules.sops {
|
||||
sops = {
|
||||
age.generateKey = true;
|
||||
age.keyFile = "/var/libs/sops-nix/key.txt";
|
||||
age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
defaultSopsFile = ./secrets/secrets.yaml;
|
||||
};
|
||||
}
|
||||
./users
|
||||
];
|
||||
pkgs = import nixpkgs {
|
||||
config = {
|
||||
allowUnfreePredicate = pkg: builtins.elem (nixpkgs.lib.getName pkg) allowed-unfree-packages;
|
||||
};
|
||||
system = "${system}";
|
||||
};
|
||||
specialArgs = {
|
||||
inherit configFiles;
|
||||
};
|
||||
system = "${system}";
|
||||
configuration = ./host/test-corp/configuration.nix;
|
||||
inherit configFiles;
|
||||
inherit home-manager;
|
||||
inherit nixpkgs;
|
||||
inherit nixvim;
|
||||
inherit sops-nix;
|
||||
inherit system;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
41
system.nix
Normal file
41
system.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{ configFiles, configuration, home-manager, nixpkgs, nixvim, sops-nix, system, ... }:
|
||||
let
|
||||
allowed-unfree-packages = [
|
||||
"corefonts"
|
||||
"mongodb"
|
||||
];
|
||||
in nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.extraSpecialArgs = { inherit configFiles; };
|
||||
home-manager.sharedModules = [
|
||||
nixvim.homeManagerModules.nixvim
|
||||
./modules/home/nixvim.nix
|
||||
];
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
}
|
||||
configuration
|
||||
./modules
|
||||
sops-nix.nixosModules.sops {
|
||||
sops = {
|
||||
age.generateKey = true;
|
||||
age.keyFile = "/var/libs/sops-nix/key.txt";
|
||||
age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
defaultSopsFile = ./secrets/secrets.yaml;
|
||||
};
|
||||
}
|
||||
./users
|
||||
];
|
||||
pkgs = import nixpkgs {
|
||||
config = {
|
||||
allowUnfreePredicate = pkg: builtins.elem (nixpkgs.lib.getName pkg) allowed-unfree-packages;
|
||||
};
|
||||
system = "${system}";
|
||||
};
|
||||
specialArgs = {
|
||||
inherit configFiles;
|
||||
};
|
||||
system = "${system}";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue