From 463d70153d0704d8f3939a7a4ffb42b9c0464eb2 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Sun, 24 Oct 2021 22:57:16 +0300 Subject: Nixify and rework package configuration - Add Nix support - Remove submodules and vendored code - Remove stack support - Various tweaks --- .direnv/flake-profile | 1 + .direnv/flake-profile.rc | 1 + .envrc | 1 + .gitignore | 8 +- .gitmodules | 6 - build | 37 ------ cabal.project | 2 - flake.lock | 298 +++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 43 +++++++ lib/XMonad | 1 - readme.org | 19 +-- stack.yaml | 5 - vendor/xmonad | 1 - vendor/xmonad-contrib | 1 - xmonad-ng.cabal | 23 ++-- xmonad.hs | 1 - 16 files changed, 364 insertions(+), 84 deletions(-) create mode 120000 .direnv/flake-profile create mode 100644 .direnv/flake-profile.rc create mode 100644 .envrc delete mode 100644 .gitmodules delete mode 100755 build create mode 100644 flake.lock create mode 100644 flake.nix delete mode 120000 lib/XMonad delete mode 100644 stack.yaml delete mode 160000 vendor/xmonad delete mode 160000 vendor/xmonad-contrib delete mode 120000 xmonad.hs diff --git a/.direnv/flake-profile b/.direnv/flake-profile new file mode 120000 index 0000000..202c555 --- /dev/null +++ b/.direnv/flake-profile @@ -0,0 +1 @@ +/home/azahi/src/xmonad-ng/.direnv/flake-profile.66151 \ No newline at end of file diff --git a/.direnv/flake-profile.rc b/.direnv/flake-profile.rc new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/.direnv/flake-profile.rc @@ -0,0 +1 @@ + diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index 3d10d27..aaa160f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,11 @@ *.hi *.o .cabal-sandbox/ +.direnv/ .ghc.environment.* -.hdevtools.* -.stack-work/ cabal.project.local cabal.project.local~ cabal.sandbox.config dist-newstyle/ dist/ -prompt-history -stack.yaml.lock -xmonad-*-* -xmonad.errors +result diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 781a58e..0000000 --- a/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "vendor/xmonad"] - path = vendor/xmonad - url = https://github.com/azahi/xmonad -[submodule "vendor/xmonad-contrib"] - path = vendor/xmonad-contrib - url = https://github.com/azahi/xmonad-contrib diff --git a/build b/build deleted file mode 100755 index b159f44..0000000 --- a/build +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -eu - -SRC_DIR="$HOME/.xmonad" -EXE_NAME="xmonad-ng" -OUT="$1" - -shift - -cd "$SRC_DIR" || exit 1 - -if command -v stack >/dev/null 2>&1 -then - unset STACK_YAML - - echo ">>> stack build <<<" - stack build --verbose || exit 1 - - ln -f -T "$(stack exec -- which $EXE_NAME)" "$OUT" || exit 1 -else - #echo ">>> cabal sandbox init <<<" - #cabal sandbox --verbose init || exit 1 - - echo ">>> cabal new-configure <<<" - cabal new-configure \ - --verbose \ - --enable-optimization \ - --enable-executable-stripping || exit 1 - - #echo ">>> cabal install <<<" - #cabal install --verbose --only-dependencies || exit 1 - - echo ">>> cabal new-build <<<" - cabal new-build --verbose || exit 1 - - find "$SRC_DIR"/dist-newstyle -type f -executable -name "$EXE_NAME" \ - -exec mv -u '{}' "$OUT" ';' || exit 1 -fi diff --git a/cabal.project b/cabal.project index 2f7a15c..6f92079 100644 --- a/cabal.project +++ b/cabal.project @@ -1,3 +1 @@ packages: ./ - ./vendor/xmonad/ - ./vendor/xmonad-contrib/ diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..daa8f27 --- /dev/null +++ b/flake.lock @@ -0,0 +1,298 @@ +{ + "nodes": { + "HTTP": { + "flake": false, + "locked": { + "lastModified": 1451647621, + "narHash": "sha256-oHIyw3x0iKBexEo49YeUDV1k74ZtyYKGR2gNJXXRxts=", + "owner": "phadej", + "repo": "HTTP", + "rev": "9bc0996d412fef1787449d841277ef663ad9a915", + "type": "github" + }, + "original": { + "owner": "phadej", + "repo": "HTTP", + "type": "github" + } + }, + "cabal-32": { + "flake": false, + "locked": { + "lastModified": 1603716527, + "narHash": "sha256-sDbrmur9Zfp4mPKohCD8IDZfXJ0Tjxpmr2R+kg5PpSY=", + "owner": "haskell", + "repo": "cabal", + "rev": "94aaa8e4720081f9c75497e2735b90f6a819b08e", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "3.2", + "repo": "cabal", + "type": "github" + } + }, + "cabal-34": { + "flake": false, + "locked": { + "lastModified": 1622475795, + "narHash": "sha256-chwTL304Cav+7p38d9mcb+egABWmxo2Aq+xgVBgEb/U=", + "owner": "haskell", + "repo": "cabal", + "rev": "b086c1995cdd616fc8d91f46a21e905cc50a1049", + "type": "github" + }, + "original": { + "owner": "haskell", + "ref": "3.4", + "repo": "cabal", + "type": "github" + } + }, + "cardano-shell": { + "flake": false, + "locked": { + "lastModified": 1608537748, + "narHash": "sha256-PulY1GfiMgKVnBci3ex4ptk2UNYMXqGjJOxcPy2KYT4=", + "owner": "input-output-hk", + "repo": "cardano-shell", + "rev": "9392c75087cb9a3d453998f4230930dea3a95725", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "cardano-shell", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1623875721, + "narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "f7e004a55b120c02ecb6219596820fcd32ca8772", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "ghc-8.6.5-iohk": { + "flake": false, + "locked": { + "lastModified": 1600920045, + "narHash": "sha256-DO6kxJz248djebZLpSzTGD6s8WRpNI9BTwUeOf5RwY8=", + "owner": "input-output-hk", + "repo": "ghc", + "rev": "95713a6ecce4551240da7c96b6176f980af75cae", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "ref": "release/8.6.5-iohk", + "repo": "ghc", + "type": "github" + } + }, + "hackage": { + "flake": false, + "locked": { + "lastModified": 1635037915, + "narHash": "sha256-I+mPG1w2homLMzqwbs32IsSlmJtLaoer3n5jczWl65o=", + "owner": "input-output-hk", + "repo": "hackage.nix", + "rev": "38dc0a55e3efd065c7e9f0c5e7ff2d056e421fe7", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "hackage.nix", + "type": "github" + } + }, + "haskell-nix": { + "inputs": { + "HTTP": "HTTP", + "cabal-32": "cabal-32", + "cabal-34": "cabal-34", + "cardano-shell": "cardano-shell", + "flake-utils": "flake-utils", + "ghc-8.6.5-iohk": "ghc-8.6.5-iohk", + "hackage": "hackage", + "hpc-coveralls": "hpc-coveralls", + "nix-tools": "nix-tools", + "nixpkgs": [ + "haskell-nix", + "nixpkgs-2105" + ], + "nixpkgs-2003": "nixpkgs-2003", + "nixpkgs-2009": "nixpkgs-2009", + "nixpkgs-2105": "nixpkgs-2105", + "nixpkgs-unstable": "nixpkgs-unstable", + "old-ghc-nix": "old-ghc-nix", + "stackage": "stackage" + }, + "locked": { + "lastModified": 1635038099, + "narHash": "sha256-ULhJ/nsZ1bvy99VASxNIAXSm8SePnANInTuHGZbgOg4=", + "owner": "input-output-hk", + "repo": "haskell.nix", + "rev": "c4e4d8dd7c23cb66df5ecc8ceb0733b27e9d1525", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "haskell.nix", + "type": "github" + } + }, + "hpc-coveralls": { + "flake": false, + "locked": { + "lastModified": 1607498076, + "narHash": "sha256-8uqsEtivphgZWYeUo5RDUhp6bO9j2vaaProQxHBltQk=", + "owner": "sevanspowell", + "repo": "hpc-coveralls", + "rev": "14df0f7d229f4cd2e79f8eabb1a740097fdfa430", + "type": "github" + }, + "original": { + "owner": "sevanspowell", + "repo": "hpc-coveralls", + "type": "github" + } + }, + "nix-tools": { + "flake": false, + "locked": { + "lastModified": 1627889534, + "narHash": "sha256-9eEbK2nrRp6rYGQoBv6LO9IA/ANZpofwAkxMuGBD45Y=", + "owner": "input-output-hk", + "repo": "nix-tools", + "rev": "15d2e4b61cb63ff351f3c490c12c4d89eafd31a1", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "nix-tools", + "type": "github" + } + }, + "nixpkgs-2003": { + "locked": { + "lastModified": 1620055814, + "narHash": "sha256-8LEHoYSJiL901bTMVatq+rf8y7QtWuZhwwpKE2fyaRY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1db42b7fe3878f3f5f7a4f2dc210772fd080e205", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-20.03-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2009": { + "locked": { + "lastModified": 1624271064, + "narHash": "sha256-qns/uRW7MR2EfVf6VEeLgCsCp7pIOjDeR44JzTF09MA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "46d1c3f28ca991601a53e9a14fdd53fcd3dd8416", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-20.09-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-2105": { + "locked": { + "lastModified": 1630481079, + "narHash": "sha256-leWXLchbAbqOlLT6tju631G40SzQWPqaAXQG3zH1Imw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "110a2c9ebbf5d4a94486854f18a37a938cfacbbb", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-21.05-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1628785280, + "narHash": "sha256-2B5eMrEr6O8ff2aQNeVxTB+9WrGE80OB4+oM6T7fOcc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6525bbc06a39f26750ad8ee0d40000ddfdc24acb", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "old-ghc-nix": { + "flake": false, + "locked": { + "lastModified": 1631092763, + "narHash": "sha256-sIKgO+z7tj4lw3u6oBZxqIhDrzSkvpHtv0Kki+lh9Fg=", + "owner": "angerman", + "repo": "old-ghc-nix", + "rev": "af48a7a7353e418119b6dfe3cd1463a657f342b8", + "type": "github" + }, + "original": { + "owner": "angerman", + "ref": "master", + "repo": "old-ghc-nix", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": [ + "haskell-nix", + "flake-utils" + ], + "haskell-nix": "haskell-nix", + "nixpkgs": [ + "haskell-nix", + "nixpkgs-unstable" + ] + } + }, + "stackage": { + "flake": false, + "locked": { + "lastModified": 1635038033, + "narHash": "sha256-3AliGUxmwAhWIlsA5oAj1PsGpytq4CWEKAnyZSpjfwU=", + "owner": "input-output-hk", + "repo": "stackage.nix", + "rev": "248b1a35980778c95543fbdc38841bb4a1a6385c", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "stackage.nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..6d8dda1 --- /dev/null +++ b/flake.nix @@ -0,0 +1,43 @@ +{ + description = "Personal XMonad configuration."; + + inputs = { + haskell-nix.url = "github:input-output-hk/haskell.nix"; + nixpkgs.follows = "haskell-nix/nixpkgs-unstable"; + flake-utils.follows = "haskell-nix/flake-utils"; + }; + + outputs = { nixpkgs, flake-utils, haskell-nix, ... }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system overlays; + inherit (haskell-nix) config; + }; + overlays = [ + haskell-nix.overlay + (final: _: { + xmonad-ng = final.haskell-nix.project' { + src = ./.; + + compiler-nix-name = "ghc8107"; + + shell = { + tools = { + brittany = { }; + cabal = { }; + haskell-language-server = { }; + hlint = { }; + }; + + buildInputs = with pkgs; [ nixfmt ]; + }; + }; + }) + ]; + + flake = pkgs.xmonad-ng.flake { }; + in flake // { + defaultPackage = flake.packages."xmonad-ng:exe:xmonad-ng"; + }); +} diff --git a/lib/XMonad b/lib/XMonad deleted file mode 120000 index 8821322..0000000 --- a/lib/XMonad +++ /dev/null @@ -1 +0,0 @@ -../src/XMonad \ No newline at end of file diff --git a/readme.org b/readme.org index 575bb3e..a21c018 100644 --- a/readme.org +++ b/readme.org @@ -1,36 +1,29 @@ -* XMonad -XMonad configuration formerly known as "xmonad-ng". - +* xmonad-ng ** Example Installation Clone this repository with submodules in the root of your home directory: -#+BEGIN_SRC bash +#+BEGIN_SRC git clone --recursive https://github.com/azahi/xmonad-config ~/.xmonad #+END_SRC Enter the cloned directory: -#+BEGIN_SRC bash +#+BEGIN_SRC cd ~/.xmonad #+END_SRC If you don't have a /xmonad/ executable in your PATH, depending on the build system that you want to use, execute: -#+BEGIN_SRC bash +#+BEGIN_SRC stack update stack build #+END_SRC or -#+BEGIN_SRC bash +#+BEGIN_SRC cabal new-update cabal new-configure cabal new-build #+END_SRC If you have the /xmonad/ executable you can just simply run: -#+BEGIN_SRC bash +#+BEGIN_SRC xmonad --recompile #+END_SRC - -** Copyright -All of the source code including vendored xmonad and xmonad-contrib packages are -released under BSD 3-Clause license. All of the rights to the vendored code -belongs to respective authors. diff --git a/stack.yaml b/stack.yaml deleted file mode 100644 index f55db85..0000000 --- a/stack.yaml +++ /dev/null @@ -1,5 +0,0 @@ -resolver: lts-16.22 -packages: - - . - - ./vendor/xmonad - - ./vendor/xmonad-contrib diff --git a/vendor/xmonad b/vendor/xmonad deleted file mode 160000 index 856c8b2..0000000 --- a/vendor/xmonad +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 856c8b2c8d18d430fa5e4a623550da585e2d1ecd diff --git a/vendor/xmonad-contrib b/vendor/xmonad-contrib deleted file mode 160000 index c51353c..0000000 --- a/vendor/xmonad-contrib +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c51353c6c6abd4d05085074d0d8f8fa3da90f4b9 diff --git a/xmonad-ng.cabal b/xmonad-ng.cabal index cd121f9..7fa6973 100644 --- a/xmonad-ng.cabal +++ b/xmonad-ng.cabal @@ -1,6 +1,8 @@ +cabal-version: 3.0 + name: xmonad-ng -version: 0.15.6 -synopsis: XMonad configuration +version: 2.0.0 +synopsis: Personal XMonad configuration description: This package is a window manager built on top of xmonad and xmonad-contrib libraries targeted for a single-display GNU\/Linux machine running Xorg. @@ -9,22 +11,21 @@ description: using only keyboard and allows using multiple workspaces, scratchpads, window layouts and etc. -license: BSD3 +license: BSD-3-Clause license-file: LICENSE -copyright: (c) 2018-2020 Azat Bahawi +copyright: (c) 2018-2021 Azat Bahawi author: Azat Bahawi maintainer: Azat Bahawi stability: experimental -tested-with: GHC ==8.8.4 +tested-with: GHC ==8.10.7 category: System -homepage: https://github.com/azahi/.xmonad -bug-reports: https://github.com/azahi/.xmonad/issues +homepage: https://github.com/azahi/xmonad-ng +bug-reports: https://github.com/azahi/xmonad-ng/issues build-type: Simple -cabal-version: >=2.0 source-repository head type: git - location: https://github.com/azahi/.xmonad + location: https://github.com/azahi/xmonad-ng executable xmonad-ng main-is: Main.hs @@ -46,14 +47,14 @@ executable xmonad-ng hs-source-dirs: src build-depends: - base ^>=4.13 + base ^>=4.14 , containers ^>=0.6 , directory ^>=1.3 , filepath ^>=1.4 , mtl ^>=2.2 , text ^>=1.2 , time ^>=1.9 - , X11 ^>=1.9 + , X11 ^>=1.10 , xmonad ^>=0.15 , xmonad-contrib ^>=0.16 diff --git a/xmonad.hs b/xmonad.hs deleted file mode 120000 index 3edb691..0000000 --- a/xmonad.hs +++ /dev/null @@ -1 +0,0 @@ -src/Main.hs \ No newline at end of file -- cgit 1.4.1