install-iwd: port to static-nix-shell

This commit is contained in:
Colin 2023-05-14 10:32:20 +00:00
parent 51ca72da84
commit b403348e43
2 changed files with 11 additions and 2 deletions

View File

@ -1,12 +1,20 @@
{ config, lib, pkgs, ... }:
let
install-iwd = pkgs.static-nix-shell.mkBash {
pname = "install-iwd";
src = ../../../../scripts;
pkgs = [ "gnused" ];
};
in
{
config = lib.mkIf config.sane.roles.client {
sane.fs."/var/lib/iwd/.secrets.psk.stamp" = {
wantedBeforeBy = [ "iwd.service" ];
generated.acl.mode = "0600";
# XXX: install-iwd uses sed, but that's part of the default systemd unit path, it seems
generated.script.script = builtins.readFile ../../../../scripts/install-iwd + ''
generated.script.script = ''
${install-iwd}/bin/install-iwd $@
touch "/var/lib/iwd/.secrets.psk.stamp"
'';
generated.script.scriptArgs = [ "/run/secrets/net" "/var/lib/iwd" ];

View File

@ -1,4 +1,5 @@
#!/bin/sh
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p gnused
# usage: install-iwd <source_dir> <dest_dir>
# source_dir contains plain-text .psk files of any filename.
# for each file, this extracts the SSID and creates a symlink in dest_dir which