about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAzat Bahawi <azahi@teknik.io>2021-12-08 05:10:08 +0300
committerAzat Bahawi <azahi@teknik.io>2021-12-08 05:10:08 +0300
commitb68523ec9c38bd86f65edfb6687d2b767a0a74b4 (patch)
tree51b4547d07dec6522269c5a95e8a7a7cf2120c4c
parentTest gitlab CI (diff)
Test
Diffstat (limited to '')
-rw-r--r--.gitlab-ci.yml45
-rw-r--r--flake.nix8
2 files changed, 44 insertions, 9 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f88c3cd..c5067a4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,13 +1,48 @@
 ---
 image: nixpkgs/nix-flakes:latest
+
 variables:
   NIX_PATH: "nixpkgs=channel:nixpkgs-unstable"
 
+before_script:
+  - nix --version
+
 stages:
-  - test
+  - env
+  - check
+  - cache
+
+show:
+  stage: env
+  script:
+    - env
+    - nix show-config |
+      tee show-config.log
+    - nix show-derivation |
+      tee show-derivation.log
+  artifacts:
+    paths:
+      - show-config.log
+      - show-derivation.log
+    expire_in: 1 week
+    when: on_success
+
+check:
+  stage: check
+  script:
+    - nix flake check --show-trace
+  allow_failure: true
 
-test:
-  stage: test
+cache:
+  stage: cache
   script:
-    - nix --version
-    - nix flake check
+    - >
+        nix build --show-trace --json |
+        jq -r '.[].outputs | to_entries[].value' |
+        nix shell nixpkgs#cachix
+        --command cachix push $CACHIX_CACHE_NAME
+  artifacts:
+    paths:
+      - result
+    expire_in: 1 week
+    when: on_success
diff --git a/flake.nix b/flake.nix
index 7d2c900..426f9bd 100644
--- a/flake.nix
+++ b/flake.nix
@@ -29,7 +29,7 @@
   outputs = { self, nixpkgs, flake-utils, ... }:
     flake-utils.lib.eachDefaultSystem (system:
       let
-        pkgs = import nixpkgs { inherit system; };
+        pkgs = nixpkgs.legacyPackages.${system};
 
         project = returnShellEnv:
           pkgs.haskellPackages.developPackage {
@@ -57,8 +57,8 @@
       in {
         defaultPackage = project false;
 
-        overlay = _: _: { xmonad-ng = self.defaultPackage.${system}; };
-
         devShell = project true;
-      });
+      }) // {
+        overlay = _: _: { xmonad-ng = self.defaultPackage; };
+      };
 }

Consider giving Nix/NixOS a try! <3