about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2022-02-19 16:51:43 +0300
committerAzat Bahawi <azat@bahawi.net>2022-02-19 16:51:43 +0300
commit160e41de9a3d0be32c2eabbc9ae6ab55fd56f02e (patch)
treed0f40fcbc7d689e2a6035abc33dc813a919831b3
parentlmao (diff)
absolute garbage wtf
Diffstat (limited to '')
-rw-r--r--flake.nix45
1 files changed, 24 insertions, 21 deletions
diff --git a/flake.nix b/flake.nix
index 39a96f9..38edac0 100644
--- a/flake.nix
+++ b/flake.nix
@@ -42,23 +42,24 @@
     let name = "xmonad-ng";
     in flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
       let
-        pkgs = nixpkgs.legacyPackages.${system};
+        pkgs = import nixpkgs {
+          inherit system;
+          inputs = null;
+          nixpkgs = nixpkgs.legacyPackages.${system};
+        };
 
-        project = returnShellEnv:
-          pkgs.haskellPackages.developPackage {
+        package = { returnShellEnv ? false }:
+          with pkgs;
+          haskellPackages.developPackage {
             inherit name returnShellEnv;
             root = ./.;
-            overrides = self: _:
-              with pkgs.haskell.lib;
-              let
-                mkPackage = packageName:
-                  dontCheck (self.callHackage packageName "0.17.0" { });
-              in {
-                xmonad = mkPackage "xmonad";
-                xmonad-contrib = mkPackage "xmonad-contrib";
+            overrides = _: _:
+              with haskellPackages; {
+                xmonad = xmonad_0_17_0;
+                xmonad-contrib = xmonad-contrib_0_17_0;
               };
             modifier = drv:
-              pkgs.haskell.lib.addBuildTools drv (with pkgs.haskellPackages; [
+              haskell.lib.addBuildTools drv (with haskellPackages; [
                 brittany
                 cabal-install
                 haskell-language-server
@@ -68,8 +69,7 @@
               ]);
           };
       in {
-        packages.${name} = project false;
-
+        packages.${name} = package { };
         defaultPackage = self.packages.${system}.${name};
 
         checks.preCommit = pre-commit-hooks.lib.${system}.run {
@@ -97,14 +97,17 @@
         };
 
         devShells = {
-          dev = project true;
-          commit = pkgs.mkShell {
+          ${name} = package { returnShellEnv = true; };
+          preCommit = pkgs.mkShell {
             inherit (self.checks.${system}.preCommit) shellHook;
           };
         };
-
-        devShell = self.devShells.${system}.dev;
-
-        overlay = _: _: { ${name} = self.defaultPackage.${system}; };
-      });
+        devShell = self.devShells.${system}.${name};
+      }) // {
+        # FIXME This exposes an attribute set of "system.package" thus making
+        # importing this package from the overlay to look like this
+        # "pkgs.xmonad-ng.${system}" which is fucking stupid. I have to fix that
+        # somehow.
+        overlay = _: _: { ${name} = self.defaultPackage; };
+      };
 }

Consider giving Nix/NixOS a try! <3