nix: Revise structure for home-manager

This commit is contained in:
Geoffrey Frogeye 2023-10-28 22:09:36 +02:00
parent ef9a1ceb26
commit 98efabc904
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
21 changed files with 322 additions and 267 deletions

View file

@ -2,4 +2,4 @@
export NIXPKGS_ALLOW_UNFREE=1 export NIXPKGS_ALLOW_UNFREE=1
nix-build '<nixpkgs/nixos>' -A vm \ nix-build '<nixpkgs/nixos>' -A vm \
-I nixpkgs=channel:nixos-23.05 \ -I nixpkgs=channel:nixos-23.05 \
-I nixos-config=./configuration.nix -I nixos-config=./testvm.nix

View file

@ -1,13 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
<nixos-hardware/dell/g3/3779>
# <nixos-hardware/pine64/pinebook-pro>
./modules/common.nix
./modules/desktop.nix
./modules/battery.nix
./modules/wireless.nix
./modules/extra.nix
./modules/dev.nix
];
}

9
config/nix/curacao.nix Normal file
View file

@ -0,0 +1,9 @@
{ ... }:
{
imports = [
<nixos-hardware/dell/g3/3779>
./os/loader.nix
];
networking.hostName = "curacao.geoffrey.frogeye.fr";
}

100
config/nix/hm/common.nix Normal file
View file

@ -0,0 +1,100 @@
{ pkgs, ... }:
{
home.stateVersion = "23.05";
programs.home-manager.enable = true;
programs = {
zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
enableSyntaxHighlighting = true;
# syntaxHighlighting.enable = true; # 23.11 syntax
};
neovim = {
enable = true;
defaultEditor = true;
vimAlias = true;
viAlias = true;
};
};
home.packages = with pkgs; [
# dotfiles dependencies
coreutils
bash
gnugrep
gnused
gnutar
openssl
git
wget
curl
python3Packages.pip
ansible # TODO Reevaluate
# shell
zsh-completions
nix-zsh-completions
zsh-history-substring-search
antigen # TODO Reevaluate
powerline-go
# terminal essentials
moreutils
man
visidata
nodePackages.insect
translate-shell
unzip
unrar
p7zip
# remote
openssh
rsync
borgbackup
# cleanup
jdupes
duperemove
optipng
libjpeg
# FIXME reflac not available (but also a dumb shell script)
# local monitoring
htop
iotop
iftop
lsof
strace
pv
progress
speedtest-cli
# multimedia toolbox
ffmpeg
sox
imagemagick
# password
pass
pwgen
# Mail
isync
msmtp
notmuch
neomutt
lynx
# Organisation
vdirsyncer
khard
khal
todoman
syncthing
];
}

70
config/nix/hm/desktop.nix Normal file
View file

@ -0,0 +1,70 @@
{ pkgs, ... }:
{
xsession.windowManager.i3.enable = true;
home.packages = with pkgs; [
# remote
tigervnc
# music
mpd
mpc-cli
ashuffle
vimpc
# multimedia common
gimp
inkscape
mpv
mpvScripts.thumbnail
libreoffice
# data management
freefilesync
# browsers
firefox
qutebrowser
# fonts
dejavu_fonts
twemoji-color-font
xfce.thunar
gnome.gedit
feh
zathura
zbar
zathura
meld
python3Packages.magic
yubikey-touch-detector
# x11-exclusive
libgnomekbd # to show keyboard layout
dunst
i3lock
numlockx
rofi
rofimoji
rxvt-unicode
# TODO urxvt-resize-font-git
scrot
simplescreenrecorder
trayer
unclutter
xautolock
xclip
lemonbar-xft
autorandr
keynav
sct
xorg.xinit
xorg.xbacklight
alacritty
# organisation
rofi-pass # TODO Try autopass.cr
thunderbird
];
}

View file

@ -2,7 +2,7 @@
{ {
# TODO Separate in diffrent packages once the structure is finalized... # TODO Separate in diffrent packages once the structure is finalized...
# or connvert into per-directory requirements # or connvert into per-directory requirements
users.users.geoffrey. packages = with pkgs; [ home.packages = with pkgs; [
# Ansible # Ansible
ansible ansible
ansible-lint ansible-lint

View file

@ -1,6 +1,6 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
users.users.geoffrey. packages = with pkgs; [ home.packages = with pkgs; [
# android tools # android tools
android-tools android-tools
@ -16,7 +16,7 @@
# downloading # downloading
yt-dlp yt-dlp
megatools megatools
transmission # transmission TODO Collision if both transmissions are active?
transmission-qt transmission-qt
# wine # wine
@ -41,8 +41,4 @@
# TODO factorio # TODO factorio
]; ];
environment.systemPackages = with pkgs; [
# android tools
android-udev-rules
];
} }

9
config/nix/hm/loader.nix Normal file
View file

@ -0,0 +1,9 @@
{ ... }:
{
imports = [
./common.nix
./dev.nix
./extra.nix
./desktop.nix
];
}

View file

@ -1,174 +0,0 @@
{ pkgs, lib, ... }:
{
boot.loader.grub.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "nixos";
time.timeZone = "Europe/Amsterdam";
# TODO qwerty-fr for console
# Enable CUPS to print documents
services.printing.enable = true;
# Enable passwordless sudo
security.sudo.extraRules = [{
groups = [ "wheel" ];
commands = [{
command = "ALL";
options = [ "NOPASSWD" ];
}];
}];
# Users
users.users.geoffrey = {
isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable sudo for the user.
packages = with pkgs; [
# dotfiles dependencies
coreutils
bash
gnugrep
gnused
gnutar
openssl
git
wget
curl
python3Packages.pip
ansible # TODO Reevaluate
# shell
zsh-completions
nix-zsh-completions
zsh-history-substring-search
antigen # TODO Reevaluate
powerline-go
# terminal essentials
moreutils
man
visidata
nodePackages.insect
translate-shell
unzip
unrar
p7zip
# remote
openssh
rsync
borgbackup
# cleanup
jdupes
duperemove
optipng
libjpeg
# FIXME reflac not available (but also a dumb shell script)
# local monitoring
htop
iotop
iftop
lsof
strace
pv
progress
speedtest-cli
# multimedia toolbox
ffmpeg
sox
imagemagick
# password
pass
pwgen
# Mail
isync
msmtp
notmuch
neomutt
lynx
# Organisation
vdirsyncer
khard
khal
todoman
syncthing
];
initialPassword = "cartable"; # DEBUG
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPE41gxrO8oZ5n3saapSwZDViOQphm6RzqgsBUyA88pU geoffrey@frogeye.fr"
];
};
environment.systemPackages = with pkgs; [
wget
kexec-tools
openvpn
update-resolv-conf # TODO Is it what I think it is?
];
# Enable compilation cache
programs = {
ccache.enable = true;
# TODO Not enough, see https://nixos.wiki/wiki/CCache.
# Might want to see if it's worth using on NixOS
gnupg.agent.enable = true;
# Let users mount disks
udevil.enable = true;
# TODO Below should be user config
zsh = {
enable = true;
autosuggestions.enable = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
};
neovim = {
enable = true;
defaultEditor = true;
vimAlias = true;
viAlias = true;
};
};
services = {
# Enable the OpenSSH daemon
openssh.enable = true;
getty.autologinUser = "geoffrey"; # DEBUG
# Time sychronisation
chrony = {
enable = true;
servers = map (n: "${toString n}.europe.pool.ntp.org") (lib.lists.range 0 3);
extraConfig = "rtcsync";
};
# Prevent power button from shutting down the computer.
# On Pinebook it's too easy to hit,
# on others I sometimes turn it off when unsuspending.
logind.extraConfig = "HandlePowerKey=ignore";
};
# FIXME services.openvpn.servers.<name>.updateResolvConf=true
# For profiles in the extensions
# TODO Hibernation?
# TEST
system.copySystemConfiguration = true;
# Use defaults from
system.stateVersion = "23.05";
}

73
config/nix/os/common.nix Normal file
View file

@ -0,0 +1,73 @@
{ pkgs, lib, ... }:
{
boot.loader.grub.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
time.timeZone = "Europe/Amsterdam";
# TODO qwerty-fr for console
# Enable CUPS to print documents
services.printing.enable = true;
# Enable passwordless sudo
security.sudo.extraRules = [{
groups = [ "wheel" ];
commands = [{
command = "ALL";
options = [ "NOPASSWD" ];
}];
}];
environment.systemPackages = with pkgs; [
wget
kexec-tools
openvpn
update-resolv-conf # TODO Is it what I think it is?
# android tools
android-udev-rules
];
programs = {
# Enable compilation cache
ccache.enable = true;
# TODO Not enough, see https://nixos.wiki/wiki/CCache.
# Might want to see if it's worth using on NixOS
gnupg.agent.enable = true;
# Let users mount disks
udevil.enable = true;
};
services = {
# Enable the OpenSSH daemon
openssh.enable = true;
getty.autologinUser = "geoffrey"; # DEBUG
# Time sychronisation
chrony = {
enable = true;
servers = map (n: "${toString n}.europe.pool.ntp.org") (lib.lists.range 0 3);
extraConfig = "rtcsync";
};
# Prevent power button from shutting down the computer.
# On Pinebook it's too easy to hit,
# on others I sometimes turn it off when unsuspending.
logind.extraConfig = "HandlePowerKey=ignore";
};
# FIXME services.openvpn.servers.<name>.updateResolvConf=true
# For profiles in the extensions
# TODO Hibernation?
# TEST
system.copySystemConfiguration = true;
# Use defaults from
system.stateVersion = "23.05";
}

View file

@ -24,83 +24,13 @@
}}/linux/us_qwerty-fr"; }}/linux/us_qwerty-fr";
}; };
layout = "qwerty-fr"; layout = "qwerty-fr";
# TODO home.keyboard = null; in home-manager... or something
}; };
# Enable sound # Enable sound
sound.enable = true; sound.enable = true;
hardware.pulseaudio.enable = true; hardware.pulseaudio.enable = true;
services.xserver.displayManager.startx.enable = true;
services.xserver.windowManager.i3.enable = true;
users.users.geoffrey. packages = with pkgs; [
# remote
tigervnc
# music
mpd
mpc-cli
ashuffle
vimpc
# multimedia common
gimp
inkscape
mpv
mpvScripts.thumbnail
libreoffice
# data management
freefilesync
# browsers
firefox
qutebrowser
# fonts
dejavu_fonts
twemoji-color-font
xfce.thunar
gnome.gedit
feh
zathura
zbar
zathura
meld
python3Packages.magic
yubikey-touch-detector
# x11-exclusive
libgnomekbd # to show keyboard layout
dunst
i3lock
numlockx
rofi
rofimoji
rxvt-unicode
# TODO urxvt-resize-font-git
scrot
simplescreenrecorder
trayer
unclutter
xautolock
xclip
lemonbar-xft
autorandr
keynav
sct
xorg.xinit
xorg.xbacklight
alacritty
# organisation
rofi-pass # TODO Try autopass.cr
thunderbird
];
environment.systemPackages = with pkgs; [ pavucontrol ]; environment.systemPackages = with pkgs; [ pavucontrol ];
services.xserver.displayManager.startx.enable = true;
} }

View file

@ -0,0 +1,22 @@
{ pkgs, ... }:
{
imports = [
<home-manager/nixos>
];
users.users.geoffrey = {
isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable sudo for the user.
initialPassword = "cartable"; # DEBUG
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPE41gxrO8oZ5n3saapSwZDViOQphm6RzqgsBUyA88pU geoffrey@frogeye.fr"
];
};
home-manager.users.geoffrey = { pkgs, ... }: {
imports = [
../hm/loader.nix
];
};
}

10
config/nix/os/loader.nix Normal file
View file

@ -0,0 +1,10 @@
{ ... }:
{
imports = [
./battery.nix
./geoffrey.nix
./common.nix
./desktop.nix
./wireless.nix
];
}

9
config/nix/pindakaas.nix Normal file
View file

@ -0,0 +1,9 @@
{ ... }:
{
imports = [
<nixos-hardware/pine64/pinebook-pro>
./os/loader.nix
];
networking.hostName = "pindakaas.geoffrey.frogeye.fr";
}

6
config/nix/testvim.nix Normal file
View file

@ -0,0 +1,6 @@
{ config, pkgs, ... }:
{
imports = [
./curacao.nix
];
}

8
config/nix/testvm.nix Normal file
View file

@ -0,0 +1,8 @@
{ ... }:
{
imports = [
./os/loader.nix
];
networking.hostName = "nixos";
}