Commit Graph

20 Commits

Author SHA1 Message Date
Nick Hassan
5f694ef481
add support for entering password for sudo 2024-02-16 23:21:25 +10:30
Roman Melnikov
f26e888c41
[#201] Deduce profile directory during activation
Problem: Since https://github.com/NixOS/nix/pull/5226 nix profiles for
users are stored in 'XDG_STATE_HOME' or 'HOME' directory. However,
'deploy-rs' still expects profiles to be present in
'/nix/var/nix/profiles/per-user'. As a result, an attempt to deploy a
profile with newer nix may fail with an error about non-existing files.

Solution: Instead of deducing the profile path prior to ssh'ing and
actual activation, deduce the path to the profile during as a part of
'activate-rs' invocation.

Now if the profile path is not specified explicitly as an attribute in
profile within the deploy flake, the path to the profile is determined
based on the user to which the profile belongs and on the values of
'XDG_STATE_HOME' and 'HOME' variables.
Additionally, if the old profile directory (in
'/nix/var/nix/profiles/per-user') for a given user already exists, it is
used instead for the sake of backward compatibility.
2023-09-12 12:00:17 +02:00
Roman Melnikov
784e9ee24d
[Chore] Handle 'temp_path' as an actual 'Path' instead of 'String'
Problem: 'temp_path' and 'lock_path' are handled as 'String'.
This can be a problem when the 'temp_path' directory is a symlink
on the target system, e.g. this is the case with the default
'/tmp' and macOS, where this directory is actually a symlink to '/private/tmp'.

Solution: Handle 'temp_path' and 'lock_path' as actual Paths.
Also, canonicalize 'temp_path' to avoid canary file path mismatches when checking
filesystem events.

As a side effect, also update the 'notify' dependency to the latest stable version.
2023-04-20 15:13:13 +08:00
Timothy DeHerrera
f2a3044a0d
optimize release build for size 2022-01-13 15:33:06 -07:00
Timothy DeHerrera
1b08f09f49
update tokio 2021-07-29 18:17:47 -06:00
Bernardo Meurer
9c32ddeb05
changed: sort Cargo.toml 2021-01-26 10:33:06 -08:00
Bernardo Meurer
815814529e
changed: remove 2015-style extern crate 2021-01-26 10:33:05 -08:00
notgne2
70c55363a9
Restructure project 2021-01-08 18:24:04 -07:00
notgne2
b6a6abe104
Modify activation logic to keep SSH connection alive for magic-rollback and avoid forking or disconnecting std{out,err} 2020-12-30 20:25:59 -07:00
notgne2
4461d1ea3f
Replace logger, add more logging options including files 2020-12-27 10:52:37 -07:00
Andreas Fuchs
3bcb3879bd Update tokio & pull in notify, instead of inotify
The notify crate is cross-platform, and the newer tokio has some bug
fixes. Let's use those.
2020-12-15 13:00:01 -07:00
Andreas Fuchs
c9eb270a8b
Debump the smol_str version to 0.1.16 to build on rust 1.45.2 (#28)
* Debump the smol_str version to 0.1.16 to build on rust 1.45.2

Rust 1.45.2 is what ships in the 20.09 release, and smol_str 0.1.17 is
incompatible with it.

* Clarify version bounds on the smol_str dependency
2020-12-15 12:08:31 -07:00
notgne2
fa4c0a86cd
Use crude Nix parsing for parsing the flake path 2020-11-29 11:51:52 -07:00
notgne2
45e99a75f9
Partially add deployment confirmation utilities (for #4) 2020-11-22 20:03:04 -07:00
notgne2
ca86bab9e9
Make all the errors work correctly (I am so so sorry) 2020-10-29 19:33:53 -07:00
notgne2
dfb77a02bb
Fix authors list in package definition 2020-10-29 11:00:22 -07:00
notgne2
3bd43f92e6
Auto rollback if deployment is not confirmed 2020-10-13 18:27:27 -07:00
notgne2
8d21dd335e Add license information, reformat Nix files, clean up 2020-09-29 15:10:06 -07:00
notgne2
239d0f8999
use separate binary for activation, more cleanup 2020-09-28 15:45:53 -07:00
notgne2
76dbef54af
stuff 2020-09-28 10:48:21 -07:00