From aec148383a5f28191c83de62d3d0582a25fb736e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 30 Dec 2019 21:34:49 +0100 Subject: [PATCH] Convert to flake --- default.nix | 35 ----------------------------------- flake.lock | 11 +++++++++++ flake.nix | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 35 deletions(-) delete mode 100644 default.nix create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/default.nix b/default.nix deleted file mode 100644 index faecc41..0000000 --- a/default.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ pkgs ? import {} }: - -with pkgs; - -stdenv.mkDerivation { - name = "nixos-channel-scripts"; - - buildInputs = with perlPackages; - [ pkgconfig nix sqlite makeWrapper perl FileSlurp LWP LWPProtocolHttps ListMoreUtils DBDSQLite NetAmazonS3 boehmgc nlohmann_json boost ]; - - buildCommand = '' - mkdir -p $out/bin - - cp ${./file-cache.hh} file-cache.hh - - g++ -Os -g ${./generate-programs-index.cc} -Wall -std=c++14 -o $out/bin/generate-programs-index -I . \ - $(pkg-config --cflags nix-main) \ - $(pkg-config --libs nix-main) \ - $(pkg-config --libs nix-expr) \ - $(pkg-config --libs nix-store) \ - -lsqlite3 -lgc - - g++ -Os -g ${./index-debuginfo.cc} -Wall -std=c++14 -o $out/bin/index-debuginfo -I . \ - $(pkg-config --cflags nix-main) \ - $(pkg-config --libs nix-main) \ - $(pkg-config --libs nix-store) \ - -lsqlite3 - - cp ${./mirror-nixos-branch.pl} $out/bin/mirror-nixos-branch - wrapProgram $out/bin/mirror-nixos-branch --set PERL5LIB $PERL5LIB --prefix PATH : ${wget}/bin:${git}/bin:${nix}/bin:${gnutar}/bin:${xz}/bin:${rsync}/bin:${openssh}/bin:$out/bin - - patchShebangs $out/bin - ''; - -} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..5730064 --- /dev/null +++ b/flake.lock @@ -0,0 +1,11 @@ +{ + "inputs": { + "nixpkgs": { + "inputs": {}, + "narHash": "sha256-HKuPcp/pBpKNBOnDlrSzObee5eB0LdzhI0RpRjTVxik=", + "originalUrl": "nixpkgs/release-19.09", + "url": "github:edolstra/nixpkgs/03f3def66a104a221aac8b751eeb7075374848fd" + } + }, + "version": 3 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..2437513 --- /dev/null +++ b/flake.nix @@ -0,0 +1,53 @@ +{ + edition = 201909; + + description = "Script for generating Nixpkgs/NixOS channels"; + + inputs.nixpkgs.url = "nixpkgs/release-19.09"; + + outputs = { self, nixpkgs }: + + { + + overlay = final: prev: { + + nixos-channel-scripts = with final; stdenv.mkDerivation { + name = "nixos-channel-scripts"; + + buildInputs = with perlPackages; + [ pkgconfig nix sqlite makeWrapper perl FileSlurp LWP LWPProtocolHttps ListMoreUtils DBDSQLite NetAmazonS3 boehmgc nlohmann_json boost ]; + + buildCommand = '' + mkdir -p $out/bin + + cp ${./file-cache.hh} file-cache.hh + + g++ -Os -g ${./generate-programs-index.cc} -Wall -std=c++14 -o $out/bin/generate-programs-index -I . \ + $(pkg-config --cflags nix-main) \ + $(pkg-config --libs nix-main) \ + $(pkg-config --libs nix-expr) \ + $(pkg-config --libs nix-store) \ + -lsqlite3 -lgc + + g++ -Os -g ${./index-debuginfo.cc} -Wall -std=c++14 -o $out/bin/index-debuginfo -I . \ + $(pkg-config --cflags nix-main) \ + $(pkg-config --libs nix-main) \ + $(pkg-config --libs nix-store) \ + -lsqlite3 + + cp ${./mirror-nixos-branch.pl} $out/bin/mirror-nixos-branch + wrapProgram $out/bin/mirror-nixos-branch --set PERL5LIB $PERL5LIB --prefix PATH : ${wget}/bin:${git}/bin:${nix}/bin:${gnutar}/bin:${xz}/bin:${rsync}/bin:${openssh}/bin:$out/bin + + patchShebangs $out/bin + ''; + }; + + }; + + defaultPackage.x86_64-linux = (import nixpkgs { + system = "x86_64-linux"; + overlays = [ self.overlay ]; + }).nixos-channel-scripts; + + }; +}