mirror of
https://forgejo.merr.is/annika/nixos.git
synced 2025-12-12 03:28:05 -05:00
Switched To A New/Modified Structure
Based heavily on https://github.com/nmasur/dotfiles
This commit is contained in:
parent
634a129840
commit
99a16590b3
25 changed files with 495 additions and 703 deletions
10
modules/common/applications/default.nix
Normal file
10
modules/common/applications/default.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./discord.nix
|
||||
./element.nix
|
||||
./firefox.nix
|
||||
./netbird.nix
|
||||
./prusa-slicer.nix
|
||||
];
|
||||
}
|
||||
25
modules/common/applications/discord.nix
Normal file
25
modules/common/applications/discord.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
options = {
|
||||
discord = {
|
||||
enable = lib.mkEnableOption {
|
||||
description = "Enable Discord";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
config = lib.mkIf (config.gui.enable && config.discord.enable) {
|
||||
home-manager.users.${config.user} = {
|
||||
home.packages = [
|
||||
pkgs.discord
|
||||
];
|
||||
xdg.configFile."discord/settings.json".text = ''
|
||||
{
|
||||
"OPEN_ON_STARTUP": true,
|
||||
"MINIMIZE_TO_TRAY": false,
|
||||
"SKIP_HOST_UPDATE": true
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
18
modules/common/applications/element.nix
Normal file
18
modules/common/applications/element.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{ config, pkgs, lib, ...}:
|
||||
{
|
||||
options = {
|
||||
element = {
|
||||
enable = lib.mkEnableOption {
|
||||
description = "Enable Element";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
config = lib.mkIf (config.gui.enable && config.element.enable) {
|
||||
home-manager.users.${config.user} = {
|
||||
home.packages = [
|
||||
pkgs.element-desktop
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
27
modules/common/applications/firefox.nix
Normal file
27
modules/common/applications/firefox.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
options = {
|
||||
firefox = {
|
||||
enable = lib.mkEnableOption {
|
||||
description = "Enable Firefox";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
config = lib.mkIf (config.gui.enable && config.firefox.enable) {
|
||||
home-manager.users.${config.user} = {
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
policies = {
|
||||
ExtensionSettings = {
|
||||
"{446900e4-71c2-419f-a6a7-df9c091e268b}" = {
|
||||
install_url = "https://addons.mozilla.org/firefox/downloads/latest/bitwarden-password-manager/latest.xpi";
|
||||
installation_mode = "normal_installed";
|
||||
default_area = "navbar";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
28
modules/common/applications/netbird.nix
Normal file
28
modules/common/applications/netbird.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
options = {
|
||||
netbird = {
|
||||
enable = lib.mkEnableOption {
|
||||
description = "Enable Netbird";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
config = lib.mkIf (config.netbird.enable)
|
||||
(lib.mkMerge [
|
||||
(lib.mkIf (config.gui.enable) {
|
||||
home-manager.users.${config.user} = {
|
||||
home.packages = [
|
||||
pkgs.netbird-ui
|
||||
];
|
||||
};
|
||||
})
|
||||
(lib.mkIf (!config.gui.enable) {
|
||||
home-manager.users.${config.user} = {
|
||||
home.packages = [
|
||||
pkgs.netbird
|
||||
];
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
18
modules/common/applications/prusa-slicer.nix
Normal file
18
modules/common/applications/prusa-slicer.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
options = {
|
||||
prusa-slicer = {
|
||||
enable = lib.mkEnableOption {
|
||||
description = "Enable Prusa Slicer";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
config = lib.mkIf (config.gui.enable && config.prusa-slicer.enable) {
|
||||
home-manager.users.${config.user} = {
|
||||
home.packages = [
|
||||
pkgs.prusa-slicer
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
40
modules/common/default.nix
Normal file
40
modules/common/default.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{ config, lib, pkgs, ...}:
|
||||
{
|
||||
imports = [
|
||||
./applications
|
||||
./programming
|
||||
./utilities
|
||||
];
|
||||
options = {
|
||||
user = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Primary user of the system";
|
||||
};
|
||||
fullName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Puny Hooman readable name of the user";
|
||||
};
|
||||
gui = {
|
||||
enable = lib.mkEnableOption {
|
||||
description = "Enable graphics.";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
config =
|
||||
let
|
||||
stateVersion = "23.11";
|
||||
in
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim
|
||||
wget
|
||||
curl
|
||||
python3
|
||||
age
|
||||
sops
|
||||
];
|
||||
home-manager.users.${config.user}.home.stateVersion = stateVersion;
|
||||
home-manager.users.root.home.stateVersion = stateVersion;
|
||||
};
|
||||
}
|
||||
7
modules/common/programming/default.nix
Normal file
7
modules/common/programming/default.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./nixpkgs-fmt.nix
|
||||
./vscode.nix
|
||||
];
|
||||
}
|
||||
18
modules/common/programming/nixpkgs-fmt.nix
Normal file
18
modules/common/programming/nixpkgs-fmt.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{ config, pkgs, lib, ...}:
|
||||
{
|
||||
options = {
|
||||
nixpkgs-fmt = {
|
||||
enable = lib.mkEnableOption {
|
||||
description = "Enable nixpkgs-fmt";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
config = lib.mkIf (config.nixpkgs-fmt.enable) {
|
||||
home-manager.users.${config.user} = {
|
||||
home.packages = [
|
||||
pkgs.nixpkgs-fmt
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
31
modules/common/programming/vscode.nix
Normal file
31
modules/common/programming/vscode.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
options = {
|
||||
vscode = {
|
||||
enable = lib.mkEnableOption {
|
||||
description = "Enable Visual Studio Code";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
config = lib.mkIf (config.gui.enable && config.vscode.enable) {
|
||||
home-manager.users.${config.user} = {
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
programs.vscode = {
|
||||
enable = true;
|
||||
extensions = with pkgs.vscode-extensions; [
|
||||
bbenoist.nix
|
||||
catppuccin.catppuccin-vsc
|
||||
];
|
||||
userSettings = {
|
||||
"workbench.colorTheme" = "Catppuccin Mocha";
|
||||
"editor.tabSize" = 2;
|
||||
"editor.insertSpaces" = true;
|
||||
"git.autofetch" = true;
|
||||
# "git.enableSmartCommit" = true;
|
||||
"git.confirmSync" = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
6
modules/common/utilities/default.nix
Normal file
6
modules/common/utilities/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./git.nix
|
||||
];
|
||||
}
|
||||
28
modules/common/utilities/git.nix
Normal file
28
modules/common/utilities/git.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
home-packages = config.home-manager.users.${config.user}.home.packages;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
gitName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Name to use for git commits";
|
||||
};
|
||||
gitEmail = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Email to use for git commits";
|
||||
};
|
||||
};
|
||||
config = {
|
||||
home-manager.users.root.programs.git = {
|
||||
enable = true;
|
||||
};
|
||||
home-manager.users.${config.user} = {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = config.gitName;
|
||||
userEmail = config.gitEmail;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
6
modules/nixos/default.nix
Normal file
6
modules/nixos/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./hardware
|
||||
];
|
||||
}
|
||||
28
modules/nixos/hardware/boot.nix
Normal file
28
modules/nixos/hardware/boot.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
boot.loader = lib.mkIf (config.physical) {
|
||||
grub = {
|
||||
enable = true;
|
||||
efiSupport = true;
|
||||
useOSProber = true;
|
||||
gfxmodeEfi = "1920x1080";
|
||||
configurationLimit = 25;
|
||||
device = "nodev";
|
||||
|
||||
# Display menu indefinitely if holding shift key
|
||||
extraConfig = ''
|
||||
if keystatus --shift; then
|
||||
set timeout=-1
|
||||
else
|
||||
set timeout=3
|
||||
fi
|
||||
'';
|
||||
|
||||
};
|
||||
|
||||
efi.canTouchEfiVariables = true;
|
||||
};
|
||||
|
||||
boot.supportedFilesystems = lib.mkIf config.physical [ "ntfs" ];
|
||||
boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
||||
}
|
||||
11
modules/nixos/hardware/default.nix
Normal file
11
modules/nixos/hardware/default.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{ lib, ... }:
|
||||
{
|
||||
imports = [
|
||||
./boot.nix
|
||||
];
|
||||
|
||||
options = {
|
||||
physical = lib.mkEnableOption "Whether this machine is a physical device.";
|
||||
server = lib.mkEnableOption "Whether this machine is a server.";
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue