Madeleine Sydney 3f846d783a Large refactor
2024-12-12 13:54:17 -07:00
2024-12-12 13:54:17 -07:00
2024-12-12 13:54:17 -07:00
2024-12-12 13:54:17 -07:00
2024-12-11 19:20:45 -07:00
2024-12-11 19:20:45 -07:00
2024-12-11 19:20:45 -07:00
2024-12-11 19:20:45 -07:00
2024-12-12 13:54:17 -07:00

Madeleine's dots for the literate (sydnix)

Top-level flake

{
  description = "Madeleine's dots for the literate (sydnix)";

  inputs = {
    <<flake-inputs>>

    disko.url = "github:nix-community/disko";

    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { nixpkgs, ... }@inputs:
    let list-nix-directory = dir:
          builtins.attrNames
            (nixpkgs.lib.filterAttrs
              (k: _v: nixpkgs.lib.hasSuffix ".nix" k)
              (builtins.readDir dir));
    in {
      # REVIEW: Why don't we put each module under nixosModules.<name>?
      nixosModules.default =
        let modules = list-nix-directory ./modules/nixos;
        in { ... }: {
          imports =
            let x = builtins.map (m: ./modules/nixos/${m}) modules;
                in x;
        };

      homeManagerModules.default =
        let modules = list-nix-directory ./modules/home;
        in { ... }: {
          imports = builtins.map (m: ./modules/home/${m}) modules;
        };

      nixosConfigurations = (
        <<flake-outputs-nixos>>
      );

      homeConfigurations =
        let users = builtins.readDir ./users;
            mkUser = username: _v: import ./users/${username}/default.nix;
        in
          builtins.mapAttrs mkUser users;
    };
}

Machines

For every ./hosts/NAME/configuration.nix, define the system under the name NAME.

let mkHost = k: v: nixpkgs.lib.nixosSystem {
      specialArgs = inputs;
      system = import ./hosts/${k}/system.nix;
      modules = [
        ./hosts/${k}/configuration.nix

        inputs.self.nixosModules.default

        inputs.disko.nixosModules.disko

        # Directory name should always match host name.
        ({ ... }: { networking.hostName = k; })

        # home-manager configuration.
        inputs.home-manager.nixosModules.home-manager
        ({ config, lib, self, ... }: {
          home-manager.useGlobalPkgs = true;
          home-manager.useUserPackages = true;

          home-manager.users =
            lib.filterAttrs
              (k: _v: builtins.elem k config.sydnix.users.users)
              self.homeConfigurations;
        })
      ];
    };
in
builtins.mapAttrs mkHost (builtins.readDir ./hosts)

nixos-testbed

{ config, pkgs, lib, disko, ... }:
{
  imports = [
    ./hardware-configuration.nix
    ./disko-config.nix
  ];

  sydnix = {
    users.users = [
      "crumb"
    ];
  };

  boot = {
    initrd = {
      enable = true;
      systemd.enable = true;

      systemd.initrdBin = with pkgs; [
        zfs
        coreutils
        babashka
      ];
    };

    loader = {
      systemd-boot.enable = true;
      efi.canTouchEfiVariables = false;
    };
  };

  # networking.hostName = "nixos-testbed";
  networking.hostId = "238e9b1e"; # head -c 8 /etc/machine-id

  time.timeZone = "America/Denver";

  i18n.defaultLocale = "en_US.UTF-8";

  console = {
    font = "Lat2-Terminus16";
    # keyMap = "us";
    useXkbConfig = true; # use xkb.options in tty.
  };

  services.xserver.enable = true;
  # services.displayManager.sddm.enable = true;
  # services.desktopManager.plasma6.enable = true;

  services.xserver.xkb.layout = "us";
  services.xserver.xkb.options = "caps:escape";

  users.users.crumb = {
    isNormalUser = true;
    extraGroups = [ "wheel" ]; # Enable sudo for the user.
    # Change this immediately after installation!
    initialPassword = "password123";
  };

  environment.systemPackages = with pkgs; [
    neovim
  ];

  services.openssh.enable = true;
  services.openssh.settings.PermitRootLogin = "yes";

  # This option defines the first version of NixOS you have installed on this
  # particular machine, and is used to maintain compatibility with application
  # data (e.g. databases) created on older NixOS versions.
  #
  # Most users should NEVER change this value after the initial install, for any
  # reason, even if you've upgraded your system to a new NixOS release.
  #
  # This value does NOT affect the Nixpkgs version your packages and OS are
  # pulled from, so changing it will NOT upgrade your system - see
  # https://nixos.org/manual/nixos/stable/#sec-upgrading for how to actually do
  # that.
  #
  # This value being lower than the current NixOS release does NOT mean your
  # system is out of date, out of support, or vulnerable.
  #
  # Do NOT change this value unless you have manually inspected all the changes
  # it would make to your configuration, and migrated your data accordingly.
  #
  # For more information, see `man configuration.nix` or
  # https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
  system.stateVersion = "24.05"; # Did you read the comment?
}

guix-rebound

The primary desktop of a girl done with her plebian phase, and done with Guix's bullshit.

References

Description
Guppy's glorious NixOS and Emacs configuration.
Readme 5.6 MiB
Languages
Emacs Lisp 59.8%
Nix 36.7%
Clojure 1.1%
CSS 0.9%
YASnippet 0.8%
Other 0.6%