1
0
Fork 0

Switch to overlays

This commit is contained in:
Malte Brandy 2020-05-22 01:13:42 +02:00
parent c407af6962
commit 88a8a5cf0d
No known key found for this signature in database
GPG key ID: 226A2D41EF5378C9
18 changed files with 74 additions and 285 deletions

View file

@ -1,11 +1,8 @@
{ pkgs, ... }: { pkgs, ... }:
let inherit (import ../lib) unfreePkgs; {
in {
home.packages = builtins.attrValues { home.packages = builtins.attrValues {
inherit (unfreePkgs) discord; inherit (pkgs.unfree) discord;
inherit (pkgs) signal-desktop tdesktop dino riot-desktop; inherit (pkgs) signal-desktop tdesktop dino riot-desktop;
weechat = pkgs.writeShellScriptBin "weechat" '' weechat = pkgs.writeShellScriptBin "weechat" "ssh -t hera 'tmux -L weechat attach'";
ssh -t hera "tmux -L weechat attach"
'';
}; };
} }

View file

@ -15,6 +15,9 @@ in {
./mpclient.nix ./mpclient.nix
./neovim ./neovim
]; ];
services.gpg-agent = {
enable = true;
};
programs = { programs = {
home-manager.enable = true; home-manager.enable = true;

View file

@ -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

View file

@ -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);
}

View file

@ -12,7 +12,7 @@ in {
volume-up = lib.mkForce [ ]; volume-up = lib.mkForce [ ];
}; };
home.packages = builtins.attrValues { home.packages = builtins.attrValues {
inherit (unfreePkgs) steam; inherit (pkgs.unfree) steam;
inherit (pkgs) minetest; inherit (pkgs) minetest;
gw2 = pkgs.buildFHSUserEnv { gw2 = pkgs.buildFHSUserEnv {
@ -42,7 +42,6 @@ in {
alsaLib alsaLib
openal openal
mpg123 mpg123
libtxc_dxtn
gnutls gnutls
krb5Full krb5Full
ncurses5 ncurses5

View file

@ -1,6 +1,6 @@
{ pkgs, lib, ... }: { pkgs, lib, ... }:
let let
inherit (import ../lib) unfreePkgs writeHaskellScript; inherit (import ../lib) writeHaskellScript;
modes = pkgs.lib.attrNames (import ./modes.nix).apollo; modes = pkgs.lib.attrNames (import ./modes.nix).apollo;
autostart-script = pkgs.writeShellScriptBin "home-manager-autostart" '' autostart-script = pkgs.writeShellScriptBin "home-manager-autostart" ''
${pkgs.xorg.xrdb}/bin/xrdb ${builtins.toFile "Xresources" "Xft.dpi: 96"} ${pkgs.xorg.xrdb}/bin/xrdb ${builtins.toFile "Xresources" "Xft.dpi: 96"}
@ -52,7 +52,7 @@ in {
activate-mode > /dev/null 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.gnome3) nautilus;
inherit (pkgs.xorg) xbacklight; inherit (pkgs.xorg) xbacklight;
inherit (pkgs) inherit (pkgs)

View file

@ -1,13 +1,11 @@
{ pkgs, config, ... }: { pkgs, config, ... }:
let let
inherit (import ../../lib) unstable; neovim = pkgs.neovim.override {
myPkgs = import ../../pkgs;
neovim = myPkgs.neovim.override {
configure = { configure = {
customRC = builtins.readFile ./vimrc; customRC = builtins.readFile ./vimrc;
packages.myVimPackage = { packages.myVimPackage = {
start = builtins.attrValues { start = builtins.attrValues {
inherit (unstable.vimPlugins) inherit (pkgs.vimPlugins)
# coc-tabnine (TODO: Why doesnt it work?) # coc-tabnine (TODO: Why doesnt it work?)
# TODO: tabnine config in home-manager # TODO: tabnine config in home-manager
# TODO: tabnine lsp: nix, rust, pandoc/latex lsp? was noch? # TODO: tabnine lsp: nix, rust, pandoc/latex lsp? was noch?

View file

@ -42,7 +42,6 @@ let
dong = "${pkgs.mpv}/bin/mpv dong.ogg &> /dev/null &"; dong = "${pkgs.mpv}/bin/mpv dong.ogg &> /dev/null &";
meditate = pkgs.writeShellScriptBin "meditate" '' meditate = pkgs.writeShellScriptBin "meditate" ''
cd ${pythia-path} cd ${pythia-path}
i3-msg fullscreen &> /dev/null
start=`${pkgs.taskwarrior}/bin/task calc now` start=`${pkgs.taskwarrior}/bin/task calc now`
mpv background.ogg &> /dev/null & mpv background.ogg &> /dev/null &
${run-printslow} << EOF ${run-printslow} << EOF

View file

@ -20,29 +20,6 @@ rec {
"brightWhite" = "#ffffff"; "brightWhite" = "#ffffff";
}; };
pkgs = import <nixpkgs> { }; pkgs = import <nixpkgs> { };
unstable = import <unstable> { };
unfreePkgs = import <nixpkgs> { 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}"]''; haskellList = list: ''["${builtins.concatStringsSep ''", "'' list}"]'';
writeHaskellScript = writeHaskellScript =
{ name ? "haskell-script", bins ? [ ], libraries ? [ ], imports ? [ ] }: { name ? "haskell-script", bins ? [ ], libraries ? [ ], imports ? [ ] }:
@ -52,15 +29,10 @@ rec {
cp $contentPath ${name}.hs cp $contentPath ${name}.hs
${ ${
pkgs.ghc.withPackages (_: pkgs.ghc.withPackages (_:
libraries ++ [ libraries ++ (builtins.attrValues {
shh inherit (pkgs.haskellPackages)
pkgs.haskellPackages.string-interpolate shh string-interpolate relude async say cmdargs text;
pkgs.haskellPackages.relude }))
pkgs.haskellPackages.async
pkgs.haskellPackages.say
pkgs.haskellPackages.cmdargs
pkgs.haskellPackages.text
])
}/bin/ghc ${name}.hs -threaded -Wall -Wno-unused-top-binds -Wno-missing-signatures -Wno-type-defaults -Wno-unused-imports -Werror }/bin/ghc ${name}.hs -threaded -Wall -Wno-unused-top-binds -Wno-missing-signatures -Wno-type-defaults -Wno-unused-imports -Werror
mv ${name} $out mv ${name} $out
${pkgs.binutils-unwrapped}/bin/strip --strip-unneeded "$out" ${pkgs.binutils-unwrapped}/bin/strip --strip-unneeded "$out"
@ -106,10 +78,11 @@ rec {
pure . Text.dropAround ('"' ==) . decodeUtf8 . trim $ escaped pure . Text.dropAround ('"' ==) . decodeUtf8 . trim $ escaped
myNixPath :: Text -> IO [String] myNixPath :: Text -> IO [String]
myNixPath path = concat <$> mapM getNivAssign ["home-manager", "nixpkgs", "unstable"] myNixPath path = (extraPaths ++) . concat <$> mapM getNivAssign ["home-manager", "nixpkgs", "unstable"]
where where
tag name str = ["-I", [i|#{name :: Text}=#{str :: Text}|]] :: [String] tag name str = ["-I", [i|#{name :: Text}=#{str :: Text}|]] :: [String]
getNivAssign name = tag name <$> getNivPath path name getNivAssign name = tag name <$> getNivPath path name
extraPaths = ["-I", [i|nixpkgs-overlays=#{path}/overlays|]]
main :: IO () main :: IO ()
${code} ${code}
@ -121,5 +94,4 @@ rec {
say path say path
''; '';
home-manager = pkgs.callPackage <home-manager/home-manager> { }; home-manager = pkgs.callPackage <home-manager/home-manager> { };
gcRetentionDays = 5;
} }

13
overlays/0-previews.nix Normal file
View file

@ -0,0 +1,13 @@
self: super:
let
preview = version: func:
if super.lib.versionOlder super.lib.version version then
func (import <unstable> { })
else
{ };
in preview "20.09pre-git" (unstable: {
gnome3 = super.gnome3 // {
inherit (unstable.gnome3) gnome-keyring seahorse gdm;
};
inherit (unstable) neovim vimPlugins syncthing nerdfonts;
})

6
overlays/1-unfree.nix Normal file
View file

@ -0,0 +1,6 @@
self: super:
if super.config.allowUnfree or false then
{ }
else {
unfree = import <nixpkgs> { config.allowUnfree = true; };
}

7
overlays/neovim.nix Normal file
View file

@ -0,0 +1,7 @@
self: super: {
neovim = super.neovim.override {
vimAlias = true;
withPython3 = true;
withPython = false;
};
}

3
overlays/nerdfonts.nix Normal file
View file

@ -0,0 +1,3 @@
self: super: {
nerdfonts = super.nerdfonts.override { fonts = [ "JetBrainsMono" ]; };
}

7
overlays/shh.nix Normal file
View file

@ -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));
};
}

3
overlays/sources.nix Normal file
View file

@ -0,0 +1,3 @@
self: super: {
sources = import ../nix/sources.nix;
}

View file

@ -1,25 +1,18 @@
let let
my-lib = import ../lib; my-lib = import ../lib;
inherit (my-lib) pkgs unstable sources writeHaskellScript unBreak colors; inherit (my-lib) pkgs;
in rec { in rec {
obelisk = (import sources.obelisk { }).command; obelisk = (import pkgs.sources.obelisk { }).command;
nix-direnv = sources.nix-direnv + "/direnvrc"; nix-direnv = pkgs.sources.nix-direnv + "/direnvrc";
neovim = unstable.neovim.override {
vimAlias = true;
withPython3 = true;
withPython = false;
};
# pkgs assumed to be present on a non nixos host # pkgs assumed to be present on a non nixos host
core-system-pkgs = { core-system-pkgs = {
inherit neovim;
inherit (pkgs) inherit (pkgs)
gitFull gnumake mkpasswd file wget curl wireguard gnupg mutt bind liboping 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 = { extra-system-pkgs = {
inherit (pkgs.gitAndTools) git-annex;
inherit (pkgs.python3Packages) qrcode; inherit (pkgs.python3Packages) qrcode;
inherit (pkgs) inherit (pkgs)
git-crypt htop tree pwgen borgbackup inotifyTools direnv socat nmap ncdu git-crypt htop tree pwgen borgbackup inotifyTools direnv socat nmap ncdu
@ -48,10 +41,8 @@ in rec {
inherit (pkgs.pythonPackages) yapf jsbeautifier; inherit (pkgs.pythonPackages) yapf jsbeautifier;
inherit (pkgs) inherit (pkgs)
go gdb mpc_cli ncmpcpp shfmt htmlTidy astyle nodejs tasksh magic-wormhole go gdb mpc_cli ncmpcpp shfmt htmlTidy astyle nodejs tasksh magic-wormhole
nixfmt stack ghcid rnix-lsp tmate rustup kitty; nixfmt stack ghcid rnix-lsp tmate rustup kitty ghc;
inherit (my-lib) ghc;
inherit obelisk; inherit obelisk;
cabal-fmt = (unBreak pkgs.haskell.packages.ghc881.cabal-fmt);
}; };
accounting-pkgs = { accounting-pkgs = {
jali = pkgs.callPackage ./jali { }; jali = pkgs.callPackage ./jali { };

View file

@ -1,7 +1,5 @@
{ pkgs, config, lib, ... }: { pkgs, config, lib, ... }:
let let me = config.m-0.private.me;
inherit (import ../lib) sources;
me = config.m-0.private.me;
in { in {
imports = [ imports = [
../cachix.nix ../cachix.nix
@ -12,6 +10,13 @@ in {
i18n = { defaultLocale = "en_US.UTF-8"; }; 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"; time.timeZone = "Europe/Berlin";
networking = { networking = {
@ -35,8 +40,8 @@ in {
environment = { environment = {
etc = lib.mapAttrs' etc = lib.mapAttrs'
(name: value: lib.nameValuePair "nix-path/${name}" { source = value; }) (name: value: lib.nameValuePair "nix-path/${name}" { source = value; })
(lib.filterAttrs (name: value: name != "__functor") sources) // { (lib.filterAttrs (name: value: name != "__functor") pkgs.sources) // {
"nix-path/nixos".source = sources.nixpkgs; "nix-path/nixos".source = pkgs.sources.nixpkgs;
}; };
variables = variables =
lib.genAttrs [ "CURL_CA_BUNDLE" "GIT_SSL_CAINFO" "SSL_CERT_FILE" ] 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" ]; [ "https://cache.nixos.org/" "https://nixcache.reflex-frp.org" ];
binaryCachePublicKeys = binaryCachePublicKeys =
[ "ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI=" ]; [ "ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI=" ];
nixPath = [ "/etc/nix-path" ]; nixPath = [ "/etc/nix-path" "nixpkgs-overlays=/etc/nixos/overlays" ];
extraOptions = '' extraOptions = ''
fallback = true fallback = true
keep-outputs = true keep-outputs = true

View file

@ -1,6 +1,4 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }: {
let inherit (import ../lib) unstable;
in {
fonts = { fonts = {
fontconfig = { fontconfig = {
enable = true; enable = true;
@ -14,10 +12,8 @@ in {
enableDefaultFonts = true; enableDefaultFonts = true;
enableFontDir = true; enableFontDir = true;
fonts = builtins.attrValues { fonts = builtins.attrValues {
nerdfonts = unstable.nerdfonts.override {
fonts = [ "JetBrainsMono" ];
}; # For all my terminal needs.
inherit (pkgs) inherit (pkgs)
nerdfonts # For all my terminal needs.
libertine # nice text font libertine # nice text font
material-icons # icons in my app material-icons # icons in my app
b612; # sans font, very good for displays b612; # sans font, very good for displays