mirror of
https://github.com/Mic92/sops-nix.git
synced 2024-12-14 11:57:52 +00:00
allow for missing switch-to-configuration directory
NixOS' switch-to-configuration program creates the /run/nixos directory, which may not be present if `system.switch.enable` is `false`.
This commit is contained in:
parent
472741cf3f
commit
e39947d0ee
1 changed files with 7 additions and 0 deletions
|
@ -978,6 +978,13 @@ func handleModifications(isDry bool, logcfg loggingConfig, symlinkPath string, s
|
|||
|
||||
writeLines := func(list []string, file string) error {
|
||||
if len(list) != 0 {
|
||||
if _, err := os.Stat(filepath.Dir(file)); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return nil
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
}
|
||||
f, err := os.OpenFile(file, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0o600)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in a new issue