From 264ed82eda55403aad810a2b32527b510c83e24a Mon Sep 17 00:00:00 2001 From: Matej Cotman Date: Thu, 22 Jan 2015 05:16:58 +0100 Subject: [PATCH] nixui: add new package --- .../package-management/nixui/default.nix | 53 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 55 insertions(+) create mode 100644 pkgs/tools/package-management/nixui/default.nix diff --git a/pkgs/tools/package-management/nixui/default.nix b/pkgs/tools/package-management/nixui/default.nix new file mode 100644 index 000000000000..261231349852 --- /dev/null +++ b/pkgs/tools/package-management/nixui/default.nix @@ -0,0 +1,53 @@ +{ stdenv, pkgs, fetchgit, nix, node_webkit, config, makeDesktopItem, writeScript +, profilePaths ? (config.nixui.profilePaths or ["/nix/var/nix/profiles"]) +, dataDir ? (config.nixui.dataDir or "/tmp") +, configurations ? (config.nixui.configurations or ["/etc/nixos/configuration.nix"]) +, NIX_PATH ? (config.nixui.NIX_PATH or "/nix/var/nix/profiles/per-user/root/channels/nixos:nixpkgs=/etc/nixos/nixpkgs:nixos-config=/etc/nixos/configuration.nix") }: +let + version = "0.1.0"; + src = fetchgit { + url = "git://github.com/matejc/nixui.git"; + rev = "refs/tags/${version}"; + sha256 = "198inv8ih751fc1l4dvjp9p6k4kfacikab61v6f604d45psnk6qf"; + }; + nixui = (import "${src}/default.nix" { nixui = src; inherit pkgs; }).build; + script = writeScript "nixui" '' + #! ${stdenv.shell} + export PATH="${nix}/bin:\$PATH" + export NIXUI_CONFIG="${config}" + ${node_webkit}/bin/nw ${nixui}/lib/node_modules/nixui/ + ''; + config = builtins.toFile "config.json" '' + { + "profilePaths": ${builtins.toJSON profilePaths}, + "dataDir": "${dataDir}", + "configurations": ${builtins.toJSON configurations}, + "NIX_PATH": "${NIX_PATH}" + } + ''; + desktop = makeDesktopItem { + name = "nixui"; + exec = script; + icon = "${nixui}/lib/node_modules/nixui/img/128.png"; + desktopName = "NixUI"; + genericName = "NixUI"; + }; +in +stdenv.mkDerivation rec { + name = "nixui-${version}"; + inherit version src; + installPhase = '' + mkdir -p $out/bin + ln -s ${script} $out/bin/nixui + + mkdir -p $out/share/applications + ln -s ${desktop}/share/applications/* $out/share/applications/ + ''; + meta = { + description = "NodeWebkit user interface for Nix"; + homepage = https://github.com/matejc/nixui; + license = stdenv.lib.licenses.bsd2; + maintainers = [ stdenv.lib.maintainers.matejc ]; + platforms = stdenv.lib.platforms.unix; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1d0e5365a718..de3e5b033ff6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -12904,6 +12904,8 @@ let nixopsUnstable = callPackage ../tools/package-management/nixops/unstable.nix { }; + nixui = callPackage ../tools/package-management/nixui { node_webkit = node_webkit_0_11; }; + nix-prefetch-scripts = callPackage ../tools/package-management/nix-prefetch-scripts { }; nix-repl = callPackage ../tools/package-management/nix-repl { };