Skip to content

Instantly share code, notes, and snippets.

View yunfachi's full-sized avatar
🏴‍☠️

yunfachi

🏴‍☠️
View GitHub Profile
@yunfachi
yunfachi / default.nix
Last active August 31, 2025 14:22
Incorrect behavior of the `name` argument in `lib.types.submoduleWith`.
let
inherit
((import <nixpkgs/lib>).evalModules {
modules = [
(
{ lib, ... }:
{
options =
let
submodule = lib.types.submodule (
@yunfachi
yunfachi / default.nix
Created August 26, 2025 18:32
strange behavior of the config argument in submodule modules when using apply
(import <nixpkgs/lib>).evalModules {
modules = [
(
{ lib, ... }:
{
options = {
someOption = lib.mkOption {
default = {
foo = { };
};
@yunfachi
yunfachi / default.nix
Created August 16, 2024 08:55
default value for read only in submodule
(import <nixpkgs/lib>).evalModules {
modules = [
({
lib,
config,
...
}: let
niceSubmodule = lib.types.submodule ({config, ...}: {
options = {
text =
@yunfachi
yunfachi / default.nix
Created August 12, 2024 17:58
override config in Nix with evalModules
(import <nixpkgs/lib>).evalModules {
modules = [
({lib, ...}: let
fake_config = lib.evalModules {
modules = [
({lib, ...}: {
options.fake.list = lib.mkOption {type = lib.types.listOf lib.types.str;};
config.fake.list = ["1"];
})
];
the...
the...
the...
the...
the...
the...