overlays: init overlays directory

Overlays now live globally in the overlays directory. They will be
pulled into the flake and the rest of your configuration automatically
from there.
This commit is contained in:
Timothy DeHerrera 2020-01-06 00:01:00 -07:00
parent e92bb060ee
commit 4cf8048807
No known key found for this signature in database
GPG key ID: 8985725DB5B0C122
14 changed files with 71 additions and 79 deletions

View file

@ -20,6 +20,8 @@ git checkout -b $new_branch template
# generate hardware config
nixos-generate-config --show-hardware-config > ./hosts/${new_host}.nix
# ensure configuration lives in expected location
ln -s $PWD /etc/nixos
# `rebuild` wrapper for `nix build` bypassing `nixos-rebuild`
# Usage: rebuild [host] {switch|boot|test|dry-activate}
@ -146,13 +148,18 @@ folder by default.
To keep [profiles](profiles) reusable across configurations, secrets should
only be imported from the `users` or [`hosts`](hosts) directory.
## Modules and Packages
## Modules, Packages and Overlays
All expressions in both [modules/defualt.nix](modules/default.nix) and
[pkgs/default.nix](pkgs/default.nix) are available globally, anywhere else in the
repo. They are additionally included in the `nixosModules` or `overlays` flake
outputs. Packages can manually be added to [flake.nix](flake.nix) for inclusion
in the `packages` output as well.
All overlays should be defined in the [overlays](overlays) directory. They will
be automatically pulled in for use by all configurations. Nix command line tools
will be able to read overlays from here as well since it is set as
`nixpkgs-overlays` in `NIX_PATH`.
The directory structure is identical to nixpkgs to provide a kind of staging area
for any modules or packages we might be wanting to merge there later. If your not
familiar or can't be bothered, simply dropping a valid nix file and pointing the

View file

@ -19,8 +19,11 @@ in {
] ++ config;
networking.hostName = hostname;
nix.nixPath =
[ "nixpkgs=${<nixpkgs>}" "nixos-config=/etc/nixos/configuration.nix" ];
nix.nixPath = [
"nixpkgs=${<nixpkgs>}"
"nixos-config=/etc/nixos/configuration.nix"
"nixpkgs-overlays=/etc/nixos/overlays"
];
nixpkgs.overlays = lib.singleton (import ./pkgs);
}

View file

@ -3,12 +3,12 @@
epoch = 201909;
inputs.nixpkgs.url = "github:nrdxp/nixpkgs/fork";
inputs.nixpkgs.url = "github:nrdxp/nixpkgs/fork-010520";
inputs.home.url = "github:nrdxp/home-manager/flakes";
outputs = args@{ self, home, nixpkgs }:
let
inherit (builtins) listToAttrs baseNameOf;
inherit (builtins) listToAttrs baseNameOf attrNames readDir;
inherit (nixpkgs.lib) removeSuffix;
pkgs = import nixpkgs {
@ -22,7 +22,10 @@
overlay = import ./pkgs;
overlays = [ self.overlay ];
overlays = let
overlays = map (name: import (./overlays + "/${name}"))
(attrNames (readDir ./overlays));
in overlays;
packages.x86_64-linux = {
inherit (pkgs) sddm-chili dejavu_nerdfont purs;

View file

@ -20,6 +20,7 @@ let
nix.nixPath = [
"nixpkgs=${nixpkgs}"
"nixos-config=/etc/nixos/configuration.nix"
"nixpkgs-overlays=/etc/nixos/overlays"
];
system.configurationRevision = self.rev;

7
overlays/cursor.nix Normal file
View file

@ -0,0 +1,7 @@
final: prev: {
# set default cursor theme when installed
cursor = prev.writeTextDir "share/icons/default/index.theme" ''
[icon theme]
Inherits=Adwaita
'';
}

15
overlays/kakoune.nix Normal file
View file

@ -0,0 +1,15 @@
final: prev: {
kakoune = prev.kakoune.override {
configure.plugins = with final.kakounePlugins; [
(kak-fzf.override { fzf = final.skim; })
kak-auto-pairs
kak-buffers
kak-powerline
];
};
# wrapper to specify config dir
kakoune-config = prev.writeShellScriptBin "k" ''
XDG_CONFIG_HOME=/etc/xdg exec ${final.kakoune}/bin/kak "$@"
'';
}

1
overlays/pkgs.nix Symbolic link
View file

@ -0,0 +1 @@
../pkgs/default.nix

6
overlays/qute.nix Normal file
View file

@ -0,0 +1,6 @@
final: prev: {
# wrapper to specify config file
qute = prev.writeShellScriptBin "qute" ''
exec ${prev.qutebrowser}/bin/qutebrowser -C /etc/xdg/qutebrowser/config.py "$@"
'';
}

11
overlays/redshift.nix Normal file
View file

@ -0,0 +1,11 @@
final: prev: {
# with sway/wayland support
redshift = prev.redshift.overrideAttrs (o: {
src = prev.fetchFromGitHub {
owner = "CameronNemo";
repo = "redshift";
rev = "39c162ca487a59857c2eac231318f4b28855798b";
sha256 = "1in27draskwwi097wiam26bx2szcf58297am3gkyng1ms3rz6i58";
};
});
}

11
overlays/wl-clipboard.nix Normal file
View file

@ -0,0 +1,11 @@
final: prev: {
# nixpkgs version causing issues for me
wl-clipboard = prev.wl-clipboard.overrideAttrs (o: {
src = prev.fetchFromGitHub {
owner = "bugaevc";
repo = "wl-clipboard";
rev = "c010972e6b0d2eb3002c49a6a1b5620ff5f7c910";
sha256 = "020l3jy9gsj6gablwdfzp1wfa8yblay3axdjc56i9q8pbhz7g12j";
};
});
}

View file

@ -17,31 +17,4 @@
"xdg/kak/autoload/default".source =
"${pkgs.kakoune-unwrapped}/share/kak/rc";
};
nixpkgs.overlays = let
kak = final: prev: {
kakoune = prev.kakoune.override {
configure.plugins = with prev.kakounePlugins; [
(kak-fzf.override { fzf = prev.skim; })
kak-auto-pairs
kak-buffers
kak-powerline
];
};
kakoune-config = prev.writeShellScriptBin "k" ''
XDG_CONFIG_HOME=/etc/xdg exec ${final.kakoune}/bin/kak "$@"
'';
kakoune-unwrapped = prev.kakoune-unwrapped.overrideAttrs (o: rec {
version = "2019.12.10";
src = prev.fetchFromGitHub {
repo = "kakoune";
owner = "mawww";
rev = "v${version}";
hash = "sha256-TnRQ73bIQGavXNp+wrKtYHgGem+R6JDWt333z2izYzE=";
};
});
};
in [ kak ];
}

View file

@ -64,21 +64,4 @@ in {
theme = "chili";
};
};
nixpkgs.overlays = let
overlay = final: prev: {
cursor = prev.writeTextDir "share/icons/default/index.theme" ''
[icon theme]
Inherits=Adwaita
'';
ffmpeg-full = prev.ffmpeg-full.override {
svt-av1 = prev.svt-av1;
dav1d = prev.dav1d;
libaom = null;
opencore-amr = null;
libopus = prev.libopus;
};
};
in [ overlay ];
}

View file

@ -16,12 +16,4 @@ in {
systemPackages = with pkgs; [ qute qutebrowser mpv youtubeDL ];
};
nixpkgs.overlays = let
overlay = final: prev: {
qute = prev.writeShellScriptBin "qute" ''
exec ${prev.qutebrowser}/bin/qutebrowser -C /etc/xdg/qutebrowser/config.py "$@"
'';
};
in [ overlay ];
}

View file

@ -87,25 +87,4 @@ in {
RestartSec = 3;
};
};
nixpkgs.overlays = let
overlay = final: prev: {
redshift = prev.redshift.overrideAttrs (o: {
src = prev.fetchFromGitHub {
owner = "CameronNemo";
repo = "redshift";
rev = "39c162ca487a59857c2eac231318f4b28855798b";
sha256 = "1in27draskwwi097wiam26bx2szcf58297am3gkyng1ms3rz6i58";
};
});
wl-clipboard = prev.wl-clipboard.overrideAttrs (o: {
src = prev.fetchFromGitHub {
owner = "bugaevc";
repo = "wl-clipboard";
rev = "c010972e6b0d2eb3002c49a6a1b5620ff5f7c910";
sha256 = "020l3jy9gsj6gablwdfzp1wfa8yblay3axdjc56i9q8pbhz7g12j";
};
});
};
in [ overlay ];
}