tangled
alpha
login
or
join now
pvsr.dev
/
nixfiles
0
fork
atom
NixOS system configurations + dotfiles via home-manager
0
fork
atom
overview
issues
pulls
pipelines
automatically update flake.nix on a branch
pvsr.dev
2 months ago
8fc9faa5
3d097fcf
+51
1 changed file
expand all
collapse all
unified
split
modules
flake
update.nix
+51
modules/flake/update.nix
reviewed
···
1
1
+
{
2
2
+
flake.modules.hjem.grancel =
3
3
+
{ pkgs, ... }:
4
4
+
{
5
5
+
systemd = {
6
6
+
services.update-flake.path = with pkgs; [
7
7
+
lix
8
8
+
jujutsu
9
9
+
git
10
10
+
openssh
11
11
+
];
12
12
+
services.update-flake.serviceConfig = {
13
13
+
Type = "oneshot";
14
14
+
ExecStart = pkgs.writers.writeFish "update-flake" ''
15
15
+
test -d /etc/nixos; or exit 0
16
16
+
cd /etc/nixos
17
17
+
jj root; or exit 0
18
18
+
19
19
+
jj new --quiet
20
20
+
set restore (jj log --no-graph -r @- -T 'change_id.shortest(8)')
21
21
+
echo Will restore $restore
22
22
+
23
23
+
set remote github
24
24
+
echo Fetching remote $remote
25
25
+
jj git fetch --remote $remote
26
26
+
jj new main@$remote
27
27
+
28
28
+
echo Starting flake update
29
29
+
git config set --local user.name 'Peter Rice (automated)'
30
30
+
git config set --local user.email noreply@pvsr.dev
31
31
+
nix flake update --commit-lock-file
32
32
+
git config unset --local user.name
33
33
+
git config unset --local user.email
34
34
+
35
35
+
set bookmark flake-update
36
36
+
jj bookmark set -B -r "@- ~ main@$remote" $bookmark
37
37
+
and jj git push --remote $remote --bookmark $bookmark
38
38
+
39
39
+
jj edit $restore
40
40
+
'';
41
41
+
};
42
42
+
timers.update-flake = {
43
43
+
timerConfig = {
44
44
+
OnCalendar = "Fri *-*-* 06:00";
45
45
+
Persistent = true;
46
46
+
};
47
47
+
wantedBy = [ "timers.target" ];
48
48
+
};
49
49
+
};
50
50
+
};
51
51
+
}