mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-07 06:19:00 +00:00
Update various configurations
Flake outputs, hosts, users, and formatting of Nix files. et cetera, et cetera.
This commit is contained in:
parent
2ccaca429a
commit
adf04a9393
@ -3,9 +3,11 @@
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
|
||||
# Managing home configurations.
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
# Managing your secrets.
|
||||
agenix.url = "github:ryantm/agenix";
|
||||
agenix.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
@ -82,6 +84,9 @@
|
||||
|
||||
# Stallman-senpai will be disappointed. :(
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
# Let home-manager to manage itself.
|
||||
programs.home-manager.enable = true;
|
||||
};
|
||||
in {
|
||||
# Exposes only my library with the custom functions to make it easier to include in other flakes.
|
||||
|
@ -5,7 +5,8 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [ # Include the results of the hardware scan.
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
|
||||
@ -18,6 +19,7 @@
|
||||
audio.enable = true;
|
||||
fonts.enable = true;
|
||||
hardware.enable = true;
|
||||
cleanup.enable = true;
|
||||
};
|
||||
dev = {
|
||||
enable = true;
|
||||
@ -27,6 +29,7 @@
|
||||
editors.neovim.enable = true;
|
||||
themes.a-happy-gnome.enable = true;
|
||||
users.users = [ "foo-dogsquared" ];
|
||||
hardware-setup.backup-archive.enable = true;
|
||||
};
|
||||
|
||||
# Use the systemd-boot EFI boot loader.
|
||||
@ -71,61 +74,5 @@
|
||||
# Before changing this value read the documentation for this option
|
||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||
system.stateVersion = "21.11"; # Did you read the comment?
|
||||
|
||||
# This is my external hard disk so it has to be non-blocking.
|
||||
fileSystems."/mnt/external-storage" = {
|
||||
device = "/dev/disk/by-uuid/665A391C5A38EB07";
|
||||
fsType = "ntfs";
|
||||
noCheck = true;
|
||||
options = [
|
||||
"nofail"
|
||||
"noauto"
|
||||
"user"
|
||||
|
||||
# See systemd.mount.5 and systemd.automount.5 manual page for more
|
||||
# details.
|
||||
"x-systemd.automount"
|
||||
"x-systemd.device-timeout=2"
|
||||
"x-systemd.idle-timeout=2"
|
||||
];
|
||||
};
|
||||
|
||||
# Automated backup for my external storage.
|
||||
services.borgbackup.jobs = {
|
||||
personal_archive = {
|
||||
exclude = [
|
||||
"/home/*/.cache"
|
||||
|
||||
# The usual NodeJS shenanigans.
|
||||
"*/node_modules"
|
||||
"*/.next"
|
||||
|
||||
# Rust-related files.
|
||||
"projects/software/*/result"
|
||||
"projects/software/*/build"
|
||||
"projects/software/*/target"
|
||||
];
|
||||
doInit = false;
|
||||
removableDevice = true;
|
||||
repo = "/mnt/external-storage/backups";
|
||||
paths = [ "~/dotfiles" "~/library" "~/writings" ];
|
||||
encryption = {
|
||||
mode = "repokey";
|
||||
passCommand = "${pkgs.gopass}/bin/gopass show misc/BorgBackup_pass";
|
||||
};
|
||||
compression = "auto,lzma";
|
||||
startAt = "daily";
|
||||
prune = {
|
||||
prefix = "{hostname}-";
|
||||
keep = {
|
||||
within = "1d";
|
||||
daily = 30;
|
||||
weekly = 4;
|
||||
monthly = 6;
|
||||
yearly = 4;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -4,26 +4,25 @@
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
|
||||
boot.initrd.availableKernelModules =
|
||||
[ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/f52c2729-2036-4bdf-8d54-21f929f3447b";
|
||||
fsType = "ext4";
|
||||
};
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/f52c2729-2036-4bdf-8d54-21f929f3447b";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/AB3A-34BC";
|
||||
fsType = "vfat";
|
||||
};
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-uuid/AB3A-34BC";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
swapDevices = [ { label = "swap"; } ];
|
||||
swapDevices = [{ label = "swap"; }];
|
||||
|
||||
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
||||
}
|
||||
|
@ -50,32 +50,36 @@ in rec {
|
||||
++ (lib.modulesToList (lib.filesToAttr ../modules/nixos));
|
||||
};
|
||||
|
||||
/* Create a home-manager configuration for use in flakes.
|
||||
/* Create a home-manager configuration for use in flakes.
|
||||
|
||||
This is a wrapper for `home-manager.lib.homeManagerConfiguration`.
|
||||
This is a wrapper for `home-manager.lib.homeManagerConfiguration`.
|
||||
|
||||
Signature:
|
||||
file -> attrset -> homeManagerConfiguration
|
||||
Where:
|
||||
- `file` is the entry point to the home-manager configuration.
|
||||
- `attrset` is the additional attribute set to be insert as one of the imported modules minus the attributes used for `home-manager.lib.homeManagerConfiguration`.
|
||||
Returns:
|
||||
A home-manager configuration to be exported in flakes.
|
||||
Signature:
|
||||
file -> attrset -> homeManagerConfiguration
|
||||
Where:
|
||||
- `file` is the entry point to the home-manager configuration.
|
||||
- `attrset` is the additional attribute set to be insert as one of the imported modules minus the attributes used for `home-manager.lib.homeManagerConfiguration`.
|
||||
Returns:
|
||||
A home-manager configuration to be exported in flakes.
|
||||
|
||||
Example:
|
||||
mkUser ./users/foo-dogsquared {}
|
||||
=> { ... } # A home-manager configuration set.
|
||||
Example:
|
||||
mkUser ./users/foo-dogsquared {}
|
||||
=> { ... } # A home-manager configuration set.
|
||||
*/
|
||||
mkUser = file: attrs@{ username ? (builtins.baseNameOf file), system ? sys, extraModules ? [], ... }:
|
||||
let
|
||||
hmConfigFunctionArgs = builtins.attrNames (builtins.functionArgs inputs.home-manager.lib.homeManagerConfiguration);
|
||||
hmModules = lib.map (path: import path) (lib.modulesToList (lib.filesToAttrRec ../modules/home-manager));
|
||||
in
|
||||
inputs.home-manager.lib.homeManagerConfiguration {
|
||||
inherit system username;
|
||||
configuration = import file;
|
||||
homeDirectory = "/home/${username}";
|
||||
extraModules = hmModules ++ extraModules ++ [ (lib.filterAttrs (n: _: !lib.elem n hmConfigFunctionArgs) attrs) ];
|
||||
extraSpecialArgs = { inherit lib system; };
|
||||
};
|
||||
mkUser = file:
|
||||
attrs@{ username ? (builtins.baseNameOf file), system ? sys
|
||||
, extraModules ? [ ], ... }:
|
||||
let
|
||||
hmConfigFunctionArgs = builtins.attrNames (builtins.functionArgs
|
||||
inputs.home-manager.lib.homeManagerConfiguration);
|
||||
hmModules = lib.map (path: import path)
|
||||
(lib.modulesToList (lib.filesToAttrRec ../modules/home-manager));
|
||||
in inputs.home-manager.lib.homeManagerConfiguration {
|
||||
inherit system username;
|
||||
configuration = import file;
|
||||
homeDirectory = "/home/${username}";
|
||||
extraModules = hmModules ++ extraModules
|
||||
++ [ (lib.filterAttrs (n: _: !lib.elem n hmConfigFunctionArgs) attrs) ];
|
||||
extraSpecialArgs = { inherit lib system; };
|
||||
};
|
||||
}
|
||||
|
22
modules/README.adoc
Normal file
22
modules/README.adoc
Normal file
@ -0,0 +1,22 @@
|
||||
= Modules
|
||||
:toc:
|
||||
|
||||
This directory contains modules for different components such as link:https://nixos.org/manual/nixos/stable/index.html#sec-writing-modules[NixOS modules] and link:https://github.com/nix-community/home-manager/[home-manager modules].
|
||||
|
||||
|
||||
|
||||
|
||||
== Importing the modules
|
||||
|
||||
Usually, you'll see no `default.nix` in place since it is imported through other means.
|
||||
One of the most common way is through `filesToAttr` defined in link:../lib[my custom library].
|
||||
|
||||
For example, to easily get a list of imported custom NixOS modules, here's one way with the custom library.
|
||||
|
||||
[source, nix]
|
||||
----
|
||||
lib.map (path: import path) (lib.modulesToList (lib.filesToAttr ./modules/nixos))
|
||||
----
|
||||
|
||||
Each modules may have to be imported differently.
|
||||
Please see the respective documentation (i.e., `man:configuration.nix(5)`, `man:home-configuration.nix` ) for more details.
|
@ -25,7 +25,7 @@ buildGoModule rec {
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "HTTP DNS client for humans.";
|
||||
description = "HTTP DNS client for humans";
|
||||
homepage = "https://github.com/mr-karan/doggo";
|
||||
license = licenses.mit;
|
||||
};
|
||||
|
@ -22,16 +22,18 @@ stdenv.mkDerivation rec {
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
install -Dm644 $out/share/gnome-shell/extensions/${passthru.extensionUuid}/schemas/* -t "${glib.makeSchemaPath "$out" "${pname}-${version}"}"
|
||||
install -Dm644 $out/share/gnome-shell/extensions/${passthru.extensionUuid}/schemas/* -t "${
|
||||
glib.makeSchemaPath "$out" "${pname}-${version}"
|
||||
}"
|
||||
|
||||
# TODO: Uncomment once custom gsettings works.
|
||||
# Unfortunately custom gsettings seems to be not properly integrated with NixOS yet.
|
||||
#
|
||||
# For more information, please track the following issue:
|
||||
# https://github.com/NixOS/nixpkgs/issues/92265
|
||||
#
|
||||
# It also contains additional links to related issues and whatnot.
|
||||
#install -Dm644 keybindings/*.xml -t $out/share/gnome-control-center/keybindings
|
||||
# TODO: Uncomment once custom gsettings works.
|
||||
# Unfortunately custom gsettings seems to be not properly integrated with NixOS yet.
|
||||
#
|
||||
# For more information, please track the following issue:
|
||||
# https://github.com/NixOS/nixpkgs/issues/92265
|
||||
#
|
||||
# It also contains additional links to related issues and whatnot.
|
||||
#install -Dm644 keybindings/*.xml -t $out/share/gnome-control-center/keybindings
|
||||
'';
|
||||
|
||||
passthru.extensionUuid = "pop-shell@system76.com";
|
||||
|
@ -3,11 +3,12 @@
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
brave
|
||||
mpv
|
||||
emacs
|
||||
github-cli
|
||||
ncmpcpp
|
||||
]
|
||||
# Doom Emacs dependencies.
|
||||
++ (with pkgs; [
|
||||
git
|
||||
ripgrep
|
||||
gnutls
|
||||
emacs-all-the-icons-fonts
|
||||
@ -46,24 +47,11 @@
|
||||
enable = true;
|
||||
musicDirectory = "$HOME/library/music";
|
||||
};
|
||||
services.mpdris2.enable = true;
|
||||
|
||||
programs.ncmpcpp = {
|
||||
enable = true;
|
||||
package = pkgs.ncmpcpp.override { visualizerSupport = true; };
|
||||
# TODO: Add more vim-related keybindings.
|
||||
bindings = [
|
||||
{ key = "j"; command = "scroll_down"; }
|
||||
{ key = "k"; command = "scroll_up"; }
|
||||
{ key = "J"; command = [ "select_item" "scroll_down" ]; }
|
||||
{ key = "K"; command = [ "select_item" "scroll_up" ]; }
|
||||
];
|
||||
};
|
||||
|
||||
# My custom modules.
|
||||
modules = {
|
||||
bleachbit.enable = true;
|
||||
i18n.enable = true;
|
||||
archiving.enable = true;
|
||||
dev = {
|
||||
enable = true;
|
||||
shell.enable = true;
|
||||
@ -73,5 +61,6 @@
|
||||
graphics.enable = true;
|
||||
audio.enable = true;
|
||||
};
|
||||
research.enable = true;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user