yelite / lite-config Goto Github PK
View Code? Open in Web Editor NEWA flake module to build NixOS, nix-darwin and Home Manager configurations, creating a consistent environment across different devices.
License: MIT License
A flake module to build NixOS, nix-darwin and Home Manager configurations, creating a consistent environment across different devices.
License: MIT License
Hello again Ye Lite,
I've come up against another issue that seems to stem from Home Manager not being configured out of the box.
I can reproduce this issue with a trivial system zsh module and home git module where I conditionally enable each via a mkEnableOption
.
{ config
, lib
, ...
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.my.system.zsh;
in
{
options.my.system.zsh = {
enable = mkEnableOption "zsh";
};
config = mkIf cfg.enable {
programs.zsh.enable = true;
};
}
{ config
, lib
, ...
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.my.home.git;
in
{
options.my.home.git = {
enable = mkEnableOption "git";
};
config = mkIf cfg.enable {
programs.git.enable = true;
};
}
I toggle these on in my host configuration and only see the system module taking affect.
{ ... }: {
my = {
system = {
zsh.enable = true;
};
home = {
git.enable = true;
};
};
}
I might be missing something; maybe I have more work to do with Home Manager to get modules showing up in the host config?
https://github.com/jcf/lite-system-emacs-overlay/tree/main#home-modules
Hello Lite Ye,
Thank you for open sourcing lite-system. It's exactly what I'm looking for and will DRY up my personal Nix configuration that I plan to open source very soon.
I have unfortunately run into an issue when adding the nix-community/emacs-overlay to my work-in-progress configuration. I've pushed a minimal example to jcf/lite-system-emacs-overlay in case it's helpful.
With nothing more than empty host, home, and system modules, I'm able to produce the following error when checking/building from my flake.nix.
{
outputs = inputs @ { flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } ({ inputs, ... }: {
imports = [
inputs.lite-system.flakeModule
];
config.lite-system = {
nixpkgs = {
overlays = [ inputs.emacs-overlay.overlays.emacs ];
};
systemModule = ./system;
homeModule = ./home;
hostModuleDir = ./host;
hosts = {
example = {
system = "aarch64-darwin";
};
};
};
});
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
lite-system.url = "github:yelite/lite-system";
# [...]
# https://github.com/nix-community/emacs-overlay
emacs-overlay = {
url = "github:nix-community/emacs-overlay/ead33b53bddac6d9e4e01d1e80e6dc1d8d30d2a3";
inputs.nixpkgs.follows = "nixpkgs";
};
};
}
$ nix run nix-darwin -- --flake $(PWD) check
[...]
error:
… while evaluating the attribute 'optionalValue.value'
at /nix/store/cjvwy2rr87ir1nb6wvs9n6lvbnzlqrdg-source/lib/modules.nix:854:5:
853|
854| optionalValue =
| ^
855| if isDefined then { value = mergedValue; }
… while evaluating a branch condition
at /nix/store/cjvwy2rr87ir1nb6wvs9n6lvbnzlqrdg-source/lib/modules.nix:855:7:
854| optionalValue =
855| if isDefined then { value = mergedValue; }
| ^
856| else {};
(stack trace truncated; use '--show-trace' to show the full trace)
error: value is null while a set was expected
nix run nix-darwin -- --flake $(PWD) check --show-trace
building the system configuration...
error:
… while calling anonymous lambda
at /nix/store/cjvwy2rr87ir1nb6wvs9n6lvbnzlqrdg-source/lib/types.nix:565:29:
564| merge = loc: defs:
565| zipAttrsWith (name: defs:
| ^
566| let merged = mergeDefinitions (loc ++ [name]) elemType defs;
… while calling anonymous lambda
at /nix/store/cjvwy2rr87ir1nb6wvs9n6lvbnzlqrdg-source/lib/modules.nix:822:28:
821| # Process mkMerge and mkIf properties.
822| defs' = concatMap (m:
| ^
823| map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
… while evaluating definitions from `/nix/store/2gkqfvzq2j0vbrlkx3y0k8qxyn4px989-source/modules/transposition.nix':
… from call site
at /nix/store/cjvwy2rr87ir1nb6wvs9n6lvbnzlqrdg-source/lib/modules.nix:823:137:
822| defs' = concatMap (m:
823| map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
| ^
824| ) defs;
… while calling 'dischargeProperties'
at /nix/store/cjvwy2rr87ir1nb6wvs9n6lvbnzlqrdg-source/lib/modules.nix:894:25:
893| */
894| dischargeProperties = def:
| ^
895| if def._type or "" == "merge" then
… while calling anonymous lambda
at /nix/store/2gkqfvzq2j0vbrlkx3y0k8qxyn4px989-source/modules/transposition.nix:62:22:
61| mapAttrs
62| (system: v: v.${attrName})
| ^
63| config.allSystems
… while calling 'g'
at /nix/store/cjvwy2rr87ir1nb6wvs9n6lvbnzlqrdg-source/lib/attrsets.nix:643:19:
642| g =
643| name: value:
| ^
644| if isAttrs value && cond value
… from call site
at /nix/store/cjvwy2rr87ir1nb6wvs9n6lvbnzlqrdg-source/lib/attrsets.nix:646:20:
645| then recurse (path ++ [name]) value
646| else f (path ++ [name]) value;
| ^
647| in mapAttrs g;
… while calling anonymous lambda
at /nix/store/cjvwy2rr87ir1nb6wvs9n6lvbnzlqrdg-source/lib/modules.nix:242:72:
241| # For definitions that have an associated option
242| declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
| ^
243|
… while evaluating the option `perSystem.aarch64-darwin.packages':
… while calling anonymous lambda
at /nix/store/cjvwy2rr87ir1nb6wvs9n6lvbnzlqrdg-source/lib/modules.nix:822:28:
821| # Process mkMerge and mkIf properties.
822| defs' = concatMap (m:
| ^
823| map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
… while evaluating definitions from `/nix/store/3n54gjkr6vgcj5vbagiacsq218pm0mim-source':
… from call site
at /nix/store/cjvwy2rr87ir1nb6wvs9n6lvbnzlqrdg-source/lib/modules.nix:823:137:
822| defs' = concatMap (m:
823| map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
| ^
824| ) defs;
… while calling 'dischargeProperties'
at /nix/store/cjvwy2rr87ir1nb6wvs9n6lvbnzlqrdg-source/lib/modules.nix:894:25:
893| */
894| dischargeProperties = def:
| ^
895| if def._type or "" == "merge" then
… while calling 'dischargeProperties'
at /nix/store/cjvwy2rr87ir1nb6wvs9n6lvbnzlqrdg-source/lib/modules.nix:894:25:
893| */
894| dischargeProperties = def:
| ^
895| if def._type or "" == "merge" then
… from call site
at /nix/store/cjvwy2rr87ir1nb6wvs9n6lvbnzlqrdg-source/lib/modules.nix:900:11:
899| if def.condition then
900| dischargeProperties def.content
| ^
901| else
… while calling 'dischargeProperties'
at /nix/store/cjvwy2rr87ir1nb6wvs9n6lvbnzlqrdg-source/lib/modules.nix:894:25:
893| */
894| dischargeProperties = def:
| ^
895| if def._type or "" == "merge" then
… from call site
at /nix/store/3n54gjkr6vgcj5vbagiacsq218pm0mim-source/flake-module.nix:286:16:
285| in
286| attrNames (overlay null null);
| ^
287|
… while calling 'composeExtensions'
at /nix/store/cjvwy2rr87ir1nb6wvs9n6lvbnzlqrdg-source/lib/fixed-points.nix:149:18:
148| composeExtensions =
149| f: g: final: prev:
| ^
150| let fApplied = f final prev;
… from call site
at /nix/store/cjvwy2rr87ir1nb6wvs9n6lvbnzlqrdg-source/lib/fixed-points.nix:150:22:
149| f: g: final: prev:
150| let fApplied = f final prev;
| ^
151| prev' = prev // fApplied;
… while calling 'emacs'
at /nix/store/1q6mi6lzvgd6ip7rn0i21p4r64cqwsxr-source/flake.nix:31:24:
30| default = final: prev: import ./overlays final prev;
31| emacs = final: prev: import ./overlays/emacs.nix final prev;
| ^
32| package = final: prev: import ./overlays/package.nix final prev;
… from call site
at /nix/store/1q6mi6lzvgd6ip7rn0i21p4r64cqwsxr-source/flake.nix:31:30:
30| default = final: prev: import ./overlays final prev;
31| emacs = final: prev: import ./overlays/emacs.nix final prev;
| ^
32| package = final: prev: import ./overlays/package.nix final prev;
… while calling anonymous lambda
at /nix/store/1q6mi6lzvgd6ip7rn0i21p4r64cqwsxr-source/overlays/emacs.nix:1:7:
1| self: super:
| ^
2| let
error: value is null while a set was expected
This is exactly the type of tool I was looking for!
There are other "frameworks" to make using nixos/HM easier, but they can have additional complexity and, ironically, more boilerplate nix code.
Or they simply don't look as clean.
Good job!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.