From 160e41de9a3d0be32c2eabbc9ae6ab55fd56f02e Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Sat, 19 Feb 2022 16:51:43 +0300 Subject: absolute garbage wtf --- flake.nix | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) (limited to 'flake.nix') 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; }; + }; } -- cgit 1.4.1