diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-05-14 18:48:51 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-05-14 18:48:51 +0200 |
commit | 2968aa8fb03db8c8d27c8a7669fb362efd40c6cc (patch) | |
tree | 48e6fb5389d41d4128bff0a11168fc470230e6c6 | |
parent | 7782c7fcc926f04a948bdfca79929cad759fca73 (diff) | |
parent | dd28d96d3469a46888ac4e1103818978aa4fc51b (diff) | |
download | utils-2968aa8fb03db8c8d27c8a7669fb362efd40c6cc.tar utils-2968aa8fb03db8c8d27c8a7669fb362efd40c6cc.tar.gz utils-2968aa8fb03db8c8d27c8a7669fb362efd40c6cc.tar.bz2 utils-2968aa8fb03db8c8d27c8a7669fb362efd40c6cc.tar.xz utils-2968aa8fb03db8c8d27c8a7669fb362efd40c6cc.zip |
Merge ymir:.nixpkgs/utils
-rw-r--r-- | nix/cliparg.nix | 4 | ||||
-rw-r--r-- | nix/default.nix | 3 | ||||
-rw-r--r-- | nix/rebuild-system.nix | 28 | ||||
-rw-r--r-- | rebuild-system | 11 |
4 files changed, 43 insertions, 3 deletions
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 @@ | |||
1 | { stdenv | 1 | { stdenv |
2 | , fetchgit | 2 | , fetchgit |
3 | , makeWrapper | 3 | , makeWrapper |
4 | , xclip | 4 | , xclip |
5 | }: | 5 | }: |
6 | 6 | ||
7 | stdenv.mkDerivation rec { | 7 | stdenv.mkDerivation rec { |
diff --git a/nix/default.nix b/nix/default.nix index 9aadc46..36aaa22 100644 --- a/nix/default.nix +++ b/nix/default.nix | |||
@@ -3,5 +3,6 @@ | |||
3 | let | 3 | let |
4 | pkgs = import <nixpkgs> {}; | 4 | pkgs = import <nixpkgs> {}; |
5 | in rec { | 5 | in rec { |
6 | cliparg = pkgs.callPackage (import ./cliparg.nix) {}; | 6 | cliparg = pkgs.callPackage ./cliparg.nix {}; |
7 | rebuild-system = pkgs.callPackage ./rebuild-system.nix {}; | ||
7 | } | 8 | } |
diff --git a/nix/rebuild-system.nix b/nix/rebuild-system.nix new file mode 100644 index 0000000..311f331 --- /dev/null +++ b/nix/rebuild-system.nix | |||
@@ -0,0 +1,28 @@ | |||
1 | { stdenv | ||
2 | , fetchgit | ||
3 | , makeWrapper | ||
4 | , sudo | ||
5 | , git | ||
6 | }: | ||
7 | |||
8 | stdenv.mkDerivation rec { | ||
9 | inherit sudo git; | ||
10 | name = "rebuild-system-${version}"; | ||
11 | version = "0.1"; | ||
12 | src = fetchgit { | ||
13 | inherit name; | ||
14 | url = git://git.yggdrasil.li/utils; | ||
15 | rev = "885af08edef3eede81101d4303e3a025dc078449"; | ||
16 | sha256 = "e4a1e4c6661a5c8f071b22251fda15bac86051d19d6c5ce60fbcd87dad8386e4"; | ||
17 | }; | ||
18 | buildInputs = [ makeWrapper ]; | ||
19 | buildPhase = "true"; | ||
20 | installPhase = '' | ||
21 | mkdir -p $out/bin | ||
22 | cp $src/rebuild-system $out/bin/ | ||
23 | chmod +x $out/bin/rebuild-system | ||
24 | wrapProgram $out/bin/rebuild-system \ | ||
25 | --prefix PATH : /var/setuid-wrappers \ | ||
26 | --prefix PATH : ${git}/bin | ||
27 | ''; | ||
28 | } | ||
diff --git a/rebuild-system b/rebuild-system new file mode 100644 index 0000000..8f116e3 --- /dev/null +++ b/rebuild-system | |||
@@ -0,0 +1,11 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | if [[ "$USER" != "root" ]]; then | ||
4 | exec sudo -- $0 $@ | ||
5 | fi | ||
6 | |||
7 | path=/etc/nixos | ||
8 | |||
9 | git -C $path pull && \ | ||
10 | git -C $path submodule update && \ | ||
11 | nixos-rebuild $@ | ||