Some massive changes to make flakiness better

Renamed the @inputs to @top. This was a misguided attempt to make a
different change, but it's going to stick, now.
Began moving packages to their own folder rather than being intermingled
with overlays
Created a local overlay that just includes my personal packages
Cleaned up some dead code
Moved to just using the raw 'imports' instead of needing to explicitly
call out the `foo = import foo.nix {};` syntax
This commit is contained in:
Greg Hellings
2024-10-11 12:28:53 -05:00
parent d9a5f7968a
commit 8d752032ae
17 changed files with 355 additions and 288 deletions
+35 -24
View File
@@ -1,28 +1,33 @@
{ inputs, overlays, ... }:
{ top, overlays, ... }:
let
wsl = args: (unstable (args // { extraMods = [ inputs.wsl.nixosModules.wsl ]; }));
unstable = args: (machine (args // {
channel = inputs.nixunstable;
hm = inputs.hmunstable;
nixvim = inputs.nixvimunstable;
}));
wsl = args: (unstable (args // { extraMods = [ top.wsl.nixosModules.wsl ]; }));
unstable =
args:
(machine (
args
// {
channel = top.nixunstable;
hm = top.hmunstable;
nixvim = top.nixvimunstable;
}
));
machine =
{ channel ? inputs.nixstable
, extraMods ? [ ]
, name
, system ? "x86_64-linux"
, hm ? inputs.hm
, nixvim ? inputs.nixvimstable
,
{
channel ? top.nixstable,
extraMods ? [ ],
name,
system ? "x86_64-linux",
hm ? top.hm,
nixvim ? top.nixvimstable,
}:
let
nixpkgs = import channel {
inherit system;
};
nixpkgs = import channel { inherit system; };
in
channel.lib.nixosSystem {
inherit system;
specialArgs = { inherit nixpkgs inputs overlays; };
specialArgs = {
inherit nixpkgs top overlays;
};
modules = [
{
nixpkgs.overlays = overlays;
@@ -31,17 +36,17 @@ let
useUserPackages = true;
users.greg = import ../home/home.nix;
extraSpecialArgs = {
inherit inputs overlays nixvim;
inherit top overlays nixvim;
home = "/home/greg";
host = name;
};
backupFileExtension = "bkp";
};
}
inputs.agenix.nixosModules.default
top.agenix.nixosModules.default
hm.nixosModules.home-manager
inputs.self.modules.nixosModule
inputs.nurpkgs.nixosModules.nur
top.self.modules.nixosModule
top.nurpkgs.nixosModules.nur
./${name}
] ++ extraMods;
};
@@ -58,7 +63,13 @@ in
iso = machine { name = "iso"; };
iso-beta = unstable { name = "iso"; };
# nix build '.#nixosConfigurations.wsl.config.system.build.installer'
nixos = wsl { name = "wsl"; system = "aarch64-linux"; };
nixos = wsl {
name = "wsl";
system = "aarch64-linux";
};
# nix build '.#nixosConfigurations.wsl-aarch.config.system.build.installer'
nixos-arm = wsl { name = "wsl"; system = "aarch64-linux"; };
nixos-arm = wsl {
name = "wsl";
system = "aarch64-linux";
};
}
+13 -12
View File
@@ -2,7 +2,7 @@
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ inputs, ... }:
{ top, ... }:
let
wanInterface = "enp2s0";
lanInterface = "enp1s0";
@@ -10,13 +10,12 @@ let
in
{
imports =
[
# Include the results of the hardware scan.
./hardware-configuration.nix
inputs.btc.nixosModules.default
./bitcoin.nix
];
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
top.btc.nixosModules.default
./bitcoin.nix
];
# Bootloader
boot = {
@@ -39,10 +38,12 @@ in
"${wanInterface}".useDHCP = true;
"${lanInterface}" = {
useDHCP = false;
ipv4.addresses = [{
address = lanIpAddress;
prefixLength = 16;
}];
ipv4.addresses = [
{
address = lanIpAddress;
prefixLength = 16;
}
];
};
};
};
+87 -70
View File
@@ -1,92 +1,109 @@
{ inputs, name, extra ? { }, packages ? [ ], overlays }:
{
top,
name,
extra ? { },
packages ? [ ],
overlays,
}:
({ config, pkgs, lib, ... }:
(
lib.attrsets.recursiveUpdate
{
config,
pkgs,
lib,
...
}:
(lib.attrsets.recursiveUpdate
{
imports = [
inputs.agenix.nixosModules.default
inputs.self.modules.nixosModule
];
imports = [
top.agenix.nixosModules.default
top.self.modules.nixosModule
];
nixpkgs.overlays = overlays;
nixpkgs.overlays = overlays;
greg.tailscale.enable = true;
greg.tailscale.enable = true;
age = {
identityPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
secrets.runner-reg = {
file = ../../secrets/gitlab/myself-${name}-runner-reg.age;
owner = "gitlab-runner";
age = {
identityPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
secrets.runner-reg = {
file = ../../secrets/gitlab/myself-${name}-runner-reg.age;
owner = "gitlab-runner";
};
};
};
environment.systemPackages = with pkgs; [
curl
gawk
git
unzip
xorriso
wget
] ++ packages;
environment.systemPackages =
with pkgs;
[
curl
gawk
git
unzip
xorriso
wget
]
++ packages;
networking = {
useHostResolvConf = pkgs.lib.mkForce false;
nameservers = [ "100.100.100.100" ];
};
networking = {
useHostResolvConf = pkgs.lib.mkForce false;
nameservers = [ "100.100.100.100" ];
};
nixpkgs.config.allowUnfree = true;
nixpkgs.config.allowUnfree = true;
users.users.gitlab-runner = {
isSystemUser = true;
group = "kvm";
extraGroups = [ "kvm" ];
};
users.users.gitlab-runner = {
isSystemUser = true;
group = "kvm";
extraGroups = [ "kvm" ];
};
services = {
gitlab-runner = {
enable = true;
settings.concurrent = 5;
services = {
shell = {
executor = "shell";
limit = 5;
authenticationTokenConfigFile = config.age.secrets.runner-reg.path;
environmentVariables = {
EFI_DIR = "${pkgs.OVMF.fd}/FV/";
STORAGE_URL = "http://s3.thehellings.lan:9000";
services = {
gitlab-runner = {
enable = true;
settings.concurrent = 5;
services = {
shell = {
executor = "shell";
limit = 5;
authenticationTokenConfigFile = config.age.secrets.runner-reg.path;
environmentVariables = {
EFI_DIR = "${pkgs.OVMF.fd}/FV/";
STORAGE_URL = "http://s3.thehellings.lan:9000";
};
};
};
};
resolved.enable = true;
};
resolved.enable = true;
};
systemd.services.gitlab-runner = {
wants = [
"network-online.target"
"systemd-resolved.service"
];
after = [
"network.target"
"network-online.target"
"systemd-resolved.service"
];
serviceConfig = {
DevicePolicy = lib.mkForce "auto";
PrivateDevices = false;
ProtectKernelModules = false;
DevicesAllow = [ "/dev/kvm" "/dev/mem" ];
DynamicUser = lib.mkForce false;
User = "root";
Group = "kvm";
systemd.services.gitlab-runner = {
wants = [
"network-online.target"
"systemd-resolved.service"
];
after = [
"network.target"
"network-online.target"
"systemd-resolved.service"
];
serviceConfig = {
DevicePolicy = lib.mkForce "auto";
PrivateDevices = false;
ProtectKernelModules = false;
DevicesAllow = [
"/dev/kvm"
"/dev/mem"
];
DynamicUser = lib.mkForce false;
User = "root";
Group = "kvm";
};
};
};
system.stateVersion = lib.mkForce "24.05";
}
system.stateVersion = lib.mkForce "24.05";
}
extra
) # End of attrsets.recursiveUpdate
) # End of outter function wrapper
) # End of attrsets.recursiveUpdate
) # End of outter function wrapper
+12 -14
View File
@@ -1,16 +1,12 @@
{ config, pkgs, lib, inputs, overlays, ... }:
{
config,
pkgs,
lib,
...
}:
let
gitlabStateDir = "/var/lib/gitlab";
container = input: (lib.attrsets.recursiveUpdate
{
bindMounts."/etc/ssh".hostPath = "/etc/ssh"; # For agenix secrets
enableTun = true;
privateNetwork = true;
}
input);
in
{
networking = {
@@ -28,12 +24,14 @@ in
greg.proxies."git.thehellings.lan" = {
target = "http://192.168.200.2";
extraConfig = ''
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Ssl on;
'';
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Ssl on;
'';
};
system.activationScripts.makeGitlabDir = lib.stringAfter [ "var" ] "mkdir -p ${gitlabStateDir} && touch ${gitlabStateDir}/touch";
system.activationScripts.makeGitlabDir = lib.stringAfter [
"var"
] "mkdir -p ${gitlabStateDir} && touch ${gitlabStateDir}/touch";
greg.containers.gitlab = {
tailscale = true;