refactor: switch all mentions of flake dir to $FLAKE and fix vars readonly

This commit is contained in:
matt1432 2024-03-26 15:32:48 -04:00
parent 3f288f3e8f
commit 9698b40420
6 changed files with 59 additions and 38 deletions

View file

@ -32,9 +32,9 @@
nix = {
# Allow deleting store files with '.' in the name
package = pkgs.nix.overrideAttrs (oldAttrs: {
package = pkgs.nix.overrideAttrs (o: {
patches =
(oldAttrs.patches or [])
(o.patches or [])
++ [
./overlays/nix/patch
];
@ -65,7 +65,6 @@
extraArgs = "--keep-since 30d";
};
};
environment.variables.FLAKE = lib.mkDefault "/home/matt/.nix";
services = {
fwupd.enable = true;
@ -83,8 +82,13 @@
default = {
imports = [
# Make the vars be the same on Nix and HM
./vars
{vars = config.vars;}
{
options.vars = lib.mkOption {
type = lib.types.attrs;
readOnly = true;
default = config.vars;
};
}
nur.hmModules.nur
@ -109,7 +113,12 @@
home.stateVersion = mainUserConf.home.stateVersion;
};
# TODO: make user an array?
greeter =
default
// {
home.stateVersion = mainUserConf.home.stateVersion;
};
${mainUser} = default;
};
}

View file

@ -1,5 +1,6 @@
{
config,
lib,
nur,
...
}: {
@ -39,8 +40,13 @@
home-manager.config = {
imports = [
# Make the vars be the same on Nix and HM
./vars
{vars = config.vars;}
{
options.vars = lib.mkOption {
type = lib.types.attrs;
readOnly = true;
default = config.vars;
};
}
nur.hmModules.nur

View file

@ -2,12 +2,12 @@
config,
lib,
...
}: {
options.vars = let
inherit (lib) mkOption types;
flakeDir = config.environment.variables.FLAKE;
cfg = config.vars;
in {
}: let
inherit (lib) mkOption types;
flakeDir = config.environment.variables.FLAKE;
cfg = config.vars;
in {
options.vars = {
mainUser = mkOption {
type = types.str;
description = ''
@ -34,8 +34,7 @@
default = import ./prompt-schemes.nix cfg.promptMainColor;
# FIXME: doesn't work when passing vars to home-manager
# readOnly = true;
readOnly = true;
type = with types;
submodule {
options = {
@ -83,4 +82,8 @@
default = true;
};
};
config = {
environment.variables.FLAKE = lib.mkDefault "/home/${cfg.mainUser}/.nix";
};
}