Refactor and modularize
This commit is contained in:
103
flake.nix
103
flake.nix
@ -1,31 +1,20 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixos-23.05";
|
||||
agenix = {
|
||||
url = "github:ryantm/agenix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.darwin.follows = "";
|
||||
};
|
||||
nixpkgs.url = "nixpkgs/nixos-23.05";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, agenix, ... }@attrs:
|
||||
let
|
||||
containerDef = import ./containers.nix;
|
||||
serviceContainers = containerDef.containers;
|
||||
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
shell = import ./shell.nix { inherit agenix pkgs; };
|
||||
system = "x86_64-linux";
|
||||
in {
|
||||
devShell.x86_64-linux = pkgs.mkShell {
|
||||
buildInputs = [
|
||||
agenix.packages.x86_64-linux.default
|
||||
(pkgs.nixos { }).nixos-rebuild
|
||||
pkgs.terraform
|
||||
];
|
||||
shellHook = ''
|
||||
alias deploy="nixos-rebuild switch --target-host root@matri.cx --build-host root@matri.cx --flake .#eve-psr-nix0"
|
||||
'';
|
||||
};
|
||||
devShell.x86_64-linux = shell.dev;
|
||||
|
||||
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt;
|
||||
|
||||
@ -38,88 +27,24 @@
|
||||
|
||||
imports = [
|
||||
agenix.nixosModules.default
|
||||
./hardware-configuration.nix
|
||||
|
||||
./system/containers.nix
|
||||
./system/hardware-configuration.nix
|
||||
./system/nix-configuration.nix
|
||||
./system/security.nix
|
||||
./system/services.nix
|
||||
./system/system.nix
|
||||
./system/virtualisation.nix
|
||||
|
||||
./user/users.nix
|
||||
];
|
||||
|
||||
nix = {
|
||||
buildMachines = [ ];
|
||||
distributedBuilds = false;
|
||||
settings = {
|
||||
auto-optimise-store = false; # https://github.com/NixOS/nix/issues/7273
|
||||
experimental-features = [ "nix-command" "flakes" ];
|
||||
};
|
||||
};
|
||||
|
||||
boot = {
|
||||
loader.systemd-boot.enable = true;
|
||||
loader.efi.canTouchEfiVariables = true;
|
||||
};
|
||||
|
||||
time.timeZone = "America/Chicago";
|
||||
networking = {
|
||||
hostName = "eve-psr-nix0";
|
||||
firewall = {
|
||||
allowedTCPPorts = [ 22 80 443 3034 ];
|
||||
allowedUDPPorts = [ 22 80 443 ];
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [ git pciutils vim wget ];
|
||||
|
||||
services = {
|
||||
openssh = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
hydra = {
|
||||
enable = true;
|
||||
hydraURL = "https://hydra.matri.cx";
|
||||
listenHost = "192.168.0.130";
|
||||
port = 3034;
|
||||
|
||||
extraConfig = ''
|
||||
using_frontend_proxy = 1
|
||||
base_uri = "https://hydra.matri.cx"
|
||||
'';
|
||||
|
||||
useSubstitutes = true;
|
||||
|
||||
notificationSender = "hydra@matri.cx";
|
||||
buildMachinesFiles = [ ];
|
||||
};
|
||||
};
|
||||
|
||||
virtualisation = {
|
||||
oci-containers = {
|
||||
backend = "podman";
|
||||
containers = serviceContainers;
|
||||
};
|
||||
};
|
||||
|
||||
security.sudo.wheelNeedsPassword = false;
|
||||
users = {
|
||||
users = {
|
||||
sezycei = {
|
||||
isNormalUser = true;
|
||||
passwordFile = self.nixosConfigurations.eve-psr-nix0.config.age.secrets.sezycei.path;
|
||||
extraGroups = [ "wheel" ];
|
||||
packages = with pkgs; [
|
||||
byobu
|
||||
tmux
|
||||
stack
|
||||
];
|
||||
};
|
||||
torrent = {
|
||||
isNormalUser = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
age = {
|
||||
secrets = {
|
||||
keys.file = ./secrets/keys.age;
|
||||
sezycei.file = ./secrets/sezycei.age;
|
||||
};
|
||||
identityPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
};
|
||||
|
||||
system.stateVersion = "22.11";
|
||||
|
Reference in New Issue
Block a user