mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-12 00:18:59 +00:00
Format the Nix files properly
This commit is contained in:
parent
539a798009
commit
f038f48464
@ -5,8 +5,7 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ # Include the results of the hardware scan.
|
||||
imports = [ # Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
|
||||
@ -63,22 +62,20 @@
|
||||
|
||||
# List packages installed in system profile. To search, run:
|
||||
# $ nix search wget
|
||||
environment.systemPackages = with pkgs; [
|
||||
git
|
||||
wget
|
||||
brave
|
||||
lf
|
||||
fd
|
||||
ripgrep
|
||||
];
|
||||
environment.systemPackages = with pkgs; [ git wget brave lf fd ripgrep ];
|
||||
|
||||
# Some programs need SUID wrappers, can be configured further or are
|
||||
# started in user sessions.
|
||||
programs.mtr.enable = true;
|
||||
security.doas.enable = true;
|
||||
|
||||
# List services that you want to enable:
|
||||
#services.borgmatic.enable = true;
|
||||
# The usual doas config.
|
||||
security.doas = {
|
||||
enable = true;
|
||||
extraRules = [{
|
||||
groups = [ "wheel" ];
|
||||
persist = true;
|
||||
}];
|
||||
};
|
||||
|
||||
# This value determines the NixOS release from which the default
|
||||
# settings for stateful data, like file locations and database versions
|
||||
@ -89,11 +86,17 @@
|
||||
system.stateVersion = "21.11"; # Did you read the comment?
|
||||
|
||||
# This is my external hard disk so it has to be non-blocking.
|
||||
fileSystems."/archive" =
|
||||
{ device = "/dev/disk/by-uuid/665A391C5A38EB07";
|
||||
fileSystems."/mnt/archive" = {
|
||||
device = "/dev/disk/by-uuid/665A391C5A38EB07";
|
||||
fsType = "ntfs";
|
||||
noCheck = true;
|
||||
options = [ "nofail" "noauto" "user" "x.systemd.automount" "x.systemd.device.timeout=1ms" ];
|
||||
options = [
|
||||
"nofail"
|
||||
"noauto"
|
||||
"user"
|
||||
"x.systemd.automount"
|
||||
"x.systemd.device.timeout=1ms"
|
||||
];
|
||||
};
|
||||
|
||||
# Automated backup for my external storage.
|
||||
@ -114,14 +117,10 @@
|
||||
doInit = false;
|
||||
removableDevice = true;
|
||||
repo = "/archive/backups";
|
||||
paths = [
|
||||
"~/dotfiles"
|
||||
"~/library"
|
||||
"~/writings"
|
||||
];
|
||||
paths = [ "~/dotfiles" "~/library" "~/writings" ];
|
||||
encryption = {
|
||||
mode = "repokey";
|
||||
passCommand = "${pkgs.gopass}/bin/gopass show misc/BorgBackup_pass"
|
||||
passCommand = "${pkgs.gopass}/bin/gopass show misc/BorgBackup_pass";
|
||||
};
|
||||
compression = "auto,lzma";
|
||||
startAt = "daily";
|
||||
|
@ -3,8 +3,7 @@
|
||||
let
|
||||
# Default system for our host configuration.
|
||||
sys = "x86_64-linux";
|
||||
in
|
||||
rec {
|
||||
in rec {
|
||||
/* Create an attribute set that represents the structure of the modules
|
||||
inside of a directory. While it can recurse into directories, it will
|
||||
stop once it detects `default.nix` inside.
|
||||
@ -21,23 +20,22 @@ rec {
|
||||
filesToAttr = dirPath:
|
||||
let
|
||||
isModule = file: type:
|
||||
(type == "regular" && lib.hasSuffix ".nix" file) || (type == "directory");
|
||||
(type == "regular" && lib.hasSuffix ".nix" file)
|
||||
|| (type == "directory");
|
||||
|
||||
collect = file: type: {
|
||||
name = lib.removeSuffix ".nix" file;
|
||||
value =
|
||||
let
|
||||
path = dirPath + "/${file}";
|
||||
in
|
||||
if (type == "regular") || (type == "directory" && lib.pathExists (path + "/default.nix"))
|
||||
then path
|
||||
else filesToAttr path;
|
||||
value = let path = dirPath + "/${file}";
|
||||
in if (type == "regular")
|
||||
|| (type == "directory" && lib.pathExists (path + "/default.nix")) then
|
||||
path
|
||||
else
|
||||
filesToAttr path;
|
||||
};
|
||||
|
||||
files = lib.filterAttrs isModule (builtins.readDir dirPath);
|
||||
in
|
||||
lib.filterAttrs (name: value: value != { }) (lib.mapAttrs' collect files);
|
||||
|
||||
in lib.filterAttrs (name: value: value != { })
|
||||
(lib.mapAttrs' collect files);
|
||||
|
||||
/* Like `filesToAttr` but does it recursively. Those modules with
|
||||
`default.nix` are ignored and gives the full module directory this time.
|
||||
@ -60,8 +58,7 @@ rec {
|
||||
# `default.nix`.
|
||||
value = if (lib.pathIsDirectory file) then filesToAttr file else file;
|
||||
};
|
||||
in
|
||||
lib.listToAttrs (lib.mapAttrsToList collect files);
|
||||
in lib.listToAttrs (lib.mapAttrsToList collect files);
|
||||
|
||||
/* Create a NixOS system through a given host folder.
|
||||
It will automate some of the things such as making the last component
|
||||
@ -71,7 +68,8 @@ rec {
|
||||
mkHost ./hosts/june {}
|
||||
=> { ... } # NixOS configuration attrset
|
||||
*/
|
||||
mkHost = file: attrs@{ system ? sys, ... }:
|
||||
mkHost = file:
|
||||
attrs@{ system ? sys, ... }:
|
||||
lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = { inherit lib system inputs; };
|
||||
@ -80,7 +78,9 @@ rec {
|
||||
# Later modules will override previously imported modules.
|
||||
modules = [
|
||||
# Set the hostname.
|
||||
{ networking.hostName = builtins.baseNameOf file; }
|
||||
{
|
||||
networking.hostName = builtins.baseNameOf file;
|
||||
}
|
||||
|
||||
# Put the given attribute set (except for the system).
|
||||
(lib.filterAttrs (n: v: !lib.elem n [ "system" ]) attrs)
|
||||
@ -102,11 +102,8 @@ rec {
|
||||
=> { d = { ... }; hello = { ... }; }
|
||||
*/
|
||||
zipToAttrs = keys: values:
|
||||
lib.listToAttrs (
|
||||
lib.zipListsWith (name: value: { inherit name value; })
|
||||
keys
|
||||
values
|
||||
);
|
||||
lib.listToAttrs
|
||||
(lib.zipListsWith (name: value: { inherit name value; }) keys values);
|
||||
|
||||
/* Count the attributes with the given predicate.
|
||||
|
||||
@ -115,5 +112,6 @@ rec {
|
||||
=> 2
|
||||
*/
|
||||
countAttrs = pred: attrs:
|
||||
lib.count (attr: pred attr.name attr.value) (lib.mapAttrsToList lib.nameValuePair attrs);
|
||||
lib.count (attr: pred attr.name attr.value)
|
||||
(lib.mapAttrsToList lib.nameValuePair attrs);
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
# A module that automates setting up agenix for your system.
|
||||
{ inputs, lib, options, config, ... }:
|
||||
|
||||
let
|
||||
cfg = config.modules.agenix;
|
||||
let cfg = config.modules.agenix;
|
||||
in {
|
||||
options.modules.agenix.enable = lib.mkEnableOption "Enable agenix on your system";
|
||||
options.modules.agenix.enable =
|
||||
lib.mkEnableOption "Enable agenix on your system";
|
||||
|
||||
imports = [ inputs.agenix.nixosModules.age ];
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
@ -1,11 +1,10 @@
|
||||
# All of your embarrassing moments, marked here forever.
|
||||
{ config, options, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.modules.archiving;
|
||||
in
|
||||
{
|
||||
options.modules.archiving.enable = lib.mkEnableOption "Install and configure archiving tools.";
|
||||
let cfg = config.modules.archiving;
|
||||
in {
|
||||
options.modules.archiving.enable =
|
||||
lib.mkEnableOption "Install and configure archiving tools.";
|
||||
|
||||
# This is not going to set BorgBackup NixOS services for you.
|
||||
# Please do it for host-specific configs instead.
|
||||
|
@ -3,13 +3,14 @@
|
||||
# That can be found in the `themes` module.
|
||||
{ config, options, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.modules.desktop;
|
||||
in
|
||||
{
|
||||
let cfg = config.modules.desktop;
|
||||
in {
|
||||
options.modules.desktop = {
|
||||
enable = lib.mkEnableOption "Enables all desktop-related services and default programs.";
|
||||
audio.enable = lib.mkEnableOption "Enables all desktop audio-related services such as Pipewire.";
|
||||
enable = lib.mkEnableOption
|
||||
"Enables all desktop-related services and default programs.";
|
||||
audio.enable = lib.mkEnableOption
|
||||
"Enables all desktop audio-related services such as Pipewire.";
|
||||
fonts.enable = lib.mkEnableOption "Enables font-related config.";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable (lib.mkMerge [
|
||||
@ -43,9 +44,25 @@ in
|
||||
|
||||
# Enable MPD-related services.
|
||||
services.mpd.enable = true;
|
||||
environment.systemPackages = with pkgs; [
|
||||
environment.systemPackages = with pkgs;
|
||||
[
|
||||
ncmpcpp # Has the worst name for a music client WTF?
|
||||
];
|
||||
})
|
||||
|
||||
(lib.mkIf cfg.fonts.enable {
|
||||
fonts = {
|
||||
enableDefaultFonts = true;
|
||||
fontconfig = {
|
||||
enable = true;
|
||||
includeUserConf = true;
|
||||
};
|
||||
|
||||
fonts = with pkgs;
|
||||
[
|
||||
|
||||
];
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
@ -2,13 +2,15 @@
|
||||
# If you want to see editor-specific modules, see `modules/editors.nix`.
|
||||
{ config, options, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.modules.dev;
|
||||
let cfg = config.modules.dev;
|
||||
in {
|
||||
options.modules.dev = {
|
||||
enable = lib.mkEnableOption "Configures my barebones requirement for a development environment.";
|
||||
shell.enable = lib.mkEnableOption "Installs of the shell utilities I rely on.";
|
||||
virtualization.enable = lib.mkEnableOption "Configures my virtualization-related stuff for my development. (I sometimes have to use these.)";
|
||||
enable = lib.mkEnableOption
|
||||
"Configures my barebones requirement for a development environment.";
|
||||
shell.enable =
|
||||
lib.mkEnableOption "Installs of the shell utilities I rely on.";
|
||||
virtualization.enable = lib.mkEnableOption
|
||||
"Configures my virtualization-related stuff for my development. (I sometimes have to use these.)";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable (lib.mkMerge [
|
||||
@ -22,9 +24,7 @@ in {
|
||||
|
||||
# Configure all of the development-related configuration in the system.
|
||||
programs.git.enable = true;
|
||||
programs.gnupg = {
|
||||
agent.enable = true;
|
||||
};
|
||||
programs.gnupg = { agent.enable = true; };
|
||||
|
||||
# Convenience!
|
||||
environment.localBinInPath = true;
|
||||
|
@ -1,23 +1,21 @@
|
||||
{ config, options, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.modules.editors;
|
||||
in
|
||||
{
|
||||
let cfg = config.modules.editors;
|
||||
in {
|
||||
options.modules.editors = {
|
||||
neovim.enable = lib.mkEnableOption "Enable Neovim and its components";
|
||||
emacs = {
|
||||
enable = lib.mkEnableOption "Enable Emacs and all of its components";
|
||||
doom.enable = lib.mkEnableOption "Enable Doom Emacs-related dependencies.";
|
||||
doom.enable =
|
||||
lib.mkEnableOption "Enable Doom Emacs-related dependencies.";
|
||||
};
|
||||
vscode.enable = lib.mkEnableOption "Enable Visual Studio Code";
|
||||
};
|
||||
|
||||
config = lib.mkMerge [
|
||||
(lib.mkIf cfg.emacs.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
emacs
|
||||
] ++ (if cfg.emacs.doom.enable then [
|
||||
environment.systemPackages = with pkgs;
|
||||
[ emacs ] ++ (if cfg.emacs.doom.enable then [
|
||||
# The required depdencies.
|
||||
git
|
||||
ripgrep
|
||||
@ -39,7 +37,8 @@ in
|
||||
|
||||
# :lang org +roam2
|
||||
sqlite
|
||||
] else []);
|
||||
] else
|
||||
[ ]);
|
||||
})
|
||||
|
||||
(lib.mkIf cfg.neovim.enable {
|
||||
@ -50,16 +49,11 @@ in
|
||||
withRuby = true;
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
editorconfig-core-c
|
||||
];
|
||||
environment.systemPackages = with pkgs; [ editorconfig-core-c ];
|
||||
})
|
||||
|
||||
(lib.mkIf cfg.vscode.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
vscode
|
||||
editorconfig-core-c
|
||||
];
|
||||
environment.systemPackages = with pkgs; [ vscode editorconfig-core-c ];
|
||||
})
|
||||
];
|
||||
}
|
||||
|
@ -4,16 +4,17 @@ let
|
||||
cfg = config.modules.themes.a-happy-gnome;
|
||||
in
|
||||
{
|
||||
options.modules.theme.a-happy-gnome.enable = lib.mkEnableOption "Enables my configuration of GNOME Shell.";
|
||||
options.modules.themes.a-happy-gnome.enable = lib.mkEnableOption "Enables my configuration of GNOME Shell.";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.xserver.enable = true;
|
||||
services.xserver.displayManager.gdm.enable = true;
|
||||
services.xserver.desktopManager.gnome.enable = true;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
chrome-gnome-shell
|
||||
# I'm pretty sure this is already done but just to make sure.
|
||||
services.gnome.chrome-gnome-shell.enable = true;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
gnomeExtensions.arcmenu
|
||||
gnomeExtensions.x11-gestures
|
||||
gnomeExtensions.gsconnect
|
||||
|
Loading…
Reference in New Issue
Block a user