diff --git a/config/nix/build.sh b/config/nix/build.sh index 2e3ac4d..001b47c 100755 --- a/config/nix/build.sh +++ b/config/nix/build.sh @@ -2,4 +2,4 @@ export NIXPKGS_ALLOW_UNFREE=1 nix-build '' -A vm \ -I nixpkgs=channel:nixos-23.05 \ --I nixos-config=./configuration.nix +-I nixos-config=./testvm.nix diff --git a/config/nix/configuration.nix b/config/nix/configuration.nix deleted file mode 100644 index 1d7c485..0000000 --- a/config/nix/configuration.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ config, pkgs, ... }: -{ - imports = [ - - # - ./modules/common.nix - ./modules/desktop.nix - ./modules/battery.nix - ./modules/wireless.nix - ./modules/extra.nix - ./modules/dev.nix - ]; -} diff --git a/config/nix/curacao.nix b/config/nix/curacao.nix new file mode 100644 index 0000000..73f8c24 --- /dev/null +++ b/config/nix/curacao.nix @@ -0,0 +1,9 @@ +{ ... }: +{ + imports = [ + + ./os/loader.nix + ]; + + networking.hostName = "curacao.geoffrey.frogeye.fr"; +} diff --git a/config/nix/hm/common.nix b/config/nix/hm/common.nix new file mode 100644 index 0000000..2479899 --- /dev/null +++ b/config/nix/hm/common.nix @@ -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 + + ]; +} diff --git a/config/nix/hm/desktop.nix b/config/nix/hm/desktop.nix new file mode 100644 index 0000000..4165f1a --- /dev/null +++ b/config/nix/hm/desktop.nix @@ -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 + ]; +} diff --git a/config/nix/modules/dev.nix b/config/nix/hm/dev.nix similarity index 95% rename from config/nix/modules/dev.nix rename to config/nix/hm/dev.nix index fdde56e..1e68ef8 100644 --- a/config/nix/modules/dev.nix +++ b/config/nix/hm/dev.nix @@ -2,7 +2,7 @@ { # TODO Separate in diffrent packages once the structure is finalized... # or connvert into per-directory requirements - users.users.geoffrey. packages = with pkgs; [ + home.packages = with pkgs; [ # Ansible ansible ansible-lint diff --git a/config/nix/modules/extra.nix b/config/nix/hm/extra.nix similarity index 80% rename from config/nix/modules/extra.nix rename to config/nix/hm/extra.nix index 36699d5..f1c36d3 100644 --- a/config/nix/modules/extra.nix +++ b/config/nix/hm/extra.nix @@ -1,6 +1,6 @@ { pkgs, ... }: { - users.users.geoffrey. packages = with pkgs; [ + home.packages = with pkgs; [ # android tools android-tools @@ -16,7 +16,7 @@ # downloading yt-dlp megatools - transmission + # transmission TODO Collision if both transmissions are active? transmission-qt # wine @@ -41,8 +41,4 @@ # TODO factorio ]; - environment.systemPackages = with pkgs; [ - # android tools - android-udev-rules - ]; } diff --git a/config/nix/hm/loader.nix b/config/nix/hm/loader.nix new file mode 100644 index 0000000..f6f3089 --- /dev/null +++ b/config/nix/hm/loader.nix @@ -0,0 +1,9 @@ +{ ... }: +{ + imports = [ + ./common.nix + ./dev.nix + ./extra.nix + ./desktop.nix + ]; +} diff --git a/config/nix/modules/common.nix b/config/nix/modules/common.nix deleted file mode 100644 index 193fb81..0000000 --- a/config/nix/modules/common.nix +++ /dev/null @@ -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..updateResolvConf=true - # For profiles in the extensions - - # TODO Hibernation? - - # TEST - system.copySystemConfiguration = true; - - # Use defaults from - system.stateVersion = "23.05"; - -} diff --git a/config/nix/modules/battery.nix b/config/nix/os/battery.nix similarity index 100% rename from config/nix/modules/battery.nix rename to config/nix/os/battery.nix diff --git a/config/nix/os/common.nix b/config/nix/os/common.nix new file mode 100644 index 0000000..2b8a311 --- /dev/null +++ b/config/nix/os/common.nix @@ -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..updateResolvConf=true + # For profiles in the extensions + + # TODO Hibernation? + + # TEST + system.copySystemConfiguration = true; + + # Use defaults from + system.stateVersion = "23.05"; + +} diff --git a/config/nix/modules/desktop.nix b/config/nix/os/desktop.nix similarity index 50% rename from config/nix/modules/desktop.nix rename to config/nix/os/desktop.nix index c2fe119..e88abd3 100644 --- a/config/nix/modules/desktop.nix +++ b/config/nix/os/desktop.nix @@ -24,83 +24,13 @@ }}/linux/us_qwerty-fr"; }; layout = "qwerty-fr"; - # TODO home.keyboard = null; in home-manager... or something - }; # Enable sound sound.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 ]; + services.xserver.displayManager.startx.enable = true; + } diff --git a/config/nix/os/geoffrey.nix b/config/nix/os/geoffrey.nix new file mode 100644 index 0000000..b04d8c2 --- /dev/null +++ b/config/nix/os/geoffrey.nix @@ -0,0 +1,22 @@ +{ pkgs, ... }: +{ + imports = [ + + ]; + + 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 + ]; + }; +} diff --git a/config/nix/os/loader.nix b/config/nix/os/loader.nix new file mode 100644 index 0000000..69dd3d5 --- /dev/null +++ b/config/nix/os/loader.nix @@ -0,0 +1,10 @@ +{ ... }: +{ + imports = [ + ./battery.nix + ./geoffrey.nix + ./common.nix + ./desktop.nix + ./wireless.nix + ]; +} diff --git a/config/nix/modules/qwerty-fr-keypad.diff b/config/nix/os/qwerty-fr-keypad.diff similarity index 100% rename from config/nix/modules/qwerty-fr-keypad.diff rename to config/nix/os/qwerty-fr-keypad.diff diff --git a/config/nix/modules/wireless.nix b/config/nix/os/wireless.nix similarity index 100% rename from config/nix/modules/wireless.nix rename to config/nix/os/wireless.nix diff --git a/config/nix/modules/wireless/.gitignore b/config/nix/os/wireless/.gitignore similarity index 100% rename from config/nix/modules/wireless/.gitignore rename to config/nix/os/wireless/.gitignore diff --git a/config/nix/modules/wireless/import.py b/config/nix/os/wireless/import.py similarity index 100% rename from config/nix/modules/wireless/import.py rename to config/nix/os/wireless/import.py diff --git a/config/nix/pindakaas.nix b/config/nix/pindakaas.nix new file mode 100644 index 0000000..38584a0 --- /dev/null +++ b/config/nix/pindakaas.nix @@ -0,0 +1,9 @@ +{ ... }: +{ + imports = [ + + ./os/loader.nix + ]; + + networking.hostName = "pindakaas.geoffrey.frogeye.fr"; +} diff --git a/config/nix/testvim.nix b/config/nix/testvim.nix new file mode 100644 index 0000000..a214d0a --- /dev/null +++ b/config/nix/testvim.nix @@ -0,0 +1,6 @@ +{ config, pkgs, ... }: +{ + imports = [ + ./curacao.nix + ]; +} diff --git a/config/nix/testvm.nix b/config/nix/testvm.nix new file mode 100644 index 0000000..7b62fa8 --- /dev/null +++ b/config/nix/testvm.nix @@ -0,0 +1,8 @@ +{ ... }: +{ + imports = [ + ./os/loader.nix + ]; + + networking.hostName = "nixos"; +}