usernix: Added
This commit is contained in:
parent
82caafaceb
commit
5b85606831
|
@ -9,6 +9,7 @@
|
||||||
./gaming
|
./gaming
|
||||||
./ssh.nix
|
./ssh.nix
|
||||||
./style.nix
|
./style.nix
|
||||||
|
./usernix
|
||||||
./vim.nix
|
./vim.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
51
hm/usernix/default.nix
Normal file
51
hm/usernix/default.nix
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
{ pkgs, lib, config, ... }:
|
||||||
|
let
|
||||||
|
ensureNixPath = "${config.xdg.configHome}/dotfiles/ensure_nix.sh";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
config = lib.mkIf config.frogeye.userNix {
|
||||||
|
home.activation = {
|
||||||
|
# When Nix is installed in the user directory via a proot, systemd --user
|
||||||
|
# is started outside of it, so it cannot access /nix. So we need to:
|
||||||
|
# - Ensure files systemd access aren't via /nix.
|
||||||
|
# Sometimes there's multiple layers of redirection, so easiest way is
|
||||||
|
# to copy the file outside the repository, but if using regular files
|
||||||
|
# directly home-manager will complain that it will overwrite
|
||||||
|
# something it didn't write.
|
||||||
|
# - Wrap services entrypoints into a proot wrapper
|
||||||
|
prootSystemd = lib.hm.dag.entryAfter [ "linkGeneration" ] [ "reloadSystemd" ] ''
|
||||||
|
cd ${config.xdg.configHome}/systemd/user
|
||||||
|
${pkgs.findutils}/bin/find . -type l | while read path
|
||||||
|
do
|
||||||
|
${pkgs.gnused}/bin/sed 's|^Exec\S\+=|\0${ensureNixPath} |' "$path" > "''${path}-proot"
|
||||||
|
rm "$path"
|
||||||
|
ln -s "''${path}-proot" "$path"
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
# I wonder if it's possible to do this in a slightly more Nix way, without causing infinite recursion
|
||||||
|
|
||||||
|
# Create a graphical entrypoint by overriding one of the OS programs
|
||||||
|
graphicalEntrypoints =
|
||||||
|
let
|
||||||
|
graphicalEntrypoint = pkgs.writeTextFile {
|
||||||
|
name = "graphical-entrypoint";
|
||||||
|
text = ''
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
exec ${ensureNixPath} ${config.xsession.scriptPath}
|
||||||
|
'';
|
||||||
|
executable = true;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
lib.mkIf config.frogeye.desktop.xorg
|
||||||
|
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||||
|
cp -f ${graphicalEntrypoint} ${config.home.homeDirectory}/.local/bin/cinnamon-session-cinnamon
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# Some systemd options don't work if you're running a proot inside, so they need to be relaxed
|
||||||
|
# TODO Following is what's necessary to remove for Syncthing to work. Might be applicable on all services.
|
||||||
|
# PrivateUsers=true
|
||||||
|
# RestrictNamespaces=true
|
||||||
|
# SystemCallFilter=@system-service
|
||||||
|
};
|
||||||
|
}
|
|
@ -3,6 +3,7 @@
|
||||||
options.frogeye = {
|
options.frogeye = {
|
||||||
extra = lib.mkEnableOption "Big software";
|
extra = lib.mkEnableOption "Big software";
|
||||||
gaming = lib.mkEnableOption "Games";
|
gaming = lib.mkEnableOption "Games";
|
||||||
|
userNix = lib.mkEnableOption "Nix is \"installed\" in ~/.nix";
|
||||||
polarity = lib.mkOption {
|
polarity = lib.mkOption {
|
||||||
default = "dynamic";
|
default = "dynamic";
|
||||||
description = "Whether to use light theme or dark theme.";
|
description = "Whether to use light theme or dark theme.";
|
||||||
|
|
Loading…
Reference in a new issue