From d8faba34819c7e696e8ccf97b639ffc96fab377e Mon Sep 17 00:00:00 2001 From: xeals Date: Thu, 15 Oct 2020 18:54:14 +1100 Subject: [PATCH] Init build support --- .drone.jsonnet | 40 +++++++++++++++++ .drone.yml | 76 ++++++++++++++++++++++++++++++++ .envrc | 1 + default.nix | 5 +-- pkgs/example-package/default.nix | 10 ----- shell.nix | 7 +++ 6 files changed, 125 insertions(+), 14 deletions(-) create mode 100644 .drone.jsonnet create mode 100644 .drone.yml create mode 100644 .envrc delete mode 100644 pkgs/example-package/default.nix create mode 100644 shell.nix diff --git a/.drone.jsonnet b/.drone.jsonnet new file mode 100644 index 0000000..cf32570 --- /dev/null +++ b/.drone.jsonnet @@ -0,0 +1,40 @@ +local Pipeline(channel) = { + kind: "pipeline", + type: "docker", + name: channel, + environment: { + NUR_REPO: "xeals", + // NIX_PATH: "nixpkgs=channel:" + channel, + CACHIX_CACHE: "xeals", + CACHIX_SIGNING_KEY: { from_secret: "cachix_key" }, + }, + steps: [ + { + name: "build", + image: "nixos/nix", + commands: [ + "nix-channel --add https://nixos.org/channels/" + channel + " nixos", + "nix-channel --update", + "nix-build ci.nix -A buildOutputs", + "nix eval -f default.nix 'lib'", + "nix eval -f default.nix 'modules'", + "nix eval -f default.nix 'overlays'" + ] + }, + { + name: "deploy", + image: "nixpkgs/cachix", + commands: [ + 'nix-build ci.nix -A cacheOutputs | cachix push "${CACHIX_CACHE}"'//, + // 'if [[ "cron" != "${DRONE_BUILD_EVENT}" && -z "${DRONE_PULL_REQUEST}" && "master" = "${DRONE_BRANCH}" ]]; then + // curl -XPOST "https://nur-update.herokuapp.com/update?repo=${NUR_REPO}"; fi' + ] + } + ] +}; + +[ + Pipeline("nixpkgs-unstable"), + Pipeline("nixos-unstable"), + Pipeline("nixos-20.03"), +] diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..e44bac9 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,76 @@ +--- +kind: pipeline +type: docker +name: nixpkgs-unstable + +platform: + os: linux + arch: amd64 + +steps: +- name: build + image: nixos/nix + commands: + - nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixos + - nix-channel --update + - nix-build ci.nix -A buildOutputs + - nix eval -f default.nix 'lib' + - nix eval -f default.nix 'modules' + - nix eval -f default.nix 'overlays' + +- name: deploy + image: nixpkgs/cachix + commands: + - nix-build ci.nix -A cacheOutputs | cachix push "${CACHIX_CACHE}" + +--- +kind: pipeline +type: docker +name: nixos-unstable + +platform: + os: linux + arch: amd64 + +steps: +- name: build + image: nixos/nix + commands: + - nix-channel --add https://nixos.org/channels/nixos-unstable nixos + - nix-channel --update + - nix-build ci.nix -A buildOutputs + - nix eval -f default.nix 'lib' + - nix eval -f default.nix 'modules' + - nix eval -f default.nix 'overlays' + +- name: deploy + image: nixpkgs/cachix + commands: + - nix-build ci.nix -A cacheOutputs | cachix push "${CACHIX_CACHE}" + +--- +kind: pipeline +type: docker +name: nixos-20.03 + +platform: + os: linux + arch: amd64 + +steps: +- name: build + image: nixos/nix + commands: + - nix-channel --add https://nixos.org/channels/nixos-20.03 nixos + - nix-channel --update + - nix-build ci.nix -A buildOutputs + - nix eval -f default.nix 'lib' + - nix eval -f default.nix 'modules' + - nix eval -f default.nix 'overlays' + +- name: deploy + image: nixpkgs/cachix + commands: + - nix-build ci.nix -A cacheOutputs | cachix push "${CACHIX_CACHE}" + +... diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..051d09d --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +eval "$(lorri direnv)" diff --git a/default.nix b/default.nix index 46c4090..81b6b7a 100644 --- a/default.nix +++ b/default.nix @@ -14,8 +14,5 @@ modules = import ./modules; # NixOS modules overlays = import ./overlays; # nixpkgs overlays - example-package = pkgs.callPackage ./pkgs/example-package { }; - # some-qt5-package = pkgs.libsForQt5.callPackage ./pkgs/some-qt5-package { }; - # ... -} +} diff --git a/pkgs/example-package/default.nix b/pkgs/example-package/default.nix deleted file mode 100644 index 2533adf..0000000 --- a/pkgs/example-package/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ stdenv }: - -stdenv.mkDerivation rec { - name = "example-package-${version}"; - version = "1.0"; - src = ./.; - buildPhase = "echo echo Hello World > example"; - installPhase = "install -Dm755 example $out"; -} - diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..1599ca6 --- /dev/null +++ b/shell.nix @@ -0,0 +1,7 @@ +{ pkgs ? import {} }: + +pkgs.mkShell { + buildInputs = [ + pkgs.jsonnet pkgs.drone-cli + ]; +}