From 885af08edef3eede81101d4303e3a025dc078449 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 16 Jul 2015 19:44:44 +0200 Subject: cleanup, rebuild-system --- nix/cliparg.nix | 4 ++-- nix/default.nix | 3 ++- nix/rebuild-system.nix | 28 ++++++++++++++++++++++++++++ rebuild-system | 11 +++++++++++ 4 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 nix/rebuild-system.nix create mode 100644 rebuild-system diff --git a/nix/cliparg.nix b/nix/cliparg.nix index fcb2066..8aa9a71 100644 --- a/nix/cliparg.nix +++ b/nix/cliparg.nix @@ -1,7 +1,7 @@ { stdenv , fetchgit -, makeWrapper -, xclip +, makeWrapper +, xclip }: stdenv.mkDerivation rec { diff --git a/nix/default.nix b/nix/default.nix index 9aadc46..de52fd4 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -3,5 +3,6 @@ let pkgs = import {}; in rec { - cliparg = pkgs.callPackage (import ./cliparg.nix) {}; + cliparg = pkgs.callPackage ./cliparg.nix {}; + rebuild-system = pkgs.callPackage ./system-rebuild.nix {}; } diff --git a/nix/rebuild-system.nix b/nix/rebuild-system.nix new file mode 100644 index 0000000..b787392 --- /dev/null +++ b/nix/rebuild-system.nix @@ -0,0 +1,28 @@ +{ stdenv +, fetchgit +, makeWrapper +, sudo +, git +}: + +stdenv.mkDerivation rec { + inherit sudo git; + name = "rebuild-system-${version}"; + version = "0.1"; + src = fetchgit { + inherit name; + url = git://git.yggdrasil.li/utils; + rev = ""; + sha256 = ""; + }; + buildInputs = [ makeWrapper ]; + buildPhase = "true"; + installPhase = '' + mkdir -p $out/bin + cp $src/rebuild-system $out/bin/ + chmod +x $out/bin/rebuild-system + wrapProgram $out/bin/rebuild-system \ + --prefix PATH : ${sudo}/bin \ + --prefix PATH : ${git}/bin + ''; +} diff --git a/rebuild-system b/rebuild-system new file mode 100644 index 0000000..8f116e3 --- /dev/null +++ b/rebuild-system @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +if [[ "$USER" != "root" ]]; then + exec sudo -- $0 $@ +fi + +path=/etc/nixos + +git -C $path pull && \ + git -C $path submodule update && \ + nixos-rebuild $@ -- cgit v1.2.3 From cdf3f394fbd4713ae8aa13f9111be9ca8f64d34b Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 16 Jul 2015 19:49:19 +0200 Subject: rev bump --- nix/rebuild-system.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nix/rebuild-system.nix b/nix/rebuild-system.nix index b787392..4a8c3e0 100644 --- a/nix/rebuild-system.nix +++ b/nix/rebuild-system.nix @@ -12,8 +12,8 @@ stdenv.mkDerivation rec { src = fetchgit { inherit name; url = git://git.yggdrasil.li/utils; - rev = ""; - sha256 = ""; + rev = "885af08edef3eede81101d4303e3a025dc078449"; + sha256 = "e4a1e4c6661a5c8f071b22251fda15bac86051d19d6c5ce60fbcd87dad8386e4"; }; buildInputs = [ makeWrapper ]; buildPhase = "true"; -- cgit v1.2.3 From fa8ffecc5e423ad7f31725568e1b03a5ac7dbc4c Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 16 Jul 2015 20:08:18 +0200 Subject: typo --- nix/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/default.nix b/nix/default.nix index de52fd4..36aaa22 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -4,5 +4,5 @@ let pkgs = import {}; in rec { cliparg = pkgs.callPackage ./cliparg.nix {}; - rebuild-system = pkgs.callPackage ./system-rebuild.nix {}; + rebuild-system = pkgs.callPackage ./rebuild-system.nix {}; } -- cgit v1.2.3 From 573496399a73e127f92d65d88f0f943b78387d4d Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 16 Jul 2015 20:11:59 +0200 Subject: =?UTF-8?q?sudo=20needs=20to=20be=20wrapped=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nix/rebuild-system.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/rebuild-system.nix b/nix/rebuild-system.nix index 4a8c3e0..f03a2e2 100644 --- a/nix/rebuild-system.nix +++ b/nix/rebuild-system.nix @@ -22,6 +22,7 @@ stdenv.mkDerivation rec { cp $src/rebuild-system $out/bin/ chmod +x $out/bin/rebuild-system wrapProgram $out/bin/rebuild-system \ + --prefix PATH : /var/setuid-wrappers \ --prefix PATH : ${sudo}/bin \ --prefix PATH : ${git}/bin ''; -- cgit v1.2.3 From dd28d96d3469a46888ac4e1103818978aa4fc51b Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 16 Jul 2015 20:13:27 +0200 Subject: Made last commit more explicit --- nix/rebuild-system.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/nix/rebuild-system.nix b/nix/rebuild-system.nix index f03a2e2..311f331 100644 --- a/nix/rebuild-system.nix +++ b/nix/rebuild-system.nix @@ -23,7 +23,6 @@ stdenv.mkDerivation rec { chmod +x $out/bin/rebuild-system wrapProgram $out/bin/rebuild-system \ --prefix PATH : /var/setuid-wrappers \ - --prefix PATH : ${sudo}/bin \ --prefix PATH : ${git}/bin ''; } -- cgit v1.2.3