Skip to content

Commit

Permalink
allow for missing switch-to-configuration directory
Browse files Browse the repository at this point in the history
NixOS' switch-to-configuration program creates the /run/nixos directory,
which may not be present if `system.switch.enable` is `false`.
  • Loading branch information
jmbaur authored and mergify[bot] committed Nov 18, 2024
1 parent 472741c commit e39947d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkgs/sops-install-secrets/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e39947d

Please sign in to comment.