Add custom impermanence module
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
5
.gitmodules
vendored
5
.gitmodules
vendored
@@ -7,8 +7,3 @@
|
||||
path = submodules/home-manager
|
||||
url = https://github.com/karaolidis/home-manager.git
|
||||
branch = integration
|
||||
|
||||
[submodule "submodules/impermanence"]
|
||||
path = submodules/impermanence
|
||||
url = https://github.com/karaolidis/impermanence
|
||||
branch = integration
|
||||
|
23
flake.lock
generated
23
flake.lock
generated
@@ -64,11 +64,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1722408750,
|
||||
"narHash": "sha256-1nKAicPoQVrCcatj84LnAagtCeriztszBlmB2rllnT8=",
|
||||
"lastModified": 1723023714,
|
||||
"narHash": "sha256-AyQvRwyaSvzoknqzKmhKRbDsUpq5Igwl8sUS7syshWg=",
|
||||
"owner": "karaolidis",
|
||||
"repo": "home-manager",
|
||||
"rev": "bd83e8a0c3b6af03eb9d9a22251c9e2145d2974c",
|
||||
"rev": "82b0b4fbd2a54f787f28853f7ef8c99448d8824b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -78,22 +78,6 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"impermanence": {
|
||||
"locked": {
|
||||
"lastModified": 1722433536,
|
||||
"narHash": "sha256-Bvy4hGg5jgOlyl3KX3X986g5r06aBJKJY79Z+VWP3vg=",
|
||||
"owner": "karaolidis",
|
||||
"repo": "impermanence",
|
||||
"rev": "720ee9a1b00516214d05e2b509e4fe26c2368d90",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "karaolidis",
|
||||
"ref": "integration",
|
||||
"repo": "impermanence",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1722433574,
|
||||
@@ -146,7 +130,6 @@
|
||||
"ags": "ags",
|
||||
"disko": "disko",
|
||||
"home-manager": "home-manager",
|
||||
"impermanence": "impermanence",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nur": "nur",
|
||||
"sops-nix": "sops-nix",
|
||||
|
14
flake.nix
14
flake.nix
@@ -31,20 +31,6 @@
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
impermanence = {
|
||||
# --- Official
|
||||
# type = "github";
|
||||
# owner = "nix-community"
|
||||
# repo = "impermanence";
|
||||
# --- Fork
|
||||
type = "github";
|
||||
owner = "karaolidis";
|
||||
repo = "impermanence";
|
||||
ref = "integration";
|
||||
# --- Local
|
||||
# url = "git+file:./submodules/impermanence";
|
||||
};
|
||||
|
||||
disko = {
|
||||
url = "github:nix-community/disko";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
@@ -1,4 +1,4 @@
|
||||
{ ... }:
|
||||
{ config, ... }:
|
||||
{
|
||||
hardware.bluetooth = {
|
||||
enable = true;
|
||||
@@ -8,5 +8,8 @@
|
||||
};
|
||||
};
|
||||
|
||||
environment.persistence."/persist".directories = [ "/var/lib/bluetooth" ];
|
||||
environment.persistence."/persist"."/var/lib/bluetooth" = { };
|
||||
systemd.services.bluetooth.after = [
|
||||
config.environment.persistence."/persist"."/var/lib/bluetooth".mount
|
||||
];
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
{ pkgs, ... }:
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
virtualisation.docker = {
|
||||
enable = true;
|
||||
@@ -18,7 +18,12 @@
|
||||
};
|
||||
|
||||
environment = {
|
||||
persistence."/persist".directories = [ "/var/lib/docker" ];
|
||||
persistence."/persist"."/var/lib/docker" = { };
|
||||
systemPackages = with pkgs; [ docker-compose ];
|
||||
};
|
||||
|
||||
systemd = {
|
||||
services.docker.after = [ config.environment.persistence."/persist"."/var/lib/docker".mount ];
|
||||
sockets.docker.after = [ config.environment.persistence."/persist"."/var/lib/docker".mount ];
|
||||
};
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{ inputs, pkgs, ... }:
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
imports = [ inputs.impermanence.nixosModules.impermanence ];
|
||||
imports = [ ./options.nix ];
|
||||
|
||||
boot.initrd.systemd =
|
||||
let
|
||||
@@ -12,35 +12,35 @@
|
||||
];
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
initrdBin = bins;
|
||||
|
||||
services.impermanence = {
|
||||
description = "Rollback BTRFS subvolumes to a pristine state";
|
||||
|
||||
serviceConfig.Type = "oneshot";
|
||||
wantedBy = [ "initrd.target" ];
|
||||
before = [ "sysroot.mount" ];
|
||||
after = [ "cryptsetup.target" ];
|
||||
unitConfig.DefaultDependencies = "no";
|
||||
|
||||
serviceConfig.Type = "oneshot";
|
||||
path = bins;
|
||||
script = builtins.readFile ./impermanence.sh;
|
||||
script = builtins.readFile ./scripts/wipe.sh;
|
||||
};
|
||||
};
|
||||
|
||||
fileSystems = {
|
||||
"/persist".neededForBoot = true;
|
||||
"/cache".neededForBoot = true;
|
||||
};
|
||||
# https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/administration/systemd-state.section.md
|
||||
# https://github.com/NixOS/nixpkgs/pull/286140/files
|
||||
# https://git.eisfunke.com/config/nixos/-/blob/e65e1dc21d06d07b454005762b177ef151f8bfb6/nixos/machine-id.nix
|
||||
sops.secrets."machineId".mode = "0444";
|
||||
|
||||
environment.persistence."/persist" = {
|
||||
hideMounts = true;
|
||||
directories = [
|
||||
"/etc/nixos"
|
||||
"/var/lib/nixos"
|
||||
"/var/lib/systemd/coredump"
|
||||
"/var/log"
|
||||
];
|
||||
files = [ "/etc/machine-id" ];
|
||||
environment = {
|
||||
etc."machine-id".source = pkgs.runCommandLocal "machine-id-link" { } ''
|
||||
ln -s ${config.sops.secrets."machineId".path} $out
|
||||
'';
|
||||
|
||||
persistence."/persist" = {
|
||||
"/etc/nixos" = { };
|
||||
"/var/lib/nixos" = { };
|
||||
"/var/lib/systemd" = { };
|
||||
"/var/log" = { };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
247
hosts/common/system/configs/impermanence/options.nix
Normal file
247
hosts/common/system/configs/impermanence/options.nix
Normal file
@@ -0,0 +1,247 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
utils,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.environment.persistence;
|
||||
|
||||
# ["/home/user/" "/.screenrc"] -> ["home" "user" ".screenrc"]
|
||||
splitPath =
|
||||
paths:
|
||||
(builtins.filter (s: builtins.typeOf s == "string" && s != "") (
|
||||
builtins.concatMap (builtins.split "/") paths
|
||||
));
|
||||
|
||||
# ["/home/user/" "/.screenrc"] -> "/home/user/.screenrc"
|
||||
mergePaths =
|
||||
paths:
|
||||
let
|
||||
prefix = lib.strings.optionalString (lib.strings.hasPrefix "/" (builtins.head paths)) "/";
|
||||
path = lib.strings.concatStringsSep "/" (splitPath paths);
|
||||
in
|
||||
prefix + path;
|
||||
|
||||
# "/home/user/.screenrc" -> ["/home", "/home/user"]
|
||||
parentsOf =
|
||||
path:
|
||||
let
|
||||
prefix = lib.strings.optionalString (lib.strings.hasPrefix "/" path) "/";
|
||||
split = splitPath [ path ];
|
||||
parents = lib.lists.take ((lib.lists.length split) - 1) split;
|
||||
in
|
||||
lib.lists.foldl' (
|
||||
state: item:
|
||||
state
|
||||
++ [
|
||||
(mergePaths [
|
||||
(if state != [ ] then lib.lists.last state else prefix)
|
||||
item
|
||||
])
|
||||
]
|
||||
) [ ] parents;
|
||||
in
|
||||
{
|
||||
options.environment.persistence =
|
||||
with lib;
|
||||
with types;
|
||||
let
|
||||
isPathLike = strings.hasPrefix "/";
|
||||
in
|
||||
mkOption {
|
||||
type = (
|
||||
addCheck (attrsOf (
|
||||
attrsOf (
|
||||
submodule (
|
||||
{ name, config, ... }:
|
||||
{
|
||||
options = {
|
||||
enable = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Whether to enable the item.";
|
||||
};
|
||||
|
||||
service = mkOption {
|
||||
type = str;
|
||||
readOnly = true;
|
||||
description = ''
|
||||
Systemd service that prepares and syncs the item.
|
||||
Can be used as a dependency in other units.
|
||||
'';
|
||||
};
|
||||
|
||||
mount = mkOption {
|
||||
type = str;
|
||||
readOnly = true;
|
||||
description = ''
|
||||
Systemd mount that binds the item.
|
||||
Can be used as a dependency in other units.
|
||||
'';
|
||||
};
|
||||
|
||||
_path = mkOption {
|
||||
type = str;
|
||||
internal = true;
|
||||
default = name;
|
||||
};
|
||||
|
||||
_sourceRoot = mkOption {
|
||||
type = str;
|
||||
internal = true;
|
||||
};
|
||||
|
||||
_source = mkOption {
|
||||
type = str;
|
||||
internal = true;
|
||||
};
|
||||
|
||||
_targetRoot = mkOption {
|
||||
type = str;
|
||||
internal = true;
|
||||
};
|
||||
|
||||
_target = mkOption {
|
||||
type = str;
|
||||
internal = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
)
|
||||
)) (attrs: lists.all isPathLike (builtins.attrNames attrs))
|
||||
);
|
||||
apply =
|
||||
ps:
|
||||
builtins.mapAttrs (
|
||||
persistence: items:
|
||||
builtins.mapAttrs (
|
||||
_: config:
|
||||
let
|
||||
_path = config._path;
|
||||
|
||||
_sourceRoot = persistence;
|
||||
|
||||
_source = mergePaths [
|
||||
_sourceRoot
|
||||
_path
|
||||
];
|
||||
|
||||
_targetRoot =
|
||||
let
|
||||
parents = lists.reverseList (parentsOf _path);
|
||||
in
|
||||
lists.foldl' (
|
||||
acc: parent:
|
||||
if acc == "/" then
|
||||
lists.findFirst (
|
||||
otherPersistence: lists.any (other: parent == other) (builtins.attrNames ps.${otherPersistence})
|
||||
) "/" (builtins.attrNames ps)
|
||||
else
|
||||
acc
|
||||
) "/" parents;
|
||||
|
||||
_target = mergePaths [
|
||||
_targetRoot
|
||||
_path
|
||||
];
|
||||
in
|
||||
config
|
||||
// {
|
||||
inherit
|
||||
_sourceRoot
|
||||
_source
|
||||
_targetRoot
|
||||
_target
|
||||
;
|
||||
service = "${utils.escapeSystemdPath _target}.service";
|
||||
mount = "${utils.escapeSystemdPath _target}.mount";
|
||||
}
|
||||
) items
|
||||
) ps;
|
||||
default = { };
|
||||
description = "Persistence config.";
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
all = lib.lists.flatten (builtins.concatMap builtins.attrValues (builtins.attrValues cfg));
|
||||
in
|
||||
{
|
||||
fileSystems = builtins.mapAttrs (_: _: { neededForBoot = true; }) cfg;
|
||||
|
||||
systemd = {
|
||||
mounts = builtins.map (c: {
|
||||
description = c._path;
|
||||
requiredBy = [ "local-fs.target" ];
|
||||
requires = [ c.service ];
|
||||
bindsTo = [ c.service ];
|
||||
after = [ c.service ];
|
||||
unitConfig = {
|
||||
ConditionPathExists = [ (lib.strings.escape [ " " ] c._source) ];
|
||||
RefuseManualStart = "yes";
|
||||
RefuseManualStop = "yes";
|
||||
};
|
||||
what = c._source;
|
||||
where = c._target;
|
||||
options = lib.strings.concatStringsSep "," ([
|
||||
"bind"
|
||||
"X-fstrim.notrim"
|
||||
"x-gvfs-hide"
|
||||
]);
|
||||
}) all;
|
||||
|
||||
services = builtins.listToAttrs (
|
||||
builtins.map (c: {
|
||||
name = utils.escapeSystemdPath c._target;
|
||||
value = {
|
||||
description = c._path;
|
||||
after = [ "local-fs-pre.target" ];
|
||||
requiredBy = [
|
||||
"local-fs.target"
|
||||
c.mount
|
||||
];
|
||||
before = [
|
||||
"local-fs.target"
|
||||
c.mount
|
||||
"umount.target"
|
||||
];
|
||||
conflicts = [ "umount.target" ];
|
||||
unitConfig.DefaultDependencies = "no";
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = "yes";
|
||||
};
|
||||
script = ''
|
||||
source=${lib.strings.escapeShellArg c._sourceRoot}
|
||||
target=${lib.strings.escapeShellArg c._targetRoot}
|
||||
path=${lib.strings.escapeShellArg c._path}
|
||||
|
||||
${builtins.readFile ./scripts/start.sh}
|
||||
'';
|
||||
preStop = ''
|
||||
source=${lib.strings.escapeShellArg c._sourceRoot}
|
||||
target=${lib.strings.escapeShellArg c._targetRoot}
|
||||
path=${lib.strings.escapeShellArg c._path}
|
||||
|
||||
${builtins.readFile ./scripts/stop.sh}
|
||||
'';
|
||||
};
|
||||
}) all
|
||||
);
|
||||
};
|
||||
|
||||
assertions =
|
||||
let
|
||||
paths = builtins.map (c: c._path) all;
|
||||
duplicates = lib.lists.filter (t: lib.lists.count (o: o == t) paths > 1) (lib.lists.unique paths);
|
||||
in
|
||||
[
|
||||
{
|
||||
assertion = lib.lists.length duplicates == 0;
|
||||
message = "Each target must be defined under a single persistence. Duplicate targets found: ${lib.concatStringsSep ", " duplicates}";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
19
hosts/common/system/configs/impermanence/scripts/start.sh
Normal file
19
hosts/common/system/configs/impermanence/scripts/start.sh
Normal file
@@ -0,0 +1,19 @@
|
||||
echo "Starting impermanence mount with source: $source, target: $target, path: $path."
|
||||
|
||||
source_current="$source"
|
||||
target_current="$target"
|
||||
|
||||
IFS='/' read -ra path_parts <<< "$path"
|
||||
unset "path_parts[-1]"
|
||||
|
||||
for part in "${path_parts[@]}"; do
|
||||
source_current="$source_current/$part"
|
||||
target_current="$target_current/$part"
|
||||
|
||||
if [ ! -d "$source_current" ]; then
|
||||
break
|
||||
fi
|
||||
|
||||
read -r mode owner group <<< "$(stat -c '%a %u %g' "$source_current")"
|
||||
install -d -m "$mode" -o "$owner" -g "$group" "$target_current"
|
||||
done
|
38
hosts/common/system/configs/impermanence/scripts/stop.sh
Normal file
38
hosts/common/system/configs/impermanence/scripts/stop.sh
Normal file
@@ -0,0 +1,38 @@
|
||||
echo "Stopping impermanence mount with source: $source, target: $target, path: $path."
|
||||
|
||||
source_current="$source"
|
||||
target_current="$target"
|
||||
|
||||
IFS='/' read -ra path_parts <<< "$path"
|
||||
unset "path_parts[-1]"
|
||||
|
||||
for part in "${path_parts[@]}"; do
|
||||
source_current="$source_current/$part"
|
||||
target_current="$target_current/$part"
|
||||
|
||||
if [ ! -d "$target_current" ]; then
|
||||
break
|
||||
fi
|
||||
|
||||
if [ -d "$source_current" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
read -r mode owner group <<< "$(stat -c '%a %u %g' "$target_current")"
|
||||
install -d -m "$mode" -o "$owner" -g "$group" "$source_current"
|
||||
done
|
||||
|
||||
source=$(realpath -m "$source/$path")
|
||||
target=$(realpath -m "$target/$path")
|
||||
|
||||
if [ ! -e "$target" ] || { [ -d "$target" ] && [ -z "$(ls -A "$target")" ]; } || { [ -f "$target" ] && [ ! -s "$target" ]; }; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -e "$source" ]; then
|
||||
>&2 echo "Error: Source $source already exists. Cannot move $target to $source."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Moving target $target to source $source."
|
||||
mv "$target" "$source"
|
@@ -11,7 +11,7 @@ mount /dev/mapper/luks /mnt/btrfs
|
||||
|
||||
if [[ -e /mnt/btrfs/@ ]]; then
|
||||
mkdir -p /mnt/btrfs/@.bak
|
||||
timestamp=$(date --date="@$(stat -c %Y /mnt/btrfs/@)" "+%Y-%m-%-d_%H:%M:%S")
|
||||
timestamp=$(date --date="@$(stat -c %Y /mnt/btrfs/@)" "+%Y-%m-%d_%H:%M:%S")
|
||||
mv /mnt/btrfs/@ "/mnt/btrfs/@.bak/$timestamp"
|
||||
fi
|
||||
|
@@ -1,6 +1,9 @@
|
||||
{ ... }:
|
||||
{ config, ... }:
|
||||
{
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
environment.persistence."/persist".directories = [ "/etc/NetworkManager/system-connections" ];
|
||||
environment.persistence."/persist"."/etc/NetworkManager/system-connections" = { };
|
||||
systemd.services.NetworkManager.after = [
|
||||
config.environment.persistence."/persist"."/etc/NetworkManager/system-connections".mount
|
||||
];
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
{ pkgs, ... }:
|
||||
{ pkgs, config, ... }:
|
||||
{
|
||||
services = {
|
||||
printing = {
|
||||
@@ -19,7 +19,19 @@
|
||||
};
|
||||
|
||||
environment.persistence."/persist" = {
|
||||
directories = [ "/var/lib/cups/ppd" ];
|
||||
files = [ "/var/lib/cups/printers.conf" ];
|
||||
"/var/lib/cups/ppd" = { };
|
||||
"/var/lib/cups/printers.conf" = { };
|
||||
};
|
||||
|
||||
systemd = {
|
||||
services.cups.after = [
|
||||
config.environment.persistence."/persist"."/var/lib/cups/ppd".mount
|
||||
config.environment.persistence."/persist"."/var/lib/cups/printers.conf".mount
|
||||
];
|
||||
sockets.cups.after = [
|
||||
config.environment.persistence."/persist"."/var/lib/cups/ppd".mount
|
||||
config.environment.persistence."/persist"."/var/lib/cups/printers.conf".mount
|
||||
];
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
imports = [ inputs.sops-nix.nixosModules.sops ];
|
||||
|
||||
environment = {
|
||||
persistence."/persist".files = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
persistence."/persist"."/etc/ssh/ssh_host_ed25519_key" = { };
|
||||
systemPackages = with pkgs; [ sops ];
|
||||
};
|
||||
|
||||
|
@@ -6,7 +6,7 @@
|
||||
};
|
||||
|
||||
environment = {
|
||||
persistence."/persist".directories = [ "/var/lib/zsh" ];
|
||||
persistence."/persist"."/var/lib/zsh" = { };
|
||||
pathsToLink = [ "/share/zsh" ];
|
||||
};
|
||||
}
|
||||
|
@@ -1,10 +1,8 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ config, pkgs, ... }:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
in
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
@@ -17,12 +15,12 @@ in
|
||||
programs.adb.enable = true;
|
||||
services.gvfs.enable = true;
|
||||
|
||||
users.users.${username}.extraGroups = [ "adbusers" ];
|
||||
users.users.${user}.extraGroups = [ "adbusers" ];
|
||||
|
||||
environment.persistence."/persist".users.${username}.files = [
|
||||
"${hmConfig.xdg.relativeDataHome}/android/adbkey"
|
||||
"${hmConfig.xdg.relativeDataHome}/android/adbkey.pub"
|
||||
];
|
||||
environment.persistence."/persist" = {
|
||||
"${home}/.local/share/android/adbkey" = { };
|
||||
"${home}/.local/share/android/adbkey.pub" = { };
|
||||
};
|
||||
|
||||
home-manager.users.${username}.home.sessionVariables.ANDROID_USER_HOME = "${hmConfig.xdg.dataHome}/android";
|
||||
home-manager.users.${user}.home.sessionVariables.ANDROID_USER_HOME = "${home}/.local/share/android";
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
@@ -8,7 +9,7 @@
|
||||
...
|
||||
}:
|
||||
{
|
||||
home-manager.users.${username}.systemd.user.services.mpris-proxy = {
|
||||
home-manager.users.${user}.systemd.user.services.mpris-proxy = {
|
||||
Unit = {
|
||||
Description = "MPRIS proxy";
|
||||
Requires = [ "sound.target" ];
|
||||
|
@@ -1,12 +1,13 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
users.users.${username}.extraGroups = [
|
||||
users.users.${user}.extraGroups = [
|
||||
"video"
|
||||
"inputs"
|
||||
];
|
||||
|
||||
home-manager.users.${username}.home.packages = with pkgs; [ brightnessctl ];
|
||||
home-manager.users.${user}.home.packages = with pkgs; [ brightnessctl ];
|
||||
}
|
||||
|
@@ -1,9 +1,10 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ ... }:
|
||||
{
|
||||
home-manager.users.${username}.programs.btop = {
|
||||
home-manager.users.${user}.programs.btop = {
|
||||
enable = true;
|
||||
settings = {
|
||||
theme_background = false;
|
||||
|
@@ -1,15 +1,14 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
utils,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
in
|
||||
{
|
||||
virtualisation.docker.rootless = {
|
||||
enable = true;
|
||||
@@ -29,9 +28,16 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
environment.persistence."/persist".users.${username}.directories = [
|
||||
"${hmConfig.xdg.relativeDataHome}/docker"
|
||||
];
|
||||
environment.persistence."/persist"."${home}/.local/share/docker" = { };
|
||||
|
||||
home-manager.users.${username}.home.packages = with pkgs; [ docker-compose ];
|
||||
systemd.user = {
|
||||
services.docker.after = [
|
||||
config.environment.persistence."/persist"."${home}/.local/share/docker".mount
|
||||
];
|
||||
sockets.docker.after = [
|
||||
config.environment.persistence."/persist"."${home}/.local/share/docker".mount
|
||||
];
|
||||
};
|
||||
|
||||
home-manager.users.${user}.home.packages = with pkgs; [ docker-compose ];
|
||||
}
|
||||
|
@@ -1,7 +1,8 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ ... }:
|
||||
{
|
||||
home-manager.users.${username}.programs.fastfetch.enable = true;
|
||||
home-manager.users.${user}.programs.fastfetch.enable = true;
|
||||
}
|
||||
|
@@ -1,7 +1,8 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home-manager.users.${username}.home.packages = with pkgs; [ ffmpeg ];
|
||||
home-manager.users.${user}.home.packages = with pkgs; [ ffmpeg ];
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
@@ -8,11 +9,10 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
userConfig = config.users.users.${username};
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
userConfig = config.users.users.${user};
|
||||
in
|
||||
{
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
lfs.enable = true;
|
||||
@@ -30,7 +30,7 @@ in
|
||||
core.fsmonitor = true;
|
||||
feature.manyFiles = true;
|
||||
fetch.writeCommitGraph = true;
|
||||
http.cookiefile = "${hmConfig.xdg.configHome}/git/cookies";
|
||||
http.cookiefile = "${home}/.config/git/cookies";
|
||||
};
|
||||
|
||||
hooks = {
|
||||
@@ -45,8 +45,8 @@ in
|
||||
};
|
||||
|
||||
sops.secrets = {
|
||||
"git/credentials".path = "${hmConfig.xdg.configHome}/git/credentials";
|
||||
"git/cookies".path = "${hmConfig.xdg.configHome}/git/cookies";
|
||||
"git/credentials".path = "${home}/.config/git/credentials";
|
||||
"git/cookies".path = "${home}/.config/git/cookies";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
@@ -7,16 +8,11 @@
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
userConfig = config.users.users.${username};
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
gpgPath = "${hmConfig.xdg.dataHome}/gnupg";
|
||||
in
|
||||
{
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
programs.gpg = {
|
||||
enable = true;
|
||||
homedir = gpgPath;
|
||||
homedir = "${home}/.local/share/gnupg";
|
||||
};
|
||||
|
||||
services.gpg-agent = {
|
||||
@@ -37,8 +33,8 @@ in
|
||||
gnupg
|
||||
];
|
||||
runtimeEnv = {
|
||||
GNUPGHOME = gpgPath;
|
||||
HOME = userConfig.home;
|
||||
GNUPGHOME = "${home}/.local/share/gnupg";
|
||||
HOME = home;
|
||||
};
|
||||
text = builtins.readFile ./import-gpg-keys.sh;
|
||||
}
|
||||
@@ -67,7 +63,7 @@ in
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
};
|
||||
|
||||
tmpfiles.rules = [ "d ${gpgPath} 0700 ${username} users -" ];
|
||||
tmpfiles.rules = [ "d ${home}/.local/share/gnupg 0700 ${user} users -" ];
|
||||
};
|
||||
|
||||
sops.secrets = {
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ config, inputs, ... }:
|
||||
{
|
||||
@@ -15,7 +16,7 @@
|
||||
useUserPackages = true;
|
||||
useGlobalPkgs = true;
|
||||
|
||||
users.${username} = {
|
||||
users.${user} = {
|
||||
home.stateVersion = "24.11";
|
||||
systemd.user.startServices = true;
|
||||
nix.settings = config.nix.settings;
|
||||
|
@@ -1,7 +1,8 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home-manager.users.${username}.home.packages = with pkgs; [ imagemagick ];
|
||||
home-manager.users.${user}.home.packages = with pkgs; [ imagemagick ];
|
||||
}
|
||||
|
@@ -1,9 +1,10 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
home.packages = with pkgs; [ ncdu ];
|
||||
|
||||
xdg.configFile."ncdu/config".text = ''
|
||||
|
@@ -1,9 +1,10 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ ... }:
|
||||
{
|
||||
home-manager.users.${username}.programs.neovim = {
|
||||
home-manager.users.${user}.programs.neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
viAlias = true;
|
||||
|
@@ -1,9 +1,10 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ inputs, ... }:
|
||||
{
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
imports = [ inputs.nur.hmModules.nur ];
|
||||
};
|
||||
}
|
||||
|
@@ -1,9 +1,10 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
home.packages = with pkgs; [
|
||||
wireplumber
|
||||
playerctl
|
||||
|
@@ -1,7 +1,8 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ ... }:
|
||||
{
|
||||
home-manager.users.${username}.programs.ranger.enable = true;
|
||||
home-manager.users.${user}.programs.ranger.enable = true;
|
||||
}
|
||||
|
@@ -1,24 +1,18 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ config, inputs, ... }:
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
userConfig = config.users.users.${username};
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
sopsKeyPath = "${hmConfig.xdg.relativeConfigHome}/sops-nix/key.txt";
|
||||
in
|
||||
{
|
||||
environment.persistence."/persist".users.${username}.files = [ sopsKeyPath ];
|
||||
environment.persistence."/persist"."${home}/.config/sops-nix/key.txt" = { };
|
||||
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
imports = [ inputs.sops-nix.homeManagerModules.sops ];
|
||||
|
||||
sops.age.keyFile = "${userConfig.home}/${sopsKeyPath}";
|
||||
home.sessionVariables.SOPS_AGE_KEY_FILE = "${userConfig.home}/${sopsKeyPath}";
|
||||
sops.age.keyFile = "${home}/.config/sops-nix/key.txt";
|
||||
home.sessionVariables.SOPS_AGE_KEY_FILE = "${home}/.config/sops-nix/key.txt";
|
||||
systemd.user.services.sops-nix.Unit.After = [
|
||||
config.environment.persistence."/persist"."${home}/.config/sops-nix/key.txt".mount
|
||||
];
|
||||
};
|
||||
}
|
||||
|
@@ -1,7 +1,8 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ config, ... }:
|
||||
{ config, utils, ... }:
|
||||
{
|
||||
networking.firewall = {
|
||||
allowedTCPPorts = [ 22000 ];
|
||||
@@ -14,17 +15,17 @@
|
||||
sops.secrets = {
|
||||
# openssl genpkey -algorithm RSA -out key.pem -pkeyopt rsa_keygen_bits:3072
|
||||
"syncthing/key" = {
|
||||
owner = username;
|
||||
owner = user;
|
||||
group = "users";
|
||||
};
|
||||
# openssl req -new -x509 -key key.pem -out cert.pem -days 9999 -subj "/CN=syncthing"
|
||||
"syncthing/cert" = {
|
||||
owner = username;
|
||||
owner = user;
|
||||
group = "users";
|
||||
};
|
||||
};
|
||||
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
key = config.sops.secrets."syncthing/key".path;
|
||||
@@ -40,6 +41,9 @@
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.services.syncthing.Unit.After = [ "sops-nix.service" ];
|
||||
systemd.user.services.syncthing.Unit.After = [
|
||||
"sops-nix.service"
|
||||
"local-fs.target"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
@@ -1,7 +1,8 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ ... }:
|
||||
{
|
||||
home-manager.users.${username}.programs.tmux.enable = true;
|
||||
home-manager.users.${user}.programs.tmux.enable = true;
|
||||
}
|
||||
|
@@ -1,7 +1,8 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home-manager.users.${username}.home.packages = with pkgs; [ tree ];
|
||||
home-manager.users.${user}.home.packages = with pkgs; [ tree ];
|
||||
}
|
||||
|
@@ -1,7 +1,8 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home-manager.users.${username}.home.packages = with pkgs; [ wget ];
|
||||
home-manager.users.${user}.home.packages = with pkgs; [ wget ];
|
||||
}
|
||||
|
@@ -1,26 +1,23 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ config, pkgs, ... }:
|
||||
let
|
||||
userConfig = config.users.users.${username};
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
in
|
||||
{
|
||||
environment.persistence."/persist".users.${username}.directories = with hmConfig.xdg.userDirs; [
|
||||
relativeDesktop
|
||||
relativeDocuments
|
||||
relativeDownload
|
||||
relativeMusic
|
||||
relativePictures
|
||||
relativeTemplates
|
||||
relativeVideos
|
||||
"VMs"
|
||||
"git"
|
||||
];
|
||||
environment.persistence."/persist" = {
|
||||
"${home}/Desktop" = { };
|
||||
"${home}/Documents" = { };
|
||||
"${home}/Downloads" = { };
|
||||
"${home}/Music" = { };
|
||||
"${home}/Pictures" = { };
|
||||
"${home}/Templates" = { };
|
||||
"${home}/Videos" = { };
|
||||
"${home}/VMs" = { };
|
||||
"${home}/git" = { };
|
||||
};
|
||||
|
||||
home-manager.users.${username} = {
|
||||
imports = [ ./options.nix ];
|
||||
home-manager.users.${user} = {
|
||||
imports = [ (import ./options.nix { inherit home; }) ];
|
||||
|
||||
xdg = {
|
||||
enable = true;
|
||||
@@ -34,8 +31,8 @@ in
|
||||
userDirs = {
|
||||
enable = true;
|
||||
extraConfig = {
|
||||
XDG_VM_DIR = "${userConfig.home}/VMs";
|
||||
XDG_GIT_DIR = "${userConfig.home}/git";
|
||||
XDG_VM_DIR = "${home}/VMs";
|
||||
XDG_GIT_DIR = "${home}/git";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@@ -1,3 +1,6 @@
|
||||
{
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.xdg;
|
||||
@@ -87,20 +90,23 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config.xdg = with lib; {
|
||||
cacheHome = mkDefault "${config.home.homeDirectory}/${cfg.relativeCacheHome}";
|
||||
configHome = mkDefault "${config.home.homeDirectory}/${cfg.relativeConfigHome}";
|
||||
dataHome = mkDefault "${config.home.homeDirectory}/${cfg.relativeDataHome}";
|
||||
stateHome = mkDefault "${config.home.homeDirectory}/${cfg.relativeStateHome}";
|
||||
config.xdg =
|
||||
with lib;
|
||||
with cfg;
|
||||
{
|
||||
cacheHome = mkDefault "${home}/${relativeCacheHome}";
|
||||
configHome = mkDefault "${home}/${relativeConfigHome}";
|
||||
dataHome = mkDefault "${home}/${relativeDataHome}";
|
||||
stateHome = mkDefault "${home}/${relativeStateHome}";
|
||||
|
||||
userDirs = {
|
||||
desktop = mkDefault "${config.home.homeDirectory}/${cfg.userDirs.relativeDesktop}";
|
||||
documents = mkDefault "${config.home.homeDirectory}/${cfg.userDirs.relativeDocuments}";
|
||||
download = mkDefault "${config.home.homeDirectory}/${cfg.userDirs.relativeDownload}";
|
||||
music = mkDefault "${config.home.homeDirectory}/${cfg.userDirs.relativeMusic}";
|
||||
pictures = mkDefault "${config.home.homeDirectory}/${cfg.userDirs.relativePictures}";
|
||||
templates = mkDefault "${config.home.homeDirectory}/${cfg.userDirs.relativeTemplates}";
|
||||
videos = mkDefault "${config.home.homeDirectory}/${cfg.userDirs.relativeVideos}";
|
||||
userDirs = with userDirs; {
|
||||
desktop = mkDefault "${home}/${relativeDesktop}";
|
||||
documents = mkDefault "${home}/${relativeDocuments}";
|
||||
download = mkDefault "${home}/${relativeDownload}";
|
||||
music = mkDefault "${home}/${relativeMusic}";
|
||||
pictures = mkDefault "${home}/${relativePictures}";
|
||||
templates = mkDefault "${home}/${relativeTemplates}";
|
||||
videos = mkDefault "${home}/${relativeVideos}";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@@ -1,23 +1,21 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ config, ... }:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
in
|
||||
{
|
||||
environment = {
|
||||
sessionVariables.ZDOTDIR = "$HOME/.config/zsh";
|
||||
persistence."/persist".users.${username}.directories = [ "${hmConfig.xdg.relativeDataHome}/zsh" ];
|
||||
persistence."/persist"."${home}/.local/share/zsh" = { };
|
||||
};
|
||||
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
dotDir = "${hmConfig.xdg.relativeConfigHome}/zsh";
|
||||
dotDir = ".config/zsh";
|
||||
autocd = true;
|
||||
history = {
|
||||
path = "${hmConfig.xdg.dataHome}/zsh/history";
|
||||
path = "${home}/.local/share/zsh/history";
|
||||
expireDuplicatesFirst = true;
|
||||
};
|
||||
historySubstringSearch.enable = true;
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
@@ -9,16 +10,15 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
agsConfig = import ./config { inherit pkgs; };
|
||||
in
|
||||
{
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
imports = [ inputs.ags.homeManagerModules.default ];
|
||||
|
||||
programs.ags.enable = true;
|
||||
xdg.configFile."ags/config.js".source = "${agsConfig}/share/config.js";
|
||||
theme.templates."${hmConfig.xdg.configHome}/ags/theme.sass".source = ./theme.sass;
|
||||
theme.templates."${home}/.config/ags/theme.sass".source = ./theme.sass;
|
||||
|
||||
systemd.user = {
|
||||
targets.tray.Unit = {
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
@@ -10,7 +11,7 @@
|
||||
{
|
||||
services.blueman.enable = true;
|
||||
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
services.blueman-applet.enable = true;
|
||||
systemd.user.services.blueman-applet.Unit.After = [ "graphical-session.target" ];
|
||||
};
|
||||
|
@@ -1,14 +1,15 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
users.users.${username}.extraGroups = [
|
||||
users.users.${user}.extraGroups = [
|
||||
"video"
|
||||
"inputs"
|
||||
];
|
||||
|
||||
home-manager.users.${username}.wayland.windowManager.hyprland.settings.bindle =
|
||||
home-manager.users.${user}.wayland.windowManager.hyprland.settings.bindle =
|
||||
let
|
||||
brightnessctl = lib.meta.getExe pkgs.brightnessctl;
|
||||
in
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
@@ -7,15 +8,12 @@
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
in
|
||||
{
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
programs.btop.settings.color_theme = "matugen";
|
||||
|
||||
theme = {
|
||||
templates."${hmConfig.xdg.configHome}/btop/themes/matugen.theme".source = ./theme.theme;
|
||||
templates."${home}/.config/btop/themes/matugen.theme".source = ./theme.theme;
|
||||
|
||||
extraConfig = "${
|
||||
lib.meta.getExe (
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
@@ -8,7 +9,7 @@
|
||||
...
|
||||
}:
|
||||
{
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
services.cbatticon = {
|
||||
enable = true;
|
||||
lowLevelPercent = 20;
|
||||
|
@@ -1,10 +1,8 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ config, ... }:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
in
|
||||
{
|
||||
programs.chromium = {
|
||||
enable = true;
|
||||
@@ -22,11 +20,11 @@ in
|
||||
};
|
||||
|
||||
environment.persistence = {
|
||||
"/persist".users.${username}.directories = [ "${hmConfig.xdg.relativeConfigHome}/chromium" ];
|
||||
"/cache".users.${username}.directories = [ "${hmConfig.xdg.relativeCacheHome}/chromium" ];
|
||||
"/persist"."${home}/.config/chromium" = { };
|
||||
"/cache"."${home}/.cache/chromium" = { };
|
||||
};
|
||||
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
programs.chromium = {
|
||||
enable = true;
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
@@ -7,15 +8,10 @@
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
in
|
||||
{
|
||||
environment.persistence."/cache".users.${username}.directories = [
|
||||
"${hmConfig.xdg.relativeCacheHome}/cliphist"
|
||||
];
|
||||
environment.persistence."/cache"."${home}/.cache/cliphist" = { };
|
||||
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
home.packages = with pkgs; [
|
||||
wl-clipboard
|
||||
cliphist
|
||||
@@ -26,7 +22,10 @@ in
|
||||
Unit = {
|
||||
Description = "Clipboard manager";
|
||||
BindsTo = [ "graphical-session.target" ];
|
||||
After = [ "graphical-session.target" ];
|
||||
After = [
|
||||
"graphical-session.target"
|
||||
config.environment.persistence."/cache"."${home}/.cache/cliphist".mount
|
||||
];
|
||||
};
|
||||
|
||||
Service.ExecStart = lib.meta.getExe (
|
||||
@@ -47,7 +46,10 @@ in
|
||||
Unit = {
|
||||
Description = "Clipboard manager (images)";
|
||||
BindsTo = [ "graphical-session.target" ];
|
||||
After = [ "graphical-session.target" ];
|
||||
After = [
|
||||
"graphical-session.target"
|
||||
config.environment.persistence."/cache"."${home}/.cache/cliphist".mount
|
||||
];
|
||||
};
|
||||
|
||||
Service.ExecStart = lib.meta.getExe (
|
||||
@@ -72,8 +74,8 @@ in
|
||||
wl-copy = "${pkgs.wl-clipboard}/bin/wl-copy";
|
||||
in
|
||||
[
|
||||
"$mod, v, exec, ${cliphist} list | ${rofi} -cache-dir ${hmConfig.xdg.cacheHome}/rofi -dmenu -display-columns 2 | ${cliphist} decode | ${wl-copy}"
|
||||
"$mod_Ctrl, v, exec, ${cliphist} list | ${rofi} -cache-dir ${hmConfig.xdg.cacheHome}/rofi -dmenu -display-columns 2 | ${cliphist} delete"
|
||||
"$mod, v, exec, ${cliphist} list | ${rofi} -cache-dir ${home}/.cache/rofi -dmenu -display-columns 2 | ${cliphist} decode | ${wl-copy}"
|
||||
"$mod_Ctrl, v, exec, ${cliphist} list | ${rofi} -cache-dir ${home}/.cache/rofi -dmenu -display-columns 2 | ${cliphist} delete"
|
||||
"$mod_Ctrl_Shift, v, exec, ${cliphist} wipe"
|
||||
];
|
||||
};
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
@@ -7,16 +8,13 @@
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
in
|
||||
{
|
||||
environment.persistence = {
|
||||
"/persist".users.${username}.directories = [ ".mozilla" ];
|
||||
"/cache".users.${username}.directories = [ "${hmConfig.xdg.relativeCacheHome}/mozilla" ];
|
||||
"/persist"."${home}/.mozilla" = { };
|
||||
"/cache"."${home}/.cache/mozilla" = { };
|
||||
};
|
||||
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
@@ -8,10 +9,10 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
hmConfig = config.home-manager.users.${user};
|
||||
in
|
||||
{
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
gtk = {
|
||||
enable = true;
|
||||
|
||||
@@ -31,7 +32,7 @@ in
|
||||
package = builtins.head hmConfig.theme.icon.packages;
|
||||
};
|
||||
|
||||
gtk2.configLocation = "${hmConfig.xdg.configHome}/gtk-2.0/gtkrc";
|
||||
gtk2.configLocation = "${home}/.config/gtk-2.0/gtkrc";
|
||||
gtk3.extraCss = "@import './theme.css';";
|
||||
gtk4.extraCss = "@import './theme.css';";
|
||||
};
|
||||
@@ -52,8 +53,8 @@ in
|
||||
};
|
||||
|
||||
theme.templates = {
|
||||
"${hmConfig.xdg.configHome}/gtk-3.0/theme.css".source = ./theme.css;
|
||||
"${hmConfig.xdg.configHome}/gtk-4.0/theme.css".source = ./theme.css;
|
||||
"${home}/.config/gtk-3.0/theme.css".source = ./theme.css;
|
||||
"${home}/.config/gtk-4.0/theme.css".source = ./theme.css;
|
||||
};
|
||||
|
||||
theme.extraConfig = "${
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
@@ -7,13 +8,10 @@
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
in
|
||||
{
|
||||
programs.hyprland.enable = true;
|
||||
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
imports = [ ./options.nix ];
|
||||
|
||||
wayland.windowManager.hyprland = {
|
||||
@@ -138,7 +136,7 @@ in
|
||||
'';
|
||||
|
||||
theme = {
|
||||
templates."${hmConfig.xdg.configHome}/hypr/theme.conf".source = ./theme.conf;
|
||||
templates."${home}/.config/hypr/theme.conf".source = ./theme.conf;
|
||||
|
||||
extraConfig = "${
|
||||
lib.meta.getExe (
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
@@ -7,17 +8,14 @@
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
in
|
||||
{
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
home = {
|
||||
packages = with pkgs; [
|
||||
hyprshot
|
||||
swappy
|
||||
];
|
||||
sessionVariables.HYPRSHOT_DIR = "${hmConfig.xdg.userDirs.pictures}/screenshots";
|
||||
sessionVariables.HYPRSHOT_DIR = "Pictures/screenshots";
|
||||
};
|
||||
|
||||
wayland.windowManager.hyprland.settings.bind =
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
@@ -8,14 +9,12 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
hmConfig = config.home-manager.users.${user};
|
||||
in
|
||||
{
|
||||
environment.persistence."/cache".users.${username}.directories = [
|
||||
"${hmConfig.xdg.relativeCacheHome}/kitty"
|
||||
];
|
||||
environment.persistence."/cache"."${home}/.cache/kitty" = { };
|
||||
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
programs.kitty = {
|
||||
enable = true;
|
||||
|
||||
@@ -32,7 +31,7 @@ in
|
||||
};
|
||||
|
||||
theme = {
|
||||
templates."${hmConfig.xdg.configHome}/kitty/theme.conf".source = ./theme.conf;
|
||||
templates."${home}/.config/kitty/theme.conf".source = ./theme.conf;
|
||||
|
||||
extraConfig = "${
|
||||
lib.meta.getExe (
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
@@ -7,20 +8,13 @@
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
in
|
||||
{
|
||||
environment.persistence = {
|
||||
"/persist".users.${username}.directories = [
|
||||
"${hmConfig.xdg.relativeConfigHome}/libreoffice/4/user"
|
||||
];
|
||||
"/cache".users.${username}.directories = [
|
||||
"${hmConfig.xdg.relativeConfigHome}/libreoffice/4/cache"
|
||||
];
|
||||
"/persist"."${home}/.config/libreoffice/4/user" = { };
|
||||
"/cache"."${home}/.config/libreoffice/4/cache" = { };
|
||||
};
|
||||
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
home.packages = with pkgs; [
|
||||
libreoffice-fresh
|
||||
hunspell
|
||||
|
@@ -1,9 +1,10 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ ... }:
|
||||
{
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
services.network-manager-applet.enable = true;
|
||||
systemd.user.services.network-manager-applet.Unit.After = [ "graphical-session.target" ];
|
||||
};
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
@@ -8,14 +9,12 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
hmConfig = config.home-manager.users.${user};
|
||||
in
|
||||
{
|
||||
environment.persistence."/cache".users.${username}.directories = [
|
||||
"${hmConfig.xdg.relativeConfigHome}/obsidian"
|
||||
];
|
||||
environment.persistence."/cache"."${home}/.config/obsidian" = { };
|
||||
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
imports = [ ./options.nix ];
|
||||
|
||||
programs.obsidian = {
|
||||
|
@@ -45,40 +45,6 @@ in
|
||||
with lib;
|
||||
with types;
|
||||
let
|
||||
checkCssPath = path: lib.filesystem.pathIsRegularFile path && lib.strings.hasSuffix ".css" path;
|
||||
|
||||
cssSnippetsOptions =
|
||||
{ config, ... }:
|
||||
{
|
||||
options = {
|
||||
enable = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Whether to enable the snippet.";
|
||||
};
|
||||
|
||||
name = mkOption {
|
||||
type = str;
|
||||
defaultText = literalExpression "lib.strings.removeSuffix \".css\" (builtins.baseNameOf source)";
|
||||
description = "Name of the snippet.";
|
||||
};
|
||||
|
||||
source = mkOption {
|
||||
type = nullOr (addCheck path checkCssPath);
|
||||
description = "Path of the source file.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
text = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Text of the file.";
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
|
||||
config.name = mkDefault (toCssName config.source);
|
||||
};
|
||||
|
||||
corePluginsOptions =
|
||||
{ config, ... }:
|
||||
{
|
||||
@@ -125,6 +91,40 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
checkCssPath = path: lib.filesystem.pathIsRegularFile path && lib.strings.hasSuffix ".css" path;
|
||||
|
||||
cssSnippetsOptions =
|
||||
{ config, ... }:
|
||||
{
|
||||
options = {
|
||||
enable = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
description = "Whether to enable the snippet.";
|
||||
};
|
||||
|
||||
name = mkOption {
|
||||
type = str;
|
||||
defaultText = literalExpression "lib.strings.removeSuffix \".css\" (builtins.baseNameOf source)";
|
||||
description = "Name of the snippet.";
|
||||
};
|
||||
|
||||
source = mkOption {
|
||||
type = nullOr (addCheck path checkCssPath);
|
||||
description = "Path of the source file.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
text = mkOption {
|
||||
type = nullOr str;
|
||||
description = "Text of the file.";
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
|
||||
config.name = mkDefault (toCssName config.source);
|
||||
};
|
||||
|
||||
themesOptions =
|
||||
{ config, ... }:
|
||||
{
|
||||
@@ -292,25 +292,27 @@ in
|
||||
|
||||
corePlugins = mkOption {
|
||||
description = "Core plugins to activate.";
|
||||
type = listOf (either (enum corePlugins) (submodule corePluginsOptions));
|
||||
type = listOf (coercedTo (enum corePlugins) (p: { name = p; }) (submodule corePluginsOptions));
|
||||
default = cfg.sharedSettings.corePlugins;
|
||||
};
|
||||
|
||||
communityPlugins = mkOption {
|
||||
description = "Community plugins to install and activate.";
|
||||
type = listOf (either package (submodule communityPluginsOptions));
|
||||
type = listOf (coercedTo package (p: { pkg = p; }) (submodule communityPluginsOptions));
|
||||
default = cfg.sharedSettings.communityPlugins;
|
||||
};
|
||||
|
||||
cssSnippets = mkOption {
|
||||
description = "CSS snippets to install.";
|
||||
type = listOf (either (addCheck path checkCssPath) (submodule cssSnippetsOptions));
|
||||
type = listOf (
|
||||
coercedTo (addCheck path checkCssPath) (p: { source = p; }) (submodule cssSnippetsOptions)
|
||||
);
|
||||
default = cfg.sharedSettings.cssSnippets;
|
||||
};
|
||||
|
||||
themes = mkOption {
|
||||
description = "Themes to install.";
|
||||
type = listOf (either package (submodule themesOptions));
|
||||
type = listOf (coercedTo package (p: { pkg = p; }) (submodule themesOptions));
|
||||
default = cfg.sharedSettings.themes;
|
||||
};
|
||||
|
||||
@@ -339,15 +341,10 @@ in
|
||||
config =
|
||||
let
|
||||
vaults = builtins.filter (vault: vault.enable == true) (builtins.attrValues cfg.vaults);
|
||||
toName = item: if item ? name then item.name else item;
|
||||
toPkg = item: if item ? pkg then item.pkg else item;
|
||||
isEnabled = item: if item ? enable then item.enable else true;
|
||||
hasOptions = item: item ? options;
|
||||
getCssName = item: if builtins.isAttrs item then item.name else toCssName item;
|
||||
getManifest =
|
||||
item:
|
||||
let
|
||||
manifest = builtins.fromJSON (builtins.readFile "${toPkg item}/manifest.json");
|
||||
manifest = builtins.fromJSON (builtins.readFile "${item.pkg}/manifest.json");
|
||||
in
|
||||
manifest.id or manifest.name;
|
||||
in
|
||||
@@ -366,16 +363,16 @@ in
|
||||
name = "${vault.target}/.obsidian/appearance.json";
|
||||
value =
|
||||
let
|
||||
enabledCssSnippets = builtins.filter isEnabled vault.settings.cssSnippets;
|
||||
activeTheme =
|
||||
lib.lists.findSingle isEnabled null (throw "Only one theme can be enabled at a time.")
|
||||
vault.settings.themes;
|
||||
enabledCssSnippets = builtins.filter (snippet: snippet.enable) vault.settings.cssSnippets;
|
||||
activeTheme = lib.lists.findSingle (
|
||||
theme: theme.enable
|
||||
) null (throw "Only one theme can be enabled at a time.") vault.settings.themes;
|
||||
in
|
||||
{
|
||||
source = (pkgs.formats.json { }).generate "appearance.json" (
|
||||
vault.settings.appearance
|
||||
// {
|
||||
enabledCssSnippets = builtins.map getCssName enabledCssSnippets;
|
||||
enabledCssSnippets = builtins.map (snippet: snippet.name) enabledCssSnippets;
|
||||
}
|
||||
// lib.attrsets.optionalAttrs (activeTheme != null) { cssTheme = getManifest activeTheme; }
|
||||
);
|
||||
@@ -388,7 +385,7 @@ in
|
||||
{
|
||||
name = "${vault.target}/.obsidian/core-plugins.json";
|
||||
value.source = (pkgs.formats.json { }).generate "core-plugins.json" (
|
||||
builtins.map toName vault.settings.corePlugins
|
||||
builtins.map (plugin: plugin.name) vault.settings.corePlugins
|
||||
);
|
||||
}
|
||||
{
|
||||
@@ -397,9 +394,7 @@ in
|
||||
builtins.listToAttrs (
|
||||
builtins.map (name: {
|
||||
inherit name;
|
||||
value = builtins.any (
|
||||
plugin: name == (toName plugin) && isEnabled plugin
|
||||
) vault.settings.corePlugins;
|
||||
value = builtins.any (plugin: name == plugin.name && plugin.enable) vault.settings.corePlugins;
|
||||
}) corePlugins
|
||||
)
|
||||
);
|
||||
@@ -408,7 +403,7 @@ in
|
||||
++ builtins.map (plugin: {
|
||||
name = "${vault.target}/.obsidian/${plugin.name}.json";
|
||||
value.source = (pkgs.formats.json { }).generate "${plugin.name}.json" plugin.options;
|
||||
}) (builtins.filter hasOptions vault.settings.corePlugins);
|
||||
}) (builtins.filter (plugin: plugin.options != { }) vault.settings.corePlugins);
|
||||
|
||||
mkCommunityPlugins =
|
||||
vault:
|
||||
@@ -416,38 +411,35 @@ in
|
||||
{
|
||||
name = "${vault.target}/.obsidian/community-plugins.json";
|
||||
value.source = (pkgs.formats.json { }).generate "community-plugins.json" (
|
||||
builtins.map getManifest (builtins.filter isEnabled vault.settings.communityPlugins)
|
||||
builtins.map getManifest (builtins.filter (plugin: plugin.enable) vault.settings.communityPlugins)
|
||||
);
|
||||
}
|
||||
]
|
||||
++ builtins.map (plugin: {
|
||||
name = "${vault.target}/.obsidian/plugins/${getManifest plugin}";
|
||||
value = {
|
||||
source = toPkg plugin;
|
||||
source = plugin.pkg;
|
||||
recursive = true;
|
||||
};
|
||||
}) vault.settings.communityPlugins
|
||||
++ builtins.map (plugin: {
|
||||
name = "${vault.target}/.obsidian/plugins/${getManifest plugin}/data.json";
|
||||
value.source = (pkgs.formats.json { }).generate "data.json" plugin.options;
|
||||
}) (builtins.filter hasOptions vault.settings.communityPlugins);
|
||||
}) (builtins.filter (plugin: plugin.options != { }) vault.settings.communityPlugins);
|
||||
|
||||
mkCssSnippets =
|
||||
vault:
|
||||
builtins.map (snippet: {
|
||||
name = "${vault.target}/.obsidian/snippets/${getCssName snippet}.css";
|
||||
name = "${vault.target}/.obsidian/snippets/${snippet.name}.css";
|
||||
value =
|
||||
if snippet ? source || snippet ? text then
|
||||
if snippet.source != null then { inherit (snippet) source; } else { inherit (snippet) text; }
|
||||
else
|
||||
{ source = snippet; };
|
||||
if snippet.source != null then { inherit (snippet) source; } else { inherit (snippet) text; };
|
||||
}) vault.settings.cssSnippets;
|
||||
|
||||
mkThemes =
|
||||
vault:
|
||||
builtins.map (theme: {
|
||||
name = "${vault.target}/.obsidian/themes/${getManifest theme}";
|
||||
value.source = toPkg theme;
|
||||
value.source = theme.pkg;
|
||||
}) vault.settings.themes;
|
||||
|
||||
mkHotkeys = vault: {
|
||||
@@ -494,9 +486,7 @@ in
|
||||
{
|
||||
assertion = builtins.all (
|
||||
vault:
|
||||
builtins.all (
|
||||
snippet: (!snippet ? source && !snippet ? text) || (snippet.source == null || snippet.text == null)
|
||||
) vault.settings.cssSnippets
|
||||
builtins.all (snippet: snippet.source == null || snippet.text == null) vault.settings.cssSnippets
|
||||
) (builtins.attrValues cfg.vaults);
|
||||
message = "Only one of `source` and `text` must be set";
|
||||
}
|
||||
|
@@ -1,9 +1,10 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
home.packages = with pkgs; [ pavucontrol ];
|
||||
|
||||
wayland.windowManager.hyprland.settings =
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
lib,
|
||||
@@ -7,9 +8,6 @@
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
in
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
@@ -19,11 +17,9 @@ in
|
||||
})
|
||||
];
|
||||
|
||||
environment.persistence."/cache".users.${username}.files = [
|
||||
"${hmConfig.xdg.relativeConfigHome}/qalculate/qalculate-gtk.history"
|
||||
];
|
||||
environment.persistence."/cache"."${home}/.config/qalculate/qalculate-gtk.history" = { };
|
||||
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
home.packages = with pkgs; [ qalculate-gtk ];
|
||||
|
||||
xdg.configFile."qalculate/qalculate-gtk.cfg".source =
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
@@ -7,11 +8,8 @@
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
in
|
||||
{
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
qt = {
|
||||
enable = true;
|
||||
platformTheme.name = "qtct";
|
||||
@@ -28,9 +26,9 @@ in
|
||||
|
||||
theme.templates = {
|
||||
# https://github.com/GabePoel/KvLibadwaita/blob/main/src/KvLibadwaita/KvLibadwaita.kvconfig
|
||||
"${hmConfig.xdg.configHome}/Kvantum/KvAdwQt/KvAdwQt.kvconfig".source = ./KvAdwQt/KvAdwQt.kvconfig;
|
||||
"${home}/.config/Kvantum/KvAdwQt/KvAdwQt.kvconfig".source = ./KvAdwQt/KvAdwQt.kvconfig;
|
||||
# https://github.com/GabePoel/KvLibadwaita/blob/main/src/KvLibadwaita/KvLibadwaita.svg
|
||||
"${hmConfig.xdg.configHome}/Kvantum/KvAdwQt/KvAdwQt.svg".source = ./KvAdwQt/KvAdwQt.svg;
|
||||
"${home}/.config/Kvantum/KvAdwQt/KvAdwQt.svg".source = ./KvAdwQt/KvAdwQt.svg;
|
||||
};
|
||||
|
||||
xdg.configFile =
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
@@ -8,14 +9,12 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
hmConfig = config.home-manager.users.${user};
|
||||
in
|
||||
{
|
||||
environment.persistence."/cache".users.${username}.directories = [
|
||||
"${hmConfig.xdg.relativeCacheHome}/rofi"
|
||||
];
|
||||
environment.persistence."/cache"."${home}/.cache/rofi" = { };
|
||||
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
programs.rofi = {
|
||||
enable = true;
|
||||
package = pkgs.rofi-wayland;
|
||||
@@ -23,7 +22,7 @@ in
|
||||
};
|
||||
|
||||
wayland.windowManager.hyprland.settings.bind = [
|
||||
"$mod, r, exec, ${lib.meta.getExe pkgs.rofi-wayland} -cache-dir ${hmConfig.xdg.cacheHome}/rofi -show drun"
|
||||
"$mod, r, exec, ${lib.meta.getExe pkgs.rofi-wayland} -cache-dir ${home}/.cache/rofi -show drun"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
@@ -7,9 +8,6 @@
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
in
|
||||
{
|
||||
networking.firewall = {
|
||||
allowedTCPPorts = [ 57621 ];
|
||||
@@ -17,11 +15,11 @@ in
|
||||
};
|
||||
|
||||
environment.persistence = {
|
||||
"/persist".users.${username}.directories = [ "${hmConfig.xdg.relativeConfigHome}/spotify" ];
|
||||
"/cache".users.${username}.directories = [ "${hmConfig.xdg.relativeCacheHome}/spotify" ];
|
||||
"/persist"."${home}/.config/spotify" = { };
|
||||
"/cache"."${home}/.cache/spotify" = { };
|
||||
};
|
||||
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
imports = [ inputs.spicetify-nix.homeManagerModules.default ];
|
||||
|
||||
programs.spicetify =
|
||||
@@ -37,7 +35,7 @@ in
|
||||
|
||||
theme = spicePkgs.themes.sleek // {
|
||||
extraCommands = ''
|
||||
export COLORS_CSS_PATH="${hmConfig.xdg.configHome}/spotify/colors.css"
|
||||
export COLORS_CSS_PATH="${home}/.config/spotify/colors.css"
|
||||
'';
|
||||
|
||||
additionalCss = ''
|
||||
@@ -60,6 +58,6 @@ in
|
||||
];
|
||||
};
|
||||
|
||||
theme.templates."${hmConfig.xdg.configHome}/spotify/colors.css".source = ./colors.css;
|
||||
theme.templates."${home}/.config/spotify/colors.css".source = ./colors.css;
|
||||
};
|
||||
}
|
||||
|
@@ -1,14 +1,16 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
utils,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
hmConfig = config.home-manager.users.${user};
|
||||
themeSwww = lib.meta.getExe (
|
||||
pkgs.writeShellApplication {
|
||||
name = "theme-swww";
|
||||
@@ -21,18 +23,19 @@ let
|
||||
);
|
||||
in
|
||||
{
|
||||
environment.persistence."/cache".users.${username}.directories = [
|
||||
"${hmConfig.xdg.relativeCacheHome}/swww"
|
||||
];
|
||||
environment.persistence."/cache"."${home}/.cache/swww" = { };
|
||||
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
home.packages = with pkgs; [ swww ];
|
||||
|
||||
systemd.user.services.swww = {
|
||||
Unit = {
|
||||
Description = "Wallpaper daemon";
|
||||
BindsTo = [ "graphical-session.target" ];
|
||||
After = [ "graphical-session.target" ];
|
||||
After = [
|
||||
"graphical-session.target"
|
||||
config.environment.persistence."/cache"."${home}/.cache/swww".mount
|
||||
];
|
||||
};
|
||||
|
||||
Service = {
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
@@ -9,15 +10,13 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
hmConfig = config.home-manager.users.${user};
|
||||
themeBin = lib.meta.getExe hmConfig.theme.pkg;
|
||||
in
|
||||
{
|
||||
environment.persistence."/persist".users.${username}.directories = [
|
||||
"${hmConfig.xdg.relativeConfigHome}/theme"
|
||||
];
|
||||
environment.persistence."/persist"."${home}/.config/theme" = { };
|
||||
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
imports = [ ./options.nix ];
|
||||
|
||||
theme.enable = true;
|
||||
|
@@ -1,5 +1,6 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{
|
||||
config,
|
||||
@@ -8,28 +9,28 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
hmConfig = config.home-manager.users.${user};
|
||||
in
|
||||
{
|
||||
environment.persistence = {
|
||||
"/persist".users.${username}.directories = [ "${hmConfig.xdg.relativeConfigHome}/Code" ];
|
||||
"/persist"."${home}/.config/Code" = { };
|
||||
# Bastard: https://github.com/microsoft/vscode/issues/3884
|
||||
"/cache".users.${username}.directories = [
|
||||
"${hmConfig.xdg.relativeConfigHome}/Code/Cache"
|
||||
"${hmConfig.xdg.relativeConfigHome}/Code/CachedConfigurations"
|
||||
"${hmConfig.xdg.relativeConfigHome}/Code/CachedData"
|
||||
"${hmConfig.xdg.relativeConfigHome}/Code/CachedExtensionVSIXs"
|
||||
"${hmConfig.xdg.relativeConfigHome}/Code/CachedExtensions"
|
||||
"${hmConfig.xdg.relativeConfigHome}/Code/CachedProfilesData"
|
||||
"${hmConfig.xdg.relativeConfigHome}/Code/Code Cache"
|
||||
"${hmConfig.xdg.relativeConfigHome}/Code/DawnCache"
|
||||
"${hmConfig.xdg.relativeConfigHome}/Code/GPUCache"
|
||||
"${hmConfig.xdg.relativeConfigHome}/Code/Service Worker/CacheStorage"
|
||||
"${hmConfig.xdg.relativeConfigHome}/Code/Service Worker/ScriptCache"
|
||||
];
|
||||
"/cache" = {
|
||||
"${home}/.config/Code/Cache" = { };
|
||||
"${home}/.config/Code/CachedConfigurations" = { };
|
||||
"${home}/.config/Code/CachedData" = { };
|
||||
"${home}/.config/Code/CachedExtensionVSIXs" = { };
|
||||
"${home}/.config/Code/CachedExtensions" = { };
|
||||
"${home}/.config/Code/CachedProfilesData" = { };
|
||||
"${home}/.config/Code/Code Cache" = { };
|
||||
"${home}/.config/Code/DawnCache" = { };
|
||||
"${home}/.config/Code/GPUCache" = { };
|
||||
"${home}/.config/Code/Service Worker/CacheStorage" = { };
|
||||
"${home}/.config/Code/Service Worker/ScriptCache" = { };
|
||||
};
|
||||
};
|
||||
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
programs.vscode = {
|
||||
enable = true;
|
||||
|
||||
|
@@ -1,7 +1,8 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home-manager.users.${username}.home.packages = with pkgs; [ wev ];
|
||||
home-manager.users.${user}.home.packages = with pkgs; [ wev ];
|
||||
}
|
||||
|
@@ -1,13 +1,11 @@
|
||||
{
|
||||
username ? throw "username argument is required",
|
||||
user ? throw "user argument is required",
|
||||
home ? throw "home argument is required",
|
||||
}:
|
||||
{ config, ... }:
|
||||
let
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
in
|
||||
{
|
||||
home-manager.users.${username} = {
|
||||
home-manager.users.${user} = {
|
||||
home.pointerCursor.x11.enable = true;
|
||||
xresources.path = "${hmConfig.xdg.configHome}/X11/xresources";
|
||||
xresources.path = "${home}/.config/X11/xresources";
|
||||
};
|
||||
}
|
||||
|
@@ -23,6 +23,7 @@
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "umask=0077" ];
|
||||
};
|
||||
};
|
||||
swap = {
|
||||
|
@@ -1,92 +1,97 @@
|
||||
{ config, ... }:
|
||||
let
|
||||
username = "nick";
|
||||
userConfig = config.users.users.${username};
|
||||
hmConfig = config.home-manager.users.${username};
|
||||
# https://github.com/NixOS/nixpkgs/issues/24570
|
||||
# https://github.com/NixOS/nixpkgs/issues/305643
|
||||
user = "nick";
|
||||
home = "/home/nick";
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
../common/user/configs/options.nix
|
||||
(import ../common/user/configs/console/android { inherit username; })
|
||||
(import ../common/user/configs/console/bluetooth { inherit username; })
|
||||
(import ../common/user/configs/console/brightnessctl { inherit username; })
|
||||
(import ../common/user/configs/console/btop { inherit username; })
|
||||
(import ../common/user/configs/console/docker { inherit username; })
|
||||
(import ../common/user/configs/console/fastfetch { inherit username; })
|
||||
(import ../common/user/configs/console/ffmpeg { inherit username; })
|
||||
(import ../common/user/configs/console/git { inherit username; })
|
||||
(import ../common/user/configs/console/gpg-agent { inherit username; })
|
||||
(import ../common/user/configs/console/home-manager { inherit username; })
|
||||
(import ../common/user/configs/console/imagemagick { inherit username; })
|
||||
(import ../common/user/configs/console/ncdu { inherit username; })
|
||||
(import ../common/user/configs/console/neovim { inherit username; })
|
||||
(import ../common/user/configs/console/nixpkgs { inherit username; })
|
||||
(import ../common/user/configs/console/pipewire { inherit username; })
|
||||
(import ../common/user/configs/console/ranger { inherit username; })
|
||||
(import ../common/user/configs/console/sops { inherit username; })
|
||||
(import ../common/user/configs/console/syncthing { inherit username; })
|
||||
(import ../common/user/configs/console/tmux { inherit username; })
|
||||
(import ../common/user/configs/console/tree { inherit username; })
|
||||
(import ../common/user/configs/console/wget { inherit username; })
|
||||
(import ../common/user/configs/console/xdg { inherit username; })
|
||||
(import ../common/user/configs/console/zsh { inherit username; })
|
||||
(import ../common/user/configs/gui/ags { inherit username; })
|
||||
(import ../common/user/configs/gui/bluetooth { inherit username; })
|
||||
(import ../common/user/configs/gui/brightnessctl { inherit username; })
|
||||
(import ../common/user/configs/gui/btop { inherit username; })
|
||||
# (import ../common/user/configs/gui/cbatticon { inherit username; })
|
||||
(import ../common/user/configs/gui/chromium { inherit username; })
|
||||
(import ../common/user/configs/gui/cliphist { inherit username; })
|
||||
(import ../common/user/configs/gui/firefox { inherit username; })
|
||||
(import ../common/user/configs/gui/gtk { inherit username; })
|
||||
(import ../common/user/configs/gui/hyprland { inherit username; })
|
||||
(import ../common/user/configs/gui/hyprshot { inherit username; })
|
||||
(import ../common/user/configs/gui/kitty { inherit username; })
|
||||
(import ../common/user/configs/gui/libreoffice { inherit username; })
|
||||
(import ../common/user/configs/gui/networking { inherit username; })
|
||||
(import ../common/user/configs/gui/obsidian { inherit username; })
|
||||
(import ../common/user/configs/gui/pipewire { inherit username; })
|
||||
(import ../common/user/configs/gui/qalculate { inherit username; })
|
||||
(import ../common/user/configs/gui/qt { inherit username; })
|
||||
(import ../common/user/configs/gui/rofi { inherit username; })
|
||||
(import ../common/user/configs/gui/spicetify { inherit username; })
|
||||
(import ../common/user/configs/gui/swww { inherit username; })
|
||||
(import ../common/user/configs/gui/theme { inherit username; })
|
||||
(import ../common/user/configs/gui/vscode { inherit username; })
|
||||
(import ../common/user/configs/gui/wev { inherit username; })
|
||||
(import ../common/user/configs/gui/x11 { inherit username; })
|
||||
(import ../common/user/configs/console/android { inherit user home; })
|
||||
(import ../common/user/configs/console/bluetooth { inherit user home; })
|
||||
(import ../common/user/configs/console/brightnessctl { inherit user home; })
|
||||
(import ../common/user/configs/console/btop { inherit user home; })
|
||||
(import ../common/user/configs/console/docker { inherit user home; })
|
||||
(import ../common/user/configs/console/fastfetch { inherit user home; })
|
||||
(import ../common/user/configs/console/ffmpeg { inherit user home; })
|
||||
(import ../common/user/configs/console/git { inherit user home; })
|
||||
(import ../common/user/configs/console/gpg-agent { inherit user home; })
|
||||
(import ../common/user/configs/console/home-manager { inherit user home; })
|
||||
(import ../common/user/configs/console/imagemagick { inherit user home; })
|
||||
(import ../common/user/configs/console/ncdu { inherit user home; })
|
||||
(import ../common/user/configs/console/neovim { inherit user home; })
|
||||
(import ../common/user/configs/console/nixpkgs { inherit user home; })
|
||||
(import ../common/user/configs/console/pipewire { inherit user home; })
|
||||
(import ../common/user/configs/console/ranger { inherit user home; })
|
||||
(import ../common/user/configs/console/sops { inherit user home; })
|
||||
(import ../common/user/configs/console/syncthing { inherit user home; })
|
||||
(import ../common/user/configs/console/tmux { inherit user home; })
|
||||
(import ../common/user/configs/console/tree { inherit user home; })
|
||||
(import ../common/user/configs/console/wget { inherit user home; })
|
||||
(import ../common/user/configs/console/xdg { inherit user home; })
|
||||
(import ../common/user/configs/console/zsh { inherit user home; })
|
||||
(import ../common/user/configs/gui/ags { inherit user home; })
|
||||
(import ../common/user/configs/gui/bluetooth { inherit user home; })
|
||||
(import ../common/user/configs/gui/brightnessctl { inherit user home; })
|
||||
(import ../common/user/configs/gui/btop { inherit user home; })
|
||||
(import ../common/user/configs/gui/chromium { inherit user home; })
|
||||
(import ../common/user/configs/gui/cliphist { inherit user home; })
|
||||
(import ../common/user/configs/gui/firefox { inherit user home; })
|
||||
(import ../common/user/configs/gui/gtk { inherit user home; })
|
||||
(import ../common/user/configs/gui/hyprland { inherit user home; })
|
||||
(import ../common/user/configs/gui/hyprshot { inherit user home; })
|
||||
(import ../common/user/configs/gui/kitty { inherit user home; })
|
||||
(import ../common/user/configs/gui/libreoffice { inherit user home; })
|
||||
(import ../common/user/configs/gui/networking { inherit user home; })
|
||||
(import ../common/user/configs/gui/obsidian { inherit user home; })
|
||||
(import ../common/user/configs/gui/pipewire { inherit user home; })
|
||||
(import ../common/user/configs/gui/qalculate { inherit user home; })
|
||||
(import ../common/user/configs/gui/qt { inherit user home; })
|
||||
(import ../common/user/configs/gui/rofi { inherit user home; })
|
||||
(import ../common/user/configs/gui/spicetify { inherit user home; })
|
||||
(import ../common/user/configs/gui/swww { inherit user home; })
|
||||
(import ../common/user/configs/gui/theme { inherit user home; })
|
||||
(import ../common/user/configs/gui/vscode { inherit user home; })
|
||||
(import ../common/user/configs/gui/wev { inherit user home; })
|
||||
(import ../common/user/configs/gui/x11 { inherit user home; })
|
||||
];
|
||||
|
||||
sops.secrets."${username}-password" = {
|
||||
sopsFile = ../../users/${username}/secrets/secrets.yaml;
|
||||
sops.secrets."${user}-password" = {
|
||||
sopsFile = ../../users/${user}/secrets/secrets.yaml;
|
||||
key = "password";
|
||||
neededForUsers = true;
|
||||
};
|
||||
|
||||
users.users.${username} = {
|
||||
users.users.${user} = {
|
||||
inherit home;
|
||||
isNormalUser = true;
|
||||
email = "nick@karaolidis.com";
|
||||
fullName = "Nikolaos Karaolidis";
|
||||
description = userConfig.fullName;
|
||||
hashedPasswordFile = config.sops.secrets."${username}-password".path;
|
||||
description = "Nikolaos Karaolidis";
|
||||
hashedPasswordFile = config.sops.secrets."${user}-password".path;
|
||||
extraGroups = [ "wheel" ];
|
||||
linger = true;
|
||||
uid = 1000;
|
||||
};
|
||||
|
||||
services.getty.autologinUser = userConfig.name;
|
||||
services.getty.autologinUser = user;
|
||||
|
||||
home-manager.users.${username} = {
|
||||
home.homeDirectory = userConfig.home;
|
||||
sops.defaultSopsFile = ../../users/${username}/secrets/secrets.yaml;
|
||||
theme.wallpaper = ../../users/${username}/secrets/wallpapers/clouds.png;
|
||||
home-manager.users.${user} = {
|
||||
home = {
|
||||
username = user;
|
||||
homeDirectory = home;
|
||||
};
|
||||
|
||||
programs.obsidian.vaults."${hmConfig.xdg.userDirs.relativeDocuments}/Obsidian/master".enable = true;
|
||||
sops.defaultSopsFile = ../../users/${user}/secrets/secrets.yaml;
|
||||
theme.wallpaper = ../../users/${user}/secrets/wallpapers/clouds.png;
|
||||
|
||||
programs.obsidian.vaults."Documents/Obsidian/master".enable = true;
|
||||
|
||||
services.syncthing.settings.folders = {
|
||||
obsidian = {
|
||||
label = "Obsidian";
|
||||
path = "${hmConfig.xdg.userDirs.documents}/Obsidian";
|
||||
path = "Documents/Obsidian";
|
||||
devices = [
|
||||
"amalthea"
|
||||
"ganymede"
|
||||
@@ -94,7 +99,7 @@ in
|
||||
};
|
||||
official = {
|
||||
label = "Official";
|
||||
path = "${hmConfig.xdg.userDirs.documents}/Official";
|
||||
path = "Documents/Official";
|
||||
devices = [
|
||||
"amalthea"
|
||||
"ganymede"
|
||||
@@ -102,6 +107,6 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
home.file."${hmConfig.xdg.userDirs.documents}/Obsidian/.stignore".source = ../common/user/configs/gui/obsidian/config/.stignore;
|
||||
home.file."Documents/Obsidian/.stignore".source = ../common/user/configs/gui/obsidian/config/.stignore;
|
||||
};
|
||||
}
|
||||
|
Submodule submodules/home-manager updated: bd83e8a0c3...82b0b4fbd2
Submodule submodules/impermanence deleted from 720ee9a1b0
Submodule submodules/nixpkgs updated: 18afacac0e...c172886f0a
Reference in New Issue
Block a user