diff --git a/README.md b/README.md index fee6d615..b51fc7fb 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/configuration.nix b/configuration.nix index 73cf2158..f8542011 100644 --- a/configuration.nix +++ b/configuration.nix @@ -19,8 +19,11 @@ in { ] ++ config; networking.hostName = hostname; - nix.nixPath = - [ "nixpkgs=${}" "nixos-config=/etc/nixos/configuration.nix" ]; + nix.nixPath = [ + "nixpkgs=${}" + "nixos-config=/etc/nixos/configuration.nix" + "nixpkgs-overlays=/etc/nixos/overlays" + ]; nixpkgs.overlays = lib.singleton (import ./pkgs); } diff --git a/flake.nix b/flake.nix index 97952ccf..d607c021 100644 --- a/flake.nix +++ b/flake.nix @@ -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; diff --git a/hosts/default.nix b/hosts/default.nix index 79158172..0ecedae8 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -20,6 +20,7 @@ let nix.nixPath = [ "nixpkgs=${nixpkgs}" "nixos-config=/etc/nixos/configuration.nix" + "nixpkgs-overlays=/etc/nixos/overlays" ]; system.configurationRevision = self.rev; diff --git a/overlays/cursor.nix b/overlays/cursor.nix new file mode 100644 index 00000000..b73a0618 --- /dev/null +++ b/overlays/cursor.nix @@ -0,0 +1,7 @@ +final: prev: { + # set default cursor theme when installed + cursor = prev.writeTextDir "share/icons/default/index.theme" '' + [icon theme] + Inherits=Adwaita + ''; +} diff --git a/overlays/kakoune.nix b/overlays/kakoune.nix new file mode 100644 index 00000000..4e4aa520 --- /dev/null +++ b/overlays/kakoune.nix @@ -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 "$@" + ''; +} diff --git a/overlays/pkgs.nix b/overlays/pkgs.nix new file mode 120000 index 00000000..f87a3ef9 --- /dev/null +++ b/overlays/pkgs.nix @@ -0,0 +1 @@ +../pkgs/default.nix \ No newline at end of file diff --git a/overlays/qute.nix b/overlays/qute.nix new file mode 100644 index 00000000..92165ab3 --- /dev/null +++ b/overlays/qute.nix @@ -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 "$@" + ''; +} diff --git a/overlays/redshift.nix b/overlays/redshift.nix new file mode 100644 index 00000000..a199893c --- /dev/null +++ b/overlays/redshift.nix @@ -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"; + }; + }); +} diff --git a/overlays/wl-clipboard.nix b/overlays/wl-clipboard.nix new file mode 100644 index 00000000..d9f288c5 --- /dev/null +++ b/overlays/wl-clipboard.nix @@ -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"; + }; + }); +} diff --git a/profiles/develop/kakoune/default.nix b/profiles/develop/kakoune/default.nix index f988b2e2..5bb67eaf 100644 --- a/profiles/develop/kakoune/default.nix +++ b/profiles/develop/kakoune/default.nix @@ -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 ]; } diff --git a/profiles/graphical/default.nix b/profiles/graphical/default.nix index fd80f6ee..2371bbc1 100644 --- a/profiles/graphical/default.nix +++ b/profiles/graphical/default.nix @@ -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 ]; } diff --git a/profiles/graphical/qutebrowser/default.nix b/profiles/graphical/qutebrowser/default.nix index b6d26536..f6709bbd 100644 --- a/profiles/graphical/qutebrowser/default.nix +++ b/profiles/graphical/qutebrowser/default.nix @@ -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 ]; } diff --git a/profiles/graphical/sway/default.nix b/profiles/graphical/sway/default.nix index ea256dc5..746d50f9 100644 --- a/profiles/graphical/sway/default.nix +++ b/profiles/graphical/sway/default.nix @@ -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 ]; }