From 3903bc17667899c9d09f8cfd7d05e2f945aca0f7 Mon Sep 17 00:00:00 2001 From: kat witch Date: Sun, 4 Jul 2021 23:45:04 +0100 Subject: [PATCH] Revamp to get lib overlays working. Base16 in console. --- default.nix | 27 +++++++++++++-------------- lib/hosts.nix | 27 +++++++++++++++++++-------- modules/nixos/default.nix | 2 +- nix/sources.json | 12 ++++++------ pkgs/default.nix | 26 ++++++++++++++++---------- pkgs/notmuch/default.nix | 24 ------------------------ profiles/common/base16.nix | 10 ++++++++++ profiles/common/default.nix | 1 + profiles/common/locale.nix | 5 ++++- profiles/common/nix.nix | 7 ------- profiles/gui/mingetty.nix | 20 +++++++++++++++----- 11 files changed, 85 insertions(+), 76 deletions(-) delete mode 100644 pkgs/notmuch/default.nix create mode 100644 profiles/common/base16.nix diff --git a/default.nix b/default.nix index 034997f3..f2a2a85a 100644 --- a/default.nix +++ b/default.nix @@ -12,23 +12,22 @@ rec { inherit (import ./lib/hosts.nix { inherit pkgs sources profiles users; inherit (deploy) target; - }) - hosts targets; + }) hosts targets; - inherit (pkgs) lib; + inherit (pkgs) lib; - runners = import ./runners.nix { inherit lib; inherit (deploy) target; }; + runners = import ./runners.nix { inherit lib; inherit (deploy) target; }; - sourceCache = with lib; let - getSources = sources: removeAttrs sources [ "__functor" "dorkfiles" ]; - source2drv = value: if isDerivation value.outPath then value.outPath else value; - sources2drvs = sources: mapAttrs (_: source2drv) (getSources sources); - in recurseIntoAttrs rec { - local = sources2drvs sources; - hexchen = sources2drvs (import sources.hexchen {}).sources; - all = attrValues local ++ attrValues hexchen; - allStr = toString all; - }; + sourceCache = with lib; let + getSources = sources: removeAttrs sources [ "__functor" "dorkfiles" ]; + source2drv = value: if isDerivation value.outPath then value.outPath else value; + sources2drvs = sources: mapAttrs (_: source2drv) (getSources sources); + in recurseIntoAttrs rec { + local = sources2drvs sources; + hexchen = sources2drvs (import sources.hexchen {}).sources; + all = attrValues local ++ attrValues hexchen; + allStr = toString all; + }; deploy = import ./lib/deploy.nix { inherit pkgs sources; diff --git a/lib/hosts.nix b/lib/hosts.nix index bffa3a94..a9591d79 100644 --- a/lib/hosts.nix +++ b/lib/hosts.nix @@ -5,11 +5,14 @@ , profiles , pkgsPath ? ../pkgs , sources ? { } +, system ? builtins.currentSystem }: with pkgs.lib; rec { + baseModules = import (pkgs.path + "/nixos/modules/module-list.nix"); + hostNames = attrNames (filterAttrs (name: type: type == "directory") (builtins.readDir hostsDir)); @@ -18,23 +21,31 @@ rec { _module.args = { inherit hosts targets; }; imports = [ ../nixos.nix ../modules/nixos ]; networking = { inherit hostName; }; - nixpkgs.pkgs = import pkgsPath { - inherit (config.nixpkgs) config; - inherit sources; - }; + nixpkgs.pkgs = pkgs; }; hosts = listToAttrs (map (hostName: - nameValuePair hostName (import (pkgs.path + "/nixos/lib/eval-config.nix") { - modules = [ + nameValuePair hostName (evalModules { + modules = baseModules ++ [ (hostConfig hostName) + ({ config, ... }: { + config._module.args.pkgs = pkgs; + config.nixpkgs.system = mkDefault system; + config.nixpkgs.initialSystem = system; + }) (if sources ? home-manager then sources.home-manager + "/nixos" else { }) - ]; - specialArgs = { inherit sources target profiles hostName users; }; + ]; + args = { + inherit baseModules modules; + }; + specialArgs = { + modulesPath = builtins.toString pkgs.path + "/nixos/modules"; + inherit sources target profiles hostName users; + }; })) hostNames); diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index b991674f..61faa2df 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -1,7 +1,7 @@ { sources, lib, ... }: { - imports = [ + imports = with (import (sources.nixexprs + "/modules")).nixos; [ base16 base16-shared ] ++ [ ./nftables ./fw-abstraction ./deploy-tf diff --git a/nix/sources.json b/nix/sources.json index dd1d9040..019b70bf 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -53,10 +53,10 @@ "homepage": null, "owner": "arcnmx", "repo": "nixexprs", - "rev": "298f007bde9d248ec7ac714183c535cede714c90", - "sha256": "0pibsl0kfw603r49v6fmi1xbb0zzfabyka02hiiaw59lzz6h3iw4", + "rev": "d093ea9917e888b11e67933a63681d850cd38666", + "sha256": "03l50ps15qdgw6a9g18jw3rrjyyccwifwqzr7vk1xk477knl734m", "type": "tarball", - "url": "https://github.com/arcnmx/nixexprs/archive/298f007bde9d248ec7ac714183c535cede714c90.tar.gz", + "url": "https://github.com/arcnmx/nixexprs/archive/d093ea9917e888b11e67933a63681d850cd38666.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "nixos-mailserver": { @@ -87,10 +87,10 @@ "homepage": "https://nur.nix-community.org/", "owner": "nix-community", "repo": "NUR", - "rev": "12bc6855f2b7e0b6402d9f26fa6bf11ed63a274a", - "sha256": "00dhqz93kfmhb1qsqfrfsrlnw459czinqq8fqbfnh3jppjv4gskf", + "rev": "3a2ab4a91c7fc7f6e3519e3091cb589db3d063ca", + "sha256": "1y2vb526b7xxa2520kfldfkn2i8w5p3rywnnr29bghsd045smpz5", "type": "tarball", - "url": "https://github.com/nix-community/NUR/archive/12bc6855f2b7e0b6402d9f26fa6bf11ed63a274a.tar.gz", + "url": "https://github.com/nix-community/NUR/archive/3a2ab4a91c7fc7f6e3519e3091cb589db3d063ca.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "tf-nix": { diff --git a/pkgs/default.nix b/pkgs/default.nix index 15b9cd02..f4bffa0b 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,10 +1,8 @@ -{ config ? { }, sources, system ? builtins.currentSystem, ... }@args: +{ sources, system ? builtins.currentSystem, ... }@args: let - pkgs = import sources.nixpkgs { inherit config; }; - overlay = self: super: - rec { - dino = super.dino.overrideAttrs ( + overlay = self: super: rec { + dino = super.dino.overrideAttrs ( { patches ? [], ... }: { patches = patches ++ [ ./dino/0001-add-an-option-to-enable-omemo-by-default-in-new-conv.patch @@ -21,8 +19,6 @@ let waybar = super.waybar.override { pulseSupport = true; }; - notmuch = super.callPackage ./notmuch { inherit (super) notmuch; }; - nur = import sources.nur { nurpkgs = self; pkgs = self; @@ -83,6 +79,16 @@ let } // super.lib.optionalAttrs (builtins.pathExists ../trusted/pkgs) (import ../trusted/pkgs { inherit super self; }); - -in - (pkgs.extend (import (sources.nixexprs + "/overlay.nix"))).extend overlay + pkgs = import sources.nixpkgs { + overlays = [ + overlay + (import (sources.nixexprs + "/overlay.nix")) + ]; + config = { + allowUnfree = true; + permittedInsecurePackages = [ + "ffmpeg-2.8.17" + ]; + }; + }; +in pkgs diff --git a/pkgs/notmuch/default.nix b/pkgs/notmuch/default.nix deleted file mode 100644 index cf132640..00000000 --- a/pkgs/notmuch/default.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ lib, notmuch, coreutils }@args: -let - notmuch = args.notmuch.super or args.notmuch; - drv = notmuch.override { withEmacs = false; }; -in -drv.overrideAttrs (old: { - doCheck = false; - - postInstall = '' - ${old.postInstall or ""} - make -C bindings/ruby exec_prefix=$out \ - SHELL=$SHELL \ - $makeFlags ''${makeFlagsArray+"''${makeFlagsArray[@]}"} \ - $installFlags ''${installFlagsArray+"''${installFlagsArray[@]}"} \ - install - mv $out/lib/ruby/vendor_ruby/* $out/lib/ruby/ - rmdir $out/lib/ruby/vendor_ruby - ''; - - meta = old.meta or { } // { - broken = old.meta.broken or false || notmuch.stdenv.isDarwin; - }; - passthru = old.passthru or { } // { super = notmuch; }; -}) diff --git a/profiles/common/base16.nix b/profiles/common/base16.nix new file mode 100644 index 00000000..0c8cde2f --- /dev/null +++ b/profiles/common/base16.nix @@ -0,0 +1,10 @@ +{ config, ... }: + +{ + base16 = { + console = { + enable = true; + scheme = "rebecca.rebecca"; + }; + }; +} diff --git a/profiles/common/default.nix b/profiles/common/default.nix index b3f86283..322a8b46 100644 --- a/profiles/common/default.nix +++ b/profiles/common/default.nix @@ -7,6 +7,7 @@ users.arc users.hexchen ./system.nix + ./base16.nix ./net.nix ./access.nix ./locale.nix diff --git a/profiles/common/locale.nix b/profiles/common/locale.nix index 90854b0d..a22fa2ab 100644 --- a/profiles/common/locale.nix +++ b/profiles/common/locale.nix @@ -1,10 +1,13 @@ { config, pkgs, ... }: { + fonts.fonts = [ + pkgs.tamzen + ]; i18n.defaultLocale = "en_GB.UTF-8"; time.timeZone = "Europe/London"; console = { - font = "Lat2-Terminus16"; + packages = [ pkgs.tamzen ]; keyMap = "uk"; }; } diff --git a/profiles/common/nix.nix b/profiles/common/nix.nix index 1eb43428..58763b2d 100644 --- a/profiles/common/nix.nix +++ b/profiles/common/nix.nix @@ -4,15 +4,12 @@ boot.loader.grub.configurationLimit = 8; boot.loader.systemd-boot.configurationLimit = 8; - nixpkgs.config = { allowUnfree = true; }; - nix = { nixPath = [ "nixpkgs=${sources.nixpkgs}" "nur=${sources.nur}" "arc=${sources.nixexprs}" "ci=${sources.ci}" - "hexy=${sources.hexchen}" ]; binaryCaches = [ "https://arc.cachix.org" "https://kittywitch.cachix.org" ]; binaryCachePublicKeys = @@ -21,8 +18,4 @@ gc.options = lib.mkDefault "--delete-older-than 1w"; trustedUsers = [ "root" "@wheel" ]; }; - - nixpkgs.config.permittedInsecurePackages = [ - "ffmpeg-2.8.17" - ]; } diff --git a/profiles/gui/mingetty.nix b/profiles/gui/mingetty.nix index 89a81275..d0d94082 100644 --- a/profiles/gui/mingetty.nix +++ b/profiles/gui/mingetty.nix @@ -3,7 +3,7 @@ let c1 = "\\e[22;34m"; c2 = "\\e[1;35m"; - nixos_logo = [ + nixos = [ " ${c1} ::::. ${c2}'::::: ::::' " " ${c1} '::::: ${c2}':::::. ::::' " " ${c1} ::::: ${c2}'::::.::::: " @@ -26,11 +26,21 @@ let ]; in { + console = { + font = "Tamzen7x14"; + earlySetup = true; + getty = { + greetingPrefix = + ''\e[H\e[2J'' + # topleft + ''\e[9;10]''; # setterm blank/powersave = 10 minutes + greeting = + "\n" + + lib.concatStringsSep "\n" nixos + + "\n\n" + + ''\e[1;32m>>> NixOS ${config.system.nixos.label} (Linux \r) - \l\e[0m''; + }; + }; services.getty = { - greetingLine = '' - \e[H\e[2J - \e[9;10]'' + lib.concatStringsSep "\n" nixos_logo + "\n\n" - + "\\e[1;32m>>> NixOS ${config.system.nixos.label} (Linux \\r) - \\l\\e[0m"; helpLine = lib.mkForce ""; }; }