From b561ebcfee857beacdc5b6f716ccccdd18771670 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Wed, 8 Dec 2021 04:06:35 +0300 Subject: Even more stuff --- default.nix | 6 +++ flake.lock | 35 +++++++++++++++ flake.nix | 91 +++++++++++++++++++++++---------------- shell.nix | 6 +++ src/lib/XMonad/Custom/Bindings.hs | 2 +- src/lib/XMonad/Custom/Misc.hs | 2 +- 6 files changed, 104 insertions(+), 38 deletions(-) create mode 100644 default.nix create mode 100644 shell.nix diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..80aeb43 --- /dev/null +++ b/default.nix @@ -0,0 +1,6 @@ +(import (let lock = builtins.fromJSON (builtins.readFile ./flake.lock); +in fetchTarball { + url = + "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; + sha256 = lock.nodes.flake-compat.locked.narHash; +}) { src = ./.; }).defaultNix diff --git a/flake.lock b/flake.lock index e28436d..51dae57 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,38 @@ { "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1627913399, + "narHash": "sha256-hY8g6H2KFL8ownSiFeMOjwPC8P0ueXpCVEbxgda3pko=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "12c64ca55c1014cdc1b16ed5a804aa8576601ff2", + "type": "github" + }, + "original": { + "owner": "edolstra", + "ref": "master", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1638122382, + "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "74f7e4319258e287b0f9cb95426c9853b282730b", + "type": "github" + }, + "original": { + "owner": "numtide", + "ref": "master", + "repo": "flake-utils", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1638366923, @@ -18,6 +51,8 @@ }, "root": { "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } } 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; + }); } diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..fa2a56c --- /dev/null +++ b/shell.nix @@ -0,0 +1,6 @@ +(import (let lock = builtins.fromJSON (builtins.readFile ./flake.lock); +in fetchTarball { + url = + "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; + sha256 = lock.nodes.flake-compat.locked.narHash; +}) { src = ./.; }).shellNix diff --git a/src/lib/XMonad/Custom/Bindings.hs b/src/lib/XMonad/Custom/Bindings.hs index 807be4f..208ccdf 100644 --- a/src/lib/XMonad/Custom/Bindings.hs +++ b/src/lib/XMonad/Custom/Bindings.hs @@ -57,7 +57,7 @@ import XMonad.Util.NamedScratchpad import XMonad.Util.WorkspaceCompare modMask :: KeyMask -modMask = controlMask +modMask = mod4Mask directions :: [Direction2D] directions = [D, U, L, R] diff --git a/src/lib/XMonad/Custom/Misc.hs b/src/lib/XMonad/Custom/Misc.hs index 355df91..366c01f 100644 --- a/src/lib/XMonad/Custom/Misc.hs +++ b/src/lib/XMonad/Custom/Misc.hs @@ -31,6 +31,6 @@ applications = Applications { browser = "qutebrowser" , mixer = "pulsemixer" , notify = "notify-send" , player = "ncmpcpp" - , term = "xterm" + , term = "alacritty" , top = "htop" } -- cgit 1.4.1