Compare commits

..

No commits in common. "5f66c1c6317c284d506d79ca4f0510be71185991" and "1b4f8911fdb55a8a8ffe190ae20d26eb598d9f38" have entirely different histories.

30 changed files with 124 additions and 275 deletions

33
default.nix Normal file
View File

@ -0,0 +1,33 @@
{ config, lib, pkgs, ... }:
{
imports = [
# TODO: Temporary until it has been subdivided into modules.
./merged.nix
# Modules
./modules/default.nix
# System configuration options
./system.nix
# Import test configuration
./test.nix
];
config = {
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# Enable default modules
modules = {
# Greeter
tuigreet.enable = true;
};
# Localization settings
time.timeZone = "Europe/Amsterdam";
i18n.defaultLocale = "en_US.UTF-8";
console.keyMap = "us";
};
}

View File

@ -1,31 +0,0 @@
{ ... }:
{
imports = [
# Import modules
../modules/default.nix
# TODO: Remove later
../merged.nix
];
config = {
# State version
system.stateVersion = "24.05";
# Machine hostname
networking.hostName = "20212060";
# Enabled modules
modules = {
pipewire.enable = true;
wpa_supplicant.enable = true;
};
# User accounts
machine.users.jan = {
sudo = true;
configuration = ../users/jan.nix;
};
};
}

View File

@ -5,9 +5,9 @@
{ config, lib, pkgs, ... }:
let
# nixvim = import (builtins.fetchGit {
# url = "https://github.com/nix-community/nixvim";
# });
nixvim = import (builtins.fetchGit {
url = "https://github.com/nix-community/nixvim";
});
# stylix = import (pkgs.fetchFromGitHub {
# owner = "danth";
# repo = "stylix";
@ -131,12 +131,10 @@ in {
# };
# Set up networking
# networking.wireless.userControlled.enable = true;
# networking.hostName = "20212060"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# networking.wireless.allowAuxiliaryImperativeNetworks = true;
nixpkgs.config.allowUnfree = true;
networking.wireless.userControlled.enable = true;
networking.hostName = "20212060"; # Define your hostname.
networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.wireless.allowAuxiliaryImperativeNetworks = true;
# Set up graphics
hardware.graphics.enable32Bit = true;
@ -160,10 +158,10 @@ in {
};
# Set up tailscale
# services.tailscale = {
# enable = true;
# useRoutingFeatures = "client";
# };
services.tailscale = {
enable = true;
useRoutingFeatures = "client";
};
# Set time zone.
# time.timeZone = "Europe/Amsterdam";
@ -175,11 +173,11 @@ in {
# nixpkgs.config.allowUnfree = true;
# Enable sound
# services.pipewire = {
# enable = true;
# alsa.enable = true;
# pulse.enable = true;
# };
services.pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
# Set up input
services.libinput.enable = true;
@ -199,7 +197,7 @@ in {
# security.pam.services.waylock = {};
# Enable programs
# programs.river.enable = true;
programs.river.enable = true;
xdg.portal = {
enable = true;
@ -211,7 +209,7 @@ in {
};
# Gamer moment
# programs.steam.enable = true;
programs.steam.enable = true;
# Define a user account. Don't forget to set a password with passwd.
# users.users.jan = {
@ -222,7 +220,10 @@ in {
# home-manager.backupFileExtension = "bak";
# Global neovim
# pr`
programs.neovim = {
enable = true;
defaultEditor = true;
};
# dconf
programs.dconf.enable = true;

View File

@ -1,23 +1,9 @@
{ lib, config, pkgs, ... }:
with lib; {
{
imports = [
# Import modules
./greeter/greetd/default.nix
./greeter/greetd/tuigreet.nix
./locale/default.nix
./neovim/default.nix
./sound/pipewire.nix
./greetd/default.nix
./tuigreet/default.nix
./users/default.nix
./unfree/default.nix
./vpn/tailscale.nix
./wifi/wpa_supplicant.nix
];
config.modules = {
# Enable default modules
neovim.enable = mkDefault true;
tuigreet.enable = mkDefault true;
tailscale.enable = mkDefault true;
};
}

View File

@ -1,9 +0,0 @@
{ lib, config, pkgs, ... }:
{
config = {
time.timeZone = "Europe/Amsterdam";
i18n.defaultLocale = "en_US.UTF-8";
console.keyMap = "us";
};
}

View File

@ -1,17 +0,0 @@
{ lib, config, pkgs, ... }:
with lib;
let
cfg = config.modules.neovim;
in {
options.modules.neovim = {
enable = mkEnableOption "neovim";
};
config = mkIf cfg.enable {
programs.neovim = {
enable = true;
defaultEditor = true;
};
};
}

View File

View File

@ -1,18 +0,0 @@
{ lib, config, pkgs, ... }:
with lib;
let
cfg = config.modules.pipewire;
in {
options.modules.pipewire = {
enable = mkEnableOption "pipewire";
};
config = mkIf cfg.enable {
services.pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
};
}

View File

@ -1,18 +0,0 @@
{ lib, config, pkgs, ... }:
with lib;
let
cfg = config.modules.unfree;
in {
options.modules.unfree = {
enable = mkEnableOption "unfree";
allowedPackages = mkOption {
type = types.listOf types.str;
default = [];
};
};
config = mkIf cfg.enable {
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (getName pkg) cfg.allowedPackages;
};
}

View File

@ -41,8 +41,8 @@ in {
# Import home manager
<home-manager/nixos>
# Import system wide configuration required for user modules
./modules/systemwide/default.nix
# Import system configuration setup
# ./system.nix
];
options = {

View File

@ -1,22 +1,19 @@
{ input, pkgs, config, ... }:
{
# Set the state version
home.stateVersion = "24.05";
imports = [
# Import all modules
./desktop/default.nix
./discord/default.nix
./feishin/default.nix
./firefox/default.nix
./obsidian/default.nix
./shell/bash.nix
./shell/fish.nix
./steam/default.nix
./theming/default.nix
./vscode/default.nix
./winbox/default.nix
./zathura/default.nix
# Import unfree helper
../../unfree/default.nix
];
}

View File

@ -6,9 +6,17 @@ let
in {
options.modules.waylock = {
enable = mkEnableOption "waylock";
system = mkOption {
type = types.attrsOf types.anything;
description = "System wide configuration to apply if module is enabled";
};
};
config = {
modules.waylock.system = mkForce {
security.pam.services.waylock = {};
};
home.packages = mkIf cfg.enable (with pkgs; [
waylock
]);

View File

@ -1,18 +0,0 @@
{config, lib, pkgs, ... }:
with lib;
let
cfg = config.modules.discord;
in {
options.modules.discord = {
enable = mkEnableOption "discord";
};
config = mkIf cfg.enable {
modules.unfree.allowedPackages = [ "discord" ];
home.packages = with pkgs; [
discord
];
};
}

View File

@ -1,14 +1,11 @@
{config, lib, pkgs, ... }:
with lib;
let
cfg = config.modules.obsidian;
in {
options.modules.obsidian = {
enable = mkEnableOption "obsidian";
};
options.modules.obsidian.enable = lib.mkEnableOption "obsidian";
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
obsidian
];

View File

@ -1,7 +0,0 @@
{config, lib, pkgs, ... }:
with lib; {
options.modules.steam = {
enable = mkEnableOption "steam";
};
}

View File

@ -1,10 +0,0 @@
{ ... }:
{
imports = [
# Import systemwide configuration files.
./river.nix
./steam.nix
./waylock.nix
];
}

View File

@ -1,10 +0,0 @@
{ lib, config, pkgs, ... }:
with lib;
let
enabled = any (user: user.modules.river.enable) (attrValues config.home-manager.users);
in {
config = mkIf enabled {
programs.river.enable = true;
};
}

View File

@ -1,10 +0,0 @@
{ lib, config, pkgs, ... }:
with lib;
let
enabled = any (user: user.modules.steam.enable) (attrValues config.home-manager.users);
in {
config = mkIf enabled {
programs.steam.enable = true;
};
}

View File

@ -1,10 +0,0 @@
{ lib, config, pkgs, ... }:
with lib;
let
enabled = any (user: user.modules.waylock.enable) (attrValues config.home-manager.users);
in {
config = mkIf enabled {
security.pam.services.waylock = {};
};
}

View File

@ -6,8 +6,6 @@ in {
options.modules.vscode.enable = lib.mkEnableOption "vscode";
config = lib.mkIf cfg.enable {
modules.unfree.allowedPackages = [ "vscode" ];
home.packages = with pkgs; [
vscode
];

View File

@ -1,18 +0,0 @@
{config, lib, pkgs, ... }:
with lib;
let
cfg = config.modules.winbox;
in {
options.modules.winbox = {
enable = mkEnableOption "winbox";
};
config = mkIf cfg.enable {
modules.unfree.allowedPackages = [ "winbox" ];
home.packages = with pkgs; [
winbox
];
};
}

13
modules/users/system.nix Normal file
View File

@ -0,0 +1,13 @@
{ lib, config, pkgs, ... }:
with lib;
let
users = config.home-manager.users;
allModules = flatten (map (user: (attrValues user.modules)) (attrValues users));
modules = filter (module: module?system && module?enable) allModules;
configs = map (module: module.system) modules;
combined = (foldl (a: b: recursiveUpdate a b) {} configs);
in {
# Add the combined systemwide config required by the user modules.
config = combined;
}

View File

@ -1,17 +0,0 @@
{ lib, config, pkgs, ... }:
with lib;
let
cfg = config.modules.tailscale;
in {
options.modules.tailscale = {
enable = mkEnableOption "tailscale";
};
config = mkIf cfg.enable {
services.tailscale = {
enable = true;
useRoutingFeatures = "client";
};
};
}

View File

@ -1,18 +0,0 @@
{ lib, config, pkgs, ... }:
with lib;
let
cfg = config.modules.wpa_supplicant;
in {
options.modules.wpa_supplicant = {
enable = mkEnableOption "wpa_supplicant";
};
config = mkIf cfg.enable {
networking.wireless = {
enable = true;
userControlled.enable = true;
allowAuxiliaryImperativeNetworks = true;
};
};
}

12
system.nix Normal file
View File

@ -0,0 +1,12 @@
{ config, lib, pkgs, ... }:
{
options = {
machine.laptop = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether the current system is a laptop.";
};
};
}

17
test.nix Normal file
View File

@ -0,0 +1,17 @@
{ config, lib, pkgs, ... }:
{
config = {
system.stateVersion = "24.05";
machine.users.jan = {
sudo = true;
configuration = ./users/jan.nix;
};
machine.users.second = {
sudo = false;
configuration = ./users/jan.nix;
};
};
}

View File

@ -11,6 +11,9 @@
# State version
home.stateVersion = "24.05";
# Allow unfree software such as vscode
nixpkgs.config.allowUnfree = true;
modules = {
# Window manager
river.enable = true;
@ -22,11 +25,6 @@
vscode.enable = true;
zathura.enable = true;
fish.enable = true;
winbox.enable = true;
discord.enable = true;
# Enable unfree
unfree.enable = true;
};
theming.themes.gruvbox = {

View File

@ -18,11 +18,11 @@ in {
# Packages
home.packages = with pkgs; [
# Programs
# vscode
# feishin
# discord
# obsidian
# winbox
vscode
feishin
discord
obsidian
winbox
# Utilities
pulsemixer