diff --git a/home/chat.nix b/home/chat.nix index 181a7dfe..c38b6cae 100644 --- a/home/chat.nix +++ b/home/chat.nix @@ -1,11 +1,8 @@ { pkgs, ... }: -let inherit (import ../lib) unfreePkgs; -in { +{ home.packages = builtins.attrValues { - inherit (unfreePkgs) discord; + inherit (pkgs.unfree) discord; inherit (pkgs) signal-desktop tdesktop dino riot-desktop; - weechat = pkgs.writeShellScriptBin "weechat" '' - ssh -t hera "tmux -L weechat attach" - ''; + weechat = pkgs.writeShellScriptBin "weechat" "ssh -t hera 'tmux -L weechat attach'"; }; } diff --git a/home/default.nix b/home/default.nix index 6c70bba5..eead46ef 100644 --- a/home/default.nix +++ b/home/default.nix @@ -15,6 +15,9 @@ in { ./mpclient.nix ./neovim ]; + services.gpg-agent = { + enable = true; + }; programs = { home-manager.enable = true; diff --git a/home/desktop/sway.config b/home/desktop/sway.config deleted file mode 100644 index 58218152..00000000 --- a/home/desktop/sway.config +++ /dev/null @@ -1,22 +0,0 @@ -set $mod Mod4 -set $lock swaylock -e -F -l -s fill -f -i ~/volatile/wallpaper.jpg - -output * bg ~/volatile/wallpaper.jpg fill - -#input type:tablet { -# map_to_region "2560x1440@3360,0" -#} - -input type:keyboard { - xkb_layout de - xkb_variant neo - xkb_options altwin:swap_lalt_lwin -} - -focus_follows_mouse no -hide_edge_borders --i3 smart -titlebar_border_thickness 0 -titlebar_padding 1 -font monospace 9.5 -default_border pixel 1 -floating_modifier $mod normal diff --git a/home/desktop/sway.nix b/home/desktop/sway.nix deleted file mode 100644 index a7403aae..00000000 --- a/home/desktop/sway.nix +++ /dev/null @@ -1,188 +0,0 @@ -{ pkgs, lib, config, ... }: -let my-pkgs = import ../../pkgs; -in { - xdg.configFile."sway/config".text = builtins.readFile ./sway.config + (let - inherit (config.m-0) colors workspaces terminal; - swayColors = { - focused = { - background = colors.blue; - border = colors.blue; - childBorder = colors.blue; - indicator = colors.green; - text = colors.foreground; - }; - focused_inactive = { - background = colors.background; - border = colors.background; - childBorder = colors.background; - indicator = colors.green; - text = colors.foreground; - }; - unfocused = { - background = colors.background; - border = colors.background; - childBorder = colors.background; - indicator = colors.green; - text = colors.foreground; - }; - urgent = { - background = colors.red; - border = colors.red; - childBorder = colors.red; - indicator = colors.green; - text = colors.foreground; - }; - }; - barColors = { - active_workspace = { - background = colors.blue; - border = colors.background; - text = colors.white; - }; - binding_mode = { - background = colors.red; - border = colors.red; - text = colors.white; - }; - focused_workspace = { - background = colors.blue; - border = colors.blue; - text = colors.white; - }; - inactive_workspace = { - background = colors.background; - border = colors.background; - text = colors.white; - }; - }; - modlessBindings = { - "ctrl+escape" = "exec $lock"; - "ctrl+space" = "exec ${pkgs.mako}/bin/makoctl dismiss"; - "XF86AudioMute" = "exec pactl set-sink-mute '@DEFAULT_SINK@' toggle"; - "XF86AudioLowerVolume" = - "exec pactl set-sink-volume '@DEFAULT_SINK@' -5%"; - "XF86AudioRaiseVolume" = - "exec pactl set-sink-volume '@DEFAULT_SINK@' +5%"; - "XF86AudioMicMute" = - "exec pactl set-source-mute 'alsa_input.pci-0000_00_1f.3.analog-stereo' toggle"; - "XF86MonBrightnessUp" = - "exec ${pkgs.brightnessctl}/bin/brightnessctl s 5%+"; - "XF86MonBrightnessDown" = - "exec ${pkgs.brightnessctl}/bin/brightnessctl s 5%-"; - }; - bindings = { - "Left" = "focus left"; - "Down" = "focus down"; - "Up" = "focus up"; - "Right" = "focus right"; - "Shift+Left" = "move left"; - "Shift+Down" = "move down"; - "Shift+Up" = "move up"; - "Shift+Right" = "move right"; - "d" = "splith"; - "t" = "layout tabbed"; - "s" = "layout toggle split"; - "f" = "fullscreen"; - "shift+space" = "floating toggle"; - "prior" = "focus parent"; - "next" = "focus child"; - "shift+r" = "exec ${pkgs.sway}/bin/swaymsg reload"; - "shift+q" = "exec ${pkgs.sway}/bin/swaymsg exit"; - "Return" = "exec ${terminal}"; - "q" = "kill"; - "m" = "output $high transform 270"; - "space" = "exec hotkeys"; - }; - workspaceBindings = pkgs.lib.fold (a: b: a // b) { } (builtins.map (num: - let - name = builtins.elemAt workspaces num; - number = toString num; - in { - "${number}" = "workspace ${number}:${name}"; - "Shift+${number}" = "move container to workspace ${number}:${name}"; - "Ctrl+${number}" = "workspace x${number}:${name}"; - "Ctrl+Shift+${number}" = - "move container to workspace x${number}:${name}"; - }) (lib.range 0 9)); - workspaceScreens = builtins.map (num: - let - name = builtins.elemAt workspaces num; - number = toString num; - in { - name = "${number}:${name}"; - screen = "$intern"; - }) (lib.range 0 9); - workspacehighScreens = builtins.map (num: - let - name = builtins.elemAt workspaces num; - number = toString num; - in { - name = "x${number}:${name}"; - screen = "$high"; - }) (lib.range 2 7); - workspacesmallScreens = builtins.map (num: - let - name = builtins.elemAt workspaces num; - number = toString num; - in { - name = "x${number}:${name}"; - screen = "$small"; - }) (lib.range 0 1 ++ [ 8 ]); - modlessBindingsConfig = lib.concatStringsSep "\n" (lib.mapAttrsToList - (binding: command: '' - bindsym ${binding} ${command} - '') modlessBindings); - bindingsConfig = lib.concatStringsSep "\n" (lib.mapAttrsToList - (binding: command: '' - bindsym $mod+${binding} ${command} - '') (bindings // workspaceBindings)); - colorConfig = lib.concatStringsSep "\n" (lib.mapAttrsToList (category: - { border, background, text, indicator, childBorder }: '' - client.${category} ${border}a0 ${background}c0 ${text} ${indicator} ${childBorder} - '') swayColors); - barsConfig = '' - set $intern 'Unknown 0x2336 0x00000000' - set $high 'Ancor Communications Inc ASUS VW248 B6LMTF011850' - set $small 'Unknown X1910WDS 001367' - - output $intern scale 1.0 - - ${pkgs.lib.concatMapStringsSep "\n" - (p: "workspace ${p.name} output ${p.screen}") - (workspaceScreens ++ workspacesmallScreens ++ workspacehighScreens)} - bindsym Print exec pactl set-source-mute 'alsa_input.pci-0000_00_1f.3.analog-stereo' false - bindsym --release Print exec pactl set-source-mute 'alsa_input.pci-0000_00_1f.3.analog-stereo' true - - bar { - id standard - status_command ${pkgs.i3status-rust}/bin/i3status-rs ${./status.toml}; - status_padding 0 - status_edge_padding 0 - font monospace 9.5 - height 17 - - mode hide - - colors { - statusline ${colors.foreground} - background ${colors.background} - ${ - lib.concatStringsSep "\n" (lib.mapAttrsToList (category: - { background, border, text }: '' - ${category} ${background} ${border} ${text} - '') barColors) - } - } - } - - exec random-wallpaper - exec ${pkgs.mako}/bin/mako --background-color "${colors.background}cc" --text-color "${colors.foreground}" --border-size 0 - exec ${my-pkgs.my-ssh-add}/bin/my-ssh-add - exec ${pkgs.xorg.xrdb}/bin/xrdb ${ - builtins.toFile "Xresources" "Xft.dpi: 96" - } - exec ${pkgs.systemd}/bin/systemctl --user set-environment SWAYSOCK="$SWAYSOCK" - exec ${pkgs.swayidle}/bin/swayidle -w before-sleep '$lock' - ''; - in barsConfig + bindingsConfig + modlessBindingsConfig + colorConfig); -} diff --git a/home/games.nix b/home/games.nix index 1307c22b..cd5cbc34 100644 --- a/home/games.nix +++ b/home/games.nix @@ -12,7 +12,7 @@ in { volume-up = lib.mkForce [ ]; }; home.packages = builtins.attrValues { - inherit (unfreePkgs) steam; + inherit (pkgs.unfree) steam; inherit (pkgs) minetest; gw2 = pkgs.buildFHSUserEnv { @@ -42,7 +42,6 @@ in { alsaLib openal mpg123 - libtxc_dxtn gnutls krb5Full ncurses5 diff --git a/home/laptop.nix b/home/laptop.nix index 1032687f..9c421f54 100644 --- a/home/laptop.nix +++ b/home/laptop.nix @@ -1,6 +1,6 @@ { pkgs, lib, ... }: let - inherit (import ../lib) unfreePkgs writeHaskellScript; + inherit (import ../lib) writeHaskellScript; modes = pkgs.lib.attrNames (import ./modes.nix).apollo; autostart-script = pkgs.writeShellScriptBin "home-manager-autostart" '' ${pkgs.xorg.xrdb}/bin/xrdb ${builtins.toFile "Xresources" "Xft.dpi: 96"} @@ -52,7 +52,7 @@ in { activate-mode > /dev/null ''; - inherit (unfreePkgs) zoom-us skypeforlinux google-chrome; + inherit (pkgs.unfree) zoom-us skypeforlinux google-chrome; inherit (pkgs.gnome3) nautilus; inherit (pkgs.xorg) xbacklight; inherit (pkgs) diff --git a/home/neovim/default.nix b/home/neovim/default.nix index b65dbe02..c4787289 100644 --- a/home/neovim/default.nix +++ b/home/neovim/default.nix @@ -1,13 +1,11 @@ { pkgs, config, ... }: let - inherit (import ../../lib) unstable; - myPkgs = import ../../pkgs; - neovim = myPkgs.neovim.override { + neovim = pkgs.neovim.override { configure = { customRC = builtins.readFile ./vimrc; packages.myVimPackage = { start = builtins.attrValues { - inherit (unstable.vimPlugins) + inherit (pkgs.vimPlugins) # coc-tabnine (TODO: Why doesn‘t it work?) # TODO: tabnine config in home-manager # TODO: tabnine lsp: nix, rust, pandoc/latex lsp? was noch? diff --git a/home/pythia.nix b/home/pythia.nix index 2feb927f..253afdb4 100644 --- a/home/pythia.nix +++ b/home/pythia.nix @@ -42,7 +42,6 @@ let dong = "${pkgs.mpv}/bin/mpv dong.ogg &> /dev/null &"; meditate = pkgs.writeShellScriptBin "meditate" '' cd ${pythia-path} - i3-msg fullscreen &> /dev/null start=`${pkgs.taskwarrior}/bin/task calc now` mpv background.ogg &> /dev/null & ${run-printslow} << EOF diff --git a/lib/default.nix b/lib/default.nix index 81563921..a21395f3 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -20,29 +20,6 @@ rec { "brightWhite" = "#ffffff"; }; pkgs = import { }; - unstable = import { }; - unfreePkgs = import { config = { allowUnfree = true; }; }; - sources = import ../nix/sources.nix; - unBreak = pkg: - pkgs.haskell.lib.overrideCabal pkg (drv: { - broken = false; - doCheck = false; - }); - shh = unBreak pkgs.haskellPackages.shh; - ghc = pkgs.ghc.withPackages (p: [ - (unBreak p.shh) - p.brittany - p.hlint - p.ghcid - p.cabal-install - p.relude - p.shake - p.hledger-lib - p.dhall - #p.releaser - p.megaparsec - p.pandoc - ]); haskellList = list: ''["${builtins.concatStringsSep ''", "'' list}"]''; writeHaskellScript = { name ? "haskell-script", bins ? [ ], libraries ? [ ], imports ? [ ] }: @@ -52,15 +29,10 @@ rec { cp $contentPath ${name}.hs ${ pkgs.ghc.withPackages (_: - libraries ++ [ - shh - pkgs.haskellPackages.string-interpolate - pkgs.haskellPackages.relude - pkgs.haskellPackages.async - pkgs.haskellPackages.say - pkgs.haskellPackages.cmdargs - pkgs.haskellPackages.text - ]) + libraries ++ (builtins.attrValues { + inherit (pkgs.haskellPackages) + shh string-interpolate relude async say cmdargs text; + })) }/bin/ghc ${name}.hs -threaded -Wall -Wno-unused-top-binds -Wno-missing-signatures -Wno-type-defaults -Wno-unused-imports -Werror mv ${name} $out ${pkgs.binutils-unwrapped}/bin/strip --strip-unneeded "$out" @@ -106,10 +78,11 @@ rec { pure . Text.dropAround ('"' ==) . decodeUtf8 . trim $ escaped myNixPath :: Text -> IO [String] - myNixPath path = concat <$> mapM getNivAssign ["home-manager", "nixpkgs", "unstable"] + myNixPath path = (extraPaths ++) . concat <$> mapM getNivAssign ["home-manager", "nixpkgs", "unstable"] where tag name str = ["-I", [i|#{name :: Text}=#{str :: Text}|]] :: [String] getNivAssign name = tag name <$> getNivPath path name + extraPaths = ["-I", [i|nixpkgs-overlays=#{path}/overlays|]] main :: IO () ${code} @@ -121,5 +94,4 @@ rec { say path ''; home-manager = pkgs.callPackage { }; - gcRetentionDays = 5; } diff --git a/overlays/0-previews.nix b/overlays/0-previews.nix new file mode 100644 index 00000000..b20ec730 --- /dev/null +++ b/overlays/0-previews.nix @@ -0,0 +1,13 @@ +self: super: +let + preview = version: func: + if super.lib.versionOlder super.lib.version version then + func (import { }) + else + { }; +in preview "20.09pre-git" (unstable: { + gnome3 = super.gnome3 // { + inherit (unstable.gnome3) gnome-keyring seahorse gdm; + }; + inherit (unstable) neovim vimPlugins syncthing nerdfonts; +}) diff --git a/overlays/1-unfree.nix b/overlays/1-unfree.nix new file mode 100644 index 00000000..c0ad9a92 --- /dev/null +++ b/overlays/1-unfree.nix @@ -0,0 +1,6 @@ +self: super: +if super.config.allowUnfree or false then + { } +else { + unfree = import { config.allowUnfree = true; }; +} diff --git a/overlays/neovim.nix b/overlays/neovim.nix new file mode 100644 index 00000000..5385f57e --- /dev/null +++ b/overlays/neovim.nix @@ -0,0 +1,7 @@ +self: super: { + neovim = super.neovim.override { + vimAlias = true; + withPython3 = true; + withPython = false; + }; +} diff --git a/overlays/nerdfonts.nix b/overlays/nerdfonts.nix new file mode 100644 index 00000000..f640e4e7 --- /dev/null +++ b/overlays/nerdfonts.nix @@ -0,0 +1,3 @@ +self: super: { + nerdfonts = super.nerdfonts.override { fonts = [ "JetBrainsMono" ]; }; +} diff --git a/overlays/shh.nix b/overlays/shh.nix new file mode 100644 index 00000000..75bb96cc --- /dev/null +++ b/overlays/shh.nix @@ -0,0 +1,7 @@ +self: super: +let inherit (self.haskell.lib) unmarkBroken dontCheck doJailbreak; +in { + haskellPackages = (super.haskellPackages or { }) // { + shh = doJailbreak (unmarkBroken (dontCheck super.haskellPackages.shh)); + }; +} diff --git a/overlays/sources.nix b/overlays/sources.nix new file mode 100644 index 00000000..34bb6fb6 --- /dev/null +++ b/overlays/sources.nix @@ -0,0 +1,3 @@ +self: super: { + sources = import ../nix/sources.nix; +} diff --git a/pkgs/default.nix b/pkgs/default.nix index c271b49f..529f7b7b 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,25 +1,18 @@ let my-lib = import ../lib; - inherit (my-lib) pkgs unstable sources writeHaskellScript unBreak colors; + inherit (my-lib) pkgs; in rec { - obelisk = (import sources.obelisk { }).command; - nix-direnv = sources.nix-direnv + "/direnvrc"; - neovim = unstable.neovim.override { - vimAlias = true; - withPython3 = true; - withPython = false; - }; + obelisk = (import pkgs.sources.obelisk { }).command; + nix-direnv = pkgs.sources.nix-direnv + "/direnvrc"; # pkgs assumed to be present on a non nixos host core-system-pkgs = { - inherit neovim; inherit (pkgs) gitFull gnumake mkpasswd file wget curl wireguard gnupg mutt bind liboping - psmisc unzip rename whois lsof parted python3 binutils ntfsprogs; + psmisc unzip rename whois lsof parted python3 binutils ntfsprogs neovim; }; extra-system-pkgs = { - inherit (pkgs.gitAndTools) git-annex; inherit (pkgs.python3Packages) qrcode; inherit (pkgs) git-crypt htop tree pwgen borgbackup inotifyTools direnv socat nmap ncdu @@ -48,10 +41,8 @@ in rec { inherit (pkgs.pythonPackages) yapf jsbeautifier; inherit (pkgs) go gdb mpc_cli ncmpcpp shfmt htmlTidy astyle nodejs tasksh magic-wormhole - nixfmt stack ghcid rnix-lsp tmate rustup kitty; - inherit (my-lib) ghc; + nixfmt stack ghcid rnix-lsp tmate rustup kitty ghc; inherit obelisk; - cabal-fmt = (unBreak pkgs.haskell.packages.ghc881.cabal-fmt); }; accounting-pkgs = { jali = pkgs.callPackage ./jali { }; diff --git a/system/default.nix b/system/default.nix index 703ae9e4..e4f2237b 100644 --- a/system/default.nix +++ b/system/default.nix @@ -1,7 +1,5 @@ { pkgs, config, lib, ... }: -let - inherit (import ../lib) sources; - me = config.m-0.private.me; +let me = config.m-0.private.me; in { imports = [ ../cachix.nix @@ -12,6 +10,13 @@ in { i18n = { defaultLocale = "en_US.UTF-8"; }; + # For nixos-rebuild + nixpkgs.overlays = let overlayPath = ../overlays; + in map (n: import (overlayPath + ("/" + n))) (builtins.filter (n: + builtins.match ".*\\.nix" n != null + || builtins.pathExists (overlayPath + ("/" + n + "/default.nix"))) + (lib.attrNames (builtins.readDir overlayPath))); + time.timeZone = "Europe/Berlin"; networking = { @@ -35,8 +40,8 @@ in { environment = { etc = lib.mapAttrs' (name: value: lib.nameValuePair "nix-path/${name}" { source = value; }) - (lib.filterAttrs (name: value: name != "__functor") sources) // { - "nix-path/nixos".source = sources.nixpkgs; + (lib.filterAttrs (name: value: name != "__functor") pkgs.sources) // { + "nix-path/nixos".source = pkgs.sources.nixpkgs; }; variables = lib.genAttrs [ "CURL_CA_BUNDLE" "GIT_SSL_CAINFO" "SSL_CERT_FILE" ] @@ -48,7 +53,7 @@ in { [ "https://cache.nixos.org/" "https://nixcache.reflex-frp.org" ]; binaryCachePublicKeys = [ "ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI=" ]; - nixPath = [ "/etc/nix-path" ]; + nixPath = [ "/etc/nix-path" "nixpkgs-overlays=/etc/nixos/overlays" ]; extraOptions = '' fallback = true keep-outputs = true diff --git a/system/fonts.nix b/system/fonts.nix index 4a73932b..9e067784 100644 --- a/system/fonts.nix +++ b/system/fonts.nix @@ -1,6 +1,4 @@ -{ config, pkgs, lib, ... }: -let inherit (import ../lib) unstable; -in { +{ config, pkgs, lib, ... }: { fonts = { fontconfig = { enable = true; @@ -14,10 +12,8 @@ in { enableDefaultFonts = true; enableFontDir = true; fonts = builtins.attrValues { - nerdfonts = unstable.nerdfonts.override { - fonts = [ "JetBrainsMono" ]; - }; # For all my terminal needs. inherit (pkgs) + nerdfonts # For all my terminal needs. libertine # nice text font material-icons # icons in my app b612; # sans font, very good for displays