about summary refs log tree commit diff
diff options
context:
space:
mode:
-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