Commit graph

85 commits

Author SHA1 Message Date
Gabriel Fontes
fc9ca99ef8
home-manager: adds configurable symlink/bindfs option 2022-08-22 11:31:31 -03:00
Kim Lindberger
2f39baeb7d
Merge pull request #85 from nix-community/minimize-activation-script-debug
nixos: Minimize activation script debug, add debugging, and more
2022-03-01 11:44:19 +01:00
talyz
95f9089e86
nixos: Minimize the amount of text added to the activation script
This is done to reduce the risk of build errors, isolate each run of
the script and reduce the amount of replicated code.

- Make the file mount script generated by `mkMountScript` a discrete
  script and only generate its invocations.

- Wrap the script invocations in scripts.
2022-02-16 15:24:47 +01:00
talyz
e8a4cefe13
nixos: Add an internal debugging option to aid script debugging 2022-02-16 13:40:17 +01:00
talyz
6ee09b4a71
create-directories: Set noglob and inherit_errexit, document options
In addition to the currently set bash options, set `noglob` and
`inherit_errexit`.

- `noglob` disables filename expansion, which could happen in the for
  loop where we do path splitting if the path contains characters
  recognized by bash as wildcards, such as `?` or `*`.

- `inherit_errexit` makes subshells inherit the status of the
  `errexit` option.
2022-02-16 13:25:17 +01:00
talyz
635bcd2d88
Add missing descriptions and improve existing ones
Closes #81
2022-02-13 23:27:11 +01:00
Kim Lindberger
bc3376a8e5
Merge pull request #82 from crunchcat/speify-main-flake-modules
Add default NixOS module to flake
2022-02-11 20:43:12 +01:00
crunchcat
7a36ba9279 Add default NixOS module to flake 2022-02-10 22:39:01 -05:00
maydayv7
ff540dbe20 docs: Document hideMounts Option 2022-02-04 14:41:56 -08:00
maydayv7
5f5bafee3a feat: Support Hiding of Bind Mounts
This is done using `x-gvfs-hide` Mount Option
2022-02-04 14:41:56 -08:00
talyz
423940122a nixos: Fix the path splitting in create-directories.bash
Previously, paths were split on bash's default delimiters (space, tab
and newline) with slashes converted to space. This meant paths
containing any such delimiters were incorrectly handled.

Fix this by temporarily replacing bash's default delimiters with `/`,
making sure this is the only character we split on.
2022-02-02 12:15:21 -08:00
talyz
65caf299a5
nixos: Fix user permissions for string type files and directories
Set the permissions for user directories and files properly when
converting them from string to submodule. Previously, they would use
the root default of `root:root`.

Fixes #74.
2022-02-02 10:09:42 +01:00
Bernardo Meurer
05cc388c3e fix(nixos): allow eval to succeed when the module is unused 2022-01-31 11:42:45 -08:00
Bernardo Meurer
3fe959d3dc refactor: utillinux -> util-linux 2022-01-31 11:12:51 -08:00
talyz
406924e62e nixos: Add support for custom permissions on created directories
Allow the owner and mode to be set when directories are created in
persistent storage by the `create-directories.bash` script. Very
useful for directories used to store secrets.

Also, make sure the user directories are created with reasonable
defaults, i.e. owned by the user and its group, not by `root:root`.
2022-01-31 11:12:29 -08:00
talyz
7f12a9d7cc nixos: Implement support for user files and directories
Allow user files and directories to be specified as follows:

environment.persistence."/persistent" = {
  users.talyz = {
    files = [
      ".screenrc"
    ];
    directories = [
      "Downloads"
    ];
  };
};

This provides an alternative to the home-manager module and may even
deprecate it in the future.
2022-01-31 11:12:29 -08:00
talyz
5738763c8d nixos: Assert that no duplicate files or directories are specified 2022-01-31 11:12:29 -08:00
talyz
0befe72b48 nixos: Refactor the module to simplify future extensibility
Implement support for a submodule representation for files and
directories. Strings are automatically converted to appropriate
submodule representations and each file and directory is handled based
only on their respective submodule's attributes. This means that for
most files, a string will suffice, but if more advanced options need
to be set for the specific files or directories, a submodule can be
used instead. It also, arguably, simplifies the implementation a bit.
2022-01-31 11:12:29 -08:00
Kim Lindberger
ff2240b04f
Merge pull request #67 from olmokramer/escape-directories
home-manager: Fix unquoted path when creating directories
2022-01-16 20:45:10 +01:00
Olmo Kramer
46aa52de9f
home-manager: Fix unquoted path when creating directories 2022-01-03 19:57:15 +01:00
Kim Lindberger
29d781b47b
Merge pull request #62 from nix-community/home-manager-start-early
home-manager: Start the bind units as early as possible
2021-12-29 21:13:21 +01:00
talyz
085284c398
home-manager: Start the bind units as early as possible 2021-12-28 20:43:39 +01:00
Kim Lindberger
0d03fa3d93
Merge pull request #61 from lourkeur/hm-bindfs-race
home-manager: allow dependencies on bind mounts
2021-12-28 15:51:46 +01:00
Louis Bettens
77a0cebfdd home-manager: allow dependencies on bind mounts 2021-12-27 17:37:29 +01:00
Bernardo Meurer
df5038f20c
Merge pull request #43 from RiscadoA/master
Added home manager module to flake.nix
2021-12-08 08:44:21 -08:00
Kim Lindberger
0616c64b0e
Merge pull request #55 from nix-community/hm-create-target-directories-for-files
home-manager: Create missing target directories for files
2021-11-19 00:30:00 +01:00
Bernardo Meurer
b74f468e4e
Merge pull request #44 from nix-community/systemd-service-files
nixos: Manage files using systemd services
2021-11-18 11:36:07 -08:00
talyz
96fc5494dc
nixos: Manage files using systemd services
Manage files by creating a systemd oneshot service for each file. The
service links or bind mounts the file as appropriate on start and
removes the link or unmounts it when stopped. Whether a symlink or
bind mount is used is determined by if the target exists - if it does,
it's bind mounted, otherwise symlinked. To make sure files are
available early enough, also run the start portion in the activation
script.

This lifts the restriction on files being placed in `/etc` and should
finally close #1.
2021-11-17 09:12:36 +01:00
Bernardo Meurer
26d69654e7
Merge pull request #56 from adisbladis/bash-exec
home-manager: Use bash exec when calling bindfs
2021-11-15 20:12:14 -08:00
adisbladis
4b4bf5026a
home-manager: Use bash exec when calling bindexec
Right now the shell script wrapper doesn't exit which results in a lot of unnecessary bash processes.
2021-11-15 23:10:59 +00:00
talyz
6b474b097a
home-manager: Create missing target directories for files
Create missing parent directories for nonexistent files in persistent
storage.

Reported in #53.
2021-11-14 19:19:17 +01:00
Kim Lindberger
00df1e57bb
Merge pull request #54 from nix-community/fix-ci
ci: Use nix-shell instead of nix run
2021-11-13 15:13:35 +01:00
talyz
4269cf2fbb
ci: Use nix-shell instead of nix run
Since the release of Nix 2.4, the ci pipeline is broken, as the syntax
and behavior of nix run changed. The command is also considered
experimental. Switch to using nix-shell instead.
2021-11-13 14:37:18 +01:00
talyz
ce77ed9bd0
README: Add note about using home-manager as a NixOS module
Fixes #52.
2021-10-29 16:20:58 +02:00
RiscadoA
80fc82343a
Added home manager module to flake 2021-09-01 16:48:14 +01:00
talyz
58558845bc
home-manager: Create the mount point in the systemd service
This is purely for convenience when fiddling with the services
manually, since the directory is created by the activation script
already.
2021-01-27 12:39:08 +01:00
talyz
48b5d5291c
home-manager: Simplify the directory creation
The checks should be unnecessary, since `mkdir -p` is idempotent.
2021-01-27 12:37:08 +01:00
talyz
4d655d7842
home-manager: Add allowOther option to let other users read bind mounts
NixOS defaults to not letting fuse mounts be allowed to let other
users read their contents. `bindfs` wants to give other users access
and is therefore normally run with `--no-allow-other` to not throw an
error.

Giving other users, mainly `root`, access to the bind mounts is,
however, useful and works fine when

programs.fuse.userAllowOther = true;

is declared in `configuration.nix`. This adds an option to choose
whether to give other users access or not. It also prompts the user to
set the `allowOther` attribute with a link to the documentation.
2021-01-27 12:35:27 +01:00
talyz
48f3a3018e
home-manager: Fix the fix
`let` variables have priority over `with` imports, argh
2021-01-27 12:34:21 +01:00
talyz
a1dfdfa1aa
home-manager: Fix bindfs options
No flag should be passed when the option list is empty.
2021-01-26 22:31:17 +01:00
talyz
77302d9381
home-manager: Document options, update readme 2021-01-25 00:15:36 +01:00
talyz
43095936d4
home-manager: Use the fsname option of the latest bindfs release
This makes changing bindfs target directories more reliable when their
paths contain spaces or commas. See
https://github.com/mpartel/bindfs/issues/94 for details.
2021-01-24 23:26:22 +01:00
talyz
e6d15a7cbb
home-manager: Don't remount when bindfs is found instead of target
Due to what is likely a bug in bindfs or fuse, the target path is
sometimes missing from the mount entry. This causes false positives
for the target directory having changed, leading to unnecessary
remounts. Luckily, it seems that when this happens, the line instead
contains the string `bindfs`, which it doesn't normally, so we can at
least circumvent this issue to some degree.
2021-01-24 11:57:21 +01:00
talyz
47147e71ff
home-manager: Fix unmounts in the activation script for recent HM
Find the correct name of the activation script entry responsible for
reloading systemd user services. The name was initially
`reloadSystemD` but has been changed to `reloadSystemd`, causing
failures due to the unmounts being done after the systemd services are
reloaded.
2021-01-24 11:56:48 +01:00
talyz
41bddc6661
nixos: Fix No such file or directory errors on fresh installs
If there were multiple levels of directories which hadn't yet been
created in persistent storage, the `create-directories.bash` script
would error out when running `realpath` on the path. To allow this,
`realpath` has to be run with `-m`.
2021-01-23 16:20:04 +01:00
talyz
2cda5cd30b
nixos: Create directories of files in persistent storage 2020-12-14 17:33:30 +01:00
talyz
3cea211006
nixos: Extract the createDirectories script out into its own file 2020-12-14 17:33:24 +01:00
talyz
74de76031f
nixos: Add description and examples 2020-12-14 17:10:34 +01:00
Cole Helbling
4c7871a86a flake: remove unused nixpkgs input
Packages are retrieved from the `pkgs` module argument, rather than
Nixpkgs itself.
2020-11-29 07:49:21 -08:00
Kim Lindberger
a7169e575a
Merge pull request #16 from danieldk/flake
Make impermanence a flake
2020-11-26 22:18:17 +01:00