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
+1
View File
@@ -8,6 +8,7 @@
# Needs https://github.com/DeterminateSystems/flake-checker/pull/130
#flake-checker.enable = true;
nixfmt-rfc-style.enable = true;
check-merge-conflicts.enable = true;
};
};
}
+14 -13
View File
@@ -1,30 +1,31 @@
{ inputs, overlays, ... }:
{ top, overlays, ... }:
let
mac =
{ system ? "aarch64-darwin"
, name
, channel ? inputs.nixunstable
, hm ? inputs.hmunstable
, extraMods ? [ ]
{
system ? "aarch64-darwin",
name,
channel ? top.nixunstable,
hm ? top.hmunstable,
extraMods ? [ ],
}:
let
nixpkgs = import channel {
inherit system overlays;
};
nixpkgs = import channel { inherit system overlays; };
in
inputs.darwin.lib.darwinSystem {
top.darwin.lib.darwinSystem {
inherit system;
specialArgs = { inherit nixpkgs; };
specialArgs = {
inherit nixpkgs;
};
modules = [
{
nixpkgs.overlays = overlays;
home-manager.extraSpecialArgs = {
inherit inputs;
inherit top;
host = name;
};
}
hm.darwinModules.home-manager
inputs.self.modules.darwinModule
top.self.modules.darwinModule
./${name}
] ++ extraMods;
};
+48 -25
View File
@@ -45,49 +45,72 @@
zed.url = "github:zed-industries/zed/v0.156.x";
};
outputs = { self, ... }@inputs:
outputs =
{ self, ... }@top:
let
local_overlay = import ./overlays;
packages_overlay = (
_: prev:
(import ./pkgs {
inherit self;
pkgs = prev;
}).packages
);
overlays = [
inputs.agenix.overlays.default
top.agenix.overlays.default
local_overlay
inputs.nurpkgs.overlay
inputs.vsext.overlays.default
(_: _: { zed-editor = inputs.zed.packages.x86_64-linux.default; })
packages_overlay
top.nurpkgs.overlay
top.vsext.overlays.default
(_: _: { zed-editor = top.zed.packages.x86_64-linux.default; })
];
in
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
top.flake-parts.lib.mkFlake { inputs = top; } {
systems = [
"aarch64-linux"
"x86_64-linux"
"aarch64-darwin"
];
flake = {
nixosConfigurations = (import ./hosts { inherit inputs overlays; });
nixosConfigurations = (import ./hosts { inherit top overlays; });
darwinConfigurations = (import ./darwin { inherit inputs overlays; });
darwinConfigurations = (import ./darwin { inherit top overlays; });
homeConfigurations = (import ./home { inherit inputs overlays; });
homeConfigurations = (import ./home { inherit top overlays; });
overlays = {
default = local_overlay;
default = packages_overlay;
local = local_overlay;
};
modules = import ./modules;
};
perSystem = { pkgs, self', system, ... }: {
_module.args.pkgs = import inputs.nixstable {
inherit system overlays;
perSystem =
{
pkgs,
self',
system,
...
}:
{
_module.args = {
pkgs = import top.nixstable { inherit system overlays; };
};
imports = [ ./pkgs ];
checks = import ./checks.nix {
inherit system;
inherit (top) hooks;
};
devShells = import ./shells.nix {
inherit self' pkgs;
inherit (top) nixvimunstable;
};
};
checks = import ./checks.nix { inherit system; inherit (inputs) hooks; };
devShells = import ./shells.nix { inherit self' pkgs; inherit (inputs) nixvimunstable; };
packages = rec {
default = iso;
iso = self.nixosConfigurations.iso.config.system.build.isoImage;
iso-beta = self.nixosConfigurations.iso-beta.config.system.build.isoImage;
};
};
};
}
+10 -8
View File
@@ -1,20 +1,22 @@
{ inputs
, overlays
, ...
}:
{ top, overlays, ... }:
rec {
greghellings =
let
system = "x86_64-linux";
pkgs = (import inputs.nixunstable { inherit system overlays; config.allowUnfree = true; });
pkgs = (
import top.nixunstable {
inherit system overlays;
config.allowUnfree = true;
}
);
in
inputs.hmunstable.lib.homeManagerConfiguration {
top.hmunstable.lib.homeManagerConfiguration {
inherit pkgs;
modules = [ ./home.nix ];
extraSpecialArgs = {
inherit inputs;
nixvim = inputs.nixvimunstable;
inherit top;
nixvim = top.nixvimunstable;
gui = false;
gnome = false;
host = "ivr";
+39 -30
View File
@@ -1,26 +1,35 @@
{ pkgs, lib, inputs, ... }:
{
pkgs,
lib,
top,
...
}:
let
nix23 = import inputs.nix23_05 {
nix23 = import top.nix23_05 {
inherit (pkgs.stdenv) system;
overlays = [ inputs.self.overlays.default ];
overlays = [ top.self.overlays.default ];
};
py = nix23.python311.withPackages (p: with p; [
django
djangorestframework
django-rapyd-modernauth
environs
mysqlclient
pyyaml
ruamel-yaml
tox
]);
py = nix23.python311.withPackages (
p: with p; [
django
djangorestframework
django-rapyd-modernauth
environs
mysqlclient
pyyaml
ruamel-yaml
tox
]
);
x = pkgs.xonsh.override {
extraPackages = (ps: [
pkgs.nur.repos.xonsh-xontribs.xonsh-direnv
pkgs.nur.repos.xonsh-xontribs.xontrib-vox
ps.xonsh-apipenv
pkgs.pipenv-ivr
]);
extraPackages = (
ps: [
pkgs.nur.repos.xonsh-xontribs.xonsh-direnv
pkgs.nur.repos.xonsh-xontribs.xontrib-vox
ps.xonsh-apipenv
pkgs.pipenv-ivr
]
);
};
in
{
@@ -33,9 +42,7 @@ in
nixpkgs.config = {
allowUnfree = true;
permittedInsecurePackages = [
"jitsi-meet-1.0.8043"
];
permittedInsecurePackages = [ "jitsi-meet-1.0.8043" ];
};
home = {
@@ -51,14 +58,16 @@ in
robo3t
x
];
file.".pip/pip.conf".text = (lib.strings.concatStringsSep "\n" [
"[global]"
"retries = 1"
"index-url = https://pypi.python.org/simple"
"extra-index-url ="
" https://pypi.ivrtechnology.com/simple/"
" https://pypidev.ivrtechnology.com/simple/"
]);
file.".pip/pip.conf".text = (
lib.strings.concatStringsSep "\n" [
"[global]"
"retries = 1"
"index-url = https://pypi.python.org/simple"
"extra-index-url ="
" https://pypi.ivrtechnology.com/simple/"
" https://pypidev.ivrtechnology.com/simple/"
]
);
username = "gregory.hellings";
homeDirectory = lib.mkForce "/home/gregory.hellings";
};
+9 -5
View File
@@ -1,4 +1,10 @@
{ pkgs, config, lib, inputs, ... }:
{
pkgs,
config,
lib,
top,
...
}:
let
cfg = config.greg.vscodium;
@@ -17,7 +23,7 @@ in
programs.vscode = {
enable = true;
package = pkgs.vscodium;
extensions = with inputs.vsext.extensions."${pkgs.stdenv.system}".vscode-marketplace; [
extensions = with top.vsext.extensions."${pkgs.stdenv.system}".vscode-marketplace; [
arrterian.nix-env-selector
asvetliakov.vscode-neovim
batisteo.vscode-django
@@ -49,9 +55,7 @@ in
"terminal.integrated.defaultProfile.linux" = "tmux";
"vscode-neovim.neovimInitVimPaths.darwin" = "~/.config/nvim/init.lua";
"vscode-neovim.neovimInitVimPaths.linux" = "~/.config/nvim/init.lua";
"workbench.settings.applyToAllProfiles" = [
"direnv.path.executable"
];
"workbench.settings.applyToAllProfiles" = [ "direnv.path.executable" ];
};
};
};
+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;
+40 -31
View File
@@ -1,11 +1,18 @@
{ config, lib, inputs, overlays, ... }:
{
config,
lib,
top,
overlays,
...
}:
let
cfg = config.greg.containers;
# Create a container with all our default settings
makeContainer = _: container:
makeContainer =
_: container:
let
agekey = "/etc/ssh/agenix_key";
in
@@ -15,35 +22,38 @@ let
localAddress = "192.168.${container.subnet}.2";
privateNetwork = true;
bindMounts = {
"${agekey}".hostPath = "/etc/ssh/ssh_host_ed25519_key"; # This is needed for agenix to
"${agekey}".hostPath = "/etc/ssh/ssh_host_ed25519_key"; # This is needed for agenix to
};
enableTun = container.tailscale;
config = { ... }: {
imports = [
inputs.agenix.nixosModules.default
inputs.self.modules.nixosModule
container.builder
];
config =
{ ... }:
{
imports = [
top.agenix.nixosModules.default
top.self.modules.nixosModule
container.builder
];
nixpkgs.overlays = overlays;
nixpkgs.overlays = overlays;
networking = {
firewall.enable = true;
useHostResolvConf = lib.mkForce false;
networking = {
firewall.enable = true;
useHostResolvConf = lib.mkForce false;
};
age.identityPaths = [ agekey ];
greg.tailscale.enable = container.tailscale;
};
age.identityPaths = [ agekey ];
greg.tailscale.enable = container.tailscale;
};
};
in
{
options.greg.containers = lib.mkOption {
default = { };
type = with lib.types; attrsOf (submodule (
{
type =
with lib.types;
attrsOf (submodule ({
options = {
tailscale = lib.mkOption {
type = bool;
@@ -57,20 +67,19 @@ in
builder = lib.mkOption {
default = { ... }: { };
description = ''
This needs to be a function, like the one for
a container's config. It will setup the core system above the
defaults set in this module.
'';
This needs to be a function, like the one for
a container's config. It will setup the core system above the
defaults set in this module.
'';
example = ''
{ pkgs, config, lib, ... } :
{
services.openssh.enable = true;
}
'';
{ pkgs, config, lib, ... } :
{
services.openssh.enable = true;
}
'';
};
};
}
));
}));
};
config = {
+31 -29
View File
@@ -1,19 +1,20 @@
final: prev:
let
myPackages = pypackages: with pypackages; [
black
dateutil
ipython
mypy
pylint
pyyaml
responses
ruamel-yaml
tox
typing-extensions
virtualenv
];
myPackages =
pypackages: with pypackages; [
black
dateutil
ipython
mypy
pylint
pyyaml
responses
ruamel-yaml
tox
typing-extensions
virtualenv
];
myPython = prev.python312.withPackages myPackages;
is2405 = prev.lib.versionAtLeast prev.lib.version "24";
@@ -24,34 +25,34 @@ rec {
## Testing adding python packages in the correct manner
pythonPackagesExtensions = (prev.pythonPackagesExtensions or [ ]) ++ [
(python-final: _:
let cp = python-final.callPackage; in {
(
python-final: _:
let
cp = python-final.callPackage;
in
{
django-rapyd-modernauth = cp ./django-rapyd-modernauth.nix { };
graypy = cp ./graypy.nix { };
itg-django-utils = cp ./itg-django-utils.nix { };
xonsh-apipenv = cp ./xonsh-apipenv.nix { };
})
}
)
];
# My own packages
aacs = prev.callPackage ./aacs.nix { };
create_ssl = prev.callPackage ./create_ssl.nix { };
enwiki-dump = prev.callPackage ./enwiki-dump.nix { };
hms = prev.callPackage ./hms {
pkgs = final.pkgs;
};
inject = prev.callPackage ./inject.nix { inherit (final) pkgs; };
inject-darwin = prev.callPackage ./inject-darwin.nix { inherit (final) pkgs; };
setup-ssh = prev.callPackage ./setup-ssh {
pkgs = final.pkgs;
};
setup-ssh = prev.callPackage ./setup-ssh { pkgs = final.pkgs; };
upgrade-pg-cluster = prev.callPackage ./upgrade-pg-cluster.nix { };
# Overrides of packages
brew = prev.callPackage ./homebrew.nix { };
copier = (if is2405 then
prev.copier.overridePythonAttrs
(_: {
copier = (
if is2405 then
prev.copier.overridePythonAttrs (_: {
version = "9.1.0";
src = final.fetchFromGitHub {
owner = "copier-org";
@@ -60,15 +61,16 @@ rec {
hash = "sha256-x5r7Xv4lAOMkR+UIEeSY7LvbYMLpTWYuICYe9ygz1tA=";
postFetch = "rm $out/tests/demo/doc/ma*ana.txt";
};
}) else prev.copier);
})
else
prev.copier
);
libbluray-custom = prev.libbluray.override {
withAACS = true;
withBDplus = true;
};
template = prev.callPackage ./template.nix { };
handbrake = prev.handbrake.override {
libbluray = libbluray-custom;
};
handbrake = prev.handbrake.override { libbluray = libbluray-custom; };
libvirt-greg = prev.libvirt.overrideAttrs {
postInstall = prev.libvirt.postInstall + "rm -r $out/lib/systemd/system/libvirtd.service";
};
-3
View File
@@ -1,3 +0,0 @@
{ pkgs, ... }:
pkgs.writeShellScriptBin "hms" (builtins.readFile ./hms.sh)
-23
View File
@@ -1,23 +0,0 @@
{ nixunstable, flake-utils }:
flake-utils.lib.eachDefaultSystemMap (system:
let
pkgs = (import nixunstable { inherit system; });
in
{
hms = pkgs.callPackage ./hms.nix {
inherit pkgs;
};
brew = pkgs.callPackage ./homebrew.nix { };
django-rapyd-modernauth = pkgs.python3.pkgs.callPackage ./django-rapyd-modernauth.nix {
buildPythonPackage = pkgs.python3.pkgs.buildPythonPackage;
};
xonsh-direnv = pkgs.callPackage ./xonsh-direnv.nix {
buildPythonPackage = pkgs.python3.pkgs.buildPythonPackage;
fetchPypi = pkgs.python.pkgs.fetchPypi;
};
}
)
+13
View File
@@ -0,0 +1,13 @@
{ pkgs, ... }:
let
c = pkgs.callPackage;
in
{
packages = {
#default = iso;
#iso = top.self.nixosConfigurations.iso.config.system.build.isoImage;
#iso-beta = self.nixosConfigurations.iso-beta.config.system.build.isoImage;
hms = c ./hms { };
};
}
+3
View File
@@ -0,0 +1,3 @@
{ writeShellScriptBin, ... }:
writeShellScriptBin "hms" (builtins.readFile ./hms.sh)
-1
View File
@@ -1,5 +1,4 @@
# vim: set ft=bash:
set -eo pipefail
# Build different targets with GUI or not
# Build and switch