nixfmt: reformat all files

This commit is contained in:
Ingolf Wagner 2019-12-20 17:54:26 +13:00
commit 42d30d7edf
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
192 changed files with 5276 additions and 5151 deletions

View file

@ -6,17 +6,17 @@ let
home = config.users.users.mainUser.home;
fontSize = config.programs.custom.urxvt.fontSize;
startupBanner = pkgs.fetchurl{
url = "https://github.com/NixOS/nixos-homepage/raw/master/logo/nix-wiki.png";
startupBanner = pkgs.fetchurl {
url =
"https://github.com/NixOS/nixos-homepage/raw/master/logo/nix-wiki.png";
sha256 = "1hrz7wr7i0b2bips60ygacbkmdzv466lsbxi22hycg42kv4m0173";
};
ticks = "\"''\"";
unstable = import <nixpkgs-unstable> {};
unstable = import <nixpkgs-unstable> { };
in
{
in {
environment.systemPackages = [
# needed for the SPC p g
@ -27,223 +27,221 @@ in
];
# download git repositories into the home folder
systemd.services =
let
clone =
repository: folder: branch:
{
enable = true;
wantedBy = [ "multi-user.target" ];
description = "clone ${repository} to ${folder}";
serviceConfig.User = userName;
unitConfig.ConditionPathExists = "!${folder}";
script = ''
${pkgs.git}/bin/git clone ${repository} --branch ${branch} ${folder}
'';
};
in
{
spacemacs-pull = clone "https://github.com/syl20bnr/spacemacs" "${home}/.emacs.d" "master";
# todo move this to spacevim.nix
spacevim-pull = clone "https://github.com/SpaceVim/SpaceVim.git" "${home}/.SpaceVim" "master";
systemd.services = let
clone = repository: folder: branch: {
enable = true;
wantedBy = [ "multi-user.target" ];
description = "clone ${repository} to ${folder}";
serviceConfig.User = userName;
unitConfig.ConditionPathExists = "!${folder}";
script = ''
${pkgs.git}/bin/git clone ${repository} --branch ${branch} ${folder}
'';
};
in {
spacemacs-pull =
clone "https://github.com/syl20bnr/spacemacs" "${home}/.emacs.d" "master";
# todo move this to spacevim.nix
spacevim-pull =
clone "https://github.com/SpaceVim/SpaceVim.git" "${home}/.SpaceVim"
"master";
};
home-manager.users."${user}" = {
# a file which needs to be included at the end
home.file.".spacemacs.d/hook-init.el".text = ''
;; -*- mode: emacs-lisp -*-
;; just add (load "~/.spacemacs.d/hook-init.el") in your dotspacemacs/init function
# a file which needs to be included at the end
home.file.".spacemacs.d/hook-init.el".text = ''
;; -*- mode: emacs-lisp -*-
;; just add (load "~/.spacemacs.d/hook-init.el") in your dotspacemacs/init function
;; overrides of dotspacemacs/init ()
;; overrides of dotspacemacs/init ()
(setq
;; List of themes, the first of the list is loaded when spacemacs starts.
;; Press <SPC> T n to cycle to the next theme in the list (works great
;; with 2 themes variants, one dark and one lixft:inconsolata:pixelsizeght)
dotspacemacs-themes '(solarized-light solarized-dark)
;; Specify the startup banner. Default value is `official', it displays
;; the official spacemacs logo. An integer value is the index of text
;; banner, `random' chooses a random text banner in `core/banners'
;; directory. A string value must be a path to an image format supported
;; by your Emacs build.
;; If the value is nil then no banner is displayed. (default 'official)
dotspacemacs-startup-banner "${startupBanner}"
;; Default font, or prioritized list of fonts. `powerline-scale' allows to
;; quickly tweak the mode-line size to make separators look not too crappy.
dotspacemacs-default-font '("Terminus"
:size ${toString fontSize}
:weight normal
:width normal
:powerline-scale 1.1)
) ;; eof
'';
home.file.".spacemacs.d/hook-layers.el".text = ''
;; -*- mode: emacs-lisp -*-
;; just add (load "~/.spacemacs.d/hook-layers.el") in your dotspacemacs/layers function
(let
((user-layers dotspacemacs-configuration-layers))
(setq
dotspacemacs-configuration-layers
(append user-layers
'( python
ansible
rust
windows-scripts
javascript
typescript
html
yaml
auto-completion
git
markdown
restclient
emacs-lisp
nixos
spell-checking
syntax-checking
systemd
lua
terraform
graphviz
c-c++
(haskell :variables
haskell-enable-hindent t
haskell-completion-backend 'lsp
haskell-enable-hindent-style "gibiansky"
haskell-process-type 'cabal-new-repl)
))))
;; List of themes, the first of the list is loaded when spacemacs starts.
;; Press <SPC> T n to cycle to the next theme in the list (works great
;; with 2 themes variants, one dark and one lixft:inconsolata:pixelsizeght)
dotspacemacs-themes '(solarized-light solarized-dark)
(let
((user-packages dotspacemacs-additional-packages ))
(setq
dotspacemacs-additional-packages
(append user-packages
'( lsp-mode
lsp-ui
lsp-haskell
direnv
))))
'';
;; Specify the startup banner. Default value is `official', it displays
;; the official spacemacs logo. An integer value is the index of text
;; banner, `random' chooses a random text banner in `core/banners'
;; directory. A string value must be a path to an image format supported
;; by your Emacs build.
;; If the value is nil then no banner is displayed. (default 'official)
dotspacemacs-startup-banner "${startupBanner}"
# a file which needs to be included at the end
home.file.".spacemacs.d/hook-user-config.el".text = ''
;; -*- mode: emacs-lisp -*-
;; just add (load "~/.spacemacs.d/hook-user-config.el") in your dotspacemacs/user-config function
;; Default font, or prioritized list of fonts. `powerline-scale' allows to
;; quickly tweak the mode-line size to make separators look not too crappy.
dotspacemacs-default-font '("Terminus"
:size ${toString fontSize}
:weight normal
:width normal
:powerline-scale 1.1)
(let ((n 2))
(setq coffee-tab-width n)
(setq javascript-indent-level n)
(setq js-indent-level n)
(setq js2-basic-offset n)
(setq web-mode-markup-indent-offset n)
(setq web-mode-css-indent-offset n)
(setq web-mode-code-indent-offset n)
(setq css-indent-offset n))
) ;; eof
;; configure indent function correctly
(add-hook 'nix-mode-hook
'(lambda ()
(setq indent-tabs-mode nil)
(setq tab-width 2)
(setq indent-line-function (quote nix-indent-line))))
;; lsp setup for haskell
;; hie-wrapper must be configured in the direnv setup
;; make sure cabal update was executed once on the machine
(setq lsp-haskell-process-path-hie "hie-wrapper")
(setq lsp-response-timeout 60)
(require 'lsp-haskell)
;; (add-hook 'haskell-mode-hook #'lsp)
(add-hook 'haskell-mode-hook #'direnv-update-environment)
'';
home.file.".spacemacs.d/hook-layers.el".text = ''
;; -*- mode: emacs-lisp -*-
;; just add (load "~/.spacemacs.d/hook-layers.el") in your dotspacemacs/layers function
(let
((user-layers dotspacemacs-configuration-layers))
(setq
dotspacemacs-configuration-layers
(append user-layers
'( python
ansible
rust
windows-scripts
javascript
typescript
html
yaml
auto-completion
git
markdown
restclient
emacs-lisp
nixos
spell-checking
syntax-checking
systemd
lua
terraform
graphviz
c-c++
(haskell :variables
haskell-enable-hindent t
haskell-completion-backend 'lsp
haskell-enable-hindent-style "gibiansky"
haskell-process-type 'cabal-new-repl)
))))
(let
((user-packages dotspacemacs-additional-packages ))
(setq
dotspacemacs-additional-packages
(append user-packages
'( lsp-mode
lsp-ui
lsp-haskell
direnv
))))
'';
# a file which needs to be included at the end
home.file.".spacemacs.d/hook-user-config.el".text = ''
;; -*- mode: emacs-lisp -*-
;; just add (load "~/.spacemacs.d/hook-user-config.el") in your dotspacemacs/user-config function
(let ((n 2))
(setq coffee-tab-width n)
(setq javascript-indent-level n)
(setq js-indent-level n)
(setq js2-basic-offset n)
(setq web-mode-markup-indent-offset n)
(setq web-mode-css-indent-offset n)
(setq web-mode-code-indent-offset n)
(setq css-indent-offset n))
;; configure indent function correctly
(add-hook 'nix-mode-hook
'(lambda ()
(setq indent-tabs-mode nil)
(setq tab-width 2)
(setq indent-line-function (quote nix-indent-line))))
;; lsp setup for haskell
;; hie-wrapper must be configured in the direnv setup
;; make sure cabal update was executed once on the machine
(setq lsp-haskell-process-path-hie "hie-wrapper")
(setq lsp-response-timeout 60)
(require 'lsp-haskell)
;; (add-hook 'haskell-mode-hook #'lsp)
(add-hook 'haskell-mode-hook #'direnv-update-environment)
;; setup run-assoc
;; in dired mode use C-<RETURN> to open file in associated program
(load "~/.spacemacs.d/run-assoc.el")
(setq associated-program-alist
'(
("${pkgs.evince}/bin/evince" "\\.pdf$")
("${pkgs.libreoffice}/bin/libreoffice" "\\.odt$")
("${pkgs.libreoffice}/bin/libreoffice" "\\.ods$")
${
let
suffixes = ["jpg" "jpeg" "png"];
rule = suffix: ''("${pkgs.sxiv}/bin/sxiv" "\\.${suffix}$")'';
in
lib.concatStringsSep "\n " (builtins.map rule suffixes)}
)
;; setup run-assoc
;; in dired mode use C-<RETURN> to open file in associated program
(load "~/.spacemacs.d/run-assoc.el")
(setq associated-program-alist
'(
("${pkgs.evince}/bin/evince" "\\.pdf$")
("${pkgs.libreoffice}/bin/libreoffice" "\\.odt$")
("${pkgs.libreoffice}/bin/libreoffice" "\\.ods$")
${
let
suffixes = [ "jpg" "jpeg" "png" ];
rule = suffix: ''("${pkgs.sxiv}/bin/sxiv" "\\.${suffix}$")'';
in lib.concatStringsSep "\n " (builtins.map rule suffixes)
}
)
'';
home.file.".spacemacs.d/run-assoc.el".source = pkgs.fetchurl {
url = "https://www.emacswiki.org/emacs/download/run-assoc.el";
sha256 = "1rg0pa09zfslgqnhbqvaa6vdi2fmanrpyzq67ppiin0h1kdgs4im";
};
home.file.".ctags.d/terraform.ctags".text = ''
--langdef=terraform
--langmap=terraform:.tf.tfvars
--regex-terraform=/^[[:space:]]*resource[[:space:]]*"([^"]*)"[[:space:]]*"([^"]*)"/\1.\2/r,Resource/
--regex-terraform=/^[[:space:]]*data[[:space:]]*"([^"]*)"[[:space:]]*"([^"]*)"/\1.\2/d,Data/
--regex-terraform=/^[[:space:]]*variable[[:space:]]*"([^"]*)"/\1/v,Variable/
--regex-terraform=/^[[:space:]]*provider[[:space:]]*"([^"]*)"/\1/p,Provider/
--regex-terraform=/^[[:space:]]*module[[:space:]]*"([^"]*)"/\1/m,Module/
--regex-terraform=/^[[:space:]]*output[[:space:]]*"([^"]*)"/\1/o,Output/
--regex-terraform=/^([a-z0-9_]+)[[:space:]]*=/\1/f,TFVar/
'';
home.file.".spacemacs.d/old/polymode.el".text = ''
;; not used at the moment
(define-hostmode poly-nix-hostmode
:mode 'nix-mode)
(define-innermode poly-nix-lisp-metadata-innermode
:mode 'emacs-lisp-mode
:head-matcher (rx "/* lisp */" (one-or-more space) ${ticks} (zero-or-more space) line-end)
:tail-matcher (rx ${ticks} (zero-or-more space) ";" (zero-or-more space) line-end)
:head-mode 'host
:tail-mode 'host)
(define-innermode poly-nix-shell-metadata-innermode
:mode 'shell-script-mode
:head-matcher (rx "/* sh */" (one-or-more space) ${ticks} (zero-or-more space) line-end)
:tail-matcher (rx ${ticks} (zero-or-more space) ";" (zero-or-more space) line-end)
:head-mode 'host
:tail-mode 'host)
(define-innermode poly-nix-python-metadata-innermode
:mode 'python-mode
:head-matcher (rx "/* python */" (one-or-more space) ${ticks} (zero-or-more space) line-end)
:tail-matcher (rx ${ticks} (zero-or-more space) ";" (zero-or-more space) line-end)
:head-mode 'host
:tail-mode 'host)
(define-innermode poly-nix-haskell-metadata-innermode
:mode 'haskell-mode
:head-matcher (rx "/* haskell */" (one-or-more space) ${ticks} (zero-or-more space) line-end)
:tail-matcher (rx ${ticks} (zero-or-more space) ";" (zero-or-more space) line-end)
:head-mode 'host
:tail-mode 'host)
(define-polymode poly-nix-mode
:hostmode 'poly-nix-hostmode
:innermodes '(poly-nix-lisp-metadata-innermode
poly-nix-shell-metadata-innermode
poly-nix-haskell-metadata-innermode
poly-nix-python-metadata-innermode))
;; remove nix-mode from auto load and replace it with poly-nix-mode
(setq auto-mode-alist (rassq-delete-all 'nix-mode auto-mode-alist))
(add-to-list 'auto-mode-alist '("\\.nix\\'" . poly-nix-mode))
'';
)
'';
home.file.".spacemacs.d/run-assoc.el".source = pkgs.fetchurl {
url = "https://www.emacswiki.org/emacs/download/run-assoc.el";
sha256 = "1rg0pa09zfslgqnhbqvaa6vdi2fmanrpyzq67ppiin0h1kdgs4im";
};
home.file.".ctags.d/terraform.ctags".text = ''
--langdef=terraform
--langmap=terraform:.tf.tfvars
--regex-terraform=/^[[:space:]]*resource[[:space:]]*"([^"]*)"[[:space:]]*"([^"]*)"/\1.\2/r,Resource/
--regex-terraform=/^[[:space:]]*data[[:space:]]*"([^"]*)"[[:space:]]*"([^"]*)"/\1.\2/d,Data/
--regex-terraform=/^[[:space:]]*variable[[:space:]]*"([^"]*)"/\1/v,Variable/
--regex-terraform=/^[[:space:]]*provider[[:space:]]*"([^"]*)"/\1/p,Provider/
--regex-terraform=/^[[:space:]]*module[[:space:]]*"([^"]*)"/\1/m,Module/
--regex-terraform=/^[[:space:]]*output[[:space:]]*"([^"]*)"/\1/o,Output/
--regex-terraform=/^([a-z0-9_]+)[[:space:]]*=/\1/f,TFVar/
'';
home.file.".spacemacs.d/old/polymode.el".text = ''
;; not used at the moment
(define-hostmode poly-nix-hostmode
:mode 'nix-mode)
(define-innermode poly-nix-lisp-metadata-innermode
:mode 'emacs-lisp-mode
:head-matcher (rx "/* lisp */" (one-or-more space) ${ticks} (zero-or-more space) line-end)
:tail-matcher (rx ${ticks} (zero-or-more space) ";" (zero-or-more space) line-end)
:head-mode 'host
:tail-mode 'host)
(define-innermode poly-nix-shell-metadata-innermode
:mode 'shell-script-mode
:head-matcher (rx "/* sh */" (one-or-more space) ${ticks} (zero-or-more space) line-end)
:tail-matcher (rx ${ticks} (zero-or-more space) ";" (zero-or-more space) line-end)
:head-mode 'host
:tail-mode 'host)
(define-innermode poly-nix-python-metadata-innermode
:mode 'python-mode
:head-matcher (rx "/* python */" (one-or-more space) ${ticks} (zero-or-more space) line-end)
:tail-matcher (rx ${ticks} (zero-or-more space) ";" (zero-or-more space) line-end)
:head-mode 'host
:tail-mode 'host)
(define-innermode poly-nix-haskell-metadata-innermode
:mode 'haskell-mode
:head-matcher (rx "/* haskell */" (one-or-more space) ${ticks} (zero-or-more space) line-end)
:tail-matcher (rx ${ticks} (zero-or-more space) ";" (zero-or-more space) line-end)
:head-mode 'host
:tail-mode 'host)
(define-polymode poly-nix-mode
:hostmode 'poly-nix-hostmode
:innermodes '(poly-nix-lisp-metadata-innermode
poly-nix-shell-metadata-innermode
poly-nix-haskell-metadata-innermode
poly-nix-python-metadata-innermode))
;; remove nix-mode from auto load and replace it with poly-nix-mode
(setq auto-mode-alist (rassq-delete-all 'nix-mode auto-mode-alist))
(add-to-list 'auto-mode-alist '("\\.nix\\'" . poly-nix-mode))
'';
};
}

View file

@ -1,7 +1,6 @@
{ lib, pkgs, ... }:
{
{ lib, pkgs, ... }: {
environment.systemPackages = let
spacevimRepo = pkgs.fetchgit{
spacevimRepo = pkgs.fetchgit {
url = "https://github.com/SpaceVim/SpaceVim.git";
rev = "9b354e05b4716b645ba6366e1265a5048a0c23d5";
sha256 = "1mn28hf857kp0jmbgd89cf5mk4dg53jcbqqrbr9zi3b854sa9ads";
@ -28,8 +27,8 @@
" disable noisy indentLine
let g:indentLine_enabled = 0
'';
in [
'';
in [
# vim
(pkgs.writers.writeDashBin "spacevim" ''

View file

@ -1,6 +1,5 @@
{ lib, ... }:
with lib;
{
with lib; {
home-manager.users.mainUser = {
programs.ssh.enable = true;

View file

@ -1,22 +1,28 @@
{ pkgs, lib, config, ... }:
let
nixCommands = { height, width }: pkgs.writeText "NixCommands.hs" /* haskell */ ''
module NixCommands where
nixCommands = { height, width }:
pkgs.writeText "NixCommands.hs" # haskell
''
module NixCommands where
nixStartIrc = "${pkgs.rxvt_unicode}/bin/urxvt -e irc"
nixStartAudacious = "${pkgs.audacious}/bin/audacious"
nixStartFlameshot = "${pkgs.flameshot}/bin/flameshot gui -p /share/"
nixInvertColors = "${pkgs.xcalib}/bin/xcalib -invert -alter"
nixStartRedshift = "${pkgs.redshift}/bin/redshift -O 6100 -g 0.9:0.9:0.9 -b 0.9"
nixResetRedshift = "${pkgs.redshift}/bin/redshift -x"
nixSetCursorImage = "${pkgs.xorg.xsetroot}/bin/xsetroot -cursor_name left_ptr"
nixSetBackground = "${pkgs.haskellPackages.image-generator}/bin/image-generator --height ${toString height} --width ${toString width} --output /dev/shm/background.png && ${pkgs.feh}/bin/feh --bg-scale /dev/shm/background.png"
nixStartAlbert = "${pkgs.albert}/bin/albert"
nixStartCopyq = "${pkgs.copyq}/bin/copyq"
nixShowCopyq = "${pkgs.copyq}/bin/copyq show"
nixStartTerminal = "${pkgs.rxvt_unicode_with-plugins}/bin/urxvtc"
'';
nixStartIrc = "${pkgs.rxvt_unicode}/bin/urxvt -e irc"
nixStartAudacious = "${pkgs.audacious}/bin/audacious"
nixStartFlameshot = "${pkgs.flameshot}/bin/flameshot gui -p /share/"
nixInvertColors = "${pkgs.xcalib}/bin/xcalib -invert -alter"
nixStartRedshift = "${pkgs.redshift}/bin/redshift -O 6100 -g 0.9:0.9:0.9 -b 0.9"
nixResetRedshift = "${pkgs.redshift}/bin/redshift -x"
nixSetCursorImage = "${pkgs.xorg.xsetroot}/bin/xsetroot -cursor_name left_ptr"
nixSetBackground = "${pkgs.haskellPackages.image-generator}/bin/image-generator --height ${
toString height
} --width ${
toString width
} --output /dev/shm/background.png && ${pkgs.feh}/bin/feh --bg-scale /dev/shm/background.png"
nixStartAlbert = "${pkgs.albert}/bin/albert"
nixStartCopyq = "${pkgs.copyq}/bin/copyq"
nixShowCopyq = "${pkgs.copyq}/bin/copyq show"
nixStartTerminal = "${pkgs.rxvt_unicode_with-plugins}/bin/urxvtc"
'';
in {
home-manager.users.mainUser = {
@ -25,7 +31,8 @@ in {
height = config.configuration.desktop.height;
width = config.configuration.desktop.width;
};
home.file.".xmonad/lib/SolarizedLight.hs".source = ./xmonad/SolarizedLight.hs;
home.file.".xmonad/lib/SolarizedLight.hs".source =
./xmonad/SolarizedLight.hs;
home.file.".xmonad/lib/SolarizedDark.hs".source = ./xmonad/SolarizedDark.hs;
home.file.".xmonad/lib/FloatKeys.hs".source = ./xmonad/FloatKeys.hs;
home.file.".xmonad/lib/TabbedFix.hs".source = ./xmonad/TabbedFix.hs;

View file

@ -1,15 +1,12 @@
# created by cabal2nix
{ mkDerivation, base, deepseq, stdenv, xmonad, xmonad-contrib
, xmonad-extras
}:
# created by cabal2nix
{ mkDerivation, base, deepseq, stdenv, xmonad, xmonad-contrib, xmonad-extras }:
mkDerivation {
pname = "palos-xmonad";
version = "0.1.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [
base deepseq xmonad xmonad-contrib xmonad-extras
];
executableHaskellDepends =
[ base deepseq xmonad xmonad-contrib xmonad-extras ];
license = stdenv.lib.licenses.gpl3;
}

View file

@ -1,4 +1,4 @@
{ pkgs ? import <nixpkgs> {
{ pkgs ? import <nixpkgs> {
overlays = [
(self: super: {
haskellPackages = super.haskellPackages.override {
@ -6,6 +6,7 @@
current-project = super.callPackage ./current-project.nix { };
};
};
})];
}}:
})
];
} }:
pkgs.haskellPackages.current-project.env

View file

@ -1,13 +1,14 @@
{ pkgs ? import <nixpkgs> {} }:
{ pkgs ? import <nixpkgs> { } }:
let
all-hies = import (fetchTarball "https://github.com/infinisil/all-hies/tarball/master") {};
in
pkgs.mkShell {
all-hies =
import (fetchTarball "https://github.com/infinisil/all-hies/tarball/master")
{ };
in pkgs.mkShell {
buildInputs = with pkgs; [
haskellPackages.hoogle
haskellPackages.hindent
haskellPackages.hlint
haskellPackages.stylish-haskell
(all-hies.selection { selector = p: {inherit (p) ghc865; }; })
(all-hies.selection { selector = p: { inherit (p) ghc865; }; })
];
}

View file

@ -1,14 +1,9 @@
{ pkgs ? import <nixpkgs> {} }:
{ pkgs ? import <nixpkgs> { } }:
let
updateCabal = pkgs.writeShellScriptBin "update-cabal" /* sh */ ''
cd ${toString ./.}
echo "# created by cabal2nix " > ${toString ./.}/current-project.nix
${pkgs.cabal2nix}/bin/cabal2nix . >> ${toString ./.}/current-project.nix
'';
in
pkgs.mkShell {
buildInputs = with pkgs; [
updateCabal
cabal2nix
];
}
updateCabal = pkgs.writeShellScriptBin "update-cabal" # sh
''
cd ${toString ./.}
echo "# created by cabal2nix " > ${toString ./.}/current-project.nix
${pkgs.cabal2nix}/bin/cabal2nix . >> ${toString ./.}/current-project.nix
'';
in pkgs.mkShell { buildInputs = with pkgs; [ updateCabal cabal2nix ]; }