Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Christopher League
nixvm
Commits
c11c9293
Commit
c11c9293
authored
Dec 22, 2018
by
Christopher League
Browse files
check latest version before updating
parent
c17913cd
Changes
3
Hide whitespace changes
Inline
Side-by-side
desktop.nix
View file @
c11c9293
...
...
@@ -16,6 +16,7 @@ in
./backgrounds.nix
./skel.nix
./fonts.nix
./version.nix
];
config
=
{
...
...
@@ -58,7 +59,6 @@ in
firefox
flameshot
tmux
(
pkgs
.
callPackage
./update.nix
{})
];
};
}
update.nix
deleted
100644 → 0
View file @
c17913cd
{
pkgs
,
...
}:
pkgs
.
writeShellScriptBin
"liucs-update"
''
# run as root
[[ $(id -un) == root ]] || {
exec sudo -H $0 "$@"
}
set -o xtrace
nix-channel --update liucs
nixos-rebuild switch
''
version.nix
View file @
c11c9293
{
{
pkgs
,
...
}:
let
hash
=
"$Format:%H$"
;
date
=
"$Format:%ci$"
;
repo
=
"https://gitlab.liu.edu/league/nixvm.git"
;
ref
=
"master"
;
showVersion
=
''
echo '
${
hash
}
(
${
date
}
)'
latest=$(
${
pkgs
.
git
}
/bin/git ls-remote
${
repo
}
${
ref
}
|cut -f1)
if [[ "
${
hash
}
" == "$latest" ]]; then
echo Your system is up to date.
else
echo An update is available.
fi
''
;
doUpdate
=
''
[[ $(id -un) == root ]] || {
exec sudo -H $0 "$@"
}
set -o xtrace
latest=$(
${
pkgs
.
git
}
/bin/git ls-remote
${
repo
}
${
ref
}
|cut -f1)
if [[ "
${
hash
}
" == "$latest" ]]; then
echo Already up to date.
else
nix-channel --update liucs
nixos-rebuild switch
fi
''
;
in
{
environment
.
systemPackages
=
[
(
pkgs
.
writeShellScriptBin
"liucs-version"
showVersion
)
(
pkgs
.
writeShellScriptBin
"liucs-update"
doUpdate
)
];
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment