From 3d7738689420f8ba811466bcafeb7478373ed103 Mon Sep 17 00:00:00 2001
From: Swarsel
-This file has 50438 words spanning 13199 lines and was last revised on 2024-12-11 00:05:08 +0100.
+This file has 50861 words spanning 13228 lines and was last revised on 2024-12-11 01:25:11 +0100.
@@ -403,7 +403,7 @@ This section defines my Emacs configuration. For a while, I considered to use ry
-My emacs is built using the emacs-overlay nix flake, which builds a bleeding edge emacs on wayland (pgtk) with utilities like treesitter support. By executing the below source block, the current build setting can be updated at any time, and you can see my most up-to-date build options (last updated: 2024-12-11 00:05:08 +0100)
+My emacs is built using the emacs-overlay nix flake, which builds a bleeding edge emacs on wayland (pgtk) with utilities like treesitter support. By executing the below source block, the current build setting can be updated at any time, and you can see my most up-to-date build options (last updated: 2024-12-11 01:25:11 +0100)
-These blocks are later inserted here: flake.nix template. Adding new flake inputs is very easy, you just add them to Inputs & Inputs@Outputs first by name in the first source-block, and then the path in the second source-block. Any variables to be set for the host configuration are done in let, and the specific setup is done in either nixosConfigurations (for NixOS systems), homeConfigurations (for home-manager systems), or nixOnDroidConfigurations (for Nix on Android). There is also the [BROKEN LINK: h:6a08495a-8566-4bb5-9fac-b03df01f6c81] section that currently just defines a Proxmox LXC image.
+These blocks are later inserted here: flake.nix template. Adding new flake inputs is very easy, you just add them to Inputs & Inputs@Outputs first by name in the first source-block, and then the path in the second source-block. Any variables to be set for the host configuration are done in let, and the specific setup is done in either nixosConfigurations (for NixOS systems), homeConfigurations (for home-manager systems), or nixOnDroidConfigurations (for Nix on Android) and darwinConfigurations (for Darwin systems, also known as Macs). There also used to be a [BROKEN LINK: h:6a08495a-8566-4bb5-9fac-b03df01f6c81] section that used to define a Proxmox LXC image when I was still using Proxmox as my main server. An example of the repository at that time would be acc0ad6 main Add several NixOS hosts on Proxmox and Oracle Cloud.
flake.nix file from the flake.nix file from the flake.nix file from the flake.nix file from the 3.2. Pre-commit-hooks (Checks)
-This file defines a number of checks that can either be run by calling nix flake check or
+This file defines a number of checks that can either be run by calling nix flake check or while in a nix-shell or nix develop. This helps me make sure that my flake confirms to my self-imposed standards. The GitHub actions perform less checks than are being done here (they are only checking the formatting, as well as statix and deadnix)
-Lastly I define some common module lists that I can simply load depending on the fundamental system (NixOS vs. non-NixOS).
+I also define some common module lists that I can simply load depending on the fundamental system (NixOS vs. non-NixOS) - nixModules, homeModules, and mixedModules.
+The interesting part is in the start: +
+pkgsFor. This function reads all available systems from nixpkgs and generates pkgs for them.forEachSystem is a function that can be called to declare an output for each such defined system.forAllSystems is a crude function that I use for expressions that depend on system, as the prior two attributes already consumed it at that stage. This is only really used to generate the checks in their own file.mkFullHost is a function that takes a hostname as well as a boolean whether it is NixOS or not, and returns a matching nixosSystem or darwinSystem. This function is only used for systems that can use both NixOS and home-manager options (darwin still counts here as it can use some NixOS options).mkFullHostConfigs is the function that dynamically creates all definded hosts. The hosts are defined by placing a directory in hosts/ under either the nixos/ or darwin/ directory. These directories are being read by readHosts and delivered to this funtion in the later call in nixosConfigurations or darwinConfigurations.
inherit (self) outputs;
lib = nixpkgs.lib // home-manager.lib;
-forEachSystem = f: lib.genAttrs (import systems) (system: f pkgsFor.${system});
-forAllSystems = lib.genAttrs [
- "x86_64-linux"
- "aarch64-linux"
- "x86_64-darwin"
- "aarch64-darwin"
-];
pkgsFor = lib.genAttrs (import systems) (
system:
import nixpkgs {
@@ -1240,6 +1248,13 @@ pkgsFor = lib.genAttrs (import systems) (
config.allowUnfree = true;
}
);
+forEachSystem = f: lib.genAttrs (import systems) (system: f pkgsFor.${system});
+forAllSystems = lib.genAttrs [
+ "x86_64-linux"
+ "aarch64-linux"
+ "x86_64-darwin"
+ "aarch64-darwin"
+];
mkFullHost = host: isNixos: {
${host} =
let
@@ -1299,14 +1314,21 @@ In this section I am creating some attributes that define general concepts of my
nixosModules imports self-defined options that I only want to use on NixOS systems. All modules are held as separately as possible, to allow for easier sharing with other people mostly.homeManagerModules imports modules that are to be used on NixOS and non-NixOS systems. These are mostly used to define outputs (monitors), keyboards and special commands for machines.packages holds packages that I am building myself. These are mostly shell scripts, but also a few others such as AppImages and firefox addons.devShells provides a development shell that can be used as a bootstrap for new installs using nix develop while inside the flake directory.formatter provides the formatter that is to be used on .nix files. At the moment this is not used anywhere.overlays imports a few community overlays (such as the emacs-overlay) and also three overlays of my own:
+devShells provides a development shell that can be used as a bootstrap for new installs using nix develop while inside the flake directory. It received an overhaul in 0a6cf0e feat: add checks to devShell, since when it is handled using forAllSystems and now including pre-commit-hook checks.formatter provides the formatter that is to be used on .nix files. It can be called by using nix fmt.check provides the pre-commit-hook checks that I have explained in Pre-commit-hooks (Checks).
+overlays imports a few community overlays (such as the emacs-overlay) and also three overlays of my own:
+
additions holds derivations that I am adding myself to nixpkgs - i.e. this is where the packages defined in /pkgs get added to nixpkgs.modifications holds derivations that I have performed overrides on. The list of interesting attribute overrides can be found by looking at the source code of a derivation and looking at the start of the file for lines of the form <name> ? <val>. But this can also be used to, for example, fetch a different version of a package instead.nixpkgs-stable holds the newest version of stable nixpkgs. I only use this on packages that seem broken on unstable, which are not many.zjstatus holds some options for zellij, but I have stopped using it since I prefer tmux.
+They are defined in Overlays (additions, overrides, nixpkgs-stable). The way this is handled was simplified in 647a2ae feat: simplify overlay structure; however, the old structure might be easier to understand as a reference.
+
{ inputs, ... }: {
+{ inputs, ... }:
+
+let
additions = final: _prev: import ../pkgs { pkgs = final; };
modifications = _: _prev: {
vesktop = _prev.vesktop.override {
@@ -3063,6 +3091,19 @@ This file now holds all of the "nixpkgs-changes" that I am using across the conf
zjstatus = inputs.zjstatus.packages.${_prev.system}.default;
};
+in
+{
+ default =
+ final: prev:
+
+ (additions final prev)
+ // (modifications final prev)
+ // (nixpkgs-stable final prev)
+ // (zjstatus final prev)
+ // (inputs.nur.overlays.default final prev)
+ // (inputs.emacs-overlay.overlay final prev)
+ // (inputs.nixgl.overlay final prev);
+
}
@@ -7037,7 +7078,7 @@ in
nix.settings.experimental-features = "nix-command flakes";
nixpkgs = {
hostPlatform = "x86_64-darwin";
- overlays = outputs.overlaysList;
+ overlays = [ outputs.overlays.default ];
config = {
allowUnfree = true;
};
@@ -14542,7 +14583,7 @@ Prints a reasuring message to proove good faith."