refactor: switch all mentions of flake dir to $FLAKE and fix vars readonly
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
3f288f3e8f
commit
9698b40420
6 changed files with 59 additions and 38 deletions
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -26,14 +26,7 @@ in {
|
|||
...
|
||||
}: let
|
||||
symlink = config.lib.file.mkOutOfStoreSymlink;
|
||||
inherit (lib) optionals;
|
||||
|
||||
astalTypes = config.home.file.".local/share/io.Aylur.Astal/types";
|
||||
astalConfigDir = ".nix/modules/ags/astal"; # FIXME: figure out way to use $FLAKE
|
||||
|
||||
# https://github.com/Aylur/ags/blob/e1f2d311ceb496a69ef6daa6aebb46ce511b2f22/nix/hm-module.nix#L69
|
||||
agsTypes = config.home.file.".local//share/com.github.Aylur.ags/types";
|
||||
agsConfigDir = ".nix/modules/ags/config"; # FIXME: figure out way to use $FLAKE
|
||||
inherit (lib) hasPrefix mdDoc optionals removePrefix;
|
||||
|
||||
configJs =
|
||||
/*
|
||||
|
@ -44,7 +37,19 @@ in {
|
|||
|
||||
export default (await transpileTypeScript('${hostName}')).default;
|
||||
'';
|
||||
|
||||
agsConfigDir = "${removePrefix "/home/${mainUser}/" flakeDir}/modules/ags";
|
||||
in {
|
||||
assertions = [
|
||||
{
|
||||
assertion = hasPrefix "/home/${mainUser}/" flakeDir;
|
||||
message = mdDoc ''
|
||||
Your $FLAKE environment variable needs to point to a directory in
|
||||
the main users' home to use the AGS module.
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
# Experimental Gtk4 ags
|
||||
programs.astal = {
|
||||
enable = true;
|
||||
|
@ -58,13 +63,15 @@ in {
|
|||
home = {
|
||||
file =
|
||||
{
|
||||
# Astal symlinks. ${./astal}, types and config.js
|
||||
".config/astal".source = symlink "${flakeDir}/modules/ags/astal";
|
||||
"${astalConfigDir}/types".source = astalTypes.source;
|
||||
"${astalConfigDir}/config.js".text = configJs;
|
||||
"${agsConfigDir}/astal/types".source = "${config.programs.astal.finalPackage}/share/io.Aylur.Astal/types";
|
||||
"${agsConfigDir}/astal/config.js".text = configJs;
|
||||
|
||||
# AGS symlinks. ${./config}, types and config.js
|
||||
".config/ags".source = symlink "${flakeDir}/modules/ags/config";
|
||||
"${agsConfigDir}/types".source = agsTypes.source;
|
||||
"${agsConfigDir}/config.js".text = configJs;
|
||||
"${agsConfigDir}/config/types".source = "${config.programs.ags.finalPackage}/share/com.github.Aylur.ags/types";
|
||||
"${agsConfigDir}/config/config.js".text = configJs;
|
||||
}
|
||||
// (import ./icons.nix {inherit pkgs agsConfigDir;});
|
||||
|
||||
|
@ -96,15 +103,15 @@ in {
|
|||
++ optionals isTouchscreen ["squeekboard"];
|
||||
|
||||
bind = [
|
||||
"$mainMod SHIFT, E , exec, ags -t powermenu"
|
||||
"$mainMod , D , exec, ags -t applauncher"
|
||||
"$mainMod SHIFT, E, exec, ags -t powermenu"
|
||||
"$mainMod , D, exec, ags -t applauncher"
|
||||
];
|
||||
binde = [
|
||||
## Brightness control
|
||||
", XF86MonBrightnessUp, exec, ags -r 'Brightness.screen += 0.05'"
|
||||
", XF86MonBrightnessDown, exec, ags -r 'Brightness.screen -= 0.05'"
|
||||
];
|
||||
bindn = [",Escape, exec, ags run-js 'closeAll()'"];
|
||||
bindn = [" , Escape, exec, ags -r 'closeAll()'"];
|
||||
bindr = ["CAPS, Caps_Lock, exec, ags -r 'Brightness.fetchCapsState()'"];
|
||||
};
|
||||
};
|
||||
|
|
|
@ -3,17 +3,17 @@
|
|||
pkgs,
|
||||
...
|
||||
}: {
|
||||
"${agsConfigDir}/icons/mouse-razer-symbolic.svg".source = pkgs.fetchurl {
|
||||
"${agsConfigDir}/config/icons/mouse-razer-symbolic.svg".source = pkgs.fetchurl {
|
||||
url = "https://raw.githubusercontent.com/bithatch/razer-icon-font/main/src/devices/mouse.svg";
|
||||
hash = "sha256-A1+eIp2VEFDyY23GIHKhbnByHXrnVS3QgIJ9sjjtuZw=";
|
||||
};
|
||||
|
||||
"${agsConfigDir}/icons/down-large-symbolic.svg".source = pkgs.fetchurl {
|
||||
"${agsConfigDir}/config/icons/down-large-symbolic.svg".source = pkgs.fetchurl {
|
||||
url = "https://www.svgrepo.com/download/158537/down-chevron.svg";
|
||||
hash = "sha256-mOfNjgZh0rt6XosKA2kpLY22lJldSS1XCphgrnvZH1s=";
|
||||
};
|
||||
|
||||
"${agsConfigDir}/icons/nixos-logo-symbolic.svg".text =
|
||||
"${agsConfigDir}/config/icons/nixos-logo-symbolic.svg".text =
|
||||
/*
|
||||
xml
|
||||
*/
|
||||
|
|
|
@ -16,7 +16,6 @@ in {
|
|||
home-manager.users.greeter = {
|
||||
imports = [
|
||||
astal.homeManagerModules.default
|
||||
../../common/vars
|
||||
../../home/theme
|
||||
];
|
||||
|
||||
|
@ -51,8 +50,5 @@ in {
|
|||
'';
|
||||
};
|
||||
};
|
||||
|
||||
vars = config.vars;
|
||||
home.stateVersion = "24.05";
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue