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 # Needs https://github.com/DeterminateSystems/flake-checker/pull/130
#flake-checker.enable = true; #flake-checker.enable = true;
nixfmt-rfc-style.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 let
mac = mac =
{ system ? "aarch64-darwin" {
, name system ? "aarch64-darwin",
, channel ? inputs.nixunstable name,
, hm ? inputs.hmunstable channel ? top.nixunstable,
, extraMods ? [ ] hm ? top.hmunstable,
extraMods ? [ ],
}: }:
let let
nixpkgs = import channel { nixpkgs = import channel { inherit system overlays; };
inherit system overlays;
};
in in
inputs.darwin.lib.darwinSystem { top.darwin.lib.darwinSystem {
inherit system; inherit system;
specialArgs = { inherit nixpkgs; }; specialArgs = {
inherit nixpkgs;
};
modules = [ modules = [
{ {
nixpkgs.overlays = overlays; nixpkgs.overlays = overlays;
home-manager.extraSpecialArgs = { home-manager.extraSpecialArgs = {
inherit inputs; inherit top;
host = name; host = name;
}; };
} }
hm.darwinModules.home-manager hm.darwinModules.home-manager
inputs.self.modules.darwinModule top.self.modules.darwinModule
./${name} ./${name}
] ++ extraMods; ] ++ extraMods;
}; };
+43 -20
View File
@@ -45,48 +45,71 @@
zed.url = "github:zed-industries/zed/v0.156.x"; zed.url = "github:zed-industries/zed/v0.156.x";
}; };
outputs = { self, ... }@inputs: outputs =
{ self, ... }@top:
let let
local_overlay = import ./overlays; local_overlay = import ./overlays;
packages_overlay = (
_: prev:
(import ./pkgs {
inherit self;
pkgs = prev;
}).packages
);
overlays = [ overlays = [
inputs.agenix.overlays.default top.agenix.overlays.default
local_overlay local_overlay
inputs.nurpkgs.overlay packages_overlay
inputs.vsext.overlays.default top.nurpkgs.overlay
(_: _: { zed-editor = inputs.zed.packages.x86_64-linux.default; }) top.vsext.overlays.default
(_: _: { zed-editor = top.zed.packages.x86_64-linux.default; })
]; ];
in in
inputs.flake-parts.lib.mkFlake { inherit inputs; } { top.flake-parts.lib.mkFlake { inputs = top; } {
systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; systems = [
"aarch64-linux"
"x86_64-linux"
"aarch64-darwin"
];
flake = { 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 = { overlays = {
default = local_overlay; default = packages_overlay;
local = local_overlay;
}; };
modules = import ./modules; modules = import ./modules;
}; };
perSystem = { pkgs, self', system, ... }: { perSystem =
_module.args.pkgs = import inputs.nixstable { {
inherit system overlays; pkgs,
self',
system,
...
}:
{
_module.args = {
pkgs = import top.nixstable { inherit system overlays; };
}; };
checks = import ./checks.nix { inherit system; inherit (inputs) hooks; }; imports = [ ./pkgs ];
devShells = import ./shells.nix { inherit self' pkgs; inherit (inputs) nixvimunstable; }; checks = import ./checks.nix {
inherit system;
inherit (top) hooks;
};
packages = rec { devShells = import ./shells.nix {
default = iso; inherit self' pkgs;
iso = self.nixosConfigurations.iso.config.system.build.isoImage; inherit (top) nixvimunstable;
iso-beta = self.nixosConfigurations.iso-beta.config.system.build.isoImage;
}; };
}; };
}; };
+10 -8
View File
@@ -1,20 +1,22 @@
{ inputs { top, overlays, ... }:
, overlays
, ...
}:
rec { rec {
greghellings = greghellings =
let let
system = "x86_64-linux"; 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 in
inputs.hmunstable.lib.homeManagerConfiguration { top.hmunstable.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
modules = [ ./home.nix ]; modules = [ ./home.nix ];
extraSpecialArgs = { extraSpecialArgs = {
inherit inputs; inherit top;
nixvim = inputs.nixvimunstable; nixvim = top.nixvimunstable;
gui = false; gui = false;
gnome = false; gnome = false;
host = "ivr"; host = "ivr";
+21 -12
View File
@@ -1,10 +1,16 @@
{ pkgs, lib, inputs, ... }: {
pkgs,
lib,
top,
...
}:
let let
nix23 = import inputs.nix23_05 { nix23 = import top.nix23_05 {
inherit (pkgs.stdenv) system; inherit (pkgs.stdenv) system;
overlays = [ inputs.self.overlays.default ]; overlays = [ top.self.overlays.default ];
}; };
py = nix23.python311.withPackages (p: with p; [ py = nix23.python311.withPackages (
p: with p; [
django django
djangorestframework djangorestframework
django-rapyd-modernauth django-rapyd-modernauth
@@ -13,14 +19,17 @@ let
pyyaml pyyaml
ruamel-yaml ruamel-yaml
tox tox
]); ]
);
x = pkgs.xonsh.override { x = pkgs.xonsh.override {
extraPackages = (ps: [ extraPackages = (
ps: [
pkgs.nur.repos.xonsh-xontribs.xonsh-direnv pkgs.nur.repos.xonsh-xontribs.xonsh-direnv
pkgs.nur.repos.xonsh-xontribs.xontrib-vox pkgs.nur.repos.xonsh-xontribs.xontrib-vox
ps.xonsh-apipenv ps.xonsh-apipenv
pkgs.pipenv-ivr pkgs.pipenv-ivr
]); ]
);
}; };
in in
{ {
@@ -33,9 +42,7 @@ in
nixpkgs.config = { nixpkgs.config = {
allowUnfree = true; allowUnfree = true;
permittedInsecurePackages = [ permittedInsecurePackages = [ "jitsi-meet-1.0.8043" ];
"jitsi-meet-1.0.8043"
];
}; };
home = { home = {
@@ -51,14 +58,16 @@ in
robo3t robo3t
x x
]; ];
file.".pip/pip.conf".text = (lib.strings.concatStringsSep "\n" [ file.".pip/pip.conf".text = (
lib.strings.concatStringsSep "\n" [
"[global]" "[global]"
"retries = 1" "retries = 1"
"index-url = https://pypi.python.org/simple" "index-url = https://pypi.python.org/simple"
"extra-index-url =" "extra-index-url ="
" https://pypi.ivrtechnology.com/simple/" " https://pypi.ivrtechnology.com/simple/"
" https://pypidev.ivrtechnology.com/simple/" " https://pypidev.ivrtechnology.com/simple/"
]); ]
);
username = "gregory.hellings"; username = "gregory.hellings";
homeDirectory = lib.mkForce "/home/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 let
cfg = config.greg.vscodium; cfg = config.greg.vscodium;
@@ -17,7 +23,7 @@ in
programs.vscode = { programs.vscode = {
enable = true; enable = true;
package = pkgs.vscodium; 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 arrterian.nix-env-selector
asvetliakov.vscode-neovim asvetliakov.vscode-neovim
batisteo.vscode-django batisteo.vscode-django
@@ -49,9 +55,7 @@ in
"terminal.integrated.defaultProfile.linux" = "tmux"; "terminal.integrated.defaultProfile.linux" = "tmux";
"vscode-neovim.neovimInitVimPaths.darwin" = "~/.config/nvim/init.lua"; "vscode-neovim.neovimInitVimPaths.darwin" = "~/.config/nvim/init.lua";
"vscode-neovim.neovimInitVimPaths.linux" = "~/.config/nvim/init.lua"; "vscode-neovim.neovimInitVimPaths.linux" = "~/.config/nvim/init.lua";
"workbench.settings.applyToAllProfiles" = [ "workbench.settings.applyToAllProfiles" = [ "direnv.path.executable" ];
"direnv.path.executable"
];
}; };
}; };
}; };
+35 -24
View File
@@ -1,28 +1,33 @@
{ inputs, overlays, ... }: { top, overlays, ... }:
let let
wsl = args: (unstable (args // { extraMods = [ inputs.wsl.nixosModules.wsl ]; })); wsl = args: (unstable (args // { extraMods = [ top.wsl.nixosModules.wsl ]; }));
unstable = args: (machine (args // { unstable =
channel = inputs.nixunstable; args:
hm = inputs.hmunstable; (machine (
nixvim = inputs.nixvimunstable; args
})); // {
channel = top.nixunstable;
hm = top.hmunstable;
nixvim = top.nixvimunstable;
}
));
machine = machine =
{ channel ? inputs.nixstable {
, extraMods ? [ ] channel ? top.nixstable,
, name extraMods ? [ ],
, system ? "x86_64-linux" name,
, hm ? inputs.hm system ? "x86_64-linux",
, nixvim ? inputs.nixvimstable hm ? top.hm,
, nixvim ? top.nixvimstable,
}: }:
let let
nixpkgs = import channel { nixpkgs = import channel { inherit system; };
inherit system;
};
in in
channel.lib.nixosSystem { channel.lib.nixosSystem {
inherit system; inherit system;
specialArgs = { inherit nixpkgs inputs overlays; }; specialArgs = {
inherit nixpkgs top overlays;
};
modules = [ modules = [
{ {
nixpkgs.overlays = overlays; nixpkgs.overlays = overlays;
@@ -31,17 +36,17 @@ let
useUserPackages = true; useUserPackages = true;
users.greg = import ../home/home.nix; users.greg = import ../home/home.nix;
extraSpecialArgs = { extraSpecialArgs = {
inherit inputs overlays nixvim; inherit top overlays nixvim;
home = "/home/greg"; home = "/home/greg";
host = name; host = name;
}; };
backupFileExtension = "bkp"; backupFileExtension = "bkp";
}; };
} }
inputs.agenix.nixosModules.default top.agenix.nixosModules.default
hm.nixosModules.home-manager hm.nixosModules.home-manager
inputs.self.modules.nixosModule top.self.modules.nixosModule
inputs.nurpkgs.nixosModules.nur top.nurpkgs.nixosModules.nur
./${name} ./${name}
] ++ extraMods; ] ++ extraMods;
}; };
@@ -58,7 +63,13 @@ in
iso = machine { name = "iso"; }; iso = machine { name = "iso"; };
iso-beta = unstable { name = "iso"; }; iso-beta = unstable { name = "iso"; };
# nix build '.#nixosConfigurations.wsl.config.system.build.installer' # 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' # 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";
};
} }
+7 -6
View File
@@ -2,7 +2,7 @@
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ inputs, ... }: { top, ... }:
let let
wanInterface = "enp2s0"; wanInterface = "enp2s0";
lanInterface = "enp1s0"; lanInterface = "enp1s0";
@@ -10,11 +10,10 @@ let
in in
{ {
imports = imports = [
[
# Include the results of the hardware scan. # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
inputs.btc.nixosModules.default top.btc.nixosModules.default
./bitcoin.nix ./bitcoin.nix
]; ];
@@ -39,10 +38,12 @@ in
"${wanInterface}".useDHCP = true; "${wanInterface}".useDHCP = true;
"${lanInterface}" = { "${lanInterface}" = {
useDHCP = false; useDHCP = false;
ipv4.addresses = [{ ipv4.addresses = [
{
address = lanIpAddress; address = lanIpAddress;
prefixLength = 16; prefixLength = 16;
}]; }
];
}; };
}; };
}; };
+25 -8
View File
@@ -1,13 +1,24 @@
{ inputs, name, extra ? { }, packages ? [ ], overlays }: {
top,
name,
extra ? { },
packages ? [ ],
overlays,
}:
({ config, pkgs, lib, ... }:
( (
lib.attrsets.recursiveUpdate {
config,
pkgs,
lib,
...
}:
(lib.attrsets.recursiveUpdate
{ {
imports = [ imports = [
inputs.agenix.nixosModules.default top.agenix.nixosModules.default
inputs.self.modules.nixosModule top.self.modules.nixosModule
]; ];
nixpkgs.overlays = overlays; nixpkgs.overlays = overlays;
@@ -22,14 +33,17 @@
}; };
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages =
with pkgs;
[
curl curl
gawk gawk
git git
unzip unzip
xorriso xorriso
wget wget
] ++ packages; ]
++ packages;
networking = { networking = {
useHostResolvConf = pkgs.lib.mkForce false; useHostResolvConf = pkgs.lib.mkForce false;
@@ -77,7 +91,10 @@
DevicePolicy = lib.mkForce "auto"; DevicePolicy = lib.mkForce "auto";
PrivateDevices = false; PrivateDevices = false;
ProtectKernelModules = false; ProtectKernelModules = false;
DevicesAllow = [ "/dev/kvm" "/dev/mem" ]; DevicesAllow = [
"/dev/kvm"
"/dev/mem"
];
DynamicUser = lib.mkForce false; DynamicUser = lib.mkForce false;
User = "root"; User = "root";
Group = "kvm"; Group = "kvm";
+9 -11
View File
@@ -1,16 +1,12 @@
{ config, pkgs, lib, inputs, overlays, ... }: {
config,
pkgs,
lib,
...
}:
let let
gitlabStateDir = "/var/lib/gitlab"; gitlabStateDir = "/var/lib/gitlab";
container = input: (lib.attrsets.recursiveUpdate
{
bindMounts."/etc/ssh".hostPath = "/etc/ssh"; # For agenix secrets
enableTun = true;
privateNetwork = true;
}
input);
in in
{ {
networking = { networking = {
@@ -33,7 +29,9 @@ in
''; '';
}; };
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 = { greg.containers.gitlab = {
tailscale = true; tailscale = true;
+18 -9
View File
@@ -1,11 +1,18 @@
{ config, lib, inputs, overlays, ... }: {
config,
lib,
top,
overlays,
...
}:
let let
cfg = config.greg.containers; cfg = config.greg.containers;
# Create a container with all our default settings # Create a container with all our default settings
makeContainer = _: container: makeContainer =
_: container:
let let
agekey = "/etc/ssh/agenix_key"; agekey = "/etc/ssh/agenix_key";
in in
@@ -18,10 +25,12 @@ let
"${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; enableTun = container.tailscale;
config = { ... }: { config =
{ ... }:
{
imports = [ imports = [
inputs.agenix.nixosModules.default top.agenix.nixosModules.default
inputs.self.modules.nixosModule top.self.modules.nixosModule
container.builder container.builder
]; ];
@@ -42,8 +51,9 @@ in
options.greg.containers = lib.mkOption { options.greg.containers = lib.mkOption {
default = { }; default = { };
type = with lib.types; attrsOf (submodule ( type =
{ with lib.types;
attrsOf (submodule ({
options = { options = {
tailscale = lib.mkOption { tailscale = lib.mkOption {
type = bool; type = bool;
@@ -69,8 +79,7 @@ in
''; '';
}; };
}; };
} }));
));
}; };
config = { config = {
+19 -17
View File
@@ -1,7 +1,8 @@
final: prev: final: prev:
let let
myPackages = pypackages: with pypackages; [ myPackages =
pypackages: with pypackages; [
black black
dateutil dateutil
ipython ipython
@@ -24,34 +25,34 @@ rec {
## Testing adding python packages in the correct manner ## Testing adding python packages in the correct manner
pythonPackagesExtensions = (prev.pythonPackagesExtensions or [ ]) ++ [ 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 { }; django-rapyd-modernauth = cp ./django-rapyd-modernauth.nix { };
graypy = cp ./graypy.nix { }; graypy = cp ./graypy.nix { };
itg-django-utils = cp ./itg-django-utils.nix { }; itg-django-utils = cp ./itg-django-utils.nix { };
xonsh-apipenv = cp ./xonsh-apipenv.nix { }; xonsh-apipenv = cp ./xonsh-apipenv.nix { };
}) }
)
]; ];
# My own packages # My own packages
aacs = prev.callPackage ./aacs.nix { }; aacs = prev.callPackage ./aacs.nix { };
create_ssl = prev.callPackage ./create_ssl.nix { }; create_ssl = prev.callPackage ./create_ssl.nix { };
enwiki-dump = prev.callPackage ./enwiki-dump.nix { }; enwiki-dump = prev.callPackage ./enwiki-dump.nix { };
hms = prev.callPackage ./hms {
pkgs = final.pkgs;
};
inject = prev.callPackage ./inject.nix { inherit (final) pkgs; }; inject = prev.callPackage ./inject.nix { inherit (final) pkgs; };
inject-darwin = prev.callPackage ./inject-darwin.nix { inherit (final) pkgs; }; inject-darwin = prev.callPackage ./inject-darwin.nix { inherit (final) pkgs; };
setup-ssh = prev.callPackage ./setup-ssh { setup-ssh = prev.callPackage ./setup-ssh { pkgs = final.pkgs; };
pkgs = final.pkgs;
};
upgrade-pg-cluster = prev.callPackage ./upgrade-pg-cluster.nix { }; upgrade-pg-cluster = prev.callPackage ./upgrade-pg-cluster.nix { };
# Overrides of packages # Overrides of packages
brew = prev.callPackage ./homebrew.nix { }; brew = prev.callPackage ./homebrew.nix { };
copier = (if is2405 then copier = (
prev.copier.overridePythonAttrs if is2405 then
(_: { prev.copier.overridePythonAttrs (_: {
version = "9.1.0"; version = "9.1.0";
src = final.fetchFromGitHub { src = final.fetchFromGitHub {
owner = "copier-org"; owner = "copier-org";
@@ -60,15 +61,16 @@ rec {
hash = "sha256-x5r7Xv4lAOMkR+UIEeSY7LvbYMLpTWYuICYe9ygz1tA="; hash = "sha256-x5r7Xv4lAOMkR+UIEeSY7LvbYMLpTWYuICYe9ygz1tA=";
postFetch = "rm $out/tests/demo/doc/ma*ana.txt"; postFetch = "rm $out/tests/demo/doc/ma*ana.txt";
}; };
}) else prev.copier); })
else
prev.copier
);
libbluray-custom = prev.libbluray.override { libbluray-custom = prev.libbluray.override {
withAACS = true; withAACS = true;
withBDplus = true; withBDplus = true;
}; };
template = prev.callPackage ./template.nix { }; template = prev.callPackage ./template.nix { };
handbrake = prev.handbrake.override { handbrake = prev.handbrake.override { libbluray = libbluray-custom; };
libbluray = libbluray-custom;
};
libvirt-greg = prev.libvirt.overrideAttrs { libvirt-greg = prev.libvirt.overrideAttrs {
postInstall = prev.libvirt.postInstall + "rm -r $out/lib/systemd/system/libvirtd.service"; 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: # vim: set ft=bash:
set -eo pipefail
# Build different targets with GUI or not # Build different targets with GUI or not
# Build and switch # Build and switch