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"; nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
}; };
outputs = { nixpkgs, ... }@inputs: outputs = { self, nixpkgs, ... }@inputs:
let let
secrets = builtins.fromJSON (builtins.readFile ./secrets.json); secrets = builtins.fromJSON (builtins.readFile ./secrets.json);
in { in {
nixosModules = {
common = import ./modules/common.nix;
};
nixosConfigurations = { nixosConfigurations = {
marauder = nixpkgs.lib.nixosSystem { marauder = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [ ./hosts/marauder ];
./marauder specialArgs = { inherit self inputs secrets; };
./common
];
specialArgs = { inherit inputs secrets; };
}; };
monolith = nixpkgs.lib.nixosSystem { monolith = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [ ./hosts/monolith ];
./monolith specialArgs = { inherit self inputs secrets; };
./common
];
specialArgs = { inherit 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"; 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; [ environment.systemPackages = with pkgs; [
# Chat clients # Chat clients
discord discord

View File

@@ -1,4 +1,6 @@
{ pkgs, secrets, ... }: { { self, pkgs, secrets, ... }: {
imports = [ self.nixosModules.common ];
networking = { networking = {
hostName = "monolith"; hostName = "monolith";
hostId = "44551c32"; 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 = { services.openssh = {
enable = true; enable = true;
settings.PasswordAuthentication = false; 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 ];
}