mirror of
https://github.com/nmasur/dotfiles
synced 2025-07-05 15:00:14 +00:00
reorganize files
This commit is contained in:
9
modules/nixos/default.nix
Normal file
9
modules/nixos/default.nix
Normal file
@ -0,0 +1,9 @@
|
||||
{ config, ... }: {
|
||||
|
||||
imports = [ ./user.nix ./timezone.nix ./doas.nix ];
|
||||
|
||||
# Pin a state version to prevent warnings
|
||||
system.stateVersion =
|
||||
config.home-manager.users.${config.user}.home.stateVersion;
|
||||
|
||||
}
|
30
modules/nixos/doas.nix
Normal file
30
modules/nixos/doas.nix
Normal file
@ -0,0 +1,30 @@
|
||||
# Replace sudo with doas
|
||||
|
||||
{ config, ... }: {
|
||||
|
||||
security = {
|
||||
|
||||
# Remove sudo
|
||||
sudo.enable = false;
|
||||
|
||||
# Add doas
|
||||
doas = {
|
||||
enable = true;
|
||||
|
||||
# No password required
|
||||
wheelNeedsPassword = false;
|
||||
|
||||
# Pass environment variables from user to root
|
||||
# Also requires removing password here
|
||||
extraRules = [{
|
||||
groups = [ "wheel" ];
|
||||
noPass = true;
|
||||
keepEnv = true;
|
||||
}];
|
||||
};
|
||||
};
|
||||
|
||||
home-manager.users.${config.user}.programs.fish.shellAliases = {
|
||||
sudo = "doas";
|
||||
};
|
||||
}
|
15
modules/nixos/timezone.nix
Normal file
15
modules/nixos/timezone.nix
Normal file
@ -0,0 +1,15 @@
|
||||
{ ... }: {
|
||||
|
||||
# Service to determine location for time zone
|
||||
services.geoclue2.enable = true;
|
||||
services.geoclue2.enableWifi = false; # Breaks when it can't connect
|
||||
location = { provider = "geoclue2"; };
|
||||
|
||||
# Enable local time based on time zone
|
||||
services.localtimed.enable = true;
|
||||
|
||||
# Required to get localtimed to talk to geoclue2
|
||||
services.geoclue2.appConfig.localtimed.isSystem = true;
|
||||
services.geoclue2.appConfig.localtimed.isAllowed = true;
|
||||
|
||||
}
|
50
modules/nixos/user.nix
Normal file
50
modules/nixos/user.nix
Normal file
@ -0,0 +1,50 @@
|
||||
{ config, lib, ... }: {
|
||||
|
||||
options = {
|
||||
|
||||
passwordHash = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Password created with mkpasswd -m sha-512";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = {
|
||||
|
||||
# Allows us to declaritively set password
|
||||
users.mutableUsers = false;
|
||||
|
||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||
users.users.${config.user} = {
|
||||
|
||||
# Create a home directory for human user
|
||||
isNormalUser = true;
|
||||
|
||||
# Automatically create a password to start
|
||||
hashedPassword = config.passwordHash;
|
||||
|
||||
extraGroups = [
|
||||
"wheel" # Sudo privileges
|
||||
];
|
||||
|
||||
};
|
||||
|
||||
home-manager.users.${config.user}.xdg = {
|
||||
userDirs = {
|
||||
enable = true;
|
||||
createDirectories = true;
|
||||
documents = "$HOME/documents";
|
||||
download = config.userDirs.download;
|
||||
music = "$HOME/media/music";
|
||||
pictures = "$HOME/media/images";
|
||||
videos = "$HOME/media/videos";
|
||||
desktop = "$HOME/other/desktop";
|
||||
publicShare = "$HOME/other/public";
|
||||
templates = "$HOME/other/templates";
|
||||
extraConfig = { XDG_DEV_DIR = "$HOME/dev"; };
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
Reference in New Issue
Block a user