Initial commit

This commit is contained in:
Jeffrey Serio 2023-07-02 11:09:41 -05:00
commit fd0b57373c
15 changed files with 1512 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*~

202
LICENSE Normal file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

24
README.org Normal file
View File

@ -0,0 +1,24 @@
* Minimal NixOS Root on ZFS configuration
This repo contains a minimal set of configuration needed for
installing NixOS on a computer with ZFS as root filesystem.
#+begin_src text
.gitignore
LICENSE
configuration.nix <- configuration shared by all hosts
flake.lock
flake.nix
hosts/exampleHost/default.nix <- per-host configuration
hosts/exampleHost/sshUnlock.txt
modules/boot/default.nix
modules/default.nix
modules/fileSystems/default.nix
modules/networking/default.nix
modules/users/default.nix
#+end_src
Just enough to get you started.
See [[https://github.com/ne9z/personal-dotfiles][my personal dotfiles repo]] for an example of how to configure
servers and desktop computers in the same git repository, based on
this template repo you are viewing now.

87
configuration.nix Normal file
View File

@ -0,0 +1,87 @@
{
inputs,
pkgs,
lib,
...
}: {
# Let 'nixos-version --json' know about the Git revision
# of this flake.
system.configurationRevision =
if (inputs.self ? rev)
then inputs.self.rev
else throw "Refuse to build: git tree is dirty.";
system.stateVersion = "22.11";
# Networking
networking = {
networkmanager.enable = true;
firewall = {
enable = true;
allowPing = true;
};
};
services.openssh = {
enable = lib.mkDefault true;
settings = {PasswordAuthentication = lib.mkDefault true;};
settings.X11Forwarding = true;
};
time.hardwareClockInLocalTime = true;
# User management
programs.zsh.enable = true;
users.users = {
root = {
openssh.authorizedKeys.keys = ["sshKey_placeholder"];
shell = pkgs.zsh;
};
jas = {
description = "Jeffrey Serio";
isNormalUser = true;
shell = pkgs.zsh;
};
};
security.sudo = {
enable = lib.mkDefault true;
extraRules = [
{
users = ["jas"];
commands = [
{
command = "ALL";
options = ["SETENV" "NOPASSWD"];
}
];
}
];
};
imports = [
"${inputs.nixpkgs}/nixos/modules/installer/scan/not-detected.nix"
];
# ZFS root
boot.zfs.forceImportRoot = lib.mkDefault false;
# Nix daemon config
nix = {
settings = {
auto-optimise-store = true;
experimental-features = ["nix-command" "flakes"];
trusted-users = ["root" "jas"];
keep-outputs = true;
keep-derivations = true;
};
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
};
environment.shells = [pkgs.bashInteractive pkgs.zsh];
}

48
flake.lock Normal file
View File

@ -0,0 +1,48 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1688302761,
"narHash": "sha256-YIYKeX3YfoAIg9DTe6cl1ga87rDCNDZugdGuqsvEN30=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "c85d9137db45a1c9c161f4718b13cc3bd4cbd173",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1688231357,
"narHash": "sha256-ZOn16X5jZ6X5ror58gOJAxPfFLAQhZJ6nOUeS4tfFwo=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "645ff62e09d294a30de823cb568e9c6d68e92606",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

34
flake.nix Normal file
View File

@ -0,0 +1,34 @@
{
description = "NixOS configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
...
} @ inputs: let
mkHost = hostname: system:
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {inherit inputs system;};
modules = [
./modules
./configuration.nix
"${self}/hosts/${hostname}"
];
};
in {
nixosConfigurations = {
moonshadow = mkHost "moonshadow" "x86_64-linux";
evergloam = mkHost "evergloam" "x86_64-linux";
nexus = mkHost "nexus" "x86_64-linux";
};
};
}

View File

@ -0,0 +1,60 @@
##
##
## Per-host configuration for evergloam
##
##
{
networking.hosts = {
"10.0.0.191" = ["nexus.local"];
"10.0.0.27" = ["logs.local"];
"10.0.0.159" = ["truenas.local"];
"10.0.0.41" = ["moonshadow.local"];
"10.0.0.223" = ["soft-serve.local"];
};
networking.firewall.allowedTCPPorts = [22];
services.znapzend = {
enable = true;
autoCreation = true;
zetup."rpool/nixos" = {
enable = true;
plan = "1y=>1d";
recursive = true;
destinations.remote = {
host = "root@truenas.local";
dataset = "nas/evergloam";
};
};
};
zfs-root = {
boot = {
devNodes = "/dev/disk/by-id/";
bootDevices = ["nvme-SKHynix_HFS512GEJ9X113N_4YC2N026710904U3D"];
immutable = false;
availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod"];
removableEfi = true;
kernelParams = [];
sshUnlock = {
# read sshUnlock.txt file.
enable = false;
authorizedKeys = [];
};
};
networking = {
# read changeHostName.txt file.
hostName = "evergloam";
timeZone = "America/Chicago";
hostId = "f44d0bef";
};
};
# To add more options to per-host configuration, you can create a
# custom configuration module, then add it here.
my-config = {
template.all.packages.enable = true;
template.all.zfs.enable = true;
template.desktop.custom.enable = true;
};
}

View File

@ -0,0 +1,62 @@
##
##
## Per-host configuration for moonshadow
##
##
{
networking.hosts = {
"10.0.0.191" = ["nexus.local"];
"10.0.0.27" = ["logs.local"];
"10.0.0.159" = ["truenas.local"];
"10.0.0.28" = ["evergloam.local"];
"10.0.0.223" = ["soft-serve.local"];
};
networking.firewall.allowedTCPPorts = [22];
services.znapzend = {
enable = true;
autoCreation = true;
zetup."rpool/nixos" = {
enable = true;
plan = "1y=>1d";
recursive = true;
destinations.remote = {
host = "root@truenas.local";
dataset = "nas/moonshadow";
};
};
};
zfs-root = {
boot = {
devNodes = "/dev/disk/by-id/";
bootDevices = ["nvme-Samsung_SSD_980_PRO_1TB_S5P2NL0W208026M"];
immutable = false;
availableKernelModules = ["nvme" "thunderbolt" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod"];
removableEfi = true;
kernelParams = [];
sshUnlock = {
# read sshUnlock.txt file.
enable = false;
authorizedKeys = [];
};
};
networking = {
# read changeHostName.txt file.
hostName = "moonshadow";
timeZone = "America/Chicago";
hostId = "d3c87a8b";
};
};
# To add more options to per-host configuration, you can create a
# custom configuration module, then add it here.
my-config = {
template.all.packages.enable = true;
template.all.zfs.enable = true;
template.any.nvidia.enable = true;
template.any.system76.enable = true;
template.desktop.custom.enable = true;
};
}

170
modules/boot/default.nix Normal file
View File

@ -0,0 +1,170 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.zfs-root.boot;
inherit (lib) mkIf types mkDefault mkOption mkMerge strings;
inherit (builtins) head toString map tail;
in {
options.zfs-root.boot = {
enable = mkOption {
description = "Enable root on ZFS support";
type = types.bool;
default = true;
};
devNodes = mkOption {
description = "Specify where to discover ZFS pools";
type = types.str;
apply = x:
assert (strings.hasSuffix "/" x
|| abort "devNodes '${x}' must have trailing slash!"); x;
default = "/dev/disk/by-id/";
};
bootDevices = mkOption {
description = "Specify boot devices";
type = types.nonEmptyListOf types.str;
};
availableKernelModules = mkOption {
type = types.nonEmptyListOf types.str;
default = ["uas" "nvme" "ahci"];
};
kernelParams = mkOption {
type = types.listOf types.str;
default = [];
};
immutable = mkOption {
description = "Enable root on ZFS immutable root support";
type = types.bool;
default = false;
};
removableEfi = mkOption {
description = "install bootloader to fallback location";
type = types.bool;
default = true;
};
partitionScheme = mkOption {
default = {
biosBoot = "-part5";
efiBoot = "-part1";
swap = "-part4";
bootPool = "-part2";
rootPool = "-part3";
};
description = "Describe on disk partitions";
type = types.attrsOf types.str;
};
sshUnlock = {
enable = mkOption {
type = types.bool;
default = false;
};
authorizedKeys = mkOption {
type = types.listOf types.str;
default = [];
};
};
};
config = mkIf cfg.enable (mkMerge [
{
zfs-root.fileSystems.datasets = {
"rpool/nixos/home" = mkDefault "/home";
"rpool/nixos/var/lib" = mkDefault "/var/lib";
"rpool/nixos/var/log" = mkDefault "/var/log";
"bpool/nixos/root" = "/boot";
};
}
(mkIf (!cfg.immutable) {
zfs-root.fileSystems.datasets = {"rpool/nixos/root" = "/";};
})
(mkIf cfg.immutable {
zfs-root.fileSystems = {
datasets = {
"rpool/nixos/empty" = "/";
"rpool/nixos/root" = "/oldroot";
};
bindmounts = {
"/oldroot/nix" = "/nix";
"/oldroot/etc/nixos" = "/etc/nixos";
};
};
boot.initrd.postDeviceCommands = ''
if ! grep -q zfs_no_rollback /proc/cmdline; then
zpool import -N rpool
zfs rollback -r rpool/nixos/empty@start
zpool export -a
fi
'';
})
{
zfs-root.fileSystems = {
efiSystemPartitions =
map (diskName: diskName + cfg.partitionScheme.efiBoot)
cfg.bootDevices;
swapPartitions =
map (diskName: diskName + cfg.partitionScheme.swap) cfg.bootDevices;
};
boot = {
kernelPackages =
mkDefault config.boot.zfs.package.latestCompatibleLinuxPackages;
initrd.availableKernelModules = cfg.availableKernelModules;
inherit (cfg) kernelParams;
supportedFilesystems = ["zfs"];
zfs = {
inherit (cfg) devNodes;
forceImportRoot = mkDefault false;
};
loader = {
efi = {
canTouchEfiVariables =
if cfg.removableEfi
then false
else true;
efiSysMountPoint =
"/boot/efis/"
+ (head cfg.bootDevices)
+ cfg.partitionScheme.efiBoot;
};
generationsDir.copyKernels = true;
grub = {
enable = true;
devices = map (diskName: cfg.devNodes + diskName) cfg.bootDevices;
efiInstallAsRemovable = cfg.removableEfi;
copyKernels = true;
efiSupport = true;
zfsSupport = true;
useOSProber = true;
extraInstallCommands = toString (map (diskName: ''
set -x
${pkgs.coreutils-full}/bin/cp -r ${config.boot.loader.efi.efiSysMountPoint}/EFI /boot/efis/${diskName}${cfg.partitionScheme.efiBoot}
set +x
'') (tail cfg.bootDevices));
};
};
};
}
(mkIf cfg.sshUnlock.enable {
boot.initrd = {
network = {
enable = true;
ssh = {
enable = true;
hostKeys = [
"/var/lib/ssh_unlock_zfs_ed25519_key"
"/var/lib/ssh_unlock_zfs_rsa_key"
];
inherit (cfg.sshUnlock) authorizedKeys;
};
postCommands = ''
tee -a /root/.profile >/dev/null <<EOF
if zfs load-key rpool/nixos; then
pkill zfs
fi
exit
EOF'';
};
};
})
]);
}

3
modules/default.nix Normal file
View File

@ -0,0 +1,3 @@
{
imports = [./boot ./fileSystems ./home-manager ./my-config ./networking];
}

View File

@ -0,0 +1,72 @@
{
config,
lib,
...
}: let
cfg = config.zfs-root.fileSystems;
inherit (lib) types mkDefault mkOption mkMerge mapAttrsToList;
in {
options.zfs-root.fileSystems = {
datasets = mkOption {
description = "Set mountpoint for datasets";
type = types.attrsOf types.str;
default = {};
};
bindmounts = mkOption {
description = "Set mountpoint for bindmounts";
type = types.attrsOf types.str;
default = {};
};
efiSystemPartitions = mkOption {
description = "Set mountpoint for efi system partitions";
type = types.listOf types.str;
default = [];
};
swapPartitions = mkOption {
description = "Set swap partitions";
type = types.listOf types.str;
default = [];
};
};
config.fileSystems = mkMerge (mapAttrsToList (dataset: mountpoint: {
"${mountpoint}" = {
device = "${dataset}";
fsType = "zfs";
options = ["X-mount.mkdir" "noatime"];
neededForBoot = true;
};
})
cfg.datasets
++ mapAttrsToList (bindsrc: mountpoint: {
"${mountpoint}" = {
device = "${bindsrc}";
fsType = "none";
options = ["bind" "X-mount.mkdir" "noatime"];
};
})
cfg.bindmounts
++ map (esp: {
"/boot/efis/${esp}" = {
device = "${config.zfs-root.boot.devNodes}/${esp}";
fsType = "vfat";
options = [
"x-systemd.idle-timeout=1min"
"x-systemd.automount"
"noauto"
"nofail"
"noatime"
"X-mount.mkdir"
];
};
})
cfg.efiSystemPartitions);
config.swapDevices = mkDefault (map (swap: {
device = "${config.zfs-root.boot.devNodes}/${swap}";
discardPolicy = mkDefault "both";
randomEncryption = {
enable = true;
allowDiscards = mkDefault true;
};
})
cfg.swapPartitions);
}

View File

@ -0,0 +1,344 @@
# Generated via dconf2nix: https://github.com/gvolpe/dconf2nix
{lib, ...}:
with lib.hm.gvariant; {
dconf.settings = {
"com/github/repsac-by/quake-mode" = {
quake-mode-focusout = true;
quake-mode-height = 76;
quake-mode-hide-from-overview = false;
quake-mode-monitor = 1;
quake-mode-width = 100;
};
"com/github/repsac-by/quake-mode/accelerators" = {
quake-mode-accelerator-1 = ["<Alt>z"];
};
"com/github/repsac-by/quake-mode/apps" = {
app-1 = "org.gnome.Terminal.desktop";
};
"org/gnome/Console" = {
font-scale = 1.1;
};
"org/gnome/Totem" = {
active-plugins = ["save-file" "recent" "autoload-subtitles" "open-directory" "vimeo" "screensaver" "rotation" "screenshot" "variable-rate" "movie-properties" "mpris" "apple-trailers" "skipto"];
subtitle-encoding = "UTF-8";
};
"org/gnome/control-center" = {
last-panel = "bluetooth";
window-state = mkTuple [980 640];
};
"org/gnome/desktop/app-folders" = {
folder-children = ["Utilities" "YaST"];
};
"org/gnome/desktop/app-folders/folders/Utilities" = {
apps = ["gnome-abrt.desktop" "gnome-system-log.desktop" "nm-connection-editor.desktop" "org.gnome.baobab.desktop" "org.gnome.Connections.desktop" "org.gnome.DejaDup.desktop" "org.gnome.Dictionary.desktop" "org.gnome.DiskUtility.desktop" "org.gnome.eog.desktop" "org.gnome.Evince.desktop" "org.gnome.FileRoller.desktop" "org.gnome.fonts.desktop" "org.gnome.seahorse.Application.desktop" "org.gnome.tweaks.desktop" "org.gnome.Usage.desktop" "vinagre.desktop"];
categories = ["X-GNOME-Utilities"];
name = "X-GNOME-Utilities.directory";
translate = true;
};
"org/gnome/desktop/app-folders/folders/YaST" = {
categories = ["X-SuSE-YaST"];
name = "suse-yast.directory";
translate = true;
};
"org/gnome/desktop/background" = {
color-shading-type = "solid";
picture-options = "zoom";
picture-uri = "file:///home/jas/.local/share/backgrounds/2023-06-08-06-24-32-catppuccin_squares-red.png";
picture-uri-dark = "file:///home/jas/.local/share/backgrounds/2023-06-08-06-24-32-catppuccin_squares-red.png";
primary-color = "#000000000000";
secondary-color = "#000000000000";
};
"org/gnome/desktop/input-sources" = {
sources = [(mkTuple ["xkb" "us"])];
xkb-options = ["terminate:ctrl_alt_bksp"];
};
"org/gnome/desktop/interface" = {
clock-format = "12h";
clock-show-weekday = true;
color-scheme = "prefer-dark";
cursor-theme = "Catppuccin-Mocha-Red-Cursors";
document-font-name = "Rubik 10";
font-antialiasing = "rgba";
font-hinting = "slight";
font-name = "Rubik 10";
gtk-theme = "Catppuccin-Mocha-Standard-Red-Dark";
icon-theme = "Papirus-Dark";
monospace-font-name = "JetBrainsMono Nerd Font Mono 10";
};
"org/gnome/desktop/notifications" = {
application-children = ["org-gnome-epiphany" "gnome-power-panel" "firefox" "org-gnome-nautilus" "com-nextcloud-desktopclient-nextcloud"];
show-in-lock-screen = false;
};
"org/gnome/desktop/notifications/application/com-nextcloud-desktopclient-nextcloud" = {
application-id = "com.nextcloud.desktopclient.nextcloud.desktop";
};
"org/gnome/desktop/notifications/application/firefox" = {
application-id = "firefox.desktop";
};
"org/gnome/desktop/notifications/application/gnome-network-panel" = {
application-id = "gnome-network-panel.desktop";
};
"org/gnome/desktop/notifications/application/gnome-power-panel" = {
application-id = "gnome-power-panel.desktop";
};
"org/gnome/desktop/notifications/application/org-gnome-epiphany" = {
application-id = "org.gnome.Epiphany.desktop";
};
"org/gnome/desktop/notifications/application/org-gnome-nautilus" = {
application-id = "org.gnome.Nautilus.desktop";
};
"org/gnome/desktop/privacy" = {
disable-camera = true;
disable-microphone = true;
};
"org/gnome/desktop/screensaver" = {
color-shading-type = "solid";
lock-enabled = false;
picture-options = "zoom";
picture-uri = "file:///home/jas/.local/share/backgrounds/2023-06-08-06-24-32-catppuccin_squares-red.png";
primary-color = "#000000000000";
secondary-color = "#000000000000";
};
"org/gnome/desktop/session" = {
idle-delay = mkUint32 300;
};
"org/gnome/desktop/sound" = {
event-sounds = true;
theme-name = "__custom";
};
"org/gnome/desktop/wm/keybindings" = {
activate-window-menu = [];
};
"org/gnome/desktop/wm/preferences" = {
button-layout = "appmenu:minimize,maximize,close";
num-workspaces = 1;
titlebar-font = "Rubik Bold 10";
};
"org/gnome/epiphany" = {
ask-for-default = false;
};
"org/gnome/epiphany/state" = {
is-maximized = false;
window-size = mkTuple [1760 1448];
};
"org/gnome/evolution-data-server" = {
migrated = true;
};
"org/gnome/gnome-screenshot" = {
delay = 0;
include-pointer = false;
last-save-directory = "file:///home/jas/downloads";
};
"org/gnome/mutter" = {
edge-tiling = true;
};
"org/gnome/nautilus/preferences" = {
default-folder-viewer = "icon-view";
migrated-gtk-settings = true;
search-filter-time-type = "last_modified";
};
"org/gnome/nautilus/window-state" = {
initial-size = mkTuple [890 550];
};
"org/gnome/settings-daemon/plugins/color" = {
night-light-enabled = false;
};
"org/gnome/settings-daemon/plugins/media-keys" = {
custom-keybindings = ["/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/" "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/"];
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = {
binding = "<Alt>space";
command = "rofi -show";
name = "rofi";
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = {
binding = "<Alt>b";
command = "rofi -show Bookmarks";
name = "rofi Bookmarks";
};
"org/gnome/settings-daemon/plugins/power" = {
sleep-inactive-ac-type = "nothing";
};
"org/gnome/shell" = {
app-picker-layout = "[{'org.gnome.Geary.desktop': <{'position': <0>}>, 'org.gnome.Contacts.desktop': <{'position': <1>}>, 'org.gnome.Weather.desktop': <{'position': <2>}>, 'org.gnome.clocks.desktop': <{'position': <3>}>, 'org.gnome.Maps.desktop': <{'position': <4>}>, 'org.gnome.Extensions.desktop': <{'position': <5>}>, 'org.gnome.Photos.desktop': <{'position': <6>}>, 'org.gnome.Totem.desktop': <{'position': <7>}>, 'org.gnome.Calculator.desktop': <{'position': <8>}>, 'nvim.desktop': <{'position': <9>}>, 'simple-scan.desktop': <{'position': <10>}>, 'org.gnome.Settings.desktop': <{'position': <11>}>, 'gnome-system-monitor.desktop': <{'position': <12>}>, 'nixos-manual.desktop': <{'position': <13>}>, 'nvidia-settings.desktop': <{'position': <14>}>, 'Utilities': <{'position': <15>}>, 'org.gnome.TextEditor.desktop': <{'position': <16>}>, 'yelp.desktop': <{'position': <17>}>, 'org.gnome.Tour.desktop': <{'position': <18>}>, 'org.gnome.Cheese.desktop': <{'position': <19>}>, 'xterm.desktop': <{'position': <20>}>, 'org.gnome.Music.desktop': <{'position': <21>}>, 'org.gnome.Calendar.desktop': <{'position': <22>}>, 'ca.desrt.dconf-editor.desktop': <{'position': <23>}>}, {'emacs.desktop': <{'position': <0>}>, 'emacsclient.desktop': <{'position': <1>}>, 'mullvad-vpn.desktop': <{'position': <2>}>, 'org.gnome.Epiphany.desktop': <{'position': <3>}>}]";
disabled-extensions = ["pop-shell@system76.com"];
enabled-extensions = ["appindicatorsupport@rgcjonas.gmail.com" "openweather-extension@jenslody.de" "pano@elhan.io" "quake-mode@repsac-by.github.com" "system-monitor-next@paradoxxx.zero.gmail.com" "unite@hardpixel.eu" "uptime-indicator@gniourfgniourf.gmail.com" "user-theme@gnome-shell-extensions.gcampax.github.com"];
favorite-apps = ["org.gnome.Nautilus.desktop" "org.gnome.Terminal.desktop" "firefox.desktop" "org.gnome.tweaks.desktop" "org.gnome.Extensions.desktop" "emacs.desktop" "fi.skyjake.Lagrange.desktop"];
welcome-dialog-last-shown-version = "44.1";
};
"org/gnome/shell/extensions/openweather" = {
city = "41.8755616,-87.6244212>Chicago, Cook County, Illinois, United States>0";
position-in-panel = "center";
pressure-unit = "inHg";
unit = "fahrenheit";
wind-speed-unit = "mph";
};
"org/gnome/shell/extensions/pano" = {
history-length = 50;
paste-on-select = false;
play-audio-on-copy = false;
send-notification-on-copy = false;
sync-primary = true;
};
"org/gnome/shell/extensions/unite" = {
extend-left-box = false;
notifications-position = "center";
window-buttons-placement = "left";
};
"org/gnome/shell/extensions/user-theme" = {
name = "Catppuccin-Mocha-Standard-Red-Dark";
};
"org/gnome/terminal/legacy/profiles:" = {
default = "95894cfd-82f7-430d-af6e-84d168bc34f5";
list = ["de8a9081-8352-4ce4-9519-5de655ad9361" "71a9971e-e829-43a9-9b2f-4565c855d664" "5083e06b-024e-46be-9cd2-892b814f1fc8" "95894cfd-82f7-430d-af6e-84d168bc34f5"];
};
"org/gnome/terminal/legacy/profiles:/:5083e06b-024e-46be-9cd2-892b814f1fc8" = {
background-color = "#24273a";
cursor-background-color = "#f4dbd6";
cursor-colors-set = true;
cursor-foreground-color = "#24273a";
foreground-color = "#cad3f5";
highlight-background-color = "#24273a";
highlight-colors-set = true;
highlight-foreground-color = "#5b6078";
palette = ["#494d64" "#ed8796" "#a6da95" "#eed49f" "#8aadf4" "#f5bde6" "#8bd5ca" "#b8c0e0" "#5b6078" "#ed8796" "#a6da95" "#eed49f" "#8aadf4" "#f5bde6" "#8bd5ca" "#a5adcb"];
use-theme-colors = false;
visible-name = "Catppuccin Macchiato";
};
"org/gnome/terminal/legacy/profiles:/:71a9971e-e829-43a9-9b2f-4565c855d664" = {
background-color = "#303446";
cursor-background-color = "#f2d5cf";
cursor-colors-set = true;
cursor-foreground-color = "#303446";
foreground-color = "#c6d0f5";
highlight-background-color = "#303446";
highlight-colors-set = true;
highlight-foreground-color = "#626880";
palette = ["#51576d" "#e78284" "#a6d189" "#e5c890" "#8caaee" "#f4b8e4" "#81c8be" "#b5bfe2" "#626880" "#e78284" "#a6d189" "#e5c890" "#8caaee" "#f4b8e4" "#81c8be" "#a5adce"];
use-theme-colors = false;
visible-name = "Catppuccin Frappe";
};
"org/gnome/terminal/legacy/profiles:/:95894cfd-82f7-430d-af6e-84d168bc34f5" = {
audible-bell = false;
background-color = "#1e1e2e";
cursor-background-color = "#f5e0dc";
cursor-colors-set = true;
cursor-foreground-color = "#1e1e2e";
font = "JetBrainsMono Nerd Font Mono 10";
foreground-color = "#cdd6f4";
highlight-background-color = "#1e1e2e";
highlight-colors-set = true;
highlight-foreground-color = "#585b70";
palette = ["#45475a" "#f38ba8" "#a6e3a1" "#f9e2af" "#89b4fa" "#f5c2e7" "#94e2d5" "#bac2de" "#585b70" "#f38ba8" "#a6e3a1" "#f9e2af" "#89b4fa" "#f5c2e7" "#94e2d5" "#a6adc8"];
scroll-on-output = true;
use-system-font = false;
use-theme-colors = false;
visible-name = "Catppuccin Mocha";
};
"org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9" = {
background-color = "rgb(23,20,33)";
foreground-color = "rgb(208,207,204)";
use-theme-colors = false;
};
"org/gnome/terminal/legacy/profiles:/:de8a9081-8352-4ce4-9519-5de655ad9361" = {
background-color = "#eff1f5";
cursor-background-color = "#dc8a78";
cursor-colors-set = true;
cursor-foreground-color = "#eff1f5";
foreground-color = "#4c4f69";
highlight-background-color = "#eff1f5";
highlight-colors-set = true;
highlight-foreground-color = "#acb0be";
palette = ["#5c5f77" "#d20f39" "#40a02b" "#df8e1d" "#1e66f5" "#ea76cb" "#179299" "#acb0be" "#6c6f85" "#d20f39" "#40a02b" "#df8e1d" "#1e66f5" "#ea76cb" "#179299" "#bcc0cc"];
use-theme-colors = false;
visible-name = "Catppuccin Latte";
};
"org/gnome/tweaks" = {
show-extensions-notice = false;
};
"org/gtk/gtk4/settings/file-chooser" = {
date-format = "regular";
location-mode = "path-bar";
show-hidden = false;
show-size-column = true;
show-type-column = true;
sidebar-width = 140;
sort-column = "name";
sort-directories-first = false;
sort-order = "ascending";
type-format = "category";
view-type = "list";
window-size = mkTuple [944 654];
};
"org/gtk/settings/color-chooser" = {
custom-colors = [(mkTuple [0.4117647058823529 2.3529411764705882e-2])];
selected-color = mkTuple [true 0.8784313725490196];
};
"org/gtk/settings/file-chooser" = {
clock-format = "12h";
date-format = "regular";
location-mode = "path-bar";
show-hidden = false;
show-size-column = true;
show-type-column = true;
sidebar-width = 170;
sort-column = "name";
sort-directories-first = false;
sort-order = "ascending";
type-format = "category";
window-position = mkTuple [344 65];
window-size = mkTuple [1231 902];
};
};
}

View File

@ -0,0 +1,122 @@
{
config,
pkgs,
inputs,
...
}: {
imports = [inputs.home-manager.nixosModules.home-manager];
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.jas = {
imports = [./dconf.nix];
home = {
username = "jas";
homeDirectory = "/home/jas";
stateVersion = "23.05";
};
programs.git = {
enable = true;
userEmail = "23226432+hyperreal64@users.noreply.github.com";
userName = "Jeffrey Serio";
extraConfig = {
core = {
editor = "vim";
pager = "diff-so-fancy | less --tabs=4 -RFX";
};
init.defaultBranch = "main";
pull.rebase = true;
};
};
programs.gpg = {
enable = true;
settings = {
default-key = "0x9129BD07C3509CED";
no-emit-version = true;
no-comments = true;
display-charset = "utf-8";
keyid-format = "0xlong";
with-fingerprint = true;
use-agent = true;
};
};
programs.fzf = {
enable = true;
defaultCommand = "fd --type f";
};
programs.bat = {
enable = true;
config = {
pager = "less -FR";
theme = "Catppuccin-Mocha";
};
};
manual.json.enable = true;
xdg.userDirs = {
enable = true;
createDirectories = true;
documents = "\$HOME/Nextcloud/documents";
download = "\$HOME/downloads";
pictures = "\$HOME/Nextcloud/pictures";
publicShare = "\$HOME/public";
music = "\$HOME/misc/music";
videos = "\$HOME/misc/videos";
templates = "\$HOME/misc/templates";
};
services.nextcloud-client.enable = true;
programs.ssh = {
enable = true;
matchBlocks = {
"nexus.local" = {
hostname = "nexus.local";
user = "jas";
identityFile = "/home/jas/.ssh/id_ed25519";
};
"hyperreal.coffee" = {
hostname = "hyperreal.coffee";
user = "jas";
identityFile = "/home/jas/.ssh/id_ed25519";
};
"nc.hyperreal.coffee" = {
hostname = "nc.hyperreal.coffee";
user = "jas";
identityFile = "/home/jas/.ssh/id_ed25519";
};
"soft-serve" = {
hostname = "soft-serve.local";
port = 23231;
identityFile = "/home/jas/.ssh/id_ed25519";
};
};
};
gtk = {
enable = true;
iconTheme = {
name = "Papirus-Dark";
package = pkgs.catppuccin-papirus-folders.override {
flavor = "mocha";
accent = "red";
};
};
theme = {
name = "Catppuccin-Mocha-Standard-Red-Dark";
package = pkgs.catppuccin-gtk.override {
accents = ["red"];
size = "standard";
variant = "mocha";
};
};
};
};
}

View File

@ -0,0 +1,251 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib) types mkIf mkOption mkMerge;
in {
options.my-config = {
template.all.packages.enable = mkOption {
description = "Enable common packages for all hosts";
type = types.bool;
default = true;
};
template.all.zfs.enable = mkOption {
description = "Enable ZFS settings";
type = types.bool;
default = true;
};
template.any.nvidia.enable = mkOption {
description = "Enable nvidia settings";
type = types.bool;
default = false;
};
template.any.system76.enable = mkOption {
description = "Enable System76 settings";
type = types.bool;
default = false;
};
template.desktop.custom.enable = mkOption {
description = "Enable customized GNOME desktop";
type = types.bool;
default = true;
};
template.server.services.enable = mkOption {
description = "Enable server settings";
type = types.bool;
default = false;
};
};
# See nixos-help > Option Definitions > Merging Configurations
config =
mkMerge
[
(mkIf config.my-config.template.desktop.custom.enable {
services.xserver = {
enable = true;
desktopManager.gnome.enable = true;
displayManager.gdm.enable = true;
};
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
environment.systemPackages = with pkgs; [
amfora
catppuccin-cursors.mochaRed
dconf2nix
emacs
firefox
gnome.dconf-editor
gnome.gnome-screenshot
gnome.gnome-terminal
gnome.gnome-tweaks
gnomeExtensions.appindicator
gnomeExtensions.openweather
gnomeExtensions.pano
gnomeExtensions.quake-mode
gnomeExtensions.unite
gnomeExtensions.uptime-indicator
gnomeExtensions.user-themes
lagrange
mullvad-vpn
nextcloud-client
rofi
rofimoji
zellij
];
fonts.fonts = with pkgs; [
font-awesome
nerdfonts
noto-fonts
noto-fonts-extra
rubik
];
fonts.fontconfig = {
antialias = true;
hinting = {
enable = true;
style = "slight";
autohint = false;
};
subpixel = {
lcdfilter = "default";
rgba = "rgb";
};
defaultFonts = {
serif = ["Noto Serif"];
sansSerif = ["Noto Sans"];
monospace = ["JetBrainsMono Nerd Font Mono"];
};
};
programs.gnupg = {
agent.enable = true;
agent.pinentryFlavor = "gnome3";
dirmngr.enable = true;
};
services.mullvad-vpn.enable = true;
})
(mkIf config.my-config.template.any.system76.enable {
services.system76-scheduler.enable = true;
hardware.system76.power-daemon.enable = true;
})
(mkIf config.my-config.template.any.nvidia.enable {
nixpkgs.config.allowUnfree = true;
services.xserver.videoDrivers = ["nvidia"];
hardware = {
opengl.enable = true;
nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
nvidia.modesetting.enable = true;
};
})
(mkIf config.my-config.template.all.zfs.enable {
services.zfs.autoScrub.enable = true;
services.sanoid = {
enable = true;
datasets.rpool.hourly = 24;
datasets.rpool.daily = 7;
datasets.rpool.weekly = 4;
datasets.rpool.monthly = 12;
datasets.rpool.recursive = true;
};
})
(mkIf config.my-config.template.all.packages.enable {
environment.systemPackages = with pkgs; [
alejandra
autossh
bat-extras.batdiff
bat-extras.batgrep
bat-extras.batman
bat-extras.batwatch
bat-extras.prettybat
btop
charm
coreutils
deadnix
diff-so-fancy
du-dust
duf
exa
fd
gcc
git
glow
gnumake
go
go-tools
gopls
gops
gosec
gum
httpie
hugo
hyperfine
jq
killall
ldns
libnotify
lnav
lsof
neofetch
nix-diff
nix-doc
nix-du
nix-tree
nmap
node2nix
nodejs
pass
pinentry
prettyping
python3Full
ranger
ripgrep
rustup
shellcheck
shfmt
skate
starship
statix
stow
tealdeer
trash-cli
unzip
vim
w3m
wget
xorg.xauth
xclip
xsel
yarn
zip
zsh-nix-shell
];
})
(mkIf config.my-config.template.server.services.enable {
programs.atop = {
enable = true;
atopacctService.enable = true;
atopService.enable = true;
atopRotateTimer.enable = true;
};
services.clamav = {
updater.enable = true;
daemon.enable = true;
};
services.rsyslogd = {
enable = true;
extraConfig = "*.* @10.0.0.27:514";
};
services.tuptime = {
enable = true;
timer.enable = true;
};
})
];
}

View File

@ -0,0 +1,32 @@
{
config,
lib,
...
}: let
cfg = config.zfs-root.networking;
inherit (lib) types mkDefault mkOption;
in {
options.zfs-root.networking = {
hostName = mkOption {
description = "The name of the machine. Used by nix flake.";
type = types.str;
default = "exampleHost";
};
timeZone = mkOption {
type = types.str;
default = "Etc/UTC";
};
hostId = mkOption {
description = "Set host id";
type = types.str;
};
};
config = {
networking.hostId = cfg.hostId;
time.timeZone = cfg.timeZone;
networking = {
firewall.enable = mkDefault true;
inherit (cfg) hostName;
};
};
}