Ctrl K
ComunidadGuías…

flake.nix

Rama master · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
# Maybe the real flake is the 友達 we made along da wei.
# Once again nahida will look by my shoulders wondering why am I wasting so much time on NixOS.
{
  description = "MeeSumee's Flake Config";

  inputs = {
    # NixOS Unstable pinned hash
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";

    # Hjem
    hjem = {
      url = "github:feel-co/hjem";
      inputs = {
        nixpkgs.follows = "nixpkgs";
      };
    };

    # Asusu numberpad driver
    asusnumpad = {
      url = "github:asus-linux-drivers/asus-numberpad-driver";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Nix-Systems
    systems.url = "github:nix-systems/default";

    # Rust-overlay dependency matching for lanzaboote and aagl
    rust-overlay = {
      url = "github:oxalica/rust-overlay/stable";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Lanzaboote
    lanzaboote = {
      url = "github:nix-community/lanzaboote/v1.1.0";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        pre-commit.follows = "";
        rust-overlay.follows = "rust-overlay";
      };
    };

    # Anime-game
    aagl = {
      url = "github:ezKEa/aagl-gtk-on-nix";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        rust-overlay.follows = "rust-overlay";
        flake-compat.follows = "";
      };
    };

    # nvim nvf
    nvf = {
      url = "github:NotAShelf/nvf";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        flake-compat.follows = "";
      };
    };

    # Agenix
    agenix = {
      url = "github:ryantm/agenix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  # Short, but fucked Schematic
  outputs = inputs: let
    # Essentially takes in everything
    inherit (inputs) nixpkgs self systems;
    # inherits lib to be used below
    inherit (nixpkgs) lib;

    # npin integration to flakes
    sources = import ./npins;

    # pkgsFor defines x64/ARM/darwin etc with systems input
    pkgsFor = lib.getAttrs (import systems) nixpkgs.legacyPackages;

    # moduleArgs defined for callModule
    moduleArgs = {
      inherit
        inputs
        self
        sources
        lib
        ;
    };

    # I don't understand this, ask rex
    eachSystem = fn: lib.mapAttrs (system: pkgs: fn {inherit system pkgs;}) pkgsFor;

    # callModule calls a .nix file
    callModule = path: attrs: import path (moduleArgs // attrs);
  in {
    # alejandra formatter from upstream
    formatter = eachSystem ({pkgs, ...}: pkgs.alejandra);

    # defines self's packages (nahida cursor etc)
    packages = eachSystem (attrs: callModule ./pkgs attrs);

    # nixos systems configured (greenery, quartz etc)
    nixosConfigurations = callModule ./hosts {};

    # checks to validate and build systems (used in GitHub CI)
    # imports from nixosConfigurations and iterates between each one as "nixos-quartz", "nixos-greenery", etc
    # thanks Mic92
    checks = nixpkgs.lib.genAttrs (import systems) (
      system: let
        inherit (nixpkgs) lib;
        nixosMachines =
          lib.mapAttrs' (name: config: lib.nameValuePair "nixos-${name}" config.config.system.build.toplevel)
          (
            (lib.filterAttrs (_: config: config.pkgs.stdenv.hostPlatform.system == system))
            self.nixosConfigurations
          );
      in
        nixosMachines
    );
  };
}