Significant progress

This commit is contained in:
Jan Bulthuis 2024-07-18 13:48:49 +02:00
parent f80047be52
commit 5f66c1c631
28 changed files with 264 additions and 102 deletions

View File

@ -1,33 +0,0 @@
{ 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";
};
}

31
machines/laptop.nix Normal file
View File

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

View File

@ -1,9 +1,23 @@
{ lib, config, pkgs, ... }: { lib, config, pkgs, ... }:
{ with lib; {
imports = [ imports = [
./greetd/default.nix # Import modules
./tuigreet/default.nix ./greeter/greetd/default.nix
./greeter/greetd/tuigreet.nix
./locale/default.nix
./neovim/default.nix
./sound/pipewire.nix
./users/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

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

View File

@ -0,0 +1,17 @@
{ 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

@ -0,0 +1,18 @@
{ 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

@ -0,0 +1,18 @@
{ 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

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

View File

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

View File

@ -0,0 +1,18 @@
{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,11 +1,14 @@
{config, lib, pkgs, ... }: {config, lib, pkgs, ... }:
with lib;
let let
cfg = config.modules.obsidian; cfg = config.modules.obsidian;
in { in {
options.modules.obsidian.enable = lib.mkEnableOption "obsidian"; options.modules.obsidian = {
enable = mkEnableOption "obsidian";
};
config = lib.mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = with pkgs; [ home.packages = with pkgs; [
obsidian obsidian
]; ];

View File

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

View File

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

View File

@ -0,0 +1,10 @@
{ 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

@ -0,0 +1,10 @@
{ 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

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

View File

@ -0,0 +1,18 @@
{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
];
};
}

17
modules/vpn/tailscale.nix Normal file
View File

@ -0,0 +1,17 @@
{ 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

@ -0,0 +1,18 @@
{ 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;
};
};
}

View File

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

View File

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

View File

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