foot, vintage fonts, scope operator

This commit is contained in:
atagen 2025-08-12 15:47:26 +10:00
parent 8d77e96d89
commit 5575604452
46 changed files with 803 additions and 702 deletions

33
lib/create.nix Normal file
View file

@ -0,0 +1,33 @@
let
inputs = import ./inputs.nix;
inherit (inputs) nixpkgs;
inherit (nixpkgs) lib;
recursivelyImport = import ./recursively-import.nix { inherit lib; };
in
{
systems =
definitions:
lib.mapAttrs (
name: info:
lib.nixosSystem {
specialArgs = {
inherit inputs;
inherit (info) system;
localPkgs = lib.packagesFromDirectoryRecursive {
inherit (inputs.nixpkgs.legacyPackages.${info.system}) callPackage;
directory = ../pkgs;
};
scope = import ./scope.nix { inherit lib; };
mainUser = info.username;
getPkgs = builtins.attrValues;
};
modules = [
inputs.home-manager.nixosModules.home-manager
inputs.hjem.nixosModules.hjem
(lib.mkAliasOptionModule [ "hm" ] [ "home-manager" "users" info.username ])
(lib.mkAliasOptionModule [ "home" ] [ "hjem" "users" info.username ])
]
++ (recursivelyImport info.imports);
}
) definitions;
}

17
lib/inputs.nix Normal file
View file

@ -0,0 +1,17 @@
let
lock = builtins.fromJSON (builtins.readFile ../flake.lock);
# we use lix's flake-compat fork here to "lazify" the flake inputs
node = lock.nodes.root.inputs.__flake-compat;
inherit (lock.nodes.${node}.locked) narHash rev url;
flake-compat = builtins.fetchTarball {
url = "${url}/archive/${rev}.tar.gz";
sha256 = narHash;
};
flake = import flake-compat {
src = ../.;
# these options prevent eager store copies
copySourceTreeToStore = false;
useBuiltinsFetchTree = true;
};
in
flake.inputs

View file

@ -0,0 +1,21 @@
{ lib }:
let
recurseIntoFolders =
elem:
if lib.isPath elem && lib.pathIsDirectory elem then
lib.filesystem.listFilesRecursive elem
else
# If it's not a folder, return it unchanged. This handles single-files and
# literal modules (written with {} syntax)
lib.singleton elem;
filterNixFiles =
paths:
builtins.filter
# filter the files for `.nix` files. if it's not a file, it can stay.
(path: !builtins.isPath path || lib.hasSuffix ".nix" path)
# Expand any folders into all the files within them. Note that this comes
# BEFORE the filtering that's happening above
(builtins.concatMap recurseIntoFolders paths);
in
filterNixFiles

1
lib/scope.nix Normal file
View file

@ -0,0 +1 @@
{ lib }: sc: mod: lib.strings.splitString "." sc |> (lib.flip lib.setAttrByPath) mod