about summary refs log tree commit diff
path: root/flake.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azahi@teknik.io>2021-12-08 04:06:35 +0300
committerAzat Bahawi <azahi@teknik.io>2021-12-08 04:06:35 +0300
commitb561ebcfee857beacdc5b6f716ccccdd18771670 (patch)
tree6d59e3054d8c750322b8bd14c1c4181c4ec49389 /flake.nix
parentSome stuff (diff)
Even more stuff
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix91
1 files changed, 55 insertions, 36 deletions
diff --git a/flake.nix b/flake.nix
index c53b5c2..7d2c900 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,45 +1,64 @@
 {
   description = "Personal XMonad configuration.";
 
-  inputs.nixpkgs = {
-    type = "github";
-    owner = "NixOS";
-    repo = "nixpkgs";
-    ref = "nixpkgs-unstable";
+  inputs = {
+    nixpkgs = {
+      type = "github";
+      owner = "NixOS";
+      repo = "nixpkgs";
+      ref = "nixpkgs-unstable";
+    };
+
+    flake-utils = {
+      type = "github";
+      owner = "numtide";
+      repo = "flake-utils";
+      ref = "master";
+      inputs.nixpkgs.follows = "nixpkgs";
+    };
+
+    flake-compat = {
+      type = "github";
+      owner = "edolstra";
+      repo = "flake-compat";
+      ref = "master";
+      flake = false;
+    };
   };
 
-  outputs = { nixpkgs, ... }:
-    let
-      system = "x86_64-linux";
+  outputs = { self, nixpkgs, flake-utils, ... }:
+    flake-utils.lib.eachDefaultSystem (system:
+      let
+        pkgs = import nixpkgs { inherit system; };
 
-      pkgs = import nixpkgs { inherit system; };
+        project = returnShellEnv:
+          pkgs.haskellPackages.developPackage {
+            inherit returnShellEnv;
+            name = "xmonad-ng";
+            root = ./.;
+            overrides = self: _:
+              with pkgs.haskell.lib;
+              let version = "0.17.0";
+              in {
+                xmonad = dontCheck (self.callHackage "xmonad" version { });
+                xmonad-contrib =
+                  dontCheck (self.callHackage "xmonad-contrib" version { });
+              };
+            modifier = drv:
+              pkgs.haskell.lib.addBuildTools drv (with pkgs.haskellPackages; [
+                brittany
+                cabal-install
+                haskell-language-server
+                hlint
+                hpack
+                stack
+              ]);
+          };
+      in {
+        defaultPackage = project false;
 
-      project = returnShellEnv:
-        pkgs.haskellPackages.developPackage {
-          inherit returnShellEnv;
-          name = "xmonad-ng";
-          root = ./.;
-          overrides = self: _:
-            with pkgs.haskell.lib;
-            let version = "0.17.0";
-            in {
-              xmonad = dontCheck (self.callHackage "xmonad" version { });
-              xmonad-contrib =
-                dontCheck (self.callHackage "xmonad-contrib" version { });
-            };
-          modifier = drv:
-            pkgs.haskell.lib.addBuildTools drv (with pkgs.haskellPackages; [
-              brittany
-              cabal-install
-              haskell-language-server
-              hlint
-              hpack
-              stack
-            ]);
-        };
-    in {
-      defaultPackage.${system} = project false;
+        overlay = _: _: { xmonad-ng = self.defaultPackage.${system}; };
 
-      devShell.${system} = project true;
-    };
+        devShell = project true;
+      });
 }

Consider giving Nix/NixOS a try! <3