First test of all machines

This commit is contained in:
KoenDR06 2025-02-27 22:12:26 +01:00
parent b963380a0a
commit 1d0209fac3
16 changed files with 268 additions and 73 deletions

18
flake.lock generated
View file

@ -7,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1736373539, "lastModified": 1739757849,
"narHash": "sha256-dinzAqCjenWDxuy+MqUQq0I4zUSfaCvN9rzuCmgMZJY=", "narHash": "sha256-Gs076ot1YuAAsYVcyidLKUMIc4ooOaRGO0PqTY7sBzA=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "bd65bc3cde04c16755955630b344bc9e35272c56", "rev": "9d3d080aec2a35e05a15cedd281c2384767c2cfe",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -23,11 +23,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1739055578, "lastModified": 1740603184,
"narHash": "sha256-2MhC2Bgd06uI1A0vkdNUyDYsMD0SLNGKtD8600mZ69A=", "narHash": "sha256-t+VaahjQAWyA+Ctn2idyo1yxRIYpaDxMgHkgCNiMJa4=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "a45fa362d887f4d4a7157d95c28ca9ce2899b70e", "rev": "f44bd8ca21e026135061a0a57dcf3d0775b67a49",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -47,11 +47,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1736549395, "lastModified": 1740569341,
"narHash": "sha256-XzwkB62Tt5UYoL1jXiHzgk/qz2fUpGHExcSIbyGTtI0=", "narHash": "sha256-WV8nY2IOfWdzBF5syVgCcgOchg/qQtpYh6LECYS9XkY=",
"owner": "pjones", "owner": "pjones",
"repo": "plasma-manager", "repo": "plasma-manager",
"rev": "a53af7f1514ef4cce8620a9d6a50f238cdedec8b", "rev": "5eeb0172fb74392053b66a8149e61b5e191b2845",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -41,7 +41,10 @@
nixosConfigurations = { nixosConfigurations = {
luna = nixpkgs.lib.nixosSystem { luna = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;}; specialArgs = {
inherit inputs outputs;
headless = false;
};
modules = [ modules = [
./machines/luna/configuration.nix ./machines/luna/configuration.nix
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
@ -52,7 +55,10 @@
]; ];
}; };
terra = nixpkgs.lib.nixosSystem { terra = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;}; specialArgs = {
inherit inputs outputs;
headless = false;
};
modules = [ modules = [
./machines/terra/configuration.nix ./machines/terra/configuration.nix
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
@ -63,7 +69,10 @@
]; ];
}; };
solis = nixpkgs.lib.nixosSystem { solis = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;}; specialArgs = {
inherit inputs outputs;
headless = true;
};
modules = [ modules = [
./machines/solis/configuration.nix ./machines/solis/configuration.nix
sops-nix.nixosModules.sops sops-nix.nixosModules.sops

View file

@ -9,8 +9,12 @@
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
./modules.nix ./modules.nix
../../modules
]; ];
horseman.username = "horseman";
networking.hostName = "luna"; networking.hostName = "luna";
system.stateVersion = "24.11"; system.stateVersion = "24.11";

View file

@ -6,12 +6,13 @@
pkgs, pkgs,
... ...
}: { }: {
imports = [../../modules]; imports = [
../../modules
../../modules/boot/loader/systemd.nix
];
config.horseman = { config.horseman = {
username = "horseman"; users.default.enable = true;
users.horseman.enable = true;
base = { base = {
nix.enable = true; nix.enable = true;
@ -45,5 +46,9 @@
visual.enable = true; visual.enable = true;
terminal.enable = true; terminal.enable = true;
}; };
terminal = {
zsh.enable = true;
};
}; };
} }

View file

@ -6,7 +6,33 @@
pkgs, pkgs,
... ...
}: { }: {
imports = []; imports = [
./hardware-configuration.nix
./modules.nix
../../modules
];
horseman.username = "horseman";
networking.hostName = "solis"; networking.hostName = "solis";
systemd.timers."backupSyncthing" = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = "weekly";
Persistent = true;
};
};
systemd.services."backupSyncthing" = {
script = ''
/home/horseman/nix-config/misc/backup.sh
'';
serviceConfig = {
Type = "oneshot";
User = "horseman";
};
};
system.stateVersion = "24.11";
} }

View file

@ -0,0 +1,37 @@
{
inputs,
outputs,
lib,
config,
pkgs,
...
}: {
imports = [
../../modules
../../modules/boot/loader/grub.nix
];
config.horseman = {
users.default.enable = true;
base = {
nix.enable = true;
locale.enable = true;
};
boot = {
loader.grub.enable = true;
};
network = {
mullvad.enable = true;
ssh.enable = true;
syncthing.enable = true;
tailscale.enable = true;
};
apps = {
terminal.enable = true;
};
};
}

View file

@ -6,7 +6,15 @@
pkgs, pkgs,
... ...
}: { }: {
imports = []; imports = [
./hardware-configuration.nix
./modules.nix
../../modules
];
horseman.username = "horseman";
networking.hostName = "terra"; networking.hostName = "terra";
system.stateVersion = "24.11";
} }

View file

@ -0,0 +1,50 @@
{
inputs,
outputs,
lib,
config,
pkgs,
...
}: {
imports = [
../../modules
../../modules/boot/loader/systemd.nix
];
config.horseman = {
users.default.enable = true;
base = {
nix.enable = true;
locale.enable = true;
};
boot = {
loader.systemd.enable = true;
greeter.sddm.enable = true;
refind.enable = true;
};
wm = {
plasma.enable = true;
};
hardware = {
gpu.nvidia.enable = true;
audio.enable = true;
};
network = {
mullvad.enable = true;
ssh.enable = true;
syncthing.enable = true;
tailscale.enable = true;
};
apps = {
dev.enable = true;
visual.enable = true;
terminal.enable = true;
};
};
}

View file

@ -1,6 +1,8 @@
{inputs, ...}: { {inputs, headless, ...}: {
imports = [ imports = [
./loader/systemd.nix
./greeter/sddm.nix ./greeter/sddm.nix
./refind.nix
( if headless then ./loader/grub.nix else ./loader/systemd.nix )
]; ];
} }

View file

@ -0,0 +1,23 @@
{
inputs,
outputs,
lib,
config,
pkgs,
...
}: let
inherit (lib) mkEnableOption mkIf mkOption types;
cfg = config.horseman.boot.loader.grub;
in {
options = {
horseman.boot.loader.grub = {
enable = mkEnableOption "Sets grub as the bootloader";
};
};
config = {
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
boot.loader.grub.configurationLimit = 10;
};
}

24
modules/boot/refind.nix Normal file
View file

@ -0,0 +1,24 @@
{
inputs,
outputs,
lib,
config,
pkgs,
...
}: let
inherit (lib) mkEnableOption mkIf mkOption types;
cfg = config.horseman.boot.refind;
in {
options = {
horseman.boot.refind = {
enable = mkEnableOption "Enables rEFInd, the boot manager";
};
};
config = {
environment.systemPackages = with pkgs; [
refind
efibootmgr
];
};
}

View file

@ -1,10 +1,10 @@
{inputs, ...}: { {inputs, headless, ...}: {
imports = [ imports = [
./apps ./apps
./hardware ./hardware
./network ./network
./terminal ./terminal
./wm ( if !headless then ./wm else ./empty.nix )
./users ./users
./boot ./boot
./base ./base

11
modules/empty.nix Normal file
View file

@ -0,0 +1,11 @@
{
inputs,
outputs,
lib,
config,
pkgs,
...
}: let
inherit (lib) mkEnableOption mkIf mkOption types;
in {
}

View file

@ -27,7 +27,7 @@ in {
shellAliases = { shellAliases = {
clone-dotfiles = "cp -r /home/horseman/nix-config/config/dotfiles/.\* /home/horseman/"; clone-dotfiles = "cp -r /home/horseman/nix-config/config/dotfiles/.\* /home/horseman/";
rebuild = "clone-dotfiles && sudo nixos-rebuild switch --flake"; rebuild = "nix fmt && clone-dotfiles && sudo nixos-rebuild switch --flake";
update = "sudo nix flake update && rebuild"; update = "sudo nix flake update && rebuild";
compose = "sudo docker compose"; compose = "sudo docker compose";
wolpc = "wakeonlan D8:5E:D3:A8:B1:0A"; wolpc = "wakeonlan D8:5E:D3:A8:B1:0A";

View file

@ -1,5 +1,47 @@
{inputs, ...}: { {
imports = [ inputs,
./horseman.nix outputs,
lib,
config,
pkgs,
...
}: let
inherit (lib) mkEnableOption mkIf mkOption types;
cfg = config.horseman.users.default;
homeCfg = config.horseman;
in {
options = {
horseman.users.default = {
enable = mkEnableOption "Default user";
};
};
config = {
home-manager = {
extraSpecialArgs = {inherit inputs outputs;};
users.${homeCfg.username} = {
home = {
username = "${homeCfg.username}";
homeDirectory = "/home/${homeCfg.username}";
stateVersion = "24.11";
};
programs = {
home-manager.enable = true;
};
};
};
users.users.horseman = {
initialPassword = "1234";
isNormalUser = true;
openssh.authorizedKeys.keyFiles = [
../../config/ssh/authorized_keys
]; ];
extraGroups = [
"wheel"
"docker"
];
};
};
} }

View file

@ -1,46 +0,0 @@
{
inputs,
outputs,
lib,
config,
pkgs,
...
}: let
inherit (lib) mkEnableOption mkIf mkOption types;
cfg = config.horseman.users.horseman;
in {
options = {
horseman.users.horseman = {
enable = mkEnableOption "Default user";
};
};
config = {
home-manager = {
extraSpecialArgs = {inherit inputs outputs;};
users.horseman = {
home = {
username = "horseman";
homeDirectory = "/home/horseman";
stateVersion = "24.11";
};
programs = {
home-manager.enable = true;
};
};
};
users.users.horseman = {
initialPassword = "1234";
isNormalUser = true;
openssh.authorizedKeys.keyFiles = [
../../config/ssh/authorized_keys
];
extraGroups = [
"wheel"
"docker"
];
};
};
}