Reorganize hosts and modules

This commit is contained in:
2024-07-18 21:50:11 -07:00
parent eb1dc47bb1
commit 1649951409
8 changed files with 46 additions and 89 deletions

View File

@@ -1,31 +0,0 @@
{ lib, config, ... }:
with lib;
{
options = {
tools.coding = {
enable = mkEnableOption "Enable coding tools";
};
};
config = mkIf config.tools.coding.enable {
programs.git = {
enable = true;
lfs.enable = true;
config = {
init.defaultBranch = "master";
user = {
email = "git@nettika.cat";
name = "Nettika";
};
credential.helper = "store";
};
};
programs.nano = {
enable = true;
nanorc = ''
set autoindent
set linenumbers
'';
};
};
}

View File

@@ -1,7 +0,0 @@
{ pkgs, lib, config, ... }:
{
imports = [
./coding.nix
./secrets.nix
];
}

View File

@@ -1,13 +0,0 @@
{ lib, config, pkgs, ... }:
with lib;
{
options = {
tools.secrets = {
enable = mkEnableOption "Enable secret-management tools";
};
};
config = mkIf config.tools.secrets.enable {
environment.systemPackages = [ pkgs.git-crypt ];
};
}

View File

@@ -5,26 +5,24 @@
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
};
outputs = { nixpkgs, ... }@inputs:
outputs = { self, nixpkgs, ... }@inputs:
let
secrets = builtins.fromJSON (builtins.readFile ./secrets.json);
in {
nixosModules = {
common = import ./modules/common.nix;
};
nixosConfigurations = {
marauder = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./marauder
./common
];
specialArgs = { inherit inputs secrets; };
modules = [ ./hosts/marauder ];
specialArgs = { inherit self inputs secrets; };
};
monolith = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./monolith
./common
];
specialArgs = { inherit inputs secrets; };
modules = [ ./hosts/monolith ];
specialArgs = { inherit self inputs secrets; };
};
};
};

View File

@@ -1,6 +1,9 @@
{ pkgs, inputs, secrets, ... }:
{ self, pkgs, inputs, secrets, ... }:
{
imports = [ ./backup.nix ];
imports = [
self.nixosModules.common
./backup.nix
];
networking.hostName = "marauder";
@@ -60,18 +63,6 @@
};
};
nixpkgs.config.allowUnfree = true;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
tools.secrets = {
enable = true;
};
tools.coding = {
enable = true;
};
environment.systemPackages = with pkgs; [
# Chat clients
discord

View File

@@ -1,4 +1,6 @@
{ pkgs, secrets, ... }: {
{ self, pkgs, secrets, ... }: {
imports = [ self.nixosModules.common ];
networking = {
hostName = "monolith";
hostId = "44551c32";
@@ -42,18 +44,6 @@
};
};
nixpkgs.config.allowUnfree = true;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
tools.secrets = {
enable = true;
};
tools.coding = {
enable = true;
};
services.openssh = {
enable = true;
settings.PasswordAuthentication = false;

29
modules/common.nix Normal file
View File

@@ -0,0 +1,29 @@
{ pkgs, ... }:
{
nixpkgs.config.allowUnfree = true;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
programs.git = {
enable = true;
lfs.enable = true;
config = {
init.defaultBranch = "master";
user = {
email = "git@nettika.cat";
name = "Nettika";
};
credential.helper = "store";
};
};
programs.nano = {
enable = true;
nanorc = ''
set autoindent
set linenumbers
'';
};
environment.systemPackages = [ pkgs.git-crypt ];
}