2022-02-17 15:47:24 +00:00
|
|
|
{ lib, pkgs, pkgs', inputs, options, config, ... }:
|
2022-02-13 13:10:21 +00:00
|
|
|
let
|
2022-02-13 23:06:31 +00:00
|
|
|
inherit (builtins) attrValues;
|
2022-02-16 01:38:17 +00:00
|
|
|
inherit (lib) mkIf mkDefault mkMerge mkAliasDefinitions;
|
2022-02-15 20:50:27 +00:00
|
|
|
inherit (lib.my) mkOpt' dummyOption;
|
2022-02-16 01:38:17 +00:00
|
|
|
|
|
|
|
defaultUsername = "dev";
|
|
|
|
uname = config.my.user.name;
|
2022-02-13 13:10:21 +00:00
|
|
|
in
|
|
|
|
{
|
2022-02-15 20:50:27 +00:00
|
|
|
options = with lib.types; {
|
|
|
|
my = {
|
|
|
|
# Pretty hacky but too lazy to figure out if there's a better way to alias the options
|
|
|
|
user = mkOpt' (attrsOf anything) { } "User definition (as `users.users.*`).";
|
|
|
|
homeConfig = mkOpt' anything { } "Home configuration (as `home-manager.users.*`)";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Only present in >=22.05, so forward declare
|
|
|
|
documentation.nixos.options.warningsAreErrors = dummyOption;
|
2022-02-13 13:10:21 +00:00
|
|
|
};
|
2022-02-06 00:06:26 +00:00
|
|
|
|
2022-02-16 01:38:17 +00:00
|
|
|
config = mkMerge [
|
2022-02-13 13:10:21 +00:00
|
|
|
{
|
|
|
|
my = {
|
|
|
|
user = {
|
|
|
|
name = mkDefault defaultUsername;
|
|
|
|
isNormalUser = true;
|
|
|
|
uid = mkDefault 1000;
|
|
|
|
extraGroups = mkDefault [ "wheel" ];
|
|
|
|
password = mkDefault "hunter2"; # TODO: secrets...
|
2022-02-06 00:06:26 +00:00
|
|
|
};
|
2022-02-13 13:10:21 +00:00
|
|
|
};
|
2022-02-06 00:06:26 +00:00
|
|
|
|
2022-02-13 23:06:31 +00:00
|
|
|
home-manager = {
|
2022-02-15 20:50:27 +00:00
|
|
|
# Installs packages in the system config instead of in the local profile on activation
|
2022-02-13 23:06:31 +00:00
|
|
|
useUserPackages = mkDefault true;
|
|
|
|
};
|
2022-02-06 00:06:26 +00:00
|
|
|
|
2022-02-13 13:10:21 +00:00
|
|
|
users = {
|
|
|
|
mutableUsers = false;
|
|
|
|
users.${uname} = mkAliasDefinitions options.my.user;
|
|
|
|
};
|
2022-02-06 00:06:26 +00:00
|
|
|
|
2022-02-13 23:06:31 +00:00
|
|
|
# NOTE: As the "outermost" module is still being evaluated in NixOS land, special params (e.g. pkgs) won't be
|
|
|
|
# passed to it
|
|
|
|
home-manager.users.${uname} = config.my.homeConfig;
|
|
|
|
|
2022-02-13 13:10:21 +00:00
|
|
|
security = {
|
|
|
|
sudo.enable = mkDefault false;
|
|
|
|
doas = {
|
|
|
|
enable = mkDefault true;
|
|
|
|
wheelNeedsPassword = mkDefault false;
|
2022-02-06 00:06:26 +00:00
|
|
|
};
|
2022-02-13 13:10:21 +00:00
|
|
|
};
|
2022-02-06 00:06:26 +00:00
|
|
|
|
2022-02-13 13:10:21 +00:00
|
|
|
nix = {
|
2022-02-17 15:59:00 +00:00
|
|
|
package = pkgs'.unstable.nixVersions.stable;
|
2022-02-13 13:10:21 +00:00
|
|
|
extraOptions =
|
|
|
|
''
|
|
|
|
experimental-features = nix-command flakes ca-derivations
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
nixpkgs = {
|
2022-02-13 17:44:14 +00:00
|
|
|
overlays = [
|
2022-02-17 15:47:24 +00:00
|
|
|
# TODO: Wait for https://github.com/NixOS/nixpkgs/pull/159074 to arrive to nixos-unstable
|
|
|
|
(final: prev: { remarshal = pkgs'.master.remarshal; })
|
2022-02-13 17:44:14 +00:00
|
|
|
];
|
2022-02-13 13:10:21 +00:00
|
|
|
config = {
|
|
|
|
allowUnfree = true;
|
2022-02-11 01:15:24 +00:00
|
|
|
};
|
2022-02-13 13:10:21 +00:00
|
|
|
};
|
2022-02-11 01:15:24 +00:00
|
|
|
|
2022-02-15 20:50:27 +00:00
|
|
|
documentation = {
|
|
|
|
nixos = {
|
|
|
|
enable = mkDefault true;
|
|
|
|
options.warningsAreErrors = mkDefault false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-02-13 23:06:31 +00:00
|
|
|
time.timeZone = mkDefault "Europe/Dublin";
|
|
|
|
|
2022-02-13 13:10:21 +00:00
|
|
|
boot = {
|
|
|
|
# Use latest LTS release by default
|
|
|
|
kernelPackages = mkDefault pkgs.linuxKernel.packages.linux_5_15;
|
|
|
|
loader = {
|
|
|
|
efi = {
|
|
|
|
efiSysMountPoint = mkDefault "/boot";
|
|
|
|
canTouchEfiVariables = mkDefault false;
|
|
|
|
};
|
2022-02-17 15:47:24 +00:00
|
|
|
grub = {
|
|
|
|
memtest86.enable = mkDefault true;
|
|
|
|
};
|
2022-02-13 13:10:21 +00:00
|
|
|
systemd-boot = {
|
|
|
|
enable = mkDefault true;
|
|
|
|
editor = mkDefault true;
|
|
|
|
consoleMode = mkDefault "max";
|
|
|
|
configurationLimit = mkDefault 10;
|
|
|
|
memtest86.enable = mkDefault true;
|
2022-02-11 01:15:24 +00:00
|
|
|
};
|
|
|
|
};
|
2022-02-13 13:10:21 +00:00
|
|
|
};
|
2022-02-06 00:19:29 +00:00
|
|
|
|
2022-02-13 13:10:21 +00:00
|
|
|
networking = {
|
|
|
|
useDHCP = mkDefault false;
|
|
|
|
enableIPv6 = mkDefault true;
|
|
|
|
};
|
2022-02-12 01:53:57 +00:00
|
|
|
|
2022-02-13 13:10:21 +00:00
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
bash-completion
|
|
|
|
vim
|
|
|
|
];
|
2022-02-06 00:06:26 +00:00
|
|
|
|
2022-02-16 01:38:17 +00:00
|
|
|
services = {
|
|
|
|
kmscon = {
|
|
|
|
enable = mkDefault true;
|
|
|
|
hwRender = mkDefault true;
|
|
|
|
extraOptions = "--verbose";
|
|
|
|
extraConfig =
|
|
|
|
''
|
|
|
|
font-name=SauceCodePro Nerd Font Mono
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
openssh = {
|
|
|
|
enable = true;
|
|
|
|
};
|
2022-02-13 13:10:21 +00:00
|
|
|
};
|
2022-02-12 01:53:57 +00:00
|
|
|
|
2022-02-13 13:10:21 +00:00
|
|
|
system = {
|
|
|
|
stateVersion = "21.11";
|
|
|
|
configurationRevision = with inputs; mkIf (self ? rev) self.rev;
|
2022-02-06 00:06:26 +00:00
|
|
|
};
|
2022-02-16 01:38:17 +00:00
|
|
|
}
|
|
|
|
(mkIf config.services.kmscon.enable {
|
|
|
|
fonts.fonts = with pkgs; [
|
|
|
|
(nerdfonts.override {
|
|
|
|
fonts = [ "SourceCodePro" ];
|
|
|
|
})
|
|
|
|
];
|
|
|
|
})
|
|
|
|
];
|
2022-02-15 20:50:27 +00:00
|
|
|
|
|
|
|
meta.buildDocsInSandbox = false;
|
2022-02-13 13:10:21 +00:00
|
|
|
}
|