Add basic theme config
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
set -e
|
|
||||||
|
|
||||||
if [ "$(id -u)" -ne 0 ]; then
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
echo "This script must be run as root or with sudo privileges."
|
echo "This script must be run as root or with sudo privileges."
|
||||||
exit 1
|
exit 1
|
||||||
|
@@ -1,5 +1,16 @@
|
|||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
environment.systemPackages = [ (pkgs.writeShellScriptBin "nix-cleanup" (builtins.readFile ./cleanup.sh)) ];
|
environment.systemPackages = [
|
||||||
|
(pkgs.writeShellApplication {
|
||||||
|
name = "nix-cleanup";
|
||||||
|
runtimeInputs = with pkgs; [
|
||||||
|
coreutils-full
|
||||||
|
btrfs-progs
|
||||||
|
util-linux
|
||||||
|
nix
|
||||||
|
];
|
||||||
|
text = builtins.readFile ./cleanup.sh;
|
||||||
|
})
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,4 @@
|
|||||||
{
|
{ device ? throw "device argument is required", ... }:
|
||||||
device ? throw "device argument is required",
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
disko.devices = {
|
disko.devices = {
|
||||||
|
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
users = lib.attrsets.filterAttrs (name: config: config.isNormalUser) config.users.users;
|
users = lib.attrsets.filterAttrs (name: config: config.isNormalUser) config.users.users;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
programs.fuse.userAllowOther = lib.mkIf (users != [ ]) true;
|
programs.fuse.userAllowOther = lib.mkIf (users != [ ]) true;
|
||||||
|
|
||||||
systemd.tmpfiles.rules = lib.mkIf (users != [ ]) (
|
systemd.tmpfiles.rules = lib.mkIf (users != [ ]) (
|
||||||
@@ -14,12 +15,14 @@ in {
|
|||||||
lib.attrsets.mapAttrsToList (user: config: "d /cache${config.home} 0700 ${user} users -") users
|
lib.attrsets.mapAttrsToList (user: config: "d /cache${config.home} 0700 ${user} users -") users
|
||||||
);
|
);
|
||||||
|
|
||||||
home-manager.users = lib.attrsets.mapAttrs (user: config: ({
|
home-manager.users = lib.attrsets.mapAttrs
|
||||||
|
(user: config: ({
|
||||||
imports = [ inputs.impermanence.nixosModules.home-manager.impermanence ];
|
imports = [ inputs.impermanence.nixosModules.home-manager.impermanence ];
|
||||||
|
|
||||||
home.persistence = {
|
home.persistence = {
|
||||||
"/persist${config.home}".allowOther = true;
|
"/persist${config.home}".allowOther = true;
|
||||||
"/cache${config.home}".allowOther = true;
|
"/cache${config.home}".allowOther = true;
|
||||||
};
|
};
|
||||||
})) users;
|
}))
|
||||||
|
users;
|
||||||
}
|
}
|
||||||
|
@@ -3,8 +3,10 @@
|
|||||||
let
|
let
|
||||||
users = lib.attrsets.filterAttrs (name: config: config.isNormalUser) config.users.users;
|
users = lib.attrsets.filterAttrs (name: config: config.isNormalUser) config.users.users;
|
||||||
sopsKeyPath = ".config/sops-nix/key.txt";
|
sopsKeyPath = ".config/sops-nix/key.txt";
|
||||||
in {
|
in
|
||||||
home-manager.users = lib.attrsets.mapAttrs (user: config: ({
|
{
|
||||||
|
home-manager.users = lib.attrsets.mapAttrs
|
||||||
|
(user: config: ({
|
||||||
imports = [ inputs.sops-nix.homeManagerModules.sops ];
|
imports = [ inputs.sops-nix.homeManagerModules.sops ];
|
||||||
|
|
||||||
sops.age.keyFile = "/persist${config.home}/${sopsKeyPath}";
|
sops.age.keyFile = "/persist${config.home}/${sopsKeyPath}";
|
||||||
@@ -13,5 +15,6 @@ in {
|
|||||||
persistence."/persist${config.home}".files = [ sopsKeyPath ];
|
persistence."/persist${config.home}".files = [ sopsKeyPath ];
|
||||||
sessionVariables.SOPS_AGE_KEY_FILE = "${config.home}/${sopsKeyPath}";
|
sessionVariables.SOPS_AGE_KEY_FILE = "${config.home}/${sopsKeyPath}";
|
||||||
};
|
};
|
||||||
})) users;
|
}))
|
||||||
|
users;
|
||||||
}
|
}
|
||||||
|
@@ -2,15 +2,19 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
users = lib.attrsets.filterAttrs (name: config: config.isNormalUser) config.users.users;
|
users = lib.attrsets.filterAttrs (name: config: config.isNormalUser) config.users.users;
|
||||||
in {
|
in
|
||||||
home-manager.users = lib.attrsets.mapAttrs (user: cfg: (let
|
{
|
||||||
|
home-manager.users = lib.attrsets.mapAttrs
|
||||||
|
(user: cfg: (
|
||||||
|
let
|
||||||
cacheHome = "${cfg.home}/.cache";
|
cacheHome = "${cfg.home}/.cache";
|
||||||
configHome = "${cfg.home}/.config";
|
configHome = "${cfg.home}/.config";
|
||||||
dataHome = "${cfg.home}/.local/share";
|
dataHome = "${cfg.home}/.local/share";
|
||||||
stateHome = "${cfg.home}/.local/state";
|
stateHome = "${cfg.home}/.local/state";
|
||||||
xdgVmDir = "${cfg.home}/VMs";
|
xdgVmDir = "${cfg.home}/VMs";
|
||||||
xdgGitDir = "${cfg.home}/git";
|
xdgGitDir = "${cfg.home}/git";
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
xdg = {
|
xdg = {
|
||||||
enable = true;
|
enable = true;
|
||||||
mimeApps.enable = true;
|
mimeApps.enable = true;
|
||||||
@@ -40,5 +44,7 @@ in {
|
|||||||
"VMs" # xdgVmDir
|
"VMs" # xdgVmDir
|
||||||
"git" # xdgGitDir
|
"git" # xdgGitDir
|
||||||
];
|
];
|
||||||
})) users;
|
}
|
||||||
|
))
|
||||||
|
users;
|
||||||
}
|
}
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
inputs.home-manager.nixosModules.default
|
inputs.home-manager.nixosModules.default
|
||||||
./options.nix
|
./options
|
||||||
./configs/persist
|
./configs/persist
|
||||||
./configs/sops
|
./configs/sops
|
||||||
./configs/xdg
|
./configs/xdg
|
||||||
@@ -14,6 +14,11 @@
|
|||||||
backupFileExtension = "bak";
|
backupFileExtension = "bak";
|
||||||
useGlobalPkgs = true;
|
useGlobalPkgs = true;
|
||||||
sharedModules = [{
|
sharedModules = [{
|
||||||
|
imports = [
|
||||||
|
./options/home-manager/matugen
|
||||||
|
./options/home-manager/theme
|
||||||
|
];
|
||||||
|
|
||||||
home.stateVersion = "24.05";
|
home.stateVersion = "24.05";
|
||||||
systemd.user.startServices = "sd-switch";
|
systemd.user.startServices = "sd-switch";
|
||||||
nix.settings = config.nix.settings;
|
nix.settings = config.nix.settings;
|
||||||
|
@@ -11,18 +11,9 @@ let
|
|||||||
type = nullOr str;
|
type = nullOr str;
|
||||||
description = "Full name of the user.";
|
description = "Full name of the user.";
|
||||||
};
|
};
|
||||||
|
|
||||||
options.wallpaper = mkOption {
|
|
||||||
type = path;
|
|
||||||
description = "Path to the user's wallpaper.";
|
|
||||||
};
|
};
|
||||||
|
in
|
||||||
options.base16Scheme = mkOption {
|
{
|
||||||
type = path;
|
|
||||||
description = "Base16 scheme to use for the user's color palette.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in {
|
|
||||||
options = with lib; with types; {
|
options = with lib; with types; {
|
||||||
users.users = mkOption {
|
users.users = mkOption {
|
||||||
type = attrsOf (submodule userOptions);
|
type = attrsOf (submodule userOptions);
|
23
users/common/options/home-manager/matugen/default.nix
Normal file
23
users/common/options/home-manager/matugen/default.nix
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.programs.matugen;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
# https://github.com/Theaninova/matugen/blob/add-home-manager-module/hm-module.nix
|
||||||
|
options.programs.matugen = with lib; with types; {
|
||||||
|
enable = mkEnableOption "matugen";
|
||||||
|
package = mkPackageOption pkgs "matugen" { };
|
||||||
|
settings = mkOption {
|
||||||
|
type = attrs;
|
||||||
|
description = "Settings to write to config.toml.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
home.packages = [ cfg.package ];
|
||||||
|
xdg.configFile."matugen/config.toml".source = lib.mkIf (cfg.settings != null) (
|
||||||
|
(pkgs.formats.toml { }).generate "matugen" cfg.settings
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
267
users/common/options/home-manager/theme/default.nix
Normal file
267
users/common/options/home-manager/theme/default.nix
Normal file
@@ -0,0 +1,267 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.theme;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
# https://github.com/Theaninova/TheaninovOS/blob/master/modules/home-manager/theme/md3-evo.nix
|
||||||
|
options.theme = with lib; with types; {
|
||||||
|
enable = mkEnableOption "theme";
|
||||||
|
|
||||||
|
configDir = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "${config.xdg.configHome}/theme";
|
||||||
|
description = "The path to the theme config directory.";
|
||||||
|
};
|
||||||
|
|
||||||
|
wallpaper = mkOption {
|
||||||
|
type = path;
|
||||||
|
description = "The path to the default wallpaper";
|
||||||
|
};
|
||||||
|
|
||||||
|
extraConfig = mkOption {
|
||||||
|
type = lines;
|
||||||
|
default = "";
|
||||||
|
description = "Extra configuration lines to add to the theme script.";
|
||||||
|
};
|
||||||
|
|
||||||
|
flavour = mkOption {
|
||||||
|
type = enum [
|
||||||
|
"content"
|
||||||
|
"expressive"
|
||||||
|
"fidelity"
|
||||||
|
"fruit-salad"
|
||||||
|
"monochrome"
|
||||||
|
"neutral"
|
||||||
|
"rainbow"
|
||||||
|
"tonal-spot"
|
||||||
|
];
|
||||||
|
default = "tonal-spot";
|
||||||
|
description = "The flavour of the theme.";
|
||||||
|
};
|
||||||
|
|
||||||
|
contrast = mkOption {
|
||||||
|
type = numbers.between (-1) 1;
|
||||||
|
default = 0;
|
||||||
|
description = "Use a modified contrast.";
|
||||||
|
};
|
||||||
|
|
||||||
|
opacity = mkOption {
|
||||||
|
type = numbers.between 0 1;
|
||||||
|
default = 1;
|
||||||
|
description = "The opacity of apps.";
|
||||||
|
};
|
||||||
|
|
||||||
|
radius = mkOption {
|
||||||
|
type = ints.unsigned;
|
||||||
|
default = 24;
|
||||||
|
description = "The radius of corners.";
|
||||||
|
};
|
||||||
|
|
||||||
|
padding = mkOption {
|
||||||
|
type = ints.unsigned;
|
||||||
|
default = 12;
|
||||||
|
description = "The padding of windows.";
|
||||||
|
};
|
||||||
|
|
||||||
|
blur = mkOption {
|
||||||
|
type = ints.unsigned;
|
||||||
|
default = 0;
|
||||||
|
description = "The blur amount of windows.";
|
||||||
|
};
|
||||||
|
|
||||||
|
color = {
|
||||||
|
semantic = {
|
||||||
|
blend = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = false;
|
||||||
|
description = "Blend the colors.";
|
||||||
|
};
|
||||||
|
|
||||||
|
danger = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "#ff0000";
|
||||||
|
description = "The color of danger.";
|
||||||
|
};
|
||||||
|
|
||||||
|
warning = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "#ffff00";
|
||||||
|
description = "The color of warning.";
|
||||||
|
};
|
||||||
|
|
||||||
|
success = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "#00ff00";
|
||||||
|
description = "The color of success.";
|
||||||
|
};
|
||||||
|
|
||||||
|
info = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "#0000ff";
|
||||||
|
description = "The color of info.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
syntax = {
|
||||||
|
blend = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
description = "Blend the colors.";
|
||||||
|
};
|
||||||
|
|
||||||
|
keywords = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "#ff8000";
|
||||||
|
description = "The color of keywords.";
|
||||||
|
};
|
||||||
|
|
||||||
|
functions = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "#0000ff";
|
||||||
|
description = "The color of functions.";
|
||||||
|
};
|
||||||
|
|
||||||
|
properties = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "#ff00ff";
|
||||||
|
description = "The color of properties.";
|
||||||
|
};
|
||||||
|
|
||||||
|
constants = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "#ff00ff";
|
||||||
|
description = "The color of constants.";
|
||||||
|
};
|
||||||
|
|
||||||
|
strings = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "#00ff00";
|
||||||
|
description = "The color of variables.";
|
||||||
|
};
|
||||||
|
|
||||||
|
numbers = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "#00ffff";
|
||||||
|
description = "The color of numbers.";
|
||||||
|
};
|
||||||
|
|
||||||
|
structures = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "#ffff00";
|
||||||
|
description = "The color of structures.";
|
||||||
|
};
|
||||||
|
|
||||||
|
types = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "#00ffff";
|
||||||
|
description = "The color of types.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
ansi = {
|
||||||
|
blend = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = true;
|
||||||
|
description = "Blend the colors.";
|
||||||
|
};
|
||||||
|
|
||||||
|
red = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "#ff0000";
|
||||||
|
description = "The color of red.";
|
||||||
|
};
|
||||||
|
|
||||||
|
green = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "#00ff00";
|
||||||
|
description = "The color of green.";
|
||||||
|
};
|
||||||
|
|
||||||
|
yellow = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "#ffff00";
|
||||||
|
description = "The color of yellow.";
|
||||||
|
};
|
||||||
|
|
||||||
|
orange = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "#ff8000";
|
||||||
|
description = "The color of orange.";
|
||||||
|
};
|
||||||
|
|
||||||
|
blue = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "#0000ff";
|
||||||
|
description = "The color of blue.";
|
||||||
|
};
|
||||||
|
|
||||||
|
magenta = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "#ff00ff";
|
||||||
|
description = "The color of magenta.";
|
||||||
|
};
|
||||||
|
|
||||||
|
cyan = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "#00ffff";
|
||||||
|
description = "The color of cyan.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
cursor = {
|
||||||
|
package = mkOption {
|
||||||
|
type = package;
|
||||||
|
default = pkgs.gnome.adwaita-icon-theme;
|
||||||
|
description = "The package providing the cursor theme.";
|
||||||
|
};
|
||||||
|
|
||||||
|
name = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "Adwaita";
|
||||||
|
description = "The cursor name within the package.";
|
||||||
|
};
|
||||||
|
|
||||||
|
size = mkOption {
|
||||||
|
type = ints.positive;
|
||||||
|
default = 32;
|
||||||
|
description = "The cursor size.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config =
|
||||||
|
let
|
||||||
|
name = "theme-init";
|
||||||
|
init = pkgs.writeShellApplication {
|
||||||
|
inherit name;
|
||||||
|
runtimeInputs = with pkgs; [ coreutils-full ];
|
||||||
|
text =
|
||||||
|
let
|
||||||
|
wallpaperPath = "${cfg.configDir}/wallpaper";
|
||||||
|
in
|
||||||
|
''
|
||||||
|
if [ ! -L "${wallpaperPath}" ]; then
|
||||||
|
ln -sf "${cfg.wallpaper}" "${wallpaperPath}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
${cfg.extraConfig}
|
||||||
|
$
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
|
lib.mkIf cfg.enable {
|
||||||
|
home = {
|
||||||
|
packages = [ init ];
|
||||||
|
|
||||||
|
pointerCursor = {
|
||||||
|
inherit (cfg.cursor) package name size;
|
||||||
|
gtk.enable = true;
|
||||||
|
x11.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
wayland.windowManager.hyprland.settings.exec-once = "${init}/bin/${name}";
|
||||||
|
};
|
||||||
|
}
|
3
users/configs/git/commit-msg.sh
Normal file
3
users/configs/git/commit-msg.sh
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
git interpret-trailers --if-exists doNothing --trailer \
|
||||||
|
"Signed-off-by: $(git config user.name) <$(git config user.email)>" \
|
||||||
|
--in-place "$1"
|
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
hmConfig = config.home-manager.users."${user.name}";
|
hmConfig = config.home-manager.users."${user.name}";
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
home-manager.users."${user.name}" = {
|
home-manager.users."${user.name}" = {
|
||||||
programs.git = {
|
programs.git = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -14,14 +15,13 @@ in {
|
|||||||
key = null;
|
key = null;
|
||||||
};
|
};
|
||||||
extraConfig.credential.helper = "store";
|
extraConfig.credential.helper = "store";
|
||||||
hooks = let
|
hooks = {
|
||||||
commit-msg-hook = pkgs.writeShellScriptBin "git-commit-msg" ''
|
commit-msg = let name = "git-commit-msg-hook"; in
|
||||||
${pkgs.git}/bin/git interpret-trailers --if-exists doNothing --trailer \
|
"${pkgs.writeShellApplication {
|
||||||
"Signed-off-by: $(git config user.name) <$(git config user.email)>" \
|
inherit name;
|
||||||
--in-place "$1"
|
runtimeInputs = with pkgs; [ git ];
|
||||||
'';
|
text = builtins.readFile ./commit-msg.sh;
|
||||||
in {
|
}}/bin/${name}";
|
||||||
commit-msg = "${commit-msg-hook}/bin/git-commit-msg";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -18,28 +18,24 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
systemd.user = {
|
systemd.user = {
|
||||||
services.gpg-agent-import = let
|
services.gpg-agent-import =
|
||||||
init = pkgs.writeShellScriptBin "import-gpg-keys" ''
|
let
|
||||||
export GNUPGHOME=${gpgPath}
|
name = "import-gpg-keys";
|
||||||
|
init = pkgs.writeShellApplication {
|
||||||
for keyfile in "${user.home}"/.config/sops-nix/secrets/gpg-agent/*.key; do
|
inherit name;
|
||||||
passfile="''${keyfile%.key}.pass"
|
runtimeInputs = with pkgs; [
|
||||||
|
coreutils-full
|
||||||
if [ -f "$passfile" ]; then
|
gnugrep
|
||||||
${pkgs.gnupg}/bin/gpg2 --batch --yes --pinentry-mode loopback --passphrase-file "$passfile" --import "$keyfile"
|
gnupg
|
||||||
else
|
];
|
||||||
${pkgs.gnupg}/bin/gpg2 --batch --yes --import "$keyfile"
|
runtimeEnv = {
|
||||||
fi
|
GNUPGHOME = gpgPath;
|
||||||
|
HOME = user.home;
|
||||||
${pkgs.gnupg}/bin/gpg2 --with-colons --import-options show-only --import "$keyfile" | grep '^fpr' | cut -d: -f10 | while read -r KEY_ID; do
|
};
|
||||||
echo "$KEY_ID:6:" >> "${gpgPath}"/otrust.txt
|
text = builtins.readFile ./import-gpg-keys.sh;
|
||||||
done
|
};
|
||||||
done
|
in
|
||||||
|
{
|
||||||
${pkgs.gnupg}/bin/gpg2 --import-ownertrust "${gpgPath}"/otrust.txt
|
|
||||||
rm "${gpgPath}"/otrust.txt
|
|
||||||
'';
|
|
||||||
in {
|
|
||||||
Unit = {
|
Unit = {
|
||||||
Description = "Auto-import GPG keys";
|
Description = "Auto-import GPG keys";
|
||||||
Requires = [ "sops-nix.service" "gpg-agent.socket" ];
|
Requires = [ "sops-nix.service" "gpg-agent.socket" ];
|
||||||
@@ -48,10 +44,10 @@ in
|
|||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
ExecStart = "${init}/bin/import-gpg-keys";
|
ExecStart = "${init}/bin/${name}";
|
||||||
};
|
};
|
||||||
|
|
||||||
Install = { WantedBy = [ "default.target" ]; };
|
Install.WantedBy = [ "default.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
tmpfiles.rules = [ "d ${hmConfig.xdg.dataHome}/gnupg 0700 ${user.name} users -" ];
|
tmpfiles.rules = [ "d ${hmConfig.xdg.dataHome}/gnupg 0700 ${user.name} users -" ];
|
||||||
|
16
users/configs/gpg-agent/import-gpg-keys.sh
Normal file
16
users/configs/gpg-agent/import-gpg-keys.sh
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
for keyfile in "$HOME"/.config/sops-nix/secrets/gpg-agent/*.key; do
|
||||||
|
passfile="${keyfile%.key}.pass"
|
||||||
|
|
||||||
|
if [ -f "$passfile" ]; then
|
||||||
|
gpg2 --batch --yes --pinentry-mode loopback --passphrase-file "$passfile" --import "$keyfile"
|
||||||
|
else
|
||||||
|
gpg2 --batch --yes --import "$keyfile"
|
||||||
|
fi
|
||||||
|
|
||||||
|
gpg2 --with-colons --import-options show-only --import "$keyfile" | grep '^fpr' | cut -d: -f10 | while read -r KEY_ID; do
|
||||||
|
echo "$KEY_ID:6:" >> "$GNUPGHOME"/otrust.txt
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
gpg2 --import-ownertrust "$GNUPGHOME"/otrust.txt
|
||||||
|
rm "$GNUPGHOME"/otrust.txt
|
@@ -96,24 +96,12 @@ in
|
|||||||
"disable_hyprland_logo" = true;
|
"disable_hyprland_logo" = true;
|
||||||
"disable_splash_rendering" = true;
|
"disable_splash_rendering" = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
exec-once = let
|
|
||||||
init = pkgs.writeShellScriptBin "hyprland-init" ''
|
|
||||||
${pkgs.swww}/bin/swww-daemon &> /tmp/swww.log &
|
|
||||||
|
|
||||||
while ! ${pkgs.swww}/bin/swww query &> /dev/null; do
|
|
||||||
sleep 0.1
|
|
||||||
done
|
|
||||||
|
|
||||||
${pkgs.swww}/bin/swww img ${user.wallpaper}
|
|
||||||
'';
|
|
||||||
in "${init}/bin/hyprland-init";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.zsh.loginExtra = lib.mkAfter ''
|
programs.zsh.loginExtra = lib.mkAfter ''
|
||||||
if [ -z "''${WAYLAND_DISPLAY}" ] && [ ! -z "''${XDG_VTNR}" ] && [ "''${XDG_VTNR}" -eq 1 ]; then
|
if [ -z "''${WAYLAND_DISPLAY}" ] && [ -n "''${XDG_VTNR}" ] && [ "''${XDG_VTNR}" -eq 1 ]; then
|
||||||
${pkgs.hyprland}/bin/hyprland &> /tmp/hyprland.log
|
hyprland &> /tmp/hyprland.log
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
58
users/configs/matugen/default.nix
Normal file
58
users/configs/matugen/default.nix
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
{ user ? throw "user argument is required" }: { config, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
hmConfig = config.home-manager.users."${user.name}";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
home-manager.users."${user.name}" = {
|
||||||
|
programs.matugen = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
config = {
|
||||||
|
custom_colors =
|
||||||
|
let
|
||||||
|
mkColor = category: color: {
|
||||||
|
color = hmConfig.theme.color.${category}.${color};
|
||||||
|
blend = hmConfig.theme.color.${category}.blend;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
danger = mkColor "semantic" "danger";
|
||||||
|
warning = mkColor "semantic" "warning";
|
||||||
|
success = mkColor "semantic" "success";
|
||||||
|
info = mkColor "semantic" "info";
|
||||||
|
|
||||||
|
red = mkColor "ansi" "red";
|
||||||
|
green = mkColor "ansi" "green";
|
||||||
|
yellow = mkColor "ansi" "yellow";
|
||||||
|
orange = mkColor "ansi" "orange";
|
||||||
|
blue = mkColor "ansi" "blue";
|
||||||
|
magenta = mkColor "ansi" "magenta";
|
||||||
|
cyan = mkColor "ansi" "cyan";
|
||||||
|
|
||||||
|
keywords = mkColor "syntax" "keywords";
|
||||||
|
functions = mkColor "syntax" "functions";
|
||||||
|
properties = mkColor "syntax" "properties";
|
||||||
|
constants = mkColor "syntax" "constants";
|
||||||
|
strings = mkColor "syntax" "strings";
|
||||||
|
numbers = mkColor "syntax" "numbers";
|
||||||
|
structures = mkColor "syntax" "structures";
|
||||||
|
types = mkColor "syntax" "types";
|
||||||
|
};
|
||||||
|
|
||||||
|
custom_keywords = {
|
||||||
|
flavour = hmConfig.theme.flavour;
|
||||||
|
contrast = builtins.toString hmConfig.theme.contrast;
|
||||||
|
opacity = builtins.toString hmConfig.theme.opacity;
|
||||||
|
radius = builtins.toString hmConfig.theme.radius;
|
||||||
|
padding = builtins.toString hmConfig.theme.padding;
|
||||||
|
double_padding = builtins.toString (hmConfig.theme.padding * 2);
|
||||||
|
blur = builtins.toString hmConfig.theme.blur;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
templates = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
@@ -1,13 +0,0 @@
|
|||||||
{ user ? throw "user argument is required" }: { inputs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
home-manager.users."${user.name}" = {
|
|
||||||
imports = [ inputs.stylix.homeManagerModules.stylix ];
|
|
||||||
|
|
||||||
stylix = {
|
|
||||||
enable = true;
|
|
||||||
image = user.wallpaper;
|
|
||||||
base16Scheme = user.base16Scheme;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
@@ -1,10 +1,33 @@
|
|||||||
{ user ? throw "user argument is required" }: { pkgs, ... }:
|
{ user ? throw "user argument is required" }: { config, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
hmConfig = config.home-manager.users."${user.name}";
|
||||||
|
in
|
||||||
{
|
{
|
||||||
home-manager.users."${user.name}" = {
|
home-manager.users."${user.name}" = {
|
||||||
home = {
|
home = {
|
||||||
packages = with pkgs; [ swww ];
|
packages = with pkgs; [ swww ];
|
||||||
persistence."/cache${user.home}".directories = [ ".cache/swww" ];
|
persistence."/cache${user.home}".directories = [ ".cache/swww" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
theme.extraConfig = let name = "theme-swww"; in
|
||||||
|
"${pkgs.writeShellApplication {
|
||||||
|
inherit name;
|
||||||
|
runtimeInputs = with pkgs; [
|
||||||
|
coreutils-full
|
||||||
|
swww
|
||||||
|
];
|
||||||
|
text = ''
|
||||||
|
if ! pgrep -x "swww-daemon" > /dev/null; then
|
||||||
|
swww-daemon &> /tmp/swww.log &
|
||||||
|
fi
|
||||||
|
|
||||||
|
while ! swww query &> /dev/null; do
|
||||||
|
sleep 0.1
|
||||||
|
done
|
||||||
|
|
||||||
|
swww img "${hmConfig.theme.configDir}/wallpaper"
|
||||||
|
'';
|
||||||
|
}}/bin/${name}";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
8
users/configs/theme/default.nix
Normal file
8
users/configs/theme/default.nix
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{ user ? throw "user argument is required" }: { pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
home-manager.users."${user.name}" = {
|
||||||
|
theme.enable = true;
|
||||||
|
home.persistence."/persist${user.home}".directories = [ ".config/theme" ];
|
||||||
|
};
|
||||||
|
}
|
@@ -1,27 +1,12 @@
|
|||||||
{ user ? throw "user argument is required" }: { inputs, lib, pkgs, ... }:
|
{ user ? throw "user argument is required" }: { inputs, lib, pkgs, ... }:
|
||||||
|
|
||||||
let
|
{
|
||||||
configDir = ".config/Code";
|
|
||||||
cacheDirs = [
|
|
||||||
".config/Code/Cache"
|
|
||||||
".config/Code/CachedConfigurations"
|
|
||||||
".config/Code/CachedData"
|
|
||||||
".config/Code/CachedExtensionVSIXs"
|
|
||||||
".config/Code/CachedExtensions"
|
|
||||||
".config/Code/CachedProfilesData"
|
|
||||||
".config/Code/Code Cache"
|
|
||||||
".config/Code/DawnCache"
|
|
||||||
".config/Code/GPUCache"
|
|
||||||
".config/Code/Service Worker/CacheStorage"
|
|
||||||
".config/Code/Service Worker/ScriptCache"
|
|
||||||
];
|
|
||||||
inherit (pkgs.callPackage "${inputs.impermanence}/lib.nix" { }) sanitizeName concatPaths;
|
|
||||||
in {
|
|
||||||
home-manager.users."${user.name}" = {
|
home-manager.users."${user.name}" = {
|
||||||
programs.vscode = {
|
programs.vscode = {
|
||||||
enable = true;
|
enable = true;
|
||||||
mutableExtensionsDir = false;
|
mutableExtensionsDir = false;
|
||||||
userSettings = {
|
userSettings = {
|
||||||
|
"diffEditor.ignoreTrimWhitespace" = false;
|
||||||
"editor.accessibilitySupport" = "off";
|
"editor.accessibilitySupport" = "off";
|
||||||
"editor.cursorBlinking" = "phase";
|
"editor.cursorBlinking" = "phase";
|
||||||
"editor.cursorSmoothCaretAnimation" = "on";
|
"editor.cursorSmoothCaretAnimation" = "on";
|
||||||
@@ -76,27 +61,24 @@ in {
|
|||||||
];
|
];
|
||||||
|
|
||||||
home.persistence = {
|
home.persistence = {
|
||||||
"/persist${user.home}".directories = [ configDir ];
|
"/persist${user.home}".directories = [ ".config/Code" ];
|
||||||
# Bastard: https://github.com/microsoft/vscode/issues/3884
|
# Bastard: https://github.com/microsoft/vscode/issues/3884
|
||||||
"/cache${user.home}".directories = cacheDirs;
|
# Even bigger Bastards:
|
||||||
|
# - https://github.com/nix-community/impermanence/issues/22
|
||||||
|
# - https://github.com/nix-community/impermanence/pull/97
|
||||||
|
# "/cache${user.home}".directories = [
|
||||||
|
# ".config/Code/Cache"
|
||||||
|
# ".config/Code/CachedConfigurations"
|
||||||
|
# ".config/Code/CachedData"
|
||||||
|
# ".config/Code/CachedExtensionVSIXs"
|
||||||
|
# ".config/Code/CachedExtensions"
|
||||||
|
# ".config/Code/CachedProfilesData"
|
||||||
|
# ".config/Code/Code Cache"
|
||||||
|
# ".config/Code/DawnCache"
|
||||||
|
# ".config/Code/GPUCache"
|
||||||
|
# ".config/Code/Service Worker/CacheStorage"
|
||||||
|
# ".config/Code/Service Worker/ScriptCache"
|
||||||
|
# ];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Some filthy fucking shit below, be warned.
|
|
||||||
# Microsoft stores cache under .config/Code instead of .cache/Code like normal people.
|
|
||||||
# Sometimes a race condition is caused if the cache bind mounts are created before the config one.
|
|
||||||
# So we do this. Sorry.
|
|
||||||
# https://github.com/nix-community/impermanence/blob/27979f1c3a0d3b9617a3563e2839114ba7d48d3f/home-manager.nix#L238
|
|
||||||
systemd.user.services = let
|
|
||||||
configDirService = "bindMount-${sanitizeName (lib.strings.escapeShellArg (concatPaths [ "/persist${user.home}" configDir ]))}.service";
|
|
||||||
in
|
|
||||||
builtins.listToAttrs (builtins.map (dir: {
|
|
||||||
name = "bindMount-${sanitizeName (lib.strings.escapeShellArg (concatPaths [ "/cache${user.home}" dir ]))}";
|
|
||||||
value = {
|
|
||||||
Unit = {
|
|
||||||
Requires = [ configDirService ];
|
|
||||||
After = [ configDirService ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}) cacheDirs);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
{ config, pkgs, ... }:
|
{ config, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
user = config.users.users.nick;
|
user = config.users.users.nick;
|
||||||
@@ -6,6 +6,8 @@ in
|
|||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./nogui.nix
|
./nogui.nix
|
||||||
|
(import ../configs/theme { inherit user; })
|
||||||
|
(import ../configs/matugen { inherit user; })
|
||||||
(import ../configs/firefox { inherit user; })
|
(import ../configs/firefox { inherit user; })
|
||||||
(import ../configs/hyprland { inherit user; })
|
(import ../configs/hyprland { inherit user; })
|
||||||
(import ../configs/rofi { inherit user; })
|
(import ../configs/rofi { inherit user; })
|
||||||
@@ -14,11 +16,9 @@ in
|
|||||||
(import ../configs/vscode { inherit user; })
|
(import ../configs/vscode { inherit user; })
|
||||||
(import ../configs/gtk { inherit user; })
|
(import ../configs/gtk { inherit user; })
|
||||||
(import ../configs/x { inherit user; })
|
(import ../configs/x { inherit user; })
|
||||||
(import ../configs/stylix { inherit user; })
|
|
||||||
];
|
];
|
||||||
|
|
||||||
users.users.nick = {
|
home-manager.users.nick = {
|
||||||
wallpaper = ./wallpapers/clouds.png;
|
theme.wallpaper = ./wallpapers/cats.jpg;
|
||||||
base16Scheme = "${pkgs.base16-schemes}/share/themes/seti.yaml";
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
user = config.users.users.nick;
|
user = config.users.users.nick;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../common
|
../common
|
||||||
(import ../configs/zsh { inherit user; })
|
(import ../configs/zsh { inherit user; })
|
||||||
|
Reference in New Issue
Block a user