flakes

Back to NixOS Overview

These are my flakes declarations.

nixos

{ inputs, ... }:
let
  innerLib = (import ../lib).withInputs inputs;

  hostConfigs = innerLib.discoverHosts {
    hostsDir = ../hosts;
    filterFn = _name: meta: (meta.type or "") != "darwin";
  };
in {
  flake.nixosConfigurations = builtins.mapAttrs
    (name: hostConfig: innerLib.buildNixosConfiguration name hostConfig)
    hostConfigs;
}

home-manager

{ inputs, system, userList, primaryUser ? "gab" }:
{ config, pkgs, ... }:
let
  _innerLib = import ../lib;
  innerLib = _innerLib.withInputs inputs;
  isDarwin = builtins.match ".*-darwin" system != null;
  homePrefix = if isDarwin then "/Users" else "/home";
in
{
  home-manager = {
    useGlobalPkgs = true;
    useUserPackages = true;
    backupFileExtension = "bck";
    extraSpecialArgs = {
      inherit inputs system;
      innerLib = innerLib;
    };
    users.${primaryUser} = { config, pkgs, lib, ... }: {
      home.username = primaryUser;
      home.homeDirectory = lib.mkForce "${homePrefix}/${primaryUser}";
      fonts.fontconfig.enable = lib.mkForce false;
      disabledModules = [
        "targets/darwin/fonts.nix"
        "targets/darwin/linkapps.nix"
      ];
      imports = [
        ../homes/common
      ] ++ (map (name: ../homes/${name}) userList);
      _module.args = {
        inherit inputs system;
        innerLib = innerLib;
      };
    };
  };
}

emanote

⚠️ I am not responsible for the damages incurred by the recursion that happens mentally when looking at the source code of the notebook via the notebook ⚠️

{ inputs, ... }:
{
  imports = [
    inputs.emanote.flakeModule
  ];

  perSystem = {
    emanote.sites = {
      notebook = {
        layers = [
          { path = ../notebook; pathString = "./notebook"; }
          { path = ../homes; pathString = "./homes"; }
          { path = ../hosts; pathString = "./hosts"; }
          { path = ../lib; pathString = "./lib"; }
          { path = ../flakes; pathString = "./flakes"; }
        ];
        extraConfig = {
          template = {
            baseUrl = "/nixOS/";
          };
        };
      };
    };
  };
}
Links to this page